CN114489900A - Method, device, medium and program product for outputting control tree - Google Patents

Method, device, medium and program product for outputting control tree Download PDF

Info

Publication number
CN114489900A
CN114489900A CN202210087320.XA CN202210087320A CN114489900A CN 114489900 A CN114489900 A CN 114489900A CN 202210087320 A CN202210087320 A CN 202210087320A CN 114489900 A CN114489900 A CN 114489900A
Authority
CN
China
Prior art keywords
control
node
tree structure
target page
control tree
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210087320.XA
Other languages
Chinese (zh)
Inventor
杨华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Lianshang Network Technology Co Ltd
Original Assignee
Shanghai Lianshang Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Lianshang Network Technology Co Ltd filed Critical Shanghai Lianshang Network Technology Co Ltd
Priority to CN202210087320.XA priority Critical patent/CN114489900A/en
Publication of CN114489900A publication Critical patent/CN114489900A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

An object of the present application is to provide a method, apparatus, medium, and program product for outputting a control tree, the method including: in response to the completion of rendering of a target page, traversing one or more controls on the target page to generate a control tree structure corresponding to the target page, wherein the control tree structure comprises a plurality of nodes, and each node corresponds to one of the one or more controls; obtaining node parameters corresponding to each node by performing parameter analysis on the control tree structure; and if the target page has a layout problem according to the node parameters, injecting the node parameters corresponding to at least one node into the corresponding nodes in the control tree structure, and outputting the control tree structure.

Description

Method, device, medium and program product for outputting control tree
Technical Field
The present application relates to the field of communications, and in particular, to a technique for outputting a control tree.
Background
In the prior art, the page layout of an App on a mobile terminal (e.g., a mobile phone) is more and more complex, and elements on the page are more and more, so that the time for opening the page is longer and longer, the use experience of the App by a user is seriously affected, and the user loss and the revenue loss of the App are caused.
Disclosure of Invention
It is an object of the present application to provide a method, apparatus, medium, and program product for outputting a control tree.
According to an aspect of the present application, there is provided a method for outputting a control tree, the method comprising:
in response to the completion of rendering of a target page, traversing one or more controls on the target page to generate a control tree structure corresponding to the target page, wherein the control tree structure comprises a plurality of nodes, and each node corresponds to one of the one or more controls;
obtaining node parameters corresponding to each node by performing parameter analysis on the control tree structure;
and if the target page has a layout problem according to the node parameters, injecting the node parameters corresponding to at least one node into the corresponding nodes in the control tree structure, and outputting the control tree structure.
According to an aspect of the present application, there is provided a user device for outputting a control tree, the device including:
a one-to-one module, configured to generate a control tree structure corresponding to a target page by traversing one or more controls on the target page in response to completion of rendering the target page, where the control tree structure includes a plurality of nodes, and each node corresponds to one of the one or more controls;
a second module, configured to perform parameter analysis on the control tree structure to obtain a node parameter corresponding to each node;
and the third module is used for injecting the node parameters corresponding to at least one node into the corresponding nodes in the control tree structure and outputting the control tree structure if the target page has layout problems according to the node parameters.
According to an aspect of the present application, there is provided a computer device for outputting a control tree, comprising a memory, a processor and a computer program stored on the memory, wherein the processor executes the computer program to implement the operations of any of the methods described above.
According to an aspect of the application, there is provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the operations of any of the methods described above.
According to an aspect of the application, a computer program product is provided, comprising a computer program which, when executed by a processor, carries out the steps of any of the methods as described above.
Compared with the prior art, the method and the device have the advantages that a control tree structure corresponding to a target page is generated by traversing one or more controls on the target page in response to the completion of rendering the target page, wherein the control tree structure comprises a plurality of nodes, and each node corresponds to one of the one or more controls; obtaining node parameters corresponding to each node by performing parameter analysis on the control tree structure; if the layout problem of the target page is determined according to the node parameters, the node parameters corresponding to at least one node are injected into the corresponding nodes in the control tree structure, the control tree structure is output, so that the key performance parameters of the page in the target application are counted in a control tree structure mode, whether the page has the layout problem is determined by analyzing the key performance parameters, if the layout problem exists in a certain page in the target application, the key performance parameters are re-injected into the corresponding nodes in the control tree structure corresponding to the page, and the control tree structure is output, so that an operator or developer of the target application can intuitively browse the control tree structure corresponding to the page with the layout problem, the layout problem of the page can be found in time, and the page is maintained or modified, avoiding user loss and revenue loss resulting in the target application.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 illustrates a flow diagram of a method for outputting a control tree according to one embodiment of the present application;
FIG. 2 illustrates a user equipment structure diagram for outputting a control tree according to one embodiment of the present application;
FIG. 3 illustrates a representation of a control tree structure according to one embodiment of the present application;
FIG. 4 illustrates an exemplary system that can be used to implement the various embodiments described in this application.
The same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
The present application is described in further detail below with reference to the attached figures.
In a typical configuration of the present application, the terminal, the device serving the network, and the trusted party each include one or more processors (e.g., Central Processing Units (CPUs)), input/output interfaces, network interfaces, and memory.
The Memory may include forms of volatile Memory, Random Access Memory (RAM), and/or non-volatile Memory in a computer-readable medium, such as Read Only Memory (ROM) or Flash Memory. Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, Phase-Change Memory (PCM), Programmable Random Access Memory (PRAM), Static Random-Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), electrically Erasable Programmable Read-Only Memory (EEPROM), flash Memory or other Memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, magnetic cassette tape, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium may be used to store information that may be accessed by a computing device.
The device referred to in the present application includes, but is not limited to, a terminal, a network device, or a device formed by integrating a terminal and a network device through a network. The terminal includes, but is not limited to, any mobile electronic product, such as a smart phone, a tablet computer, etc., capable of performing human-computer interaction with a user (e.g., human-computer interaction through a touch panel), and the mobile electronic product may employ any operating system, such as an Android operating system, an iOS operating system, etc. The network Device includes an electronic Device capable of automatically performing numerical calculation and information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded Device, and the like. The network device includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud of a plurality of servers; here, the Cloud is composed of a large number of computers or web servers based on Cloud Computing (Cloud Computing), which is a kind of distributed Computing, one virtual supercomputer consisting of a collection of loosely coupled computers. Including, but not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a VPN network, a wireless Ad Hoc network (Ad Hoc network), etc. Preferably, the device may also be a program running on the terminal, the network device, or a device formed by integrating the terminal and the network device, the touch terminal, or the network device and the touch terminal through a network.
Of course, those skilled in the art will appreciate that the foregoing is by way of example only, and that other existing or future devices, which may be suitable for use in the present application, are also encompassed within the scope of the present application and are hereby incorporated by reference.
In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
FIG. 1 shows a flowchart of a method for outputting a control tree according to an embodiment of the present application, the method including step S11, step S12, and step S13. In step S11, in response to that a target page is rendered, a user device generates a control tree structure corresponding to the target page by traversing one or more controls on the target page, where the control tree structure includes a plurality of nodes, and each node corresponds to one of the one or more controls; in step S12, the user equipment obtains a node parameter corresponding to each node by performing parameter analysis on the control tree structure; in step S13, if it is determined that the target page has a layout problem according to the node parameters, the user equipment injects the node parameters corresponding to at least one node into a corresponding node in the control tree structure, and outputs the control tree structure.
In step S11, in response to that the target page is rendered, the user equipment generates a control tree structure corresponding to the target page by traversing one or more controls on the target page, where the control tree structure includes a plurality of nodes, and each node corresponds to one of the one or more controls. In some embodiments, when the target page is launched, the target page is rendered on the user device so that the user can see the complete target page on the user device. In some embodiments, all controls (including a currently visible control and a currently invisible control) on a target page are traversed, and a traversal result is stored according to a tree structure to generate a control tree structure corresponding to the target page, where the control tree structure includes a plurality of nodes, each node corresponds to one control on the target page, each control in the target page corresponds to one node in the control tree structure, and there is a one-to-one correspondence between nodes and controls, that is, different nodes correspond to different controls, and different controls correspond to different nodes. In some embodiments, a window object (e.g., window) is obtained from a target page, and then each control on the target page may be obtained from the window object, so as to traverse all the controls on the target page, for example, the window object may be obtained from the target page through a WindowManager (window management) service, for example, a first control (e.g., rootview) in the window object is obtained first, and then whether the control has a corresponding child control is determined, if so, a first child control in at least one child control corresponding to the control is obtained continuously, and then, whether the child control has a corresponding child control is determined continuously, if so, a first child control in at least one child control corresponding to the child control is obtained continuously, and so on, until all the controls on the target page are traversed.
In step S12, the user equipment obtains a node parameter corresponding to each node by performing parameter analysis on the control tree structure. In some embodiments, the node parameters corresponding to each node are obtained by performing parameter analysis on the control tree structure, where the node parameters include, but are not limited to, a depth, a degree, a height, a total number of nodes, and the like corresponding to each node.
In step S13, if it is determined that the target page has a layout problem according to the node parameters, the user equipment injects the node parameters corresponding to at least one node into a corresponding node in the control tree structure, and outputs the control tree structure. In some embodiments, the node parameters may affect the rendering speed of the user device for the target page and the time it takes to render the target page. In some embodiments, it may be determined whether the target page has a layout problem according to a node parameter corresponding to at least one node of the plurality of nodes, and if it is determined that the target page has a layout problem according to a node parameter corresponding to at least one node, the node parameters corresponding to the at least one node are re-injected into the corresponding node in the control tree structure, alternatively, the node parameters corresponding to the plurality of nodes are re-injected into the corresponding nodes in the control tree structure, for example, if the depth corresponding to at least one node is greater than or equal to a predetermined depth threshold, or, if the degree corresponding to at least one node is equal to 1, or, if the height corresponding to at least one node is greater than or equal to a predetermined height threshold, or, if the total number of nodes corresponding to at least one node is greater than or equal to a predetermined number threshold, it may be determined that the target page has a layout problem. In some embodiments, the control tree structure may be directly output, or the control tree structure may be first converted into a file with a predetermined format and the file may be output. According to the method and the device, the key performance parameters of the page in the target application are counted in a control tree structure mode, whether the page has layout problems or not is determined by analyzing the key performance parameters, if a certain page in the target application has the layout problems, the key performance parameters are reinjected into corresponding nodes in the control tree structure corresponding to the page, and the control tree structure is output, so that an operator or developer of the target application can intuitively browse the control tree structure corresponding to the page with the layout problems, the layout problems of the page can be timely found, and the page is maintained or modified, and the loss and income loss of a user of the target application are avoided.
In some embodiments, the generating a control tree structure corresponding to the target page includes: for a first control traversed currently, generating a first node corresponding to the first control, and adding the first node to a control tree structure corresponding to the target page; judging whether the first control has at least one corresponding first sub-control; if yes, continuously traversing the first sub-control in the at least one first sub-control. In some embodiments, for a first control on a currently traversed target page, a first node corresponding to the first control is generated, the first node is added to a control tree structure corresponding to the target page, and then whether the first control has a corresponding first sub-control is continuously determined, if yes, the first sub-control in at least one first sub-control corresponding to the first control is continuously traversed, a node corresponding to the first sub-control is generated, the node is added to the control tree structure, and so on.
In some embodiments, the determining whether the first control has a corresponding at least one first child control comprises: judging whether the first control is a container type control or not; if not, determining that the first control does not have a corresponding first sub-control; and if not, judging whether the first control has at least one corresponding first sub-control. In some embodiments, only the container type control (e.g., viewGroup) may have a corresponding child control, and other types of controls may not have a corresponding child control. In some embodiments, it is determined whether the first control is a container type control, if not, it may be directly determined that the first control does not have a corresponding first sub-control, and if so, it is only necessary to determine whether the first control has a corresponding first sub-control.
In some embodiments, the method further comprises: if the first control does not have the corresponding first child control, the user equipment determines whether the parent control of the first control has at least one second child control which is not traversed; if yes, continuously traversing the first second sub-control in the at least one second sub-control. In some embodiments, if a control is a child control of another control, then the other control is a parent control of the control. In some embodiments, if there is no corresponding first child control of the first control, it is required to determine whether there is at least one second child control that is not traversed by the parent control of the first control, for example, there are a plurality of second child controls View1, View2, View3, View4 of the parent control of the first control, where View1 has been traversed before, and View2, View3, View4 have not been traversed currently, and it may be determined that there is at least one second child control that is not traversed by the first control. In some embodiments, if there is at least one second child control that has not been traversed in the first control, the first second child control in the at least one second child control is continuously traversed, and in the above example, since the View2, the View3, and the View4 have not been traversed currently, the first second child control, i.e., the View2, in the views 2, 3, and 4 is continuously traversed. In some embodiments, if the parent control of the first control does not have at least one second child control that has not been traversed, it is determined whether the second parent control of the parent control has at least one third child control that has not been traversed, if so, it is determined whether a first third child control of the at least one third child control is continuously traversed, otherwise, it is determined whether the third parent control of the second parent control has at least one fourth child control that has not been traversed, and so on. In some embodiments, if the first control has at least one second child control that has not been traversed, continuing to traverse a first second child control of the at least one second child control, after traversing the first second child control, if the first second child control has a corresponding third child control, continuing to traverse a first third child control of the at least one third child control that corresponds to the first second child control, and so on, if the first second child control does not have a corresponding third child control, it is necessary to determine whether the parent control of the first control has one or more second child controls that are arranged behind the first control, if so, continuing to traverse the first second child control of the one or more second child controls, and so on, and if not, it is necessary to determine whether the parent control of the parent control has at least one third child control that has not been traversed, and so on.
In some embodiments, for the currently traversed first control, generating a first node corresponding to the first control, and adding the first node to the control tree structure corresponding to the target page includes: determining whether a corresponding parent control exists in a first control traversed currently; if not, initializing a control tree structure corresponding to the target page, generating a first node corresponding to the first control, and adding the first node into the control tree structure as a root node of the control tree structure; otherwise, positioning a second node corresponding to the father control in the control tree structure, generating a first node corresponding to the first control, and adding the first node into the control tree structure as a next child node of the second node. In some embodiments, for a first control on a currently traversed target page, determining whether the first control has a corresponding parent control, if not, initializing a control tree structure corresponding to the target page, generating a first node corresponding to the first control, and adding the first node as a root node of the control tree structure into the control tree structure, if so, positioning a second node corresponding to the parent control in the control tree structure, generating a first node corresponding to the first control, and adding the first node as a next child node of the second node into the control tree structure, for example, if a second node corresponding to the parent control in the control tree structure does not currently have a corresponding child node, directly adding the first node as a first child node of the second node into the control tree structure, and if at least one child node corresponding to the second node corresponding to the parent control currently exists in the control tree structure, adding the first node to the control tree structure as a next child node that is ranked after the at least one child node.
In some embodiments, the node parameter comprises a depth corresponding to each of the nodes. In some embodiments, the depth corresponding to each node may be determined according to a unique path length from a root node of the control tree structure to the node, and the unique path length may be directly used as the depth corresponding to the node, or the unique path length +1 may also be used as the depth corresponding to the node, for example, if a child node corresponding to the root node includes node a and a child node corresponding to node a includes node B, then a unique path from the root node to node B is "root node- > node a- > node B", and the length of the path is 2, then the path length may be directly used as the depth corresponding to node B, or the path length +1 may also be used as the depth corresponding to node B.
In some embodiments, the method further comprises: and if the depth corresponding to at least one node is greater than or equal to a preset depth threshold, the user equipment determines that the target page has a layout problem. In some embodiments, if the depth corresponding to a node is deeper, it indicates that the nesting level corresponding to the node is more, which increases the time required for the user equipment to render the target page, and indicates that the node has a performance problem. In some embodiments, if the depth corresponding to a certain node in the control tree structure is greater than or equal to a predetermined depth threshold, it may be determined that the target page has a layout problem. In some embodiments, if there is more than a predetermined number of at least one node in the control tree structure with a depth greater than or equal to a predetermined depth threshold, it may be determined that a layout problem exists for the target page.
In some embodiments, the node parameters further include a degree corresponding to each of the nodes. In some embodiments, the degree corresponding to each node refers to the number of child nodes of the node. For example, if there are 3 child nodes in a node, the degree corresponding to the node is 0. In some embodiments, if a node does not have a child node, i.e., if the node is a leaf node, the degree corresponding to the node is 0.
In some embodiments, the method further comprises: and if the degree corresponding to at least one node is equal to 1, the user equipment determines that the target page has a layout problem. In some embodiments, if the degree corresponding to a node is equal to 1, that is, there is only one child node in the node, it indicates that the node has a performance problem. In some embodiments, if the degree corresponding to a certain node in the control tree structure is equal to 1, it may be determined that the target page has a layout problem. In some embodiments, if the degree corresponding to more than a predetermined number of at least one node in the control tree structure is equal to 1, it may be determined that the target page has a layout problem.
In some embodiments, for each node, if the node is a root node of the control tree structure, the node parameter corresponding to the root node further includes a height of the control tree structure. In some embodiments, the height of the control tree structure refers to the longest path length from the root node to a leaf node of the control tree structure, and the longest path length may be directly used as the height of the control tree structure, or the longest path length +1 may also be used as the height of the control tree structure. In some embodiments, for a root node in a control tree structure, the node parameter corresponding to the root node also includes a height of the control tree structure.
In some embodiments, the method further comprises: and if the height corresponding to the root node is greater than or equal to a preset height threshold value, the user equipment determines that the target page has a layout problem. In some embodiments, if the height of the control tree structure is higher, it indicates that the maximum nesting level corresponding to the control tree structure is more, which increases the time required for the user equipment to render the target page, and indicates that the root node, i.e., the control tree structure, has a performance problem.
In some embodiments, the node parameter corresponding to the root node further includes a total number of nodes of the control tree structure. In some embodiments, the total number of nodes of the control tree structure refers to the number of all nodes (including root nodes, leaf nodes, non-leaf nodes) in the control tree structure. In some embodiments, for a root node in the control tree structure, the node parameter corresponding to the root node further includes a total number of nodes of the control tree structure.
In some embodiments, the method further comprises: and if the total number of the nodes corresponding to the root node is greater than or equal to a preset number threshold, the user equipment determines that the target page has a layout problem. In some embodiments, if the total number of nodes of the control tree structure is larger, the time required for the user equipment to render the target page may be increased, which indicates that the root node, i.e., the control tree structure, has a performance problem.
In some embodiments, the determining that the target page has a layout problem if the total number of nodes corresponding to the root node is greater than or equal to a predetermined number threshold includes: and if the sum of the product of the total number of the nodes corresponding to the root node and the first preset coefficient and the product of the height corresponding to the root node and the second preset coefficient is greater than or equal to a preset value, determining that the target page has a layout problem. In some embodiments, the more total nodes corresponding to the root node, the more time the user device takes to render the target page, the more likely the target page is to have a layout problem, and the higher the height corresponding to the root node, the more time the user device takes to render the target page, the more likely the target page is to have a layout problem. In some embodiments, if mTotal c1+ mhight c2> -pv, where mTotal is the total number of nodes corresponding to the root node, mhight is the height corresponding to the root node, c1 is a first predetermined coefficient, c2 is a second predetermined coefficient, and pv is a predetermined value, then it may be determined that the target page has a layout problem.
In some embodiments, the method further comprises: the user equipment determines whether each node has a performance problem according to the node parameters; and if one or more nodes in the plurality of nodes have performance problems, determining that the target page has layout problems. In some embodiments, according to the node parameter corresponding to each node, whether the node has a performance problem may be determined in one of the above manners, or whether the node has a performance problem may be determined in any combination of at least one of the above manners. In some embodiments, it may be determined that the target page has a layout problem as long as one node in the control tree structure has a performance problem, or it may be determined that the target page has a layout problem as long as a predetermined number of one or more nodes in the control tree structure have a performance problem.
In some embodiments, the injecting node parameters corresponding to at least one node into a corresponding node in the control tree structure includes: and injecting node parameters corresponding to the one or more nodes with the performance problem into corresponding nodes in the control tree structure. In some embodiments, node parameters corresponding to all nodes are injected into corresponding nodes in the control tree structure. In some embodiments, only the node parameters corresponding to the one or more nodes that have a performance problem are injected into the corresponding nodes in the control tree structure.
In some embodiments, said outputting said control tree structure comprises: and converting the control tree structure into a target file in a key-value pair format, and outputting the target file. In some embodiments, the control tree result is converted into a target file in a key-value pair (e.g., json, JavaScript Object notification) format, and the target file is output, so that an operator or a developer can intuitively browse the control tree structure corresponding to a target page with a layout problem.
Fig. 2 shows a structure diagram of a user equipment for outputting a control tree according to an embodiment of the present application, where the user equipment includes a one-module 11, a two-module 12, and a three-module 13. A one-to-one module 11, configured to generate a control tree structure corresponding to a target page by traversing one or more controls on the target page in response to completion of rendering the target page, where the control tree structure includes multiple nodes, and each node corresponds to one of the one or more controls; a second module 12, configured to perform parameter analysis on the control tree structure to obtain a node parameter corresponding to each node; and a third module 13, configured to, if it is determined that the target page has a layout problem according to the node parameters, inject the node parameters corresponding to at least one node into a corresponding node in the control tree structure, and output the control tree structure.
A one-to-one module 11, configured to generate a control tree structure corresponding to a target page by traversing one or more controls on the target page in response to completion of rendering the target page, where the control tree structure includes multiple nodes, and each node corresponds to one of the one or more controls. In some embodiments, when the target page is launched, the target page is rendered on the user device so that the user can see the complete target page on the user device. In some embodiments, a control tree structure corresponding to the target page is generated by traversing all controls (including a currently visible control and a currently invisible control) on the target page and storing the traversal result according to the tree structure, where the control tree structure includes a plurality of nodes, each node corresponds to a control on the target page, each control in the target page corresponds to a node in the control tree structure, and there is a one-to-one correspondence between nodes and controls, that is, different nodes correspond to different controls, and different controls correspond to different nodes. In some embodiments, a window object (e.g., window) is obtained from a target page, and then each control on the target page may be obtained from the window object, so as to traverse all the controls on the target page, for example, the window object may be obtained from the target page through a WindowManager (window management) service, for example, a first control (e.g., rootview) in the window object is obtained first, and then whether the control has a corresponding child control is determined, if so, a first child control in at least one child control corresponding to the control is obtained continuously, and then, whether the child control has a corresponding child control is determined continuously, if so, a first child control in at least one child control corresponding to the child control is obtained continuously, and so on, until all the controls on the target page are traversed.
And a second module 12, configured to perform parameter analysis on the control tree structure to obtain a node parameter corresponding to each node. In some embodiments, the node parameters corresponding to each node are obtained by performing parameter analysis on the control tree structure, where the node parameters include, but are not limited to, a depth, a degree, a height, a total number of nodes, and the like corresponding to each node.
And a third module 13, configured to, if it is determined that the target page has a layout problem according to the node parameters, inject the node parameters corresponding to at least one node into a corresponding node in the control tree structure, and output the control tree structure. In some embodiments, the node parameters may affect the rendering speed of the user device for the target page and the time it takes to render the target page. In some embodiments, it may be determined whether the target page has a layout problem according to a node parameter corresponding to at least one node of the plurality of nodes, and if it is determined that the target page has a layout problem according to a node parameter corresponding to at least one node, the node parameters corresponding to the at least one node are re-injected into the corresponding node in the control tree structure, or, the node parameters corresponding to the plurality of nodes are re-injected into the corresponding nodes in the control tree structure, for example, if the depth corresponding to at least one node is greater than or equal to a predetermined depth threshold, or, if the degree corresponding to at least one node is equal to 1, or, if the height corresponding to at least one node is greater than or equal to a predetermined height threshold, or, if the total number of nodes corresponding to at least one node is greater than or equal to a predetermined number threshold, it may be determined that the target page has a layout problem. In some embodiments, the control tree structure may be directly output, or the control tree structure may be first converted into a file with a predetermined format and the file may be output. According to the method and the device, the key performance parameters of the page in the target application are counted in a control tree structure mode, whether the page has layout problems or not is determined by analyzing the key performance parameters, if a certain page in the target application has the layout problems, the key performance parameters are reinjected into corresponding nodes in the control tree structure corresponding to the page, and the control tree structure is output, so that an operator or developer of the target application can intuitively browse the control tree structure corresponding to the page with the layout problems, the layout problems of the page can be timely found, and the page is maintained or modified, and the loss and income loss of a user of the target application are avoided.
In some embodiments, the generating a control tree structure corresponding to the target page includes: for a first control traversed currently, generating a first node corresponding to the first control, and adding the first node to a control tree structure corresponding to the target page; judging whether the first control has at least one corresponding first sub-control; if yes, continuously traversing the first sub-control in the at least one first sub-control. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the determining whether the first control has a corresponding at least one first child control comprises: judging whether the first control is a container type control or not; if not, determining that the first control does not have a corresponding first sub-control; and if not, judging whether the first control has at least one corresponding first sub-control. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the apparatus is further configured to: if the first control does not have the corresponding first child control, determining whether the parent control of the first control has at least one second child control which is not traversed; if yes, continuously traversing the first second sub-control in the at least one second sub-control. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, for the currently traversed first control, generating a first node corresponding to the first control, and adding the first node to the control tree structure corresponding to the target page includes: determining whether a corresponding parent control exists in a first control traversed currently; if not, initializing a control tree structure corresponding to the target page, generating a first node corresponding to the first control, and adding the first node into the control tree structure as a root node of the control tree structure; otherwise, positioning a second node corresponding to the father control in the control tree structure, generating a first node corresponding to the first control, and adding the first node into the control tree structure as a next child node of the second node. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the node parameter comprises a depth corresponding to each of the nodes. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the apparatus is further configured to: and if the depth corresponding to at least one node is greater than or equal to a preset depth threshold value, determining that the target page has a layout problem. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the node parameters further include a degree corresponding to each of the nodes. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the apparatus is further configured to: and if the degree corresponding to at least one node is equal to 1, determining that the target page has a layout problem. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, for each node, if the node is a root node of the control tree structure, the node parameter corresponding to the root node further includes a height of the control tree structure. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the apparatus is further configured to: and if the height corresponding to the root node is larger than or equal to a preset height threshold value, determining that the target page has a layout problem. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the node parameter corresponding to the root node further includes a total number of nodes of the control tree structure. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the apparatus is further configured to: and if the total number of the nodes corresponding to the root node is greater than or equal to a preset number threshold, determining that the target page has a layout problem. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the determining that the target page has a layout problem if the total number of nodes corresponding to the root node is greater than or equal to a predetermined number threshold includes: and if the sum of the product of the total number of the nodes corresponding to the root node and the first preset coefficient and the product of the height corresponding to the root node and the second preset coefficient is greater than or equal to a preset value, determining that the target page has a layout problem. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the apparatus is further configured to: determining whether each node has a performance problem according to the node parameters; and if one or more nodes in the plurality of nodes have performance problems, determining that the target page has layout problems. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, the injecting node parameters corresponding to at least one node into a corresponding node in the control tree structure includes: and injecting node parameters corresponding to the one or more nodes with the performance problem into corresponding nodes in the control tree structure. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
In some embodiments, said outputting said control tree structure comprises: and converting the control tree structure into a target file in a key-value pair format, and outputting the target file. Here, the related operations are the same as or similar to those of the embodiment shown in fig. 1, and therefore are not described again, and are included herein by reference.
FIG. 3 illustrates a rendering schematic of a control tree structure according to one embodiment of the present application.
As shown in fig. 3, the root node of the control tree structure is rootview, rootview has 2 child nodes, respectively childview1 and childview2, childview1 has 2 child nodes, respectively childview3 and childview4, childview2 has 1 child node, childview5, the node parameter corresponding to each node is injected into the corresponding node in the control tree structure by performing parameter analysis on the control tree structure, the node parameter corresponding to rootview includes total number of nodes, namely, childview count (5), depth count (1), degree or child node number, childCount (2), the node parameter corresponding to childview counter 1 includes depth count (2), degree or child node number, childview count (2), the node parameter corresponding to childview2 includes depth count (2), degree or child node number, counte count (1), the corresponding node parameter includes 923, child node number of child nodes (76), counte count (3), or child node count (3870), the node parameters corresponding to the childview5 include depth (3), degree or child node number childCount (0), and since the degree or child node number childCount corresponding to the childview2 is 1, the childview2 has a performance problem, and it can be determined that the target page has a layout problem.
In addition to the methods and apparatus described in the embodiments above, the present application also provides a computer readable storage medium storing computer code that, when executed, performs the method as described in any of the preceding claims.
The present application also provides a computer program product, which when executed by a computer device, performs the method of any of the preceding claims.
The present application further provides a computer device, comprising:
one or more processors;
a memory for storing one or more computer programs;
the one or more computer programs, when executed by the one or more processors, cause the one or more processors to implement the method of any preceding claim.
FIG. 4 illustrates an exemplary system that can be used to implement the various embodiments described herein;
in some embodiments, as shown in FIG. 4, the system 300 can be implemented as any of the devices in the various embodiments described. In some embodiments, system 300 may include one or more computer-readable media (e.g., system memory or NVM/storage 320) having instructions and one or more processors (e.g., processor(s) 305) coupled with the one or more computer-readable media and configured to execute the instructions to implement modules to perform the actions described herein.
For one embodiment, system control module 310 may include any suitable interface controllers to provide any suitable interface to at least one of processor(s) 305 and/or any suitable device or component in communication with system control module 310.
The system control module 310 may include a memory controller module 330 to provide an interface to the system memory 315. Memory controller module 330 may be a hardware module, a software module, and/or a firmware module.
System memory 315 may be used, for example, to load and store data and/or instructions for system 300. For one embodiment, system memory 315 may include any suitable volatile memory, such as suitable DRAM. In some embodiments, the system memory 315 may include a double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).
For one embodiment, system control module 310 may include one or more input/output (I/O) controllers to provide an interface to NVM/storage 320 and communication interface(s) 325.
For example, NVM/storage 320 may be used to store data and/or instructions. NVM/storage 320 may include any suitable non-volatile memory (e.g., flash memory) and/or may include any suitable non-volatile storage device(s) (e.g., one or more Hard Disk Drives (HDDs), one or more Compact Disc (CD) drives, and/or one or more Digital Versatile Disc (DVD) drives).
NVM/storage 320 may include storage resources that are physically part of the device on which system 300 is installed or may be accessed by the device and not necessarily part of the device. For example, NVM/storage 320 may be accessible over a network via communication interface(s) 325.
Communication interface(s) 325 may provide an interface for system 300 to communicate over one or more networks and/or with any other suitable device. System 300 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and/or protocols.
For one embodiment, at least one of the processor(s) 305 may be packaged together with logic for one or more controller(s) (e.g., memory controller module 330) of the system control module 310. For one embodiment, at least one of the processor(s) 305 may be packaged together with logic for one or more controller(s) of the system control module 310 to form a System In Package (SiP). For one embodiment, at least one of the processor(s) 305 may be integrated on the same die with logic for one or more controller(s) of the system control module 310. For one embodiment, at least one of the processor(s) 305 may be integrated on the same die with logic for one or more controller(s) of the system control module 310 to form a system on a chip (SoC).
In various embodiments, system 300 may be, but is not limited to being: a server, a workstation, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet, a netbook, etc.). In various embodiments, system 300 may have more or fewer components and/or different architectures. For example, in some embodiments, system 300 includes one or more cameras, a keyboard, a Liquid Crystal Display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an Application Specific Integrated Circuit (ASIC), and speakers.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware, for example, implemented using Application Specific Integrated Circuits (ASICs), general purpose computers or any other similar hardware devices. In one embodiment, the software programs of the present application may be executed by a processor to implement the steps or functions described above. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Additionally, some of the steps or functions of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
In addition, some of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present application through the operation of the computer. Those skilled in the art will appreciate that the form in which the computer program instructions reside on a computer-readable medium includes, but is not limited to, source files, executable files, installation package files, and the like, and that the manner in which the computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Computer-readable media herein can be any available computer-readable storage media or communication media that can be accessed by a computer.
Communication media includes media by which communication signals, including, for example, computer readable instructions, data structures, program modules, or other data, are transmitted from one system to another. Communication media may include conductive transmission media such as cables and wires (e.g., fiber optics, coaxial, etc.) and wireless (non-conductive transmission) media capable of propagating energy waves such as acoustic, electromagnetic, RF, microwave, and infrared. Computer readable instructions, data structures, program modules, or other data may be embodied in a modulated data signal, for example, in a wireless medium such as a carrier wave or similar mechanism such as is embodied as part of spread spectrum techniques. The term "modulated data signal" means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. The modulation may be analog, digital or hybrid modulation techniques.
By way of example, and not limitation, computer-readable storage media may include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. For example, computer-readable storage media include, but are not limited to, volatile memory such as random access memory (RAM, DRAM, SRAM); and non-volatile memory such as flash memory, various read-only memories (ROM, PROM, EPROM, EEPROM), magnetic and ferromagnetic/ferroelectric memories (MRAM, FeRAM); and magnetic and optical storage devices (hard disk, tape, CD, DVD); or other now known media or later developed that can store computer-readable information/data for use by a computer system.
An embodiment according to the present application comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or a solution according to the aforementioned embodiments of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.

Claims (20)

1. A method for outputting a control tree, wherein the method comprises:
in response to the completion of rendering of a target page, traversing one or more controls on the target page to generate a control tree structure corresponding to the target page, wherein the control tree structure comprises a plurality of nodes, and each node corresponds to one of the one or more controls;
obtaining node parameters corresponding to each node by performing parameter analysis on the control tree structure;
and if the target page has a layout problem according to the node parameters, injecting the node parameters corresponding to at least one node into the corresponding nodes in the control tree structure, and outputting the control tree structure.
2. The method of claim 1, wherein the generating a control tree structure corresponding to the target page comprises:
for a first control traversed currently, generating a first node corresponding to the first control, and adding the first node to a control tree structure corresponding to the target page;
judging whether the first control has at least one corresponding first sub-control; if yes, continuously traversing the first sub-control in the at least one first sub-control.
3. The method of claim 2, wherein the determining whether the first control has a corresponding at least one first child control comprises:
judging whether the first control is a container type control or not; if not, determining that the first control does not have a corresponding first sub-control; and if not, judging whether the first control has at least one corresponding first sub-control.
4. The method of claim 2 or 3, wherein the method further comprises:
if the first control does not have the corresponding first child control, determining whether the parent control of the first control has at least one second child control which is not traversed; if yes, continuously traversing the first second sub-control in the at least one second sub-control.
5. The method of claim 2, wherein for the currently traversed first control, generating a first node corresponding to the first control, and adding the first node to a control tree structure corresponding to the target page comprises:
determining whether a corresponding parent control exists in a first control traversed currently;
if not, initializing a control tree structure corresponding to the target page, generating a first node corresponding to the first control, and adding the first node into the control tree structure as a root node of the control tree structure;
otherwise, positioning a second node corresponding to the father control in the control tree structure, generating a first node corresponding to the first control, and adding the first node into the control tree structure as a next child node of the second node.
6. The method of claim 1, wherein the node parameter comprises a depth corresponding to the each node.
7. The method of claim 6, wherein the method further comprises:
and if the depth corresponding to at least one node is greater than or equal to a preset depth threshold value, determining that the target page has a layout problem.
8. The method of claim 6, wherein the node parameters further comprise a degree to which the each node corresponds.
9. The method of claim 8, wherein the method further comprises:
and if the degree corresponding to at least one node is equal to 1, determining that the target page has a layout problem.
10. The method of claim 8, wherein for each node, if the node is a root node of the control tree structure, the node parameter corresponding to the root node further includes a height of the control tree structure.
11. The method of claim 10, wherein the method further comprises:
and if the height corresponding to the root node is greater than or equal to a preset height threshold value, determining that the target page has a layout problem.
12. The method of claim 10, wherein the node parameter corresponding to the root node further comprises a total number of nodes of the control tree structure.
13. The method of claim 12, wherein the method further comprises:
and if the total number of the nodes corresponding to the root node is greater than or equal to a preset number threshold, determining that the target page has a layout problem.
14. The method of claim 13, wherein the determining that the target page has a layout problem if the total number of nodes corresponding to the root node is greater than or equal to a predetermined number threshold comprises:
and if the sum of the product of the total number of the nodes corresponding to the root node and the first preset coefficient and the product of the height corresponding to the root node and the second preset coefficient is greater than or equal to a preset value, determining that the target page has a layout problem.
15. The method of claim 1, wherein the method further comprises:
determining whether each node has a performance problem according to the node parameters;
and if one or more nodes in the plurality of nodes have performance problems, determining that the target page has layout problems.
16. The method of claim 15, wherein the injecting node parameters corresponding to at least one node into a corresponding node in the control tree structure comprises:
and injecting node parameters corresponding to the one or more nodes with the performance problem into corresponding nodes in the control tree structure.
17. The method of claim 1, wherein the outputting the control tree structure comprises:
and converting the control tree structure into a target file in a key-value pair format, and outputting the target file.
18. A computer device for outputting a control tree, comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to implement the steps of the method according to any of claims 1 to 17.
19. A computer-readable storage medium, on which a computer program/instructions are stored, which, when being executed by a processor, carry out the steps of the method according to any one of claims 1 to 17.
20. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method according to any one of claims 1 to 17 when executed by a processor.
CN202210087320.XA 2022-01-25 2022-01-25 Method, device, medium and program product for outputting control tree Pending CN114489900A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210087320.XA CN114489900A (en) 2022-01-25 2022-01-25 Method, device, medium and program product for outputting control tree

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210087320.XA CN114489900A (en) 2022-01-25 2022-01-25 Method, device, medium and program product for outputting control tree

Publications (1)

Publication Number Publication Date
CN114489900A true CN114489900A (en) 2022-05-13

Family

ID=81475117

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210087320.XA Pending CN114489900A (en) 2022-01-25 2022-01-25 Method, device, medium and program product for outputting control tree

Country Status (1)

Country Link
CN (1) CN114489900A (en)

Similar Documents

Publication Publication Date Title
CN108958780B (en) Method and equipment for presenting update information of hosted program
CN110266505B (en) Method and equipment for managing session group
CN110765395B (en) Method and equipment for providing novel information
CN110290557B (en) Method and equipment for loading page tags in application
CN111488096B (en) Method and equipment for displaying interactive presentation information in reading application
CN110290058B (en) Method and equipment for presenting session message in application
WO2021147930A1 (en) Message splicing method and device
CN110443641B (en) Method and device for managing reading authority and comment information of novel section
CN111796731A (en) Method and equipment for automatically arranging icons
CN114489900A (en) Method, device, medium and program product for outputting control tree
CN111079039B (en) Method and equipment for collecting books
CN111680250B (en) Method and equipment for recalling presentation information
CN111385353B (en) Method and equipment for providing application presentation information
CN110460642B (en) Method and device for managing reading mode
CN115134325A (en) Method, device and medium for information push
CN110321205B (en) Method and equipment for managing hosted program in hosted program
CN113918897A (en) Method, apparatus, and medium for displaying application in application open platform
CN114296651A (en) Method and equipment for storing user-defined data information
CN112905422A (en) Alarm rule management method and equipment based on search server
CN113157162A (en) Method, apparatus, medium and program product for revoking session messages
CN111125565A (en) Method and equipment for inputting information in application
CN110781431A (en) Method and equipment for providing novel information
CN117590973A (en) Method, equipment and medium for determining window correlation
CN110866109B (en) Method and equipment for collecting books
CN111552906B (en) Method and equipment for responding to page access request in reading application

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination