WO2018076795A1 - 页面刷新的方法及装置 - Google Patents

页面刷新的方法及装置 Download PDF

Info

Publication number
WO2018076795A1
WO2018076795A1 PCT/CN2017/092843 CN2017092843W WO2018076795A1 WO 2018076795 A1 WO2018076795 A1 WO 2018076795A1 CN 2017092843 W CN2017092843 W CN 2017092843W WO 2018076795 A1 WO2018076795 A1 WO 2018076795A1
Authority
WO
WIPO (PCT)
Prior art keywords
updated
area
content
page
location
Prior art date
Application number
PCT/CN2017/092843
Other languages
English (en)
French (fr)
Inventor
宁月松
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2018076795A1 publication Critical patent/WO2018076795A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a method and an apparatus for page refresh.
  • the process of displaying a page or rendering a page generally includes: 101: The engine parses the received HTML (HyperText Markup Language) or XML (Extensible Markup Language) document and Constructs a Document Object Model (DOM) tree.
  • the nodes in the Render tree have a corresponding relationship with the nodes of the DOM tree, and the coordinates of different nodes in the Render tree are different, and different nodes respectively correspond to different page areas and page contents.
  • 103 Layout the page according to attribute information such as the position of the node in the Render tree.
  • 104 Synthesize and refresh the laid page content to the buffer area.
  • 105 Draw and display the contents of the buffer area. After the page is displayed, the content of parts of the page or the entire area can be updated according to the update requirements.
  • the kernel of the mainstream webkit, chromium and other browsers can achieve partial refresh of the page, that is, the area that needs to be updated frequently is distinguished from other areas that need to be updated after the display, and the area that needs to be updated frequently is refreshed independently.
  • the local refresh mechanism in the prior art can effectively reduce the unnecessary refresh and reduce the waste of resources and energy in the refresh process to a certain extent, but the reduction of resources and energy is still limited.
  • the present application provides a method and apparatus for page refreshing, which can further reduce waste of resources and energy on the basis of local refresh provided by the prior art.
  • the present application provides a method for refreshing a page, including: acquiring a location of an area to be updated; determining a location of the target area, where the target area is an area currently visible on the display in the page; When there is a preset relationship between the location of the location and the location of the target area, the content to be updated is not drawn in the area to be updated during the page refresh process.
  • the area to be updated is an area to be updated in the page to be updated, and the content to be updated is content corresponding to at least one node to be updated in the rendering tree corresponding to the page.
  • the nodes of the Render tree are usually used as the rendering basis. Each node corresponds to the specific content of the page.
  • a node corresponding to the content that needs to be updated is referred to as a node to be updated.
  • the area to be updated referred to in the present application is an area to be updated corresponding to the content to be updated corresponding to the node to be updated.
  • the locations of the regions to be updated and the target regions may be represented in the form of coordinates of a plurality of vertices of the regions.
  • the position of the area may be represented by coordinates of four vertices of the rectangle; when the area to be updated and/or the target area is a circular area, the area is The position can be represented by a circular center and a radius.
  • the method for refreshing the page increases the determination process of whether there is a preset relationship between the location of the area to be updated and the location of the area currently visible on the display when the partial refresh is required, when to be updated.
  • the content to be updated is not drawn in the region to be updated. Since the drawing process consumes a lot of resources and energy and does not perform the drawing process, it can reduce the waste of resources and energy during page rendering.
  • the location of the to-be-updated area and the location of the target area have a preset relationship, and specifically, the area to be updated does not overlap with the target area.
  • the present application can reduce the waste of resources and energy in the page refreshing process by not drawing the content to be updated in the area to be updated.
  • the location of the to-be-updated area and the location of the target area have a preset relationship, which includes: an overlapping area between the area to be updated and the target area, but the first node exists in the corresponding rendering tree of the page.
  • the area corresponding to the first node completely occludes the area to be updated.
  • the area corresponding to the first node completely occludes the area to be updated when the first node has the following relationship with the node to be updated: the area corresponding to the first node includes the area corresponding to the node to be updated, and the first node is
  • the value of the z coordinate in the rendering tree is greater than the value of the z coordinate of the node to be updated in the rendering tree.
  • the present application can reduce the waste of resources and energy during the page refresh process by not drawing the content to be updated in the area to be updated.
  • the preset relationship between the to-be-updated area and the location of the target area may be: the area to be updated is completely outside the target area, and the distance between the area to be updated and the target area Outside the preset range.
  • the user may move the page slightly so that the area to be updated falls within the page display area. Therefore, the determination of the distance between the area to be updated and the area currently visible on the display is increased.
  • the area to be updated is close to the area currently visible on the display, in order to present a better page display effect, It is still necessary to refresh and render the content to be updated in the area to be updated; when the distance between the area to be updated and the target area exceeds a certain range, the distance between the area to be updated and the target area may be considered to be far away. Refresh and draw the content to be updated in the update area.
  • the location of the area to be updated and the location of the target area are preset.
  • the system may also be that the location of the area to be updated is completely outside the target area, and the time that the area to be updated is completely outside the target area exceeds a certain time range.
  • the location of the area to be updated is completely outside the target area, and the time when the area to be updated is completely outside the target area exceeds a certain time range, it can be considered that the user does not need to be in a long time.
  • the content of the area to be updated is browsed, so the content to be updated can be refreshed and drawn in the area to be updated.
  • the method when the preset relationship between the location of the to-be-updated area and the location of the target area exists, the method further includes: determining a category of the content to be updated. Correspondingly, when the content to be updated belongs to the first category, the content to be updated is not cached in the cache area before the content to be updated is not in the area to be updated; when the content to be updated belongs to the second category, Before the content to be updated is not drawn in the area to be updated, the method further includes: refreshing the to-be-updated content to the cache area.
  • the first category is that when the preset relationship between the area to be updated and the target area exists, if the content to be updated is not refreshed to the buffer area, the preset is not present in the area to be updated and the target area. In the case of the relationship, the content to be updated is still able to be displayed normally, that is, the content that does not need to be updated if the user is not visible.
  • the second category is that when the preset relationship is to be updated between the area to be updated and the target area, if the content to be updated is not refreshed to the cache area, the content to be updated is not updated when the preset relationship is not existed between the area to be updated and the target area. Content that cannot be displayed properly, that is, content that still needs to be updated if the user is not visible.
  • the category determination of the content to be updated is also added, and when the location of the area to be updated has a preset relationship with the target area,
  • the process of refreshing the content to be updated to the buffer area is not processed, and the drawing process is naturally terminated, thereby further reducing the page. Waste of resources and energy during the refresh process.
  • the content to be updated corresponding to the node to be updated belongs to the second category, the content to be updated is still refreshed into the buffer area, and only the drawing process of the content to be updated and the subsequent steps are stopped, so that waste of resources and energy can be minimized. On the basis of this, the normal display of the content to be updated is guaranteed at the same time.
  • the embodiment of the present application further provides a method for refreshing a page, including: acquiring a location of an area to be updated; determining a location of the target area, where the target area is an area currently visible on the display in the page; When there is a preset relationship between the location of the update area and the location of the target area, the content to be updated is refreshed to the area to be updated.
  • the area to be updated is the area to be updated in the page, and the content to be updated is the content corresponding to at least one node to be updated in the rendering tree corresponding to the page.
  • the location of the to-be-updated area and the location of the target area have a preset relationship
  • the method includes: the area to be updated and the target area have an overlapping area, and the corresponding rendering tree of the page does not There is a first node; the area corresponding to the first node completely occludes the area to be updated. That is, the area to be updated partially overlaps or completely overlaps with the target area, and the overlapped area is not "occluded" by other areas. In this case, the area to be updated is partially visible or all visible to the user.
  • the location of the area to be updated there is a preset relationship between the location of the area to be updated and the location of the target area. It is also possible that there is no overlap between the area to be updated and the target area, but the distance between the area to be updated and the target area is within a preset range. Or, there is no overlap between the area to be updated and the target area, but the duration is within a certain period of time, that is, the duration is short. In these cases, in order to ensure a good page display effect, it is necessary to refresh and draw the content to be updated in the area to be updated.
  • the present application further provides a terminal, which is used to perform each step in the method described in the foregoing first aspect, and the function of the terminal may be implemented by using hardware or by executing corresponding software by hardware.
  • the hardware or software includes one or more modules corresponding to the above functions.
  • the structure of the terminal includes a processor, a memory, a display and a bus, and the processor is configured to support the terminal to perform a corresponding function in the above method.
  • the memory is for coupling to a processor that holds the program instructions and data necessary for the terminal.
  • This display is used to display the area currently displayed on the page.
  • the terminal further includes a communication interface, where the communication interface is used to support communication between the terminal and other devices.
  • the terminal includes: an obtaining module, configured to acquire a location of the to-be-updated area, where the to-be-updated area is an area to be updated in the page to be updated, and the content to be updated is corresponding to the page.
  • a display module configured to determine an area currently displayed in the page, and display the page content in the currently displayed area on a display; the processing module uses Determining a location of the target area, where the target area is an area displayed by the display module on the display; when the location of the area to be updated acquired by the acquisition module has a preset relationship with the location of the target area The content to be updated is not drawn in the to-be-updated area during the page update process.
  • the application provides a terminal for performing each step in the method described in the foregoing second aspect, and the function of the terminal may be implemented by using hardware or by executing corresponding software by hardware.
  • the hardware or software includes one or more modules corresponding to the above functions.
  • the structure of the terminal includes a processor, a memory, a display and a bus, and the processor is configured to support the terminal to perform a corresponding function in the above method.
  • the memory is for coupling to a processor that holds the program instructions and data necessary for the terminal.
  • the terminal further includes a communication interface, where the communication interface is used to support communication between the terminal and other devices.
  • the terminal includes: an obtaining module, configured to acquire a location of the to-be-updated area, where the to-be-updated area is an area to be updated in the page to be updated, and the content to be updated is corresponding to the page.
  • a display module configured to determine an area currently displayed in the page, and display the page content in the currently displayed area on a display; the processing module uses Determining a location of the target area, where the target area is an area displayed on the display by the display module in the page; when the location of the area to be updated acquired by the acquiring module and the location of the target area are pre-predetermined When the relationship is set, the content to be updated is refreshed to the area to be updated.
  • the present application provides a computer storage medium for storing computer software instructions for use in the terminal of the above third aspect, comprising a program designed to perform the above aspects.
  • the present application provides a computer storage medium for storing computer software instructions for use in the terminal of the above fourth aspect, comprising a program designed to perform the above aspects.
  • the method and device for refreshing the page provided by the present application are required in comparison with the local refresh mechanism in the prior art.
  • a partial refresh is to be performed, a determination process is made as to whether there is a preset relationship between the position of the area to be updated and the position of the area currently visible on the display of the page, when the position of the area to be updated and the current position of the page are visible on the display
  • the content to be updated is not drawn in the area to be updated during the page refresh process.
  • the drawing process consumes a lot of resources and energy and does not perform the drawing process, it can reduce the waste of resources and energy. Therefore, the present application can reduce the unnecessary refresh process on the basis of the partial refresh of the prior art, thereby further reducing the waste of resources and energy in the page refresh process.
  • FIG. 2 is a schematic structural diagram of a terminal according to an embodiment of the present application.
  • FIG. 3 is a schematic flowchart diagram of a method for page refreshing according to an embodiment of the present disclosure
  • FIG. 4 is a schematic flowchart diagram of another method for page refreshing according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic flowchart of still another method for page refreshing according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of an apparatus for page refreshing according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of another apparatus for page refreshing according to an embodiment of the present disclosure.
  • FIG. 2 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
  • the terminal includes at least one processor 201, a communication bus 202, a memory 203, and a display 204.
  • the processor 201 can be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits.
  • CPU general purpose central processing unit
  • ASIC application-specific integrated circuit
  • Communication bus 202 can include a path for communicating information between the components described above.
  • the memory 203 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type that can store information and instructions.
  • the dynamic storage device can also be an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage, and a disc storage device. (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be Any other media accessed, but not limited to this.
  • the memory can exist independently and be connected to the processor via a bus.
  • the memory can also be integrated with the processor.
  • the display 204 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, and a cathode ray tube (CRT) display device.
  • LCD liquid crystal display
  • LED light emitting diode
  • CRT cathode ray tube
  • processor 201 may include one or more CPUs, such as CPU0 and CPU1 in FIG.
  • the terminal 200 may include multiple processors, such as the processor 201 and the processor 208 in FIG. Each of these processors can be a single-CPU processor or a multi-core processor.
  • a processor herein may refer to one or more devices, circuits, and/or processing cores for processing data, such as computer program instructions.
  • the terminal 200 further includes at least one communication interface 205, wherein the communication interface 205 is applicable to any device such as a transceiver for communicating with other devices or communication networks, such as an ether. Network, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.
  • a transceiver for communicating with other devices or communication networks, such as an ether.
  • Network Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.
  • RAN Radio Access Network
  • WLAN Wireless Local Area Networks
  • the terminal 200 may further include other output devices 206 and input devices 207.
  • Output device 206 is in communication with processor 201 and can display information in a variety of ways.
  • the output device can be a projector or the like.
  • Input device 207 is in communication with processor 201 and can accept user input in a variety of ways.
  • input device 207 can be a mouse, keyboard, touch screen device, or sensing device, and the like.
  • the terminal 200 described above may be a general purpose computer device or a dedicated computer device.
  • the terminal 200 can be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet, a wireless terminal device, a communication device, an embedded device, or the like in FIG. Structured equipment.
  • PDA personal digital assistant
  • the embodiment of the present application does not limit the type of the terminal 200.
  • a software program such as a browser is also installed in the terminal referred to in the embodiment of the present application, and the specific operation of the browser can be performed by the processor.
  • the user When performing webpage operations, the user generally enters a Uniform Resource Locator (URL) address in the browser to request a response from the server.
  • URL Uniform Resource Locator
  • the browser receives the response sent by the server, the page content represented by the HyperText Markup Language (HTML) included in the response is parsed and rendered and displayed to the user.
  • HTML HyperText Markup Language
  • the browser saves the content after acquiring the content.
  • the corresponding content is obtained from the database and displayed.
  • a certain area of the page is used to scroll a group of news
  • the group of news includes 5 news
  • the browser obtains the content of the group news from the server and saves it in the database, during the running of the webpage
  • the browser When running to the code that needs to update the content of the page, get the corresponding data from the database and update the display.
  • the embodiment of the present application provides a method for page refreshing, which is applied to the terminal shown in FIG. 2, and the method includes:
  • the area to be updated is an area that the content to be updated is to be updated in the page.
  • the browser will retrieve the page content and parse the entire page into a dom tree containing multiple different nodes, and construct a render tree corresponding to the dom tree, and in the render tree.
  • the node renders the page as a basic element.
  • Each node of the render tree has a coordinate in the render tree, and each node corresponds to the specific content of the page.
  • the node corresponding to the content that needs to be updated is referred to as a node to be updated, and the node to be updated may be one or more.
  • the area to be updated referred to in the present application is an area to be updated corresponding to the content to be updated corresponding to the node to be updated.
  • the content to be updated may be a media file such as a picture, audio data, or video data. For example, if there is an area in the page where the picture is played dynamically, the picture currently played in the area is picture 1, and when the picture 2 needs to be played, the picture 2 is the content to be updated.
  • the location of the area to be updated may be represented by coordinates of multiple vertices of the area to be updated in a preset coordinate system.
  • the area to be updated is a rectangular area
  • the coordinates of the vertices of the rectangular area may be used to represent the area.
  • the area to be updated is a circular area
  • it can be represented by the center of the circular area and the radius of the circular area.
  • the terminal may divide each page into multiple areas according to nodes in advance and store relationships between different areas.
  • node 1 corresponds to area 1
  • node 2 corresponds to area 2
  • node 3 corresponds to area 3
  • the target area is an area of the page that is currently visible on the display.
  • the terminal may not be able to display a complete web page, and only a part of the web page may be displayed, and the user may view the webpage content by pulling up, pulling down, and the like. Therefore, a part of the area on the webpage and the content displayed by the area are visible to the user, and another part of the area and the content corresponding to the area are invisible to the user.
  • the target area referred to in this embodiment is the part of the page area that is visible to the user.
  • the location of the target area may also be represented by coordinates of multiple vertices of the target area in a preset coordinate system.
  • the target area may be represented by the vertex coordinates of the rectangular area.
  • the target area can be represented by the center of the circular area and the radius of the circular area.
  • the location of the to-be-updated area and the location of the target area have a preset relationship, and specifically includes any one of the following situations.
  • the present application can reduce the waste of resources and energy in the page refreshing process by not drawing the content to be updated in the area to be updated.
  • the area to be updated and the target area have an overlapping area, but the first node exists in the rendering tree corresponding to the page, and the area corresponding to the first node completely occludes the area to be updated.
  • the first node when the first node has the following relationship with the node to be updated, it may be determined that the area corresponding to the first node completely obscures the area to be updated: the value of the z coordinate of the first node in the rendering tree is greater than the node to be updated. The value of the z coordinate in the rendering tree is located, and the area to be updated is completely located in the area corresponding to the first node.
  • the present application can reduce the waste of resources and energy during the page refresh process by not drawing the content to be updated in the area to be updated.
  • the area to be updated is completely outside the target area, and the distance between the area to be updated and the target area is outside the preset range.
  • the user may move the page slightly so that the area to be updated falls within the page display area.
  • Cause This increases the determination of the distance between the area to be updated and the viewable area currently displayed on the display by the page, in order to present a better page display when the area to be updated is closer to the viewable area currently displayed on the display.
  • the effect is that the content to be updated is still refreshed and rendered in the area to be updated; when the distance between the area to be updated and the target area exceeds a certain range, the distance between the area to be updated and the target area may be considered to be far away. In this case, Do not refresh and draw the content to be updated in the area to be updated.
  • the location of the area to be updated is completely outside the target area, and the time when the area to be updated is completely outside the target area exceeds a certain time range.
  • the location of the area to be updated is completely outside the target area, and the time when the area to be updated is completely outside the target area exceeds a certain time range, it can be considered that the user does not need to be in a long time.
  • the content of the area to be updated is browsed, so the content to be updated can be refreshed and drawn in the area to be updated.
  • the area to be updated partially overlaps or completely overlaps with the target area, and the overlapped area is not “occluded” by other areas, that is, the area to be updated is partially visible or all visible to the user.
  • step 304 After determining the location of the area to be updated and the location of the target area, it is determined whether there is a preset relationship between the location of the area to be updated and the location of the target area. If there is no preset relationship, it indicates that the area to be updated is visible to the user for the user. Then, step 304 is performed; if there is a preset relationship, it indicates that the area to be updated is invisible to the user, and step 305 is performed.
  • the content to be updated is stored in the buffer area, and the content to be updated is drawn and displayed in the area to be updated, thus completing the refresh of the area to be updated.
  • the node to be updated is not located in the target area, or the node to be updated is located in the target area but is occluded by other nodes, and is regarded as invisible to the user. In the case that the user is not visible, there is no need to refresh the area to be updated.
  • the content to be updated is not drawn in the area to be updated.
  • the drawing operation consumes more resources and energy during the page display process, so the resource and energy consumption can be reduced without performing the drawing operation.
  • the refresh process actually includes caching the content to be updated to the cache, drawing, displaying, and the like. Not drawing processing means that no drawing processing and subsequent operations are performed. As for the process of "cache the content to be updated to the cache area" before the drawing operation, the process can be performed normally.
  • the page refreshing method Compared with the local refresh mechanism in the prior art, the page refreshing method provided by the embodiment of the present application increases the position of the area to be updated and the current area of the page that is visible on the display when a partial refresh is required. Whether there is a judgment process of the preset relationship, when the location of the area to be updated and the page When there is a preset relationship in the position of the area previously visible on the display, the content to be updated is not drawn in the area to be updated. Since the drawing process consumes a lot of resources and energy and does not perform the drawing process, it can reduce the waste of resources and energy. Therefore, the present application can reduce the unnecessary refresh process on the basis of the partial refresh of the prior art, thereby further reducing the waste of resources and energy in the page refresh process.
  • the embodiment of the present application further provides a method for refreshing a page, which specifically includes:
  • step 301 For the specific implementation process of this step, refer to step 301, and details are not described herein again.
  • step 302 For the specific implementation process of this step, refer to step 302, and details are not described herein again.
  • step 303 For the specific implementation process of this step, refer to step 303, and details are not described herein again.
  • step 404 is performed, and if there is a preset relationship, step 405 is performed.
  • step 304 For the specific implementation process of this step, refer to step 304, and details are not described herein again.
  • the category of the content to be updated includes a first category and a second category.
  • the first category is when the preset relationship between the area to be updated and the target area exists, if the content to be updated is not refreshed to the buffer area, when the preset relationship is not existed between the area to be updated and the target area
  • the content to be updated still can be displayed normally, that is, the content that does not need to be updated if the user is not visible.
  • the content to be updated is a set of unrelated pictures, or a moving image that is repeatedly played, etc., when the preset relationship between the area to be updated corresponding to the content and the target area exists, the updated content does not continue.
  • the update is done so there is no need to continuously refresh the content to the cache.
  • the content to be updated is refreshed to the area to be updated, and the updated content is displayed normally.
  • the second category is that when the preset relationship is to be updated between the area to be updated and the target area, if the content to be updated is not refreshed to the cache area, the content to be updated is not updated when the preset relationship is not existed between the area to be updated and the target area.
  • Content that cannot be displayed properly that is, content that still needs to be updated if the user is not visible.
  • the content to be updated includes a counter, and an element in the updated content needs to be counted, that is, the content to be updated is content that needs to be continuously updated. If the update content is not continuously refreshed to the cache area, the count statistics will appear. error.
  • step 406 is performed to minimize resource and energy waste.
  • the content of the first category includes content such as a picture or a video that needs to be dynamically updated in the webpage, and each update of the content does not affect each other.
  • the area to be updated is located in the visible area of the user.
  • this update can be ignored, neither need to cache nor draw the content to be updated.
  • the area to be updated is located in the user's viewable area, and the content that needs to be updated can be re-acquired for caching and drawing.
  • the location of the to-be-updated area has a preset relationship with the target area, and the content to be updated belongs to the second category, perform steps to ensure normal use of the user on the basis of minimizing waste of resources and energy. 407.
  • some pages are displayed by refreshing all the acquired data into the buffer area and changing the content displayed in the area by changing the coordinates of the data to be displayed.
  • the content of the second category referred to in the embodiment of the present application includes such content. For example, if an area is used to display 1 set of pictures and a total of 8 pictures, in the process of displaying or rendering the page, the data corresponding to the 8 sets of pictures are all refreshed to the buffer area, and the picture to be displayed is changed when drawing.
  • the corresponding node coordinates can display the corresponding picture.
  • changing the coordinates of the nodes corresponding to the pictures to be displayed is often performed according to certain rules, for example, refreshing to the next set of pictures every preset time.
  • the update content needs to be re-acquired every time the display is performed, and the picture is displayed again from the first group, so that the latter picture is difficult to be displayed. Therefore, the updated content needs to be cached in the cache, and refreshed according to the coordinates of the image that needs to be displayed according to the preset rule, so that when the content to be updated is redrawn, the one that should be displayed is displayed according to the original preset rule. Group picture. Therefore, in this application scenario, even if the area to be updated is not in the visible area of the user, the content to be updated needs to be refreshed to the buffer area, otherwise the page content cannot be displayed normally.
  • the content to be updated is not cached in the buffer area, and the content to be updated is not drawn in the area to be updated.
  • the step of refreshing the content to be updated to the buffer area is not operated, and the process of drawing and the like is naturally terminated.
  • the category determination of the content to be updated is also added, and when the location of the area to be updated has a preset relationship with the target area,
  • the process of refreshing the content to be updated to the buffer area is not processed, and the drawing process is naturally terminated, thereby further reducing the page. Waste of resources and energy during the refresh process.
  • the content to be updated corresponding to the node to be updated belongs to the second category, the content to be updated is still refreshed into the buffer area, and only the drawing process of the content to be updated and the subsequent steps are stopped, so that waste of resources and energy can be minimized. On the basis of this, the normal display of the content to be updated is guaranteed at the same time.
  • the steps in the embodiment of the present application are performed after the step 103 shown in FIG. 1, before the step 104, that is, the application is executed during the entire page refresh process.
  • the content to be updated is cached to the area to be updated and before the content to be updated is drawn.
  • the drawing operation in the area to be updated in the embodiment of the present application refers to the step 105 in the process of not performing the page refreshing process; the cached content to be updated in the cache area according to the embodiment of the present application means that the page refresh is not performed. Step 104 in the process.
  • the embodiment of the present application further provides a page refreshing method, which is applied to FIG.
  • the method includes:
  • the area to be updated is an area to be updated in the page to be updated, and the content to be updated is content corresponding to at least one node to be updated in the rendering tree corresponding to the page.
  • the target area is an area in the page that is currently visible on the display.
  • step 501 and step 502 For the specific implementation process of step 501 and step 502, reference may be made to step 301 and step 302.
  • step 504 When there is a preset relationship between the location of the to-be-updated area and the location of the target area, the following step 504 is performed. When there is no preset relationship between the location of the to-be-updated area and the location of the target area, the following step 505 is performed. .
  • the preset relationship between the location of the area to be updated and the location of the target area includes the following cases:
  • the area to be updated partially overlaps or completely overlaps with the target area, and the overlapped area is not "occluded" by other areas, that is, the area to be updated is partially visible or all visible to the user.
  • A3 There is no overlap between the area to be updated and the target area, but the duration is within a certain period of time, that is, the duration is short. In these cases, in order to ensure a good page display effect, it is necessary to refresh and draw the content to be updated in the area to be updated.
  • the present application can reduce the waste of resources and energy in the page refreshing process by not drawing the content to be updated in the area to be updated.
  • the area to be updated has an overlapping area with the target area, but the first node exists in the rendering tree corresponding to the page, and the area corresponding to the first node completely occludes the area to be updated.
  • the first node when the first node has the following relationship with the node to be updated, it may be determined that the area corresponding to the first node completely obscures the area to be updated: the value of the z coordinate of the first node in the rendering tree is greater than the node to be updated. The value of the z coordinate in the rendering tree is located, and the area to be updated is completely located in the area corresponding to the first node.
  • the present application can reduce the waste of resources and energy during the page refresh process by not drawing the content to be updated in the area to be updated.
  • the area to be updated is completely outside the target area, and the distance between the area to be updated and the target area is outside the preset range.
  • the area to be updated when the area to be updated is not in the area where the page is currently visible on the display, there is In some cases, the user may move the page slightly so that the area to be updated falls within the page display area. Therefore, the determination of the distance between the area to be updated and the area currently visible on the display is increased.
  • the area to be updated is close to the area currently visible on the display, in order to present a better page display effect, It is still necessary to refresh and render the content to be updated in the area to be updated; when the distance between the area to be updated and the target area exceeds a certain range, the distance between the area to be updated and the target area may be considered to be far away. Refresh and draw the content to be updated in the update area.
  • the location of the area to be updated is completely outside the target area, and the time when the area to be updated is completely outside the target area exceeds a certain time range.
  • the location of the area to be updated is completely outside the target area, and the time when the area to be updated is completely outside the target area exceeds a certain time range, it can be considered that the user does not need to be in a long time.
  • the content of the area to be updated is browsed, so the content to be updated can be refreshed and drawn in the area to be updated.
  • the content to be updated is not drawn in the area to be updated.
  • the page refreshing method increases the position of the area to be updated and the current area of the page that is visible on the display when a partial refresh is required. Whether there is a determination process of the preset relationship, when there is a preset relationship between the position of the area to be updated and the position of the area currently visible on the display of the page, the content to be updated is refreshed to the area to be updated, and the part of the page is realized. Refresh. If the preset relationship is not satisfied, the page does not need to be locally refreshed. Compared with the local refresh mechanism in the prior art, the application can reduce unnecessary refreshing process, thereby further reducing resources and energy during page refreshing. Waste.
  • the present application further provides a device for refreshing a page, where the device is used as a terminal, and specifically includes:
  • the obtaining module 601 is configured to obtain a location of the area to be updated.
  • the area to be updated is an area to be updated in the page to be updated, and the content to be updated is content corresponding to at least one node to be updated in the rendering tree corresponding to the page.
  • the display module 602 is configured to determine an area currently displayed in the page, and display the page content in the currently displayed area on a display.
  • the processing module 603 is configured to determine a location of the target area, where the target area is an area displayed by the display module 602 on the display; and the location and location of the to-be-updated area acquired by the obtaining module 601 When there is a preset relationship in the location of the target area, the content to be updated is not drawn in the area to be updated during the page refresh process.
  • the terminal is presented in the form of a functional module.
  • a “module” herein may refer to an application-specific integrated circuit (ASIC), circuitry, a processor and memory that executes one or more software or firmware programs, integrated logic circuitry, and/or other functions that provide the functionality described above. Device.
  • ASIC application-specific integrated circuit
  • the terminal can take the form shown in FIG.
  • the obtaining module 601 and the processing module 603 can be implemented by the processor 201 and the memory 203 of FIG. 2, and the display module 602 can be implemented by the display 204 of FIG.
  • the preset relationship between the area to be updated and the location of the target area includes: There is no overlapping area between the area to be updated and the target area.
  • the location of the to-be-updated area and the location of the target area have a preset relationship
  • the method includes: the area to be updated and the target area have an overlapping area, and the first in the rendering tree corresponding to the page exists. a node; the area corresponding to the first node completely occludes the area to be updated corresponding to the node to be updated.
  • the processing module 603 is further configured to: when the location of the to-be-updated area and the location of the target area have the preset relationship, determine a category of the content to be updated; when the to-be-updated When the content belongs to the first category, the content to be updated is not cached in the cache area; the first category is when the preset relationship between the area to be updated and the target area exists, if the to-be-updated is not to be updated When the content is refreshed to the buffer area, when the to-be-updated area and the target area do not have the preset relationship, the content to be updated can still be displayed normally; when the content to be updated belongs to the second When the category is not refreshed to the cache area; the second category is when the preset relationship between the area to be updated and the target area exists, if the content to be updated is not refreshed to the location When the cache area is described, when the preset relationship is not existed between the to-be-updated area and the target area, the content to be updated cannot be normally displayed.
  • the device for refreshing the page provided by the embodiment of the present application increases the position of the area to be updated and the current position of the page on the display when the partial refresh is required. Whether there is a determination process of the preset relationship, when there is a preset relationship between the position of the area to be updated and the position of the area currently visible on the display of the page, the content to be updated is not drawn in the area to be updated. Since the drawing process consumes a lot of resources and energy and does not perform the drawing process, it can reduce the waste of resources and energy. Therefore, the present application can reduce the unnecessary refresh process on the basis of the partial refresh of the prior art, thereby further reducing the waste of resources and energy in the page refresh process.
  • the present application further provides a device for refreshing a page, where the device is used as a terminal, and specifically includes:
  • the obtaining module 701 is configured to obtain a location of the area to be updated.
  • the area to be updated is an area to be updated in the page to be updated, and the content to be updated is content corresponding to at least one node to be updated in the rendering tree corresponding to the page.
  • the display module 702 is configured to determine an area currently displayed in the page, and display the page content in the currently displayed area on a display.
  • the processing module 703 is configured to determine a location of the target area, where the target area is a visible area displayed by the display module 702 on the display in the page; and the location of the to-be-updated area acquired by the obtaining module 701 When there is a preset relationship with the location of the target area, the content to be updated is refreshed to the area to be updated.
  • the terminal is presented in the form of a functional module.
  • a “module” herein may refer to an application-specific integrated circuit (ASIC), circuitry, a processor and memory that executes one or more software or firmware programs, integrated logic circuitry, and/or other functions that provide the functionality described above. Device.
  • ASIC application-specific integrated circuit
  • the terminal can take the form shown in FIG.
  • the obtaining module 701 and the processing module 703 can be implemented by the processor 201 and the memory 203 of FIG. 2, and the display module 702 can be implemented by the display 204 of FIG.
  • the preset relationship between the area to be updated and the location of the target area includes: There is no overlapping area between the area to be updated and the target area.
  • the location of the to-be-updated area and the location of the target area have a preset relationship
  • the method includes: the area to be updated and the target area have an overlapping area, and the corresponding rendering tree does not exist in the rendering tree. a node; the area corresponding to the first node completely occludes the area to be updated.
  • the device for refreshing the page provided by the embodiment of the present application increases the position of the area to be updated and the current position of the page on the display when the partial refresh is required. Whether there is a determination process of the preset relationship, when there is a preset relationship between the position of the area to be updated and the position of the area currently visible on the display of the page, the content to be updated is refreshed to the area to be updated, and the part of the page is realized. Refresh. If the preset relationship is not satisfied, the page does not need to be locally refreshed. Compared with the local refresh mechanism in the prior art, the application can reduce unnecessary refreshing process, thereby further reducing resources and energy during page refreshing. Waste.
  • the present application can be implemented by means of software plus necessary general hardware, and of course, by hardware, but in many cases, the former is a better implementation. .
  • the technical solution of the present application which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a readable storage medium, such as a floppy disk of a computer.
  • a hard disk or optical disk, etc. includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods described in various embodiments of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Controls And Circuits For Display Device (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

一种页面刷新的方法及装置,涉及计算机技术领域,可进一步减少页面刷新过程中的资源和能量浪费的问题。其中,该方法包括:当需要更新页面内容时,获取待更新区域的位置,该待更新区域为待更新内容在页面中所要更新的区域,所述待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容;确定目标区域的位置,该目标区域为页面的当前在显示器上可视的区域;当待更新区域的位置与目标区域的位置存在预设关系时,不在待更新区域中绘制所述待更新内容。该方法和装置应用在页面局部更新的过程中。

Description

页面刷新的方法及装置
本申请要求于2016年10月31日提交中国专利局、申请号为201610932504.6、发明名称为“页面刷新的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种页面刷新的方法及装置。
背景技术
随着JavaScript、级联样式表3(Cascading Style Sheet 3,CSS3)等技术在页面展示中的应用,页面展示的内容越来越丰富多样和便于交互。例如:现在很多页面中都会有用于展示动画或者定时更新视频的区域。
如图1所示,显示一个页面或者渲染一个页面的过程一般包括:101:引擎解析已接收的HTML(HyperText Markup Language,超文本标记语言)或XML(Extensible Markup Language,可扩展标记语言)文档并构造文档对象模型(Document Object Model,DOM)树。102:根据DOM树中的节点信息,加入样式信息等构造与DOM树对应的Render树(中文:渲染树)。其中,Render树中的节点与DOM树的节点存在对应关系,且不同节点在Render树中的坐标不同,不同的节点分别对应不同的页面区域、页面内容。103:根据Render树中节点的位置等属性信息布局页面。104:将布局好的页面内容合成并刷新到缓存区。105:将缓存区中的内容绘制并显示出来。在显示页面后,可根据更新需求对页面的部分区域或整个区域的内容进行更新。
目前,主流的webkit、chromium等浏览器的内核,能够实现页面的局部刷新,即将需要经常更新的区域与其它显示后不需要更新的区域进行区分,对需要经常更新的区域独立刷新。
现有技术中的这种局部刷新机制,虽然可以在一定程度上有效的减少不必要的刷新,减少刷新过程中资源和能量的浪费,但其对资源和能量的减少仍然是有限的。
发明内容
本申请提供一种页面刷新的方法及装置,能够实现在现有技术提供的局部刷新的基础上进一步减少资源和能量的浪费。
为达到上述目的,本申请采用如下技术方案:
第一方面,本申请提供一种页面刷新的方法,包括:获取待更新区域的位置;确定目标区域的位置,该目标区域为所述页面中当前在显示器上可视的区域;当待更新区域的位置与目标区域的位置存在预设关系时,在页面刷新的过程中,不在所述待更新区域中绘制所述待更新内容。
其中,所述待更新区域为待更新内容在页面中所要更新的区域,待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容。实际应用中,页面刷新时通常以Render树的节点为渲染基础,每个节点对应着页面的特定内容,在对页面局部刷新时,也即对页面的部分区域更新页面内容时,存在有些节点的内容 需要更新,有些节点的内容不需要更新。因此,本申请中,将需要更新的内容对应的节点称为待更新节点。相应的,本申请中所指的待更新区域为与待更新节点对应的待更新内容所要更新的区域。
待更新区域和目标区域的位置可以以区域的多个顶点的坐标的形式表示。例如:当待更新区域和/或目标区域为矩形区域时,该区域的位置可以以矩形的四个顶点的坐标来表示;当待更新区域和/或目标区域为圆形区域时,该区域的位置可以以圆形的圆心以及半径来表示。
可见,本申请提供的页面刷新的方法,在需要进行局部刷新时,增加了对待更新区域的位置与页面的当前在显示器上可视的区域的位置是否存在预设关系的判断过程,当待更新区域的位置与页面的当前在显示器上可视的区域的位置存在预设关系时,不在待更新区域中绘制待更新内容。由于绘制过程会消耗大量的资源和能量,不进行绘制过程,则能够减少页面渲染过程中的资源和能量的浪费。
作为一种可选实施例,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:待更新区域与目标区域不存在重叠区域。
在该实施例中,当待更新区域与目标区域不存在重叠区域时,表明待更新区域位于页面当前在显示器上可视的区域之外,对用户而言为不可见的区域。因此,这种情况下,本申请通过不在待更新区域中绘制待更新内容,能够减少页面刷新过程中的资源和能量的浪费。
作为另一种可选实施例,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:待更新区域与目标区域存在重叠区域,但页面对应的渲染树中存在第一节点;该第一节点对应的区域完全遮挡所述待更新区域。其中,当该第一节点与待更新节点存在如下关系时,可确定第一节点对应的区域完全遮挡待更新区域:第一节点对应的区域包含待更新节点对应的区域,且该第一节点在渲染树中的z坐标的取值大于待更新节点在所述渲染树中的z坐标的取值。
在该实施例中,虽然待更新区域与目标区域存在重叠区域,但还存在完全“遮挡”待更新区域的其他区域,因此,待更新区域对用户而言仍然是不可见的,这种情况下,本申请通过不在待更新区域中绘制待更新内容,能够减少页面刷新过程中的资源和能量的浪费。
作为又一种可选实施例,所述待更新区域与所述目标区域的位置存在预设关系还可以为:待更新区域完全位于目标区域之外,且待更新区域与目标区域之间的距离在预设范围外。
在该实施例中,当待更新区域不在页面当前在显示器上可视的区域内时,有些情况下,用户可能稍微移动页面便使得待更新区域落入页面显示区域内。因此增加了对待更新区域与页面当前在显示器上可视的区域的距离的判断,当待更新区域与页面当前在显示器上可视的区域的距离较近时,为了呈现较好的页面显示效果,仍然需要在待更新区域中刷新并渲染待更新内容;当待更新区域与目标区域的距离超过了一定范围时,可认为待更新区域与目标区域的距离较远,这种情况下,可以不在待更新区域中刷新并绘制待更新内容。
作为再一种可选实施例,所述待更新区域与所述目标区域的位置存在预设关 系还可以为:待更新区域的位置完全位于目标区域之外,且待更新区域完全位于目标区域之外的时间超过了一定时间范围。
在该实施例中,当待更新区域的位置完全位于目标区域之外,且待更新区域完全位于目标区域之外的时间超过了一定时间范围时,可以认为用户在较长的时间内都不需要浏览待更新区域的内容,因此,可以不在待更新区域中刷新并绘制待更新内容。
作为一种实施例,当所述待更新区域的位置与所述目标区域的位置存在所述预设关系时,所述方法还包括:确定所述待更新内容的类别。相应的,当待更新内容属于第一类别时,在不在所述待更新区域中绘制所述待更新内容之前,不在缓存区域中缓存所述待更新内容;当待更新内容属于第二类别时,在不在待更新区域中绘制所述待更新内容之前,所述方法还包括:将所述待更新内容刷新到缓存区域。
其中,所述第一类别为当待更新区域与目标区域存在所述预设关系时,如果不将待更新内容刷新到所述缓存区,则当待更新区域与目标区域不存在所述预设关系时,所述待更新内容仍然能够正常显示的内容,也即是指在用户不可见的情况下不需要更新的内容。第二类别为当待更新区域与目标区域存在所述预设关系时,如果不将待更新内容刷新到缓存区域,则当待更新区域与目标区域不存在所述预设关系时,待更新内容无法正常显示的内容,也即是指在用户不可见的情况下仍然需要更新的内容。
在该实施例中,在对待更新区域的位置与目标区域是否存在预设关系进行判断的基础上,还增加了对待更新内容的类别判断,当待更新区域的位置与目标区域存在预设关系,且待更新节点对应的待更新内容属于第一类别时,在进行页面刷新的过程中,从将待更新内容刷新到缓存区这个过程就开始不处理,绘制过程自然也会终止,能够进一步减少页面刷新过程中的资源和能量浪费。当待更新节点对应的待更新内容属于第二类别时,则仍然将待更新内容刷新到缓存区中,仅停止对待更新内容的绘制处理以及后续步骤,这样能够在尽量减少资源和能量的浪费的基础上,同时保证待更新内容的正常显示。
第二方面,本申请实施例还提供一种页面刷新的方法,包括:获取待更新区域的位置;确定目标区域的位置,所述目标区域为页面中当前在显示器上可视的区域;当待更新区域的位置与目标区域的位置存在预设关系时,将待更新内容刷新至待更新区域。
其中,如上文所述,待更新区域为待更新内容在页面中所要更新的区域,待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容。
作为一种实施例,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:所述待更新区域与所述目标区域存在重叠区域,且所述页面对应的渲染树中不存在第一节点;所述第一节点对应的区域完全遮挡所述待更新区域。也即,待更新区域与目标区域存在部分重叠或完全重叠,且重叠的区域不被其他区域“遮挡”,这种情况下,待更新区域对用户而言为部分可见或全部可见。
在一些情况下,该待更新区域与目标区域的位置存在预设关系存在预设关系 还可以为:待更新区域与目标区域不存在重叠,但待更新区域与目标区域之间的距离在预设范围内。又或者,待更新区域与目标区域不存在重叠,但持续时间在一定时间段内,也即持续时间较短。在这些情况下,为了保证良好的页面显示效果,需要在待更新区域中刷新并绘制待更新内容。
第三方面,本申请还提供一种终端,用于执行上述第一方面所述的方法中的各个步骤,该终端的功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个上述功能相应的模块。
在一种可能的实施例中,该终端的结构中包括处理器、存储器、显示器和总线,该处理器被配置为支持该终端执行上述方法中相应的功能。该存储器用于与处理器耦合,其保存该终端必要的程序指令和数据。该显示器用于显示页面中当前显示的区域。可选的,该终端还包括通信接口,该通信接口用于支持该终端与其他设备之间的通信。
在另一种可能的实施例中,该终端包括:获取模块,用于获取待更新区域的位置,其中,待更新区域为待更新内容在页面中所要更新的区域,待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容;显示模块,用于确定所述页面中当前显示的区域,并将在所述当前显示的区域中的页面内容在显示器上显示;处理模块,用于确定目标区域的位置,该目标区域为页面中所述显示模块在所述显示器上显示的区域;当获取模块获取的所述待更新区域的位置与所述目标区域的位置存在预设关系时,在页面更新的过程中,不在所述待更新区域中绘制所述待更新内容。
第四方面,本申请提供了一种终端,用于执行上述第二方面所述的方法中的各个步骤,该终端的功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个上述功能相应的模块。
在一种可能的实施例中,该终端的结构中包括处理器、存储器、显示器和总线,该处理器被配置为支持该终端执行上述方法中相应的功能。该存储器用于与处理器耦合,其保存该终端必要的程序指令和数据。可选的,该终端还包括通信接口,该通信接口用于支持该终端与其他设备之间的通信。
在另一种可能的实施例中,该终端包括:获取模块,用于获取待更新区域的位置,其中,待更新区域为待更新内容在页面中所要更新的区域,待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容;显示模块,用于确定所述页面中当前显示的区域,并将在所述当前显示的区域中的页面内容在显示器上显示;处理模块,用于确定目标区域的位置,所述目标区域为页面中所述显示模块在所述显示器上显示的区域;当所述获取模块获取的所述待更新区域的位置与所述目标区域的位置存在预设关系时,将所述待更新内容刷新至所述待更新区域。
第五方面,本申请提供了一种计算机存储介质,用于储存为上述第三方面所述的终端所用的计算机软件指令,其包含用于执行上述方面所设计的程序。
第六方面,本申请提供了一种计算机存储介质,用于存储为上述第四方面所述的终端所用的计算机软件指令,其包含用于执行上述方面所设计的程序。与现有技术中的局部刷新机制相比,本申请提供的页面刷新的方法及装置,在需 要进行局部刷新时,增加了对待更新区域的位置与页面的当前在显示器上可视的区域的位置是否存在预设关系的判断过程,当待更新区域的位置与页面的当前在显示器上可视的区域的位置存在预设关系时,在进行页面刷新的过程中,不在待更新区域中绘制待更新内容。由于绘制过程会消耗大量的资源和能量,不进行绘制过程,则能够减少资源和能量的浪费。因此,本申请能够在现有技术的局部刷新的基础上减少不必要的刷新过程,进而能够进一步减少页面刷新过程中的资源和能量的浪费。
附图说明
图1为现有技术中页面显示的流程示意图;
图2为本申请实施例提供的一种终端的结构示意图;
图3为本申请实施例提供的一种页面刷新的方法的流程示意图;
图4为本申请实施例提供的另一种页面刷新的方法的流程示意图;
图5为本申请实施例提供的再一种页面刷新的方法的流程示意图;
图6为本申请实施例提供的一种页面刷新的装置的结构示意图;
图7为本申请实施例提供的另一种页面刷新的装置的结构示意图。
具体实施方式
本申请实施例提供的页面刷新的方法可应用于终端。如图2所示为本申请实施例提供的终端的结构示意图。终端包括至少一个处理器201、通信总线202、存储器203和显示器204。
处理器201可以是一个通用中央处理器(CPU),微处理器,特定应用集成电路(application-specific integrated circuit,ASIC),或一个或多个集成电路等。
通信总线202可包括一通路,在上述组件之间传送信息。
存储器203可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过总线与处理器相连接。存储器也可以和处理器集成在一起。
显示器204可以是液晶显示器(liquid crystal display,LCD),发光二级管(light emitting diode,LED)显示设备,阴极射线管(cathode ray tube,CRT)显示设备。
在具体实现中,作为一种实施例,处理器201可以包括一个或多个CPU,例如图2中的CPU0和CPU1。
在具体实现中,作为一种实施例,终端200可以包括多个处理器,例如图2中的处理器201和处理器208。这些处理器中的每一个可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。
在具体实现中,作为一种实施例,终端200还包括至少一个通信接口205,其中,所述通信接口205,适用任何收发器一类的装置,用于与其他设备或通信网络通信,如以太网,无线接入网(Radio Access Network,RAN),无线局域网(Wireless Local Area Networks,WLAN)等。
在具体实现中,作为一种实施例,终端200还可以包括其他输出设备206和输入设备207。输出设备206和处理器201通信,可以以多种方式来显示信息。例如,该输出设备可以为投影仪(projector)等。输入设备207和处理器201通信,可以以多种方式接受用户的输入。例如,输入设备207可以是鼠标、键盘、触摸屏设备或传感设备等。
上述的终端200可以是一个通用计算机设备或者是一个专用计算机设备。在具体实现中,终端200可以是台式机、便携式电脑、网络服务器、掌上电脑(Personal Digital Assistant,PDA)、移动手机、平板电脑、无线终端设备、通信设备、嵌入式设备或有图2中类似结构的设备。本申请实施例不限定终端200的类型。
本申请实施例所指的终端中还安装有浏览器等软件程序,浏览器的具体操作可由处理器执行。在进行网页操作时,用户一般会在浏览器中输入统一资源定位符(Uniform Resource Locator,URL)地址以请求服务器的响应。当浏览器接收到服务器发送的响应时,解析该响应中包含的以超文本标记语言(HyperText Markup Language,HTML)表示的页面内容并进行渲染后显示给用户。其中,如果响应内容中包括需要定时更新的数据,如滚动播放的新闻、广告、动画、视频等,并需要在页面的特定区域中定时更新显示,则浏览器在获取这些内容后将这些内容保存在数据库中,并在需要进行页面更新时,从数据库中获取相应的内容并显示。示例性的,页面的某一特定区域用于滚动播放一组新闻,该组新闻包括5则新闻,则浏览器从服务器获取该组新闻的内容并保存在数据库中后,在网页运行过程中,运行到需要更新页面内容的代码时,从数据库中获取相应的数据并更新显示。
如图3所示,结合上述应用场景,本申请实施例提供一种页面刷新的方法,应用于如图2所示的终端中,该方法包括:
301:获取待更新区域的位置。
其中,所述待更新区域为所述待更新内容在所述页面中所要更新的区域。如前文所述,在初次加载页面的过程中,浏览器会获取页面内容并把整个页面解析为包含多个不同节点的dom树,并构建与dom树对应的render树,并以render树中的节点为基本元素对页面进行渲染。其中render树的每个节点在render树中有一个坐标,每个节点对应页面的特定内容。在对页面局部刷新时,也即对页面的部分区域更新页面内容时,存在有些节点的内容需要更新,有些节点的内容不需要更新。因此,本申请中,将需要更新的内容对应的节点称为待更新节点,待更新节点可以为一个或多个。相应的,本申请中所指的待更新区域为与待更新节点对应的待更新内容所要更新的区域。
其中,待更新内容可以为图片、音频数据或视频数据等媒体文件。例如:页面中存在动态播放图片的区域,该区域当前播放的图片为图片1,则当需要播放图片2时,该图片2则为待更新内容。
可选的,待更新区域的位置可通过待更新区域的多个顶点在预设坐标系中的坐标表示,例如:当待更新区域为矩形区域时,可以通过该矩形区域的顶点坐标来表示该待更新区域。当待更新区域为圆形区域时,可以通过该圆形区域的圆心和该圆形区域的半径表示。
可选的,终端可以预先将每个页面按照节点划分为多个区域并存储不同区域之间的关系。例如,节点1对应区域1,节点2对应区域2,节点3对应区域3,区域1与区域2之间存在重叠区域,区域1与区域2之间不存在重叠区域。
302:确定目标区域的位置。
其中,所述目标区域为页面的当前在显示器上可视的区域。
实际应用中,终端可能无法显示一个完整的网页,仅能显示部分网页,用户可通过上拉、下拉等操作查看网页内容。因此,网页上一部分区域以及该区域显示的内容对用户而言为可见的,另一部分区域以及该区域对应的内容对用户而言为不可见的。本实施例中所指的目标区域则为对用户而言可见的那部分页面区域。
可选的,目标区域的位置也可以通过目标区域的多个顶点在预设坐标系中的坐标表示,例如:当目标区域为矩形区域时,可以通过该矩形区域的顶点坐标来表示该目标区域。当目标区域为圆形区域时,可以通过该圆形区域的圆心和该圆形区域的半径表示该目标区域。
303:判断待更新区域的位置与目标区域的位置是否存在预设关系。
可选的,所述待更新区域与所述目标区域的位置存在预设关系,具体包括以下任意一种情况。
A1、待更新区域与目标区域不存在重叠区域。
在该实施例中,当待更新区域与目标区域不存在重叠区域时,表明待更新区域位于页面当前在显示器上可视的区域之外,对用户而言为不可见的区域。因此,这种情况下,本申请通过不在待更新区域中绘制待更新内容,能够减少页面刷新过程中的资源和能量的浪费。
A2、待更新区域与目标区域存在重叠区域,但页面对应的渲染树中存在第一节点,且该第一节点对应的区域完全遮挡所述待更新区域。
具体的,当该第一节点与待更新节点存在如下关系时,可确定第一节点对应的区域完全遮挡待更新区域:该第一节点在渲染树中的z坐标的取值大于待更新节点在所述渲染树中的z坐标的取值,且待更新区域完全位于第一节点对应的区域内。
在该实施例中,虽然待更新区域与目标区域存在重叠区域,但还存在完全“遮挡”待更新区域的其他区域,因此,待更新区域对用户而言仍然是不可见的,这种情况下,本申请通过不在待更新区域中绘制待更新内容,能够减少页面刷新过程中的资源和能量的浪费。
A3、待更新区域完全位于目标区域之外,且待更新区域与目标区域之间的距离在预设范围外。
在该实施例中,当待更新区域不在页面当前在显示器上显示的可视区域内时,有些情况下,用户可能稍微移动页面便使得待更新区域落入页面显示区域内。因 此增加了对待更新区域与页面当前在显示器上显示的可视区域的距离的判断,当待更新区域与页面当前在显示器上显示的可视区域的距离较近时,为了呈现较好的页面显示效果,仍然需要在待更新区域中刷新并渲染待更新内容;当待更新区域与目标区域的距离超过了一定范围时,可认为待更新区域与目标区域的距离较远,这种情况下,可以不在待更新区域中刷新并绘制待更新内容。
A4、待更新区域的位置完全位于目标区域之外,且待更新区域完全位于目标区域之外的时间超过了一定时间范围。
在该实施例中,当待更新区域的位置完全位于目标区域之外,且待更新区域完全位于目标区域之外的时间超过了一定时间范围时,可以认为用户在较长的时间内都不需要浏览待更新区域的内容,因此,可以不在待更新区域中刷新并绘制待更新内容。
相应的,待更新区域的位置与目标区域的位置不存在预设关系,具体包括以下情况:
B1、待更新区域与目标区域存在部分重叠或完全重叠,且重叠的区域不被其他区域“遮挡”,也即待更新区域对用户而言为部分可见或全部可见。
B2、待更新区域与目标区域不存在重叠,但待更新区域与目标区域之间的距离在预设范围内。
B3、待更新区域与目标区域不存在重叠,但持续时间在一定时间段内,也即持续时间较短。在这些情况下,为了保证良好的页面显示效果,需要在待更新区域中刷新并绘制待更新内容。
在确定待更新区域和目标区域的位置后,判断待更新区域的位置与目标区域的位置是否存在预设关系,如果不存在预设关系,则表明待更新区域对用户而言为用户可见的,则执行步骤304;如果存在预设关系,则表明待更新区域对用户而言为用户不可见的,则执行步骤305。
304:将所述待更新内容刷新至所述待更新区域。
如果存在预设关系,则将待更新内容存储到缓存区,并在待更新区域中将待更新内容绘制并显示出来,这样便完成了对待更新区域的刷新。
反之,待更新节点未位于目标区域内,或者待更新节点虽然位于目标区域内,但被其他节点遮挡,则对用户而言都视为用户不可见的。在用户不可见的情况下,无需刷新所述待更新区域。
305:不在待更新区域中绘制待更新内容。
其中,绘制操作在页面显示过程中会消耗较多的资源和能量,因此不进行绘制操作能够减少资源和能量的消耗。刷新过程实际上包括将待更新内容缓存到缓存区、绘制、显示等操作。不进行绘制处理也即意味着不绘制处理及后续操作。至于位于绘制操作之前的“将待更新内容缓存到缓存区”这个过程可以不,也可以正常进行。
与现有技术中的局部刷新机制相比,本申请实施例提供的页面刷新的方法,在需要进行局部刷新时,增加了对待更新区域的位置与页面的当前在显示器上可视的区域的位置是否存在预设关系的判断过程,当待更新区域的位置与页面的当 前在显示器上可视的区域的位置存在预设关系时,不在待更新区域中绘制待更新内容。由于绘制过程会消耗大量的资源和能量,不进行绘制过程,则能够减少资源和能量的浪费。因此,本申请能够在现有技术的局部刷新的基础上减少不必要的刷新过程,进而能够进一步减少页面刷新过程中的资源和能量的浪费。
为了尽可能的减少页面刷新过程中的资源和能量浪费,减少不必要的刷新过程,同时又便于某些内容的正常显示,避免对用户使用造成影响,在不刷新待更新区域内容的实际处理过程中,需要对内容的类别进行区分,因此,如图4所示,本申请实施例还提供了一种页面刷新的方法,具体包括:
401:获取待更新区域的位置。
该步骤的具体实现过程可参考步骤301,此处不再赘述。
402:确定目标区域的位置。
该步骤的具体实现过程可参考步骤302,此处不再赘述。
403:判断待更新区域的位置与目标区域的位置是否存在预设关系。
该步骤的具体实现过程可参考步骤303,此处不再赘述。
如果不存在预设关系,则执行步骤404,如果存在预设关系,则执行步骤405。
404:将待更新内容刷新至所述待更新区域。
该步骤的具体实现过程可参考步骤304,此处不再赘述。
405:确定待更新内容的类别。
其中,待更新内容的类别包括第一类别和第二类别。
其中,第一类别为当待更新区域与目标区域存在所述预设关系时,如果不将待更新内容刷新到所述缓存区,则当待更新区域与目标区域不存在所述预设关系时,所述待更新内容仍然能够正常显示的内容,也即是指在用户不可见的情况下不需要更新的内容。例如,待更新内容为一组互不关联的图片,或者重复播放的动态图像等,当这些内容对应的待更新区域与所述目标区域存在所述预设关系时,由于更新内容并不会持续的进行更新,因此无需持续刷新这些内容存储到缓存区。这些内容的待更新区域与所述目标区域不再存在所述预设关系时,再刷新待更新内容到待更新区域,即可正常显示更新内容。第二类别为当待更新区域与目标区域存在所述预设关系时,如果不将待更新内容刷新到缓存区域,则当待更新区域与目标区域不存在所述预设关系时,待更新内容无法正常显示的内容,也即是指在用户不可见的情况下仍然需要更新的内容。例如,待更新内容包含一个计数器,需要对更新内容中的某个元素进行计数统计,即待更新内容是需要持续更新的内容,如果不持续将上述更新内容刷新到缓存区域,则计数统计会出现误差。
如果所述待更新区域的位置与所述目标区域的位置存在预设关系,且所述待更新内容属于第一类别,则为了最大程度的减少资源和能量浪费,执行步骤406。
示例性的,第一类别的内容包括网页中需要动态更新的图片或者视频等内容,且这些内容的每次更新之间互不影响,当此次更新时,待更新区域位于用户可视区域之外,则可忽略此次更新,既不需要缓存也不需要绘制该待更新内容。下次更新时,待更新区域位于用户可视区域内,则可正常重新获取需要更新的内容进行缓存以及绘制。
如果所述待更新区域的位置与所述目标区域存在预设关系,且所述待更新内容属于第二类别,则在尽量减少资源和能量浪费的基础上,为了保证用户的正常使用,执行步骤407。
示例性的,有些页面的显示原理为,将获取的所有数据均刷新到缓存区中,通过更改待显示数据的坐标来更改区域中显示的内容。本申请实施例中所指的第二类别的内容即包括这类内容。例如:某个区域用于显示1组图片,共8个图片,则其在显示或者渲染页面的过程中,将8组图片对应的数据均刷新到缓存区,在绘制的时候通过更改待显示图片对应的节点坐标即可显示相应的图片。为了能够更好的显示所有8组图片,更改待显示图片对应的节点坐标往往按照一定的规则进行,例如每隔预设的时间刷新到下一组图片。由此,如果按照第一类别的处理方式,不将更新内容缓存到缓存区,则每次显示时都需要重新获取更新内容,而图片重新从第1组开始显示,使得后面的图片难以得到显示,因此,需要将更新内容缓存在缓存中,并按照预设的规则的需要显示的图片的坐标进行刷新,从而使得重新绘制待更新内容时,会按照原有的预设规则显示应该显示的一组图片。因此,在这种应用场景下,即使待更新区域不在用户可见区域,仍然需要将待更新内容刷新到缓存区,否则页面内容无法正常显示。
406:不在缓存区中缓存所述待更新内容以及不在所述待更新区域中绘制所述待更新内容。
对于属于第一类别的待更新内容,从不将待更新内容刷新到缓存区这一步骤开始就不操作,进而,绘制等过程自然就终止。
407:将所述待更新内容刷新到缓存区域,但不在待更新区域中绘制所述待更新内容。
对于第二类别的待更新内容,即使不需要绘制这些内容,但仍然要将这些内容刷新到缓存区中以保证这些内容为实时更新的,不影响后续的显示。
在该实施例中,在对待更新区域的位置与目标区域是否存在预设关系进行判断的基础上,还增加了对待更新内容的类别判断,当待更新区域的位置与目标区域存在预设关系,且待更新节点对应的待更新内容属于第一类别时,在进行页面刷新的过程中,从将待更新内容刷新到缓存区这个过程就开始不处理,绘制过程自然也会终止,能够进一步减少页面刷新过程中的资源和能量浪费。当待更新节点对应的待更新内容属于第二类别时,则仍然将待更新内容刷新到缓存区中,仅停止对待更新内容的绘制处理以及后续步骤,这样能够在尽量减少资源和能量的浪费的基础上,同时保证待更新内容的正常显示。
需要说明的是,结合图1所示的页面刷新过程,本申请实施例中的各个步骤执行在图1所示的步骤103之后,步骤104之前,也即本申请执行在整个页面刷新过程中的将待更新内容缓存到待更新区域以及绘制待更新内容之前。此外,本申请实施例中所指的不在待更新区域中绘制操作是指不进行页面刷新过程中的步骤105;本申请实施例所指的不在缓存区域中缓存待更新内容是指不进行页面刷新过程中的步骤104。
如图5所示,本申请实施例还提供一种页面刷新的方法,应用于如图2所示 的终端中,该方法包括:
501:获取待更新区域的位置。
其中,所述待更新区域为待更新内容在页面中所要更新的区域,所述待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容。
502:确定目标区域的位置。
其中,所述目标区域为所述页面中当前在显示器上可视的区域。
步骤501和步骤502的具体实现过程可参考步骤301和步骤302。
503:判断待更新区域的位置与目标区域的位置是否存在预设关系。
当所述待更新区域的位置与所述目标区域的位置存在预设关系时,执行下述步骤504,当待更新区域的位置与目标区域的位置不存在预设关系时,执行下述步骤505。
其中,待更新区域的位置与目标区域的位置存在预设关系,具体包括以下情况:
A1、待更新区域与目标区域存在部分重叠或完全重叠,且重叠的区域不被其他区域“遮挡”,也即待更新区域对用户而言为部分可见或全部可见。
A2、待更新区域与目标区域不存在重叠,但待更新区域与目标区域之间的距离在预设范围内。
A3、待更新区域与目标区域不存在重叠,但持续时间在一定时间段内,也即持续时间较短。在这些情况下,为了保证良好的页面显示效果,需要在待更新区域中刷新并绘制待更新内容。
相应的,待更新区域与目标区域的位置不存在预设关系,具体包括以下情况:
B1、待更新区域与目标区域不存在重叠区域。
在该实施例中,当待更新区域与目标区域不存在重叠区域时,表明待更新区域位于页面当前在显示器上可视的区域之外,对用户而言为不可见的区域。因此,这种情况下,本申请通过不在待更新区域中绘制待更新内容,能够减少页面刷新过程中的资源和能量的浪费。
B2、待更新区域与目标区域存在重叠区域,但页面对应的渲染树中存在第一节点,且该第一节点对应的区域完全遮挡所述待更新区域。
具体的,当该第一节点与待更新节点存在如下关系时,可确定第一节点对应的区域完全遮挡待更新区域:该第一节点在渲染树中的z坐标的取值大于待更新节点在所述渲染树中的z坐标的取值,且待更新区域完全位于第一节点对应的区域内。
在该实施例中,虽然待更新区域与目标区域存在重叠区域,但还存在完全“遮挡”待更新区域的其他区域,因此,待更新区域对用户而言仍然是不可见的,这种情况下,本申请通过不在待更新区域中绘制待更新内容,能够减少页面刷新过程中的资源和能量的浪费。
B3、待更新区域完全位于目标区域之外,且待更新区域与目标区域之间的距离在预设范围外。
在该实施例中,当待更新区域不在页面当前在显示器上可视的区域内时,有 些情况下,用户可能稍微移动页面便使得待更新区域落入页面显示区域内。因此增加了对待更新区域与页面当前在显示器上可视的区域的距离的判断,当待更新区域与页面当前在显示器上可视的区域的距离较近时,为了呈现较好的页面显示效果,仍然需要在待更新区域中刷新并渲染待更新内容;当待更新区域与目标区域的距离超过了一定范围时,可认为待更新区域与目标区域的距离较远,这种情况下,可以不在待更新区域中刷新并绘制待更新内容。
B4、待更新区域的位置完全位于目标区域之外,且待更新区域完全位于目标区域之外的时间超过了一定时间范围。
在该实施例中,当待更新区域的位置完全位于目标区域之外,且待更新区域完全位于目标区域之外的时间超过了一定时间范围时,可以认为用户在较长的时间内都不需要浏览待更新区域的内容,因此,可以不在待更新区域中刷新并绘制待更新内容。
504:将待更新内容刷新至所述待更新区域。
505:不在待更新区域中绘制所述待更新内容。
与现有技术中的局部刷新机制相比,本申请实施例提供的页面刷新的方法,在需要进行局部刷新时,增加了对待更新区域的位置与页面的当前在显示器上可视的区域的位置是否存在预设关系的判断过程,当待更新区域的位置与页面的当前在显示器上可视的区域的位置存在预设关系时,才将待更新内容刷新到待更新区域,实现对页面的局部刷新。如果不满足预设关系,则不需要对页面进行局部刷新,与现有技术中的局部刷新机制相比,本申请能够减少不必要的刷新过程,进而能够进一步减少页面刷新过程中的资源和能量的浪费。
如图6所示,作为上述图3和图4所示方法的具体应用,本申请还提供一种页面刷新的装置,该装置作为终端,具体包括:
获取模块601,用于获取待更新区域的位置。
其中,所述待更新区域为待更新内容在页面中所要更新的区域,所述待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容。
显示模块602,用于确定所述页面中当前显示的区域,并将在所述当前显示的区域中的页面内容在显示器上显示。
处理模块603,用于确定目标区域的位置,所述目标区域为页面中所述显示模块602在所述显示器上显示的区域;当所述获取模块601获取的所述待更新区域的位置与所述目标区域的位置存在预设关系时,在页面刷新的过程中,不在所述待更新区域中绘制所述待更新内容。
在本实施例中,终端是以功能模块的形式来呈现。这里的“模块”可以指特定应用集成电路(application-specific integrated circuit,ASIC),电路,执行一个或多个软件或固件程序的处理器和存储器,集成逻辑电路,和/或其他可以提供上述功能的器件。在一个简单的实施例中,本领域的技术人员可以想到终端可以采用图2所示的形式。获取模块601和处理模块603可以通过图2的处理器201和存储器203来实现,显示模块602可以通过图2的显示器204来实现。
可选的,所述待更新区域与所述目标区域的位置存在预设关系,具体包括: 所述待更新区域与所述目标区域不存在重叠区域。
可选的,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:所述待更新区域与所述目标区域存在重叠区域,且所述页面对应的渲染树中存在第一节点;所述第一节点对应的区域完全遮挡所述待更新节点对应的待更新区域。
可选的,所述处理模块603,还用于当所述待更新区域的位置与所述目标区域的位置存在所述预设关系时,确定所述待更新内容的类别;当所述待更新内容属于第一类别时,不在缓存区域中缓存所述待更新内容;所述第一类别为当所述待更新区域与所述目标区域存在所述预设关系时,如果不将所述待更新内容刷新到所述缓存区,则当所述待更新区域与所述目标区域不存在所述预设关系时,所述待更新内容仍然能够正常显示的内容;当所述待更新内容属于第二类别时,将所述待更新内容刷新到缓存区域;所述第二类别为当所述待更新区域与所述目标区域存在所述预设关系时,如果不将所述待更新内容刷新到所述缓存区域,则当所述待更新区域与所述目标区域不存在所述预设关系时,所述待更新内容无法正常显示的内容。
与现有技术中的局部刷新机制相比,本申请实施例提供的页面刷新的装置,在需要进行局部刷新时,增加了对待更新区域的位置与页面的当前在显示器上可视的区域的位置是否存在预设关系的判断过程,当待更新区域的位置与页面的当前在显示器上可视的区域的位置存在预设关系时,不在待更新区域中绘制待更新内容。由于绘制过程会消耗大量的资源和能量,不进行绘制过程,则能够减少资源和能量的浪费。因此,本申请能够在现有技术的局部刷新的基础上减少不必要的刷新过程,进而能够进一步减少页面刷新过程中的资源和能量的浪费。
如图7所示,作为上述图5所示方法的具体应用,本申请还提供一种页面刷新的装置,该装置作为终端,具体包括:
获取模块701,用于获取待更新区域的位置。
其中,所述待更新区域为待更新内容在页面中所要更新的区域,所述待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容。
显示模块702,用于确定所述页面中当前显示的区域,并将在所述当前显示的区域中的页面内容在显示器上显示。
处理模块703,用于确定目标区域的位置,所述目标区域为页面中所述显示模块702在所述显示器上显示的可视区域;当所述获取模块701获取的所述待更新区域的位置与所述目标区域的位置存在预设关系时,将所述待更新内容刷新至所述待更新区域。
在本实施例中,终端是以功能模块的形式来呈现。这里的“模块”可以指特定应用集成电路(application-specific integrated circuit,ASIC),电路,执行一个或多个软件或固件程序的处理器和存储器,集成逻辑电路,和/或其他可以提供上述功能的器件。在一个简单的实施例中,本领域的技术人员可以想到终端可以采用图2所示的形式。获取模块701和处理模块703可以通过图2的处理器201和存储器203来实现,显示模块702可以通过图2的显示器204来实现。
可选的,所述待更新区域与所述目标区域的位置存在预设关系,具体包括: 所述待更新区域与所述目标区域不存在重叠区域。
可选的,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:所述待更新区域与所述目标区域存在重叠区域,且所述页面对应的渲染树中不存在第一节点;所述第一节点对应的区域完全遮挡所述待更新区域。
与现有技术中的局部刷新机制相比,本申请实施例提供的页面刷新的装置,在需要进行局部刷新时,增加了对待更新区域的位置与页面的当前在显示器上可视的区域的位置是否存在预设关系的判断过程,当待更新区域的位置与页面的当前在显示器上可视的区域的位置存在预设关系时,才将待更新内容刷新到待更新区域,实现对页面的局部刷新。如果不满足预设关系,则不需要对页面进行局部刷新,与现有技术中的局部刷新机制相比,本申请能够减少不必要的刷新过程,进而能够进一步减少页面刷新过程中的资源和能量的浪费。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘,硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。

Claims (14)

  1. 一种页面刷新的方法,其特征在于,包括:
    获取待更新区域的位置,所述待更新区域为待更新内容在页面中所要更新的区域,所述待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容;
    确定目标区域的位置,所述目标区域为所述页面中当前在显示器上可视的区域;
    当所述待更新区域的位置与所述目标区域的位置存在预设关系时,在页面刷新的过程中,不在所述待更新区域中绘制所述待更新内容。
  2. 根据权利要求1所述的方法,其特征在于,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:
    所述待更新区域与所述目标区域不存在重叠区域。
  3. 根据权利要求1所述的方法,其特征在于,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:
    所述待更新区域与所述目标区域存在重叠区域,且所述页面对应的渲染树中存在第一节点;所述第一节点对应的区域完全遮挡所述待更新区域。
  4. 根据权利要求1所述的方法,其特征在于,当所述待更新区域的位置与所述目标区域的位置存在所述预设关系时,所述方法还包括:
    确定所述待更新内容的类别;
    当所述待更新内容属于第一类别时,在不在所述待更新区域中绘制所述待更新内容之前,所述方法还包括:不在缓存区域中缓存所述待更新内容;所述第一类别为当所述待更新区域与所述目标区域存在所述预设关系时,如果不将所述待更新内容刷新到所述缓存区,则当所述待更新区域与所述目标区域不存在所述预设关系时,所述待更新内容仍然能够正常显示的内容;
    当所述待更新内容属于第二类别时,在不在所述待更新区域中绘制所述待更新内容之前,所述方法还包括:将所述待更新内容刷新到缓存区域;所述第二类别为当所述待更新区域与所述目标区域存在所述预设关系时,如果不将所述待更新内容刷新到所述缓存区域,则当所述待更新区域与所述目标区域不存在所述预设关系时,所述待更新内容无法正常显示的内容。
  5. 一种页面刷新的方法,其特征在于,包括:
    获取待更新区域的位置,所述待更新区域为待更新内容在页面中所要更新的区域,所述待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容;
    确定目标区域的位置,所述目标区域为所述页面中当前在显示器上可视的区域;
    当所述待更新区域的位置与所述目标区域的位置存在预设关系时,将所述待更新内容刷新至所述待更新区域。
  6. 根据权利要求5所述的方法,其特征在于,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:
    所述待更新区域与所述目标区域存在重叠区域,且所述页面对应的渲染树中不存在第一节点;所述第一节点对应的区域完全遮挡所述待更新区域。
  7. 一种页面刷新的装置,其特征在于,包括:
    获取模块,用于获取待更新区域的位置,所述待更新区域为待更新内容在页面中所要更新的区域,所述待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容;
    显示模块,用于确定所述页面中当前显示的区域,并将在所述当前显示的区域中的页面内容在显示器上显示;
    处理模块,用于确定目标区域的位置,所述目标区域为页面中所述显示模块在所述显示器上显示的区域;当所述获取模块获取的所述待更新区域的位置与所述目标区域的位置存在预设关系时,在页面更新的过程中,不在所述待更新区域中绘制所述待更新内容。
  8. 根据权利要求7所述的装置,其特征在于,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:
    所述待更新区域与所述目标区域不存在重叠区域。
  9. 根据权利要求7所述的装置,其特征在于,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:
    所述待更新区域与所述目标区域存在重叠区域,且所述页面对应的渲染树中存在第一节点;所述第一节点对应的区域完全遮挡所述待更新区域。
  10. 根据权利要求7所述的装置,其特征在于,
    所述处理模块,还用于当所述待更新区域的位置与所述目标区域的位置存在所述预设关系时,确定所述待更新内容的类别;
    当所述待更新内容属于第一类别时,不在缓存区域中缓存所述待更新内容;所述第一类别为当所述待更新区域与所述目标区域存在所述预设关系时,如果不将所述待更新内容刷新到所述缓存区,则当所述待更新区域与所述目标区域不存在所述预设关系时,所述待更新内容仍然能够正常显示的内容;
    当所述待更新内容属于第二类别时,将所述待更新内容刷新到缓存区域;所述第二类别为当所述待更新区域与所述目标区域存在所述预设关系时,如果不将所述待更新内容刷新到所述缓存区域,则当所述待更新区域与所述目标区域不存在所述预设关系时,所述待更新内容无法正常显示的内容。
  11. 一种页面刷新的装置,其特征在于,包括:
    获取模块,用于获取待更新区域的位置,所述待更新区域为待更新内容在页面中所要更新的区域,所述待更新内容为页面对应的渲染树中的至少一个待更新节点对应的内容;
    显示模块,用于确定所述页面中当前显示的区域,并将在所述当前显示的区域中的页面内容在显示器上显示;
    处理模块,用于确定目标区域的位置,所述目标区域为页面中所述显示模块在所述显示器上显示的区域;当所述获取模块获取的所述待更新区域的位置与所述目标区域的位置存在预设关系时,将所述待更新内容刷新至所述待更新区域。
  12. 根据权利要求11所述的装置,其特征在于,所述待更新区域与所述目标区域的位置存在预设关系,具体包括:
    所述待更新区域与所述目标区域存在重叠区域,且所述页面对应的渲染树中不存在第一节点;所述第一节点对应的区域完全遮挡所述待更新区域。
  13. 一种终端,其特征在于,包括:处理器、存储器、显示器和总线,所述处理器、存储器、显示器通过所述总线互相通信,其中:
    所述存储器用于存储计算机可执行程序代码;
    所述处理器用于根据所述存储器存储的计算机可执行程序代码执行如权利要求1至4任意一项所述的方法;
    所述显示器用于显示所述页面中当前显示的区域。
  14. 一种终端,其特征在于,包括:处理器、存储器、显示器和总线,所述处理器、存储器、显示器通过所述总线互相通信,其中:
    所述存储器用于存储计算机可执行程序代码;
    所述处理器用于根据所述存储器存储的计算机可执行程序代码执行如权利要求5至6任意一项所述的方法;
    所述显示器用于显示所述页面中当前显示的区域。
PCT/CN2017/092843 2016-10-31 2017-07-13 页面刷新的方法及装置 WO2018076795A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610932504.6 2016-10-31
CN201610932504.6A CN106570098B (zh) 2016-10-31 2016-10-31 页面刷新的方法及装置

Publications (1)

Publication Number Publication Date
WO2018076795A1 true WO2018076795A1 (zh) 2018-05-03

Family

ID=60414218

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/092843 WO2018076795A1 (zh) 2016-10-31 2017-07-13 页面刷新的方法及装置

Country Status (2)

Country Link
CN (1) CN106570098B (zh)
WO (1) WO2018076795A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110134905A (zh) * 2019-05-21 2019-08-16 北京字节跳动网络技术有限公司 一种页面更新显示方法、装置、设备及存储介质
CN110647704A (zh) * 2019-09-20 2020-01-03 北京思维造物信息科技股份有限公司 一种页面更新方法、装置及设备
CN111813467A (zh) * 2019-04-10 2020-10-23 阿里巴巴集团控股有限公司 一种界面刷新方法、装置及可读存储介质
CN111831351A (zh) * 2020-06-24 2020-10-27 平安普惠企业管理有限公司 基于图像分析的页面加载方法、装置和计算机设备
CN112883297A (zh) * 2021-02-26 2021-06-01 迈普通信技术股份有限公司 网络拓扑显示方法、装置、及电子设备
TWI756563B (zh) * 2018-09-11 2022-03-01 日商日本漫讀股份有限公司 電子內容瀏覽系統、電子內容瀏覽方法、及電腦可讀取之記錄媒體
CN114398019A (zh) * 2022-01-24 2022-04-26 广州文石信息科技有限公司 屏幕更新请求的处理方法、装置及电子墨水屏设备

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106570098B (zh) * 2016-10-31 2020-06-16 华为技术有限公司 页面刷新的方法及装置
CN107357623A (zh) * 2017-07-20 2017-11-17 上海金大师网络科技有限公司 一种基于多图层的局部绘制方法及系统
CN110489187B (zh) * 2018-05-15 2021-09-24 腾讯科技(深圳)有限公司 页面刷新方法、装置、存储介质和计算机设备
CN110580125B (zh) * 2018-06-07 2022-04-22 广州视源电子科技股份有限公司 显示界面的局部刷新方法、装置、设备及介质
CN110908680A (zh) * 2018-09-17 2020-03-24 阿里巴巴集团控股有限公司 一种信息处理方法、装置及设备
CN110908550B (zh) * 2018-09-17 2022-11-08 北京京东尚科信息技术有限公司 光标悬停状态下的操作处理方法和装置
CN109783305B (zh) * 2018-11-22 2022-08-19 厦门市美亚柏科信息股份有限公司 用于监控信息的方法和装置
CN109375918A (zh) * 2018-11-23 2019-02-22 天津字节跳动科技有限公司 小程序的界面渲染方法、装置、电子设备和存储介质
CN110311754B (zh) * 2019-06-24 2022-03-11 北京字节跳动网络技术有限公司 一种数据的接收方法、装置、存储介质及电子设备
CN110909279B (zh) * 2019-11-19 2022-09-13 广州至真信息科技有限公司 一种网页的渲染方法、装置、计算机设备和存储介质
CN115442664A (zh) * 2022-08-19 2022-12-06 武汉斗鱼鱼乐网络科技有限公司 一种面板视图的显示方法、装置、介质、以及电子设备
CN115659087B (zh) * 2022-11-28 2023-03-17 阿里巴巴(中国)有限公司 页面渲染方法、设备及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101192233A (zh) * 2007-03-29 2008-06-04 腾讯科技(深圳)有限公司 一种对网页进行动态更新的方法、系统及设备
CN103365930A (zh) * 2012-04-11 2013-10-23 富泰华工业(深圳)有限公司 网页内容显示控制系统及方法
CN103577603A (zh) * 2013-11-19 2014-02-12 北京京东尚科信息技术有限公司 一种网页加载方法、装置及系统
CN103853417A (zh) * 2012-11-30 2014-06-11 腾讯科技(深圳)有限公司 网络动态图片的滚动分页显示方法和装置
WO2016082586A1 (zh) * 2014-11-27 2016-06-02 广州市动景计算机科技有限公司 网页更新方法及装置
CN105787036A (zh) * 2016-02-25 2016-07-20 广州神马移动信息科技有限公司 一种控制页面内容更新的方法及装置
CN106570098A (zh) * 2016-10-31 2017-04-19 华为技术有限公司 页面刷新的方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120144288A1 (en) * 2010-12-02 2012-06-07 International Business Machines Corporation Web page content display priority and bandwidth management
CN104850415A (zh) * 2014-02-13 2015-08-19 腾讯科技(深圳)有限公司 页面加载方法和装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101192233A (zh) * 2007-03-29 2008-06-04 腾讯科技(深圳)有限公司 一种对网页进行动态更新的方法、系统及设备
CN103365930A (zh) * 2012-04-11 2013-10-23 富泰华工业(深圳)有限公司 网页内容显示控制系统及方法
CN103853417A (zh) * 2012-11-30 2014-06-11 腾讯科技(深圳)有限公司 网络动态图片的滚动分页显示方法和装置
CN103577603A (zh) * 2013-11-19 2014-02-12 北京京东尚科信息技术有限公司 一种网页加载方法、装置及系统
WO2016082586A1 (zh) * 2014-11-27 2016-06-02 广州市动景计算机科技有限公司 网页更新方法及装置
CN105787036A (zh) * 2016-02-25 2016-07-20 广州神马移动信息科技有限公司 一种控制页面内容更新的方法及装置
CN106570098A (zh) * 2016-10-31 2017-04-19 华为技术有限公司 页面刷新的方法及装置

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI756563B (zh) * 2018-09-11 2022-03-01 日商日本漫讀股份有限公司 電子內容瀏覽系統、電子內容瀏覽方法、及電腦可讀取之記錄媒體
CN111813467A (zh) * 2019-04-10 2020-10-23 阿里巴巴集团控股有限公司 一种界面刷新方法、装置及可读存储介质
CN110134905A (zh) * 2019-05-21 2019-08-16 北京字节跳动网络技术有限公司 一种页面更新显示方法、装置、设备及存储介质
CN110134905B (zh) * 2019-05-21 2022-03-04 北京字节跳动网络技术有限公司 一种页面更新显示方法、装置、设备及存储介质
CN110647704A (zh) * 2019-09-20 2020-01-03 北京思维造物信息科技股份有限公司 一种页面更新方法、装置及设备
CN110647704B (zh) * 2019-09-20 2022-05-24 北京思维造物信息科技股份有限公司 一种页面更新方法、装置及设备
CN111831351A (zh) * 2020-06-24 2020-10-27 平安普惠企业管理有限公司 基于图像分析的页面加载方法、装置和计算机设备
CN112883297A (zh) * 2021-02-26 2021-06-01 迈普通信技术股份有限公司 网络拓扑显示方法、装置、及电子设备
CN114398019A (zh) * 2022-01-24 2022-04-26 广州文石信息科技有限公司 屏幕更新请求的处理方法、装置及电子墨水屏设备
CN114398019B (zh) * 2022-01-24 2024-02-23 广州文石信息科技有限公司 屏幕更新请求的处理方法、装置及电子墨水屏设备

Also Published As

Publication number Publication date
CN106570098A (zh) 2017-04-19
CN106570098B (zh) 2020-06-16

Similar Documents

Publication Publication Date Title
WO2018076795A1 (zh) 页面刷新的方法及装置
CN106991154B (zh) 网页渲染方法、装置、终端及服务器
US7370284B2 (en) User interface for displaying multiple applications
WO2016026384A1 (zh) 一种客户端页面显示方法、装置及系统
WO2020034951A1 (zh) 利用前端编程语言优化图片懒加载的方法以及电子设备
CN112667330B (zh) 一种页面显示方法及计算机设备
US20180285337A1 (en) Method, apparatus, and computer program product for managing retrieval of content for display by a browser
US9575941B1 (en) Dynamic adjustment to content for a display device
US20170109139A1 (en) Dynamic source code formatting
US10915236B2 (en) User interface design system
US20200125631A1 (en) Extensible Grid Layout
US11610563B2 (en) Location-based display of pixel history
KR20190059943A (ko) 실시간 컨텐츠 전달을 위한 방법 및 시스템
US9430808B2 (en) Synchronization points for state information
CN115793926A (zh) 列表的渲染方法、装置、电子设备及存储介质
US20130063444A1 (en) Aligning Script Animations with Display Refresh
EP3008697B1 (en) Coalescing graphics operations
CN110609729A (zh) 一种基于cmspweb的页面监听滚动渲染方法
JP2010092103A (ja) Webページ表示方法、サーバ装置、及びプログラム
WO2018137470A1 (zh) 用户终端及网页图片资源加载装置与方法、存储介质
CN117111799A (zh) 数据展示方法及装置、存储介质及电子设备
TW201416967A (zh) 呈現界面工具集的方法及系統
US20120096048A1 (en) Personalized Object Dimension
US20160342570A1 (en) Document presentation qualified by conditions evaluated on rendering
JP4921570B2 (ja) ブログサービス提供システム、方法及びプログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17865342

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17865342

Country of ref document: EP

Kind code of ref document: A1