CN-121996860-A - Web page rendering method and electronic equipment
Abstract
A Web page rendering method and electronic equipment are used for reducing the load and power consumption of the electronic equipment during Web page browsing. The method comprises the steps that a first application process generates a first rendering tree, and the first rendering tree is used for drawing a first application interface corresponding to a Web page in Web application. The first application process sends the first rendering tree to the system rendering process. And then, the system rendering process generates a second rendering tree according to the first rendering tree and the rendering node corresponding to the first application, wherein the first application is an application except the Web application in the electronic equipment. And the system rendering process generates a first display interface according to the second rendering tree, wherein the first display interface comprises a first application interface and a second application interface of the first application. Because the main process of the Web application is not required to be subjected to rasterization and synthesis, the interaction times between processes can be reduced, and the synthesis times can be reduced, so that the load and the power consumption of the electronic equipment can be reduced.
Inventors
- Jin Chenyang
- ZHENG TIANJI
- LI ZIMIAN
- LIU RONGLIANG
Assignees
- 华为技术有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241104
Claims (15)
- 1. The page rendering method is characterized by being applied to electronic equipment, wherein the electronic equipment runs a system rendering process and a first application process of a Web application, and the method comprises the following steps: The first application process generates a first rendering tree, and the first rendering tree is used for drawing a first application interface corresponding to a Web page in Web application; The first application process sends the first rendering tree to the system rendering process; the system rendering process generates a second rendering tree according to the first rendering tree and a rendering node corresponding to a first application, wherein the first application is an application except the Web application in the electronic equipment; And the system rendering process generates a first display interface according to the second rendering tree, wherein the first display interface comprises the first application interface and a second application interface corresponding to the first application.
- 2. The method according to claim 1, wherein the method further comprises: The first application process generates a first drawing instruction list of a first application interface according to the first rendering tree, and sends the first drawing instruction list to the system rendering process, or, The system rendering process generates a first drawing instruction list of a first application interface according to the first rendering tree; The system rendering process generates the first display interface according to the second rendering tree, and the system rendering process comprises the following steps: And the system rendering process generates the first display interface according to the second rendering tree and the first drawing instruction list.
- 3. The method of claim 1 or 2, wherein the Web page comprises a native control, and the second rendering tree further comprises a rendering node corresponding to the native control.
- 4. The method of claim 3, wherein the first rendering tree comprises rendering nodes corresponding to the native controls.
- 5. The method according to claim 4, wherein the method further comprises: the first application process receives a third rendering tree sent by the system rendering process, wherein the third rendering tree comprises rendering nodes corresponding to the native controls; The first application process generates a fourth rendering tree, wherein the fourth rendering tree comprises rendering nodes corresponding to Web controls in the Web page; The first application process generates a first rendering tree comprising: the first application process generates the first rendering tree according to the third rendering tree and the fourth rendering tree.
- 6. The method according to claim 4, wherein the method further comprises: The system rendering process generates a third rendering tree, wherein the third rendering tree comprises rendering nodes corresponding to the native controls; the system rendering process generates a second rendering tree according to the first rendering tree and a rendering node corresponding to the first application, and the system rendering process comprises the following steps: The system rendering process generates the second rendering tree according to the first rendering tree, the third rendering tree and the rendering node corresponding to the first application, wherein the first rendering tree comprises the rendering node corresponding to the Web control in the Web page.
- 7. The method of any one of claims 1-6, wherein the system rendering process generates a second rendering tree according to the first rendering tree and a rendering node corresponding to the first application, including: the system rendering process creates a fifth rendering tree, and takes a root node in the first rendering tree and a root node in the rendering node corresponding to the first application as child nodes of the root node in the fifth rendering tree to obtain the second rendering tree, or And the system rendering process takes the root node in the first rendering tree as a child node of one of the rendering nodes corresponding to the first application to obtain the second rendering tree.
- 8. The method according to any one of claims 1 to 7, wherein the first rendering tree adopts a first data format, the first data format is a format that can be supported by the system rendering process, and the format that can be supported by the first application process is a second data format.
- 9. The method of any one of claims 1-8, wherein the first application process sending the first rendering tree to the system rendering process comprises: The first application process writes the first rendering tree into a first shared memory, the system rendering process reads the first rendering tree from the first shared memory, or, The first application process adds the first rendering tree to a first message queue, and the system rendering process obtains the first rendering tree from the first message queue.
- 10. The method according to any one of claims 1 to 9, wherein the electronic device further runs a second application process of a second application, and the second application is an application other than the Web application; the system rendering process generates a first display interface according to the second rendering tree, and the system rendering process comprises the following steps: the system rendering process generates a first bitmap according to the second rendering tree, wherein the first bitmap comprises the first application interface and the second application interface; the system rendering process obtains a second bitmap, wherein the second bitmap comprises a third application interface of the second application process; The system rendering process generates the first display interface according to the first bitmap and the second bitmap.
- 11. The method according to any one of claims 1-10, wherein the first application process sends the first rendering tree to the system rendering process, comprising: and when the first application process determines that the electronic equipment is in a first rendering mode, the first application process sends the first rendering tree to the system rendering process.
- 12. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any one of claims 1-11 when executing the computer program.
- 13. A chip system, characterized in that the chip system comprises a processing circuit and a storage medium, wherein the storage medium stores instructions, and the instructions implement the method according to any one of claims 1-11 when executed by the processing circuit.
- 14. A computer readable storage medium for storing a computer program which, when run on a computer, causes the computer to perform the method of any one of claims 1 to 11.
- 15. A computer program product, characterized in that the computer program product comprises a computer program which, when run on a computer, causes the computer to carry out the method according to any one of claims 1-11.
Description
Web page rendering method and electronic equipment Technical Field The present application relates to the field of terminal technologies, and in particular, to a Web page rendering method and an electronic device. Background A Web page through which a user can conveniently access and use various resources and services on the internet can be used to present information and provide interactive functions. Currently, web Applications (APP) generally adopt an application self-drawing method to implement Web page rendering (or called page drawing), that is, the Web applications render and generate a bitmap (bitmap) corresponding to a current Web page and submit the bitmap to a system rendering process of an operating system, and the system rendering process synthesizes the bitmap with bitmaps of other display contents to be displayed and then displays the resultant bitmap on a screen. But applying the self-rendering method results in higher hardware load and higher power consumption of the device. Disclosure of Invention The embodiment of the application provides a Web page rendering method and electronic equipment, which are used for reducing the load and power consumption of the electronic equipment during Web page browsing. In a first aspect, a Web page rendering method is provided, which can be applied to an electronic device, where the electronic device runs a system rendering process and a first application process of a Web application. The method comprises the steps that a first application process generates a first rendering tree, and the first rendering tree is used for drawing a first application interface corresponding to a Web page in the Web application. The first application process sends the first rendering tree to the system rendering process. And then, the system rendering process generates a second rendering tree according to the first rendering tree and the rendering node corresponding to the first application, wherein the first application is an application of the electronic equipment except the Web application. And the system rendering process generates a first display interface according to the second rendering tree, wherein the first display interface comprises a first application interface and a second application interface of the first application. In the method, after the first application process obtains the first rendering tree, the first rendering tree is sent to the system rendering process, and the system rendering process can co-build the second rendering tree based on the first rendering tree and the rendering node of the first application, and then perform subsequent rendering according to the second rendering tree. Compared with the method that the rendering process of the Web application needs to request the main process of the Web application to perform rasterization and synthesis after generating the rendering tree in the self-drawing method, the method of the embodiment of the application directly sends the rendering tree to the system rendering process without requesting the main process of the Web application to perform rasterization and synthesis, so that the number of inter-process interaction times can be reduced, and the first rendering tree and the rendering nodes of other applications are co-built into the second rendering tree, so that the number of times of synthesis can be reduced by performing one-time synthesis according to the second rendering tree, so that the load and power consumption of electronic equipment are reduced, and the smoothness of Web page display (such as sliding scenes and animations) is improved. In one possible implementation, multiple ways of generating the drawing instructions may be provided. In one manner, a first application process may generate a first list of drawing instructions for the first application interface from the first rendering tree and send the first list of drawing instructions to a system rendering process. The system rendering process may then generate a first display interface from the second rendering tree and the first list of drawing instructions. Based on the implementation mode, the existing drawing capability of the first application process can be multiplexed, and complexity of implementation of the scheme is reduced. Alternatively, the system rendering process may generate the first drawing instruction list of the first application interface according to the first rendering tree, for example, the system rendering process may generate the first drawing instruction list directly according to the first rendering tree, or the system rendering process may generate the first drawing instruction list according to the second rendering tree, where the second rendering tree includes the rendering nodes in the first rendering tree, so it may be understood that the first drawing instruction list is generated according to the portion of the first rendering tree included in the second rendering tree. The system rendering pro