The present invention relates to the field of mobile communication technologies, and more particularly, to a webpage display method and device.
When a user uses a portable terminal, for example, a mobile phone, a PAD or the like, to browse webpages, as the webpages are designed according to the size of a screen of a desktop computer and the size of the screen of the portable terminal is smaller, if an original webpage is displayed on the screen of the portable mobile terminal, the height and the width of the webpage will be beyond the screen of the portable terminal, and when the user browses, the user needs to adjust the content of the webpage while browsing; if the webpage is directly and fully scaled down to the same size as that of the screen in the portable terminal for display, the displayed content of the webpage is too small, and the user cannot clearly browse the content of the webpage, significantly affecting user experience.
With respect to the aforementioned problem, at present, a webpage display method widely used in a portable terminal is: improving the readability of a webpage in the portable terminal by enlarging fonts of some content. A specific implementation method is as follows: when the content of the webpage is composed, it is guaranteed that the overall layout of the webpage is unchanged, and the text of the important content of the webpage is scaled up to make words of the important content achieve a readable effect. When the user needs to carefully read some content, the text content is scaled up again in an interactive way. Although the method optimizes the text and can guarantee the integrity of the overall layout of the webpage, the scale-up of the text results in deformation of composition of some areas and overflow hiding of the words, which damages the composition of local details.
Thus, how to provide a webpage display method that can guarantee the readability and can also retain the detail composition of the webpage becomes a problem to be urgently addressed in this field.
Embodiments of the present application provide a webpage display method and device, which can guarantee the readability of a webpage in a portable terminal and can also retain the detail composition of the webpage, improving user experience.
In the embodiments of the present application, a webpage display method is disclosed, the method including: acquiring source code of a webpage to be displayed; parsing the source code to form tree-shaped nodes; composing the tree-shaped nodes according to style specifications of the source code; locating a primary container according to the composed tree-shaped nodes; locating at least one secondary container in the primary container, wherein each of the secondary containers contains some of the elements of the webpage to be displayed; adjusting the area of the secondary container; and drawing the adjusted secondary container, and displaying the elements of the webpage to be displayed which are contained in the adjusted secondary container on a screen.
In the embodiments of the present application, a webpage display device is further disclosed, the device including: an acquisition unit configured to acquire source code of a webpage to be displayed; a parsing unit configured to parse the source code acquired by the acquisition unit to form tree-shaped nodes; a composing unit configured to compose the tree-shaped nodes formed by the parsing unit through parsing according to style specifications of the source code; a first locating unit configured to locate/determine a primary container according to the tree-shaped nodes composed by the composing unit; a second locating unit configured to locate/determine at least one secondary container in the primary container, wherein each of the secondary containers contains some of the elements of the webpage to be displayed; a first adjustment unit configured to adjust the area of the secondary container located by the second locating unit; and a drawing unit configured to draw the secondary container adjusted by the first adjustment unit, and display the elements of the webpage to be displayed which are contained in the adjusted secondary container on a screen.
In the embodiments of the present application, a webpage display method is disclosed, the method including: composing tree-shaped nodes according to style specifications of source code of a webpage to be displayed, wherein the tree-shaped nodes are formed after the source code is parsed; locating a primary container and at least one secondary container in the primary container according to the composed tree-shaped nodes, wherein each secondary container contains some of the elements in the webpage to be displayed; and by adjusting the area of the at least one secondary container, changing the elements displayed on a screen.
In the embodiments of the present application, a webpage display device is further disclosed, the device including: a processor; the processor being configured to: compose tree-shaped nodes according to style specifications of source code of a webpage to be displayed, wherein the tree-shaped nodes are formed after the source code is parsed; locate/determine a primary container and at least one secondary container in the primary container according to the composed tree-shaped nodes, wherein each secondary container contains some in the elements of the webpage to be displayed; and by adjusting the area of the at least one secondary container, change the elements displayed on a screen.
It can be known form the aforementioned technical solutions that, in the webpage display method and device according to the embodiments of the present application, source code of a webpage to be displayed is parsed to form tree-shaped nodes, and a primary container and secondary containers of the tree-shaped nodes are located, wherein each of the secondary containers contains some of the elements of the webpage to be displayed. Then the area of each of the secondary containers is adjusted, the adjusted secondary container is drawn, and elements of the webpage to be displayed which are contained in the secondary container are displayed on a screen. Compared with the prior art, in the embodiments of the present application, a webpage to be displayed is modularized, when some of the elements of the webpage are adjusted, actually an adjusted object is a secondary container that contains the elements, and thus, scale-up of the elements will not damage the detail composition of the secondary container. At the same time, as various secondary containers are mutually independent modules, when the area of a certain secondary container is adjusted, the composition of other secondary containers will not be influenced. It can be seen that the webpage display method and device according to the embodiments of the present application not only can guarantee the readability of a webpage, but also, on this basis, can retain the detail composition of the webpage, improving user experience.
To illustrate the technical solutions according to the embodiments of the present application or in the prior art more clearly, the accompanying drawings for describing the embodiments or in the prior art are introduced briefly in the following. Apparently, persons of ordinary skill in the art can obtain other drawings according to the accompanying drawings without paying any creative efforts.
To make persons skilled in the art better understand the technical solutions in the embodiments of the present application and make the aforementioned objectives, features and advantages of the embodiments of the present application more comprehensible, the technical solutions in the embodiments of the present application are further described below in detail with reference to the accompanying drawings.
Referring to
The method includes:
Step 101: Source code of a webpage to be displayed is acquired.
The webpage to be displayed refers to a webpage to be displayed after a user triggers the webpage in a portable terminal, which may be any webpage, for example, Netease, Sohu or Baidu and the like. The source code is computer description language, which organizes and composes elements such as pictures, video, music and words on a webpage to be displayed by means of assembly, and displays the elements in the form of a webpage after they are translated by a browser. The source code may be written in a Hypertext Markup Language (HTML).
Step 102: The source code is parsed to form tree-shaped nodes.
An existing webpage is generally written in an HTML language, and the content of the existing webpage follows an HTML specification or a WAP specification; in order to make the structure of the source code of the webpage to be displayed clearer to make it easier to modularize the webpage to be displayed according to webpage elements, the source code of the webpage to be displayed may be parsed to identify tree-shaped nodes therein.
The tree-shaped nodes may be any known or upcoming tree-shaped node. For example, in a preferred embodiment of the present application, the webpage is standardized according to a Document Object Model (DOM), the source code for describing the webpage to be displayed is parsed, and DOM nodes are identified. Certainly, the above is merely an example provided in the present application, and the present application is not limited thereto.
Step 103: The tree-shaped nodes are composed according to style specifications of the source code.
The tree-shaped nodes map a page of the webpage to be displayed as a document that is made up of hierarchy nodes, wherein the nodes are divided into several levels, and the nodes in each level contain certain webpage elements; however, in order to accurately display the composition structure of the webpage to be displayed to facilitate modularization of the content of the webpage to be displayed, the tree-shaped nodes are composed according to style specifications of the source code.
The composing the tree-shaped nodes according to style specifications of the source code may be that the tree-shaped nodes are composed according to Cascading Style Sheets (CSS) or an HTML style, and may also be that the tree-shaped nodes are composed according to other standards, which is not limited in the present application.
In addition, the operation of composing the tree-shaped nodes is a technology well-known to persons skilled in the art, which is not repeated herein in the present application.
Step 104: A primary container is located (i.e., determined) according to the composed tree-shaped nodes.
The primary container is a module that contains multiple smaller modules on a webpage. For example, a full page of a webpage can be regarded as a primary container. In the tree-shaped nodes, a node that contains multiple secondary nodes can be located/determined as a primary container.
In the webpage display method according to the embodiments of the present application, whether a node is the primary container is located through the width of the node after composition; the width of the node refers to the number of pixels occupied horizontally when the tree-shaped node is displayed in a pixel device according to the original proportion, and in the present application, the width of the node is determined according to the number of the webpage elements that are contained in the node.
Step 105: At least one secondary container in the primary container is located.
Each primary container may contain one or more secondary containers. The number of the secondary containers that are contained in the primary container is determined according to the structure of the webpage to be displayed. For example, the structure of the home page of Baidu Search is relatively simple, and thus it can be located as one secondary container; in terms of the home page of 360 Browser, the home page of 360 Browser can be regarded as a primary container. During location, a root node is located as the primary container, the right side of the page is regarded as a module, and the left side is regarded as a module; and thus when the node is located, the primary container contains two secondary containers. In addition, when a primary container contains multiple secondary containers, the secondary containers are mutually independent; the layout of the elements in other secondary containers is not impacted when any of the secondary containers is adjusted.
Generally, component elements of a webpage can be divided into two broad categories: body elements and ancillary elements for location. The body elements are, for example, texts, pictures, blocks with a background or a border, forms, input boxes, other visual elements and the like. The ancillary elements for location are, for example, invisible blocks (for example, performance of HTML tags <div> in a default style). When the tree-shaped nodes are located, an ancillary element that contains a large portion of content can be located as a primary container, other ancillary elements can be located as secondary containers in the primary container, and major elements are filled in each secondary container.
Step 106: The area of the secondary container is adjusted.
A scaling factor is calculated in accordance with the importance of the secondary container, and according to the calculated scaling factor, the area of each secondary container is respectively adjusted; the area of the secondary container with greater importance is scaled up, while the area of the secondary container with less importance is scaled down, wherein the scale-up degree is subject to clear display on the portable terminal. The clear display refers to that, after the webpage to be displayed is displayed on the portable terminal, a user can clearly browse the content of the scaled-up secondary container without performing any operation. In addition, the importance of the secondary container can be judged according to the frequency at which a webpage element is browsed. If the webpage element is a part that is often browsed by a user during browsing of the webpage, the importance of the webpage element is high. Thus, when a secondary container is located, it is feasible to locate the part that contains webpage elements browsed at a higher frequency as a secondary container with a larger area, and the importance of the secondary container is judged through the area of the secondary container.
The adjusting the area of the secondary container refers to uniformly scaling the width and the height of the secondary container. When the secondary container is scaled, the webpage elements contained in the secondary container may also be correspondingly scaled up or scaled down. When the area of the secondary container is adjusted, comparing the areas after the adjustment and before the adjustment, the total width of the secondary container is kept unchanged.
Step 107: The adjusted secondary container is drawn, and elements of the webpage to be displayed which are contained in the adjusted secondary container are displayed on a screen.
In the webpage display method according to this embodiment, source code of a webpage to be displayed is parsed to form tree-shaped nodes, and a primary container and secondary containers of the tree-shaped nodes are located, wherein each of the secondary containers contains some of the elements of the webpage to be displayed. Then the area of each of the secondary containers is adjusted, the adjusted secondary container is drawn, and elements of the webpage to be displayed which are contained in the secondary container are displayed on a screen. Compared with the prior art, in the embodiment of the present application, a webpage to be displayed is modularized. When some of the elements of the webpage are adjusted, the real object to be adjusted is a secondary container that contains the elements. Thus, scale-up of the elements will not damage the detail composition of the secondary container. At the same time, as various secondary containers are mutually independent modules, when the area of a certain secondary container is adjusted, the composition of other secondary containers will not be impacted. It can be seen that the webpage display method and device according to the embodiment of the present application not only can guarantee the readability of a webpage, but also, on this basis, can retain the detail composition of the webpage, improving user experience.
To make persons skilled in the art understand the technical solutions of the present application more clearly, on the basis of the aforementioned embodiment, the present application also provides a flow chart of a second implementation of the webpage display method.
Referring to
The method includes:
Step 201: Source code of a webpage to be displayed is acquired.
Step 202: The source code is parsed to form tree-shaped nodes.
Step 203: The tree-shaped nodes are composed according to style specifications of the source code.
Step 204: Whether a parent node of the current node is null or is a primary container is judged, and if the parent node of the current node is null, step 206 is performed; if the parent node of the current node is the primary container, step 205 is performed.
The parent node of the current node is null, that is, the current node is a root node.
Step 205: Whether the width of the current node is greater than or equal to a first percentage (for example, 50%) of the width of a root node and greater than or equal to a second percentage (for example, 90%) of the width of the parent node of the current node is judged; if yes, step 206 is performed; if no, no operation is performed.
When the width of the current node is greater than or equal to 90% of the width of the parent node thereof, it indicates that the parent node of the current node is only an ancillary element for location and the webpage elements that are contained therein are all contained in the container where the current node is located.
Step 206: Whether the height of the current node is a fixed value is judged. If the height of the current node is the fixed value, no operation is performed on the current node; and if the current node is not the fixed value, step 207 is performed.
The judging whether the height of the current nodes is a fixed value may include: whether source code corresponding to the current node sets the height value of the current node as a fixed value is judged, and if the height value of the current node is set as the fixed value, it is judged that the height of the current node is the fixed value; otherwise, it is judged that the height of the current nodes may not be the fixed value. Whether a background image corresponding to the current node supports a variable height may be judged, and if the height of the background image of the current node is not variable, for example, a repeat-x image or a no-repeat image, it is judged that the height of the current node is a fixed value, and otherwise, it is judged that the height of the current nodes may not be the fixed value.
The above is merely an example provided in the present application, and in the present application, when whether the current node is variable is judged; the judgment may also be made through other factors, which are not limited in the present application.
When the width of the secondary container is adjusted to the same width as that of the screen of the portable terminal, in order to ensure that the webpage elements in the secondary container are reasonably composed, the height of the secondary container will change, thus, the primary container that contains the secondary containers will need to support the variable height.
Step 207: The current node is determined as a primary container.
Step 208: Whether the parent node of the current node is a primary container is judged. If the parent node of the current node is not the primary container, no operation is performed; and if the parent node of the current node is the primary container, step 209 is performed.
The secondary containers are nested in the primary container, and multiple secondary containers are mutually independent; thus, according to the hierarchical structure characteristics of the tree-shaped nodes, the parent node of the secondary container node is a primary container.
Step 209: Whether the width of the current node is a third percentage (for example, 20%) to a fourth percentage (for example, 80%) of the width of the parent node thereof is judged. If yes, step 210 is performed; and if no, no operation is performed.
As each primary container contains at least one secondary container, when the primary container contains one secondary container, the width of the secondary container is 80% of the width of the primary container; when the primary container contains more secondary containers, the width of each of the secondary container accounts for less than 80% of the width of the primary container; if the width of the secondary container accounts for less than 20% of the width of the primary container thereof, the area of the secondary container is too small, which makes no sense based on the technical problems to be solved in the present application. Therefore, the width of the secondary container accounts for 20% to 80% of the width of the primary container.
Step 210: The current node is determined as a secondary container.
Step 211: The area of each of the secondary containers is calculated, and an average value of the areas of all the secondary containers is obtained.
It can be known from the aforementioned embodiment that the area of the secondary container shows the importance of the webpage elements contained in the secondary container; the larger the area of the secondary container is, the greater the importance of the elements contained in the secondary container is.
When the primary container contains at least two secondary containers, the area of each secondary container may be calculated according to the importance of the secondary container, and the calculation method may be: calculating a product of the width and the height of the secondary container, and using the result of the product as the area value of the secondary container; or calculating an area value of each category of elements in the secondary container, and adding all the area values to obtain the area of the secondary container, wherein, the element categories include texts, pictures, animated video and controls, and according to the importance of each category of elements, each category of elements are preset with a weighted parameter, and the area of the elements is obtained according to the calculation of multiplying the physical area of the elements by the weighted parameter of the elements; when the primary container only contains one secondary container, it may not be necessary to compare the importance among the secondary containers, and it is feasible to directly display the webpage to be displayed.
Step 212: The area of each of the secondary containers is compared with the average value.
Step 213: If the area of the secondary container is greater than the average value, the secondary container is scaled up according to a preset scale factor k, wherein, the k is greater than 1; at the same time, other secondary containers are correspondingly scaled down to keep the total width of the secondary containers unchanged.
The preset scale factor k can be calculated according to different webpage compositions and the number and the size of the secondary container; or the scale factor of each secondary container is obtained through calculation. In order to ensure that the total width of the secondary containers is unchanged, when a secondary container of greater importance is scaled up k times according to its own preset scale factor, other secondary containers are correspondingly scaled down.
The method of calculating the preset scale factor of each secondary container includes: suppose that a visual width of a page on a screen of a portable terminal is u and the width of each secondary container is w, the value of u divided by w is the preset scale factor k of the secondary container. The algorithm may also be used as an algorithm for the scaling factor of each secondary container when any secondary container is adjusted to fit the screen display.
Step 214: The adjusted secondary container is drawn, and elements of the webpage to be displayed that are contained in the adjusted secondary container are displayed on a screen.
The drawing in the present application refers to displaying the content contained in the secondary container on a screen through combination, movement, cascading, scaling, clipping and other technical measures.
In the webpage display method according to this embodiment, the area of the secondary container is used to indicate the importance of the webpage content that is contained in the secondary container, which is convenient and simple to determine a secondary container to be displayed, avoiding a lot of operation processes, and thus the speed at which the webpage is displayed on a screen is increased, improving user experience.
When a user browses a webpage, it is unlikely that the user only browses some of the content of the webpage; when the user needs to browse some content other than the content currently displayed, the content of the webpage displayed may be switched; based on this, according to the aforementioned embodiment, the present application further provides a third implementation of the webpage display method.
Referring to
The method further includes:
Step 301: Source code of a webpage to be displayed is acquired.
Step 302: The source code is parsed to form tree-shaped nodes.
Step 303: The tree-shaped nodes are composed according to style specifications of the source code.
Step 304: A primary container is located according to the composed tree-shaped nodes.
Step 305: At least one secondary container in the primary container is located.
Step 306: The area of the secondary container is adjusted.
Step 307: The adjusted secondary container is drawn, and elements of the webpage to be displayed which are contained in the secondary container are displayed on a screen.
Step 301 to step 307 are similar to those in the aforementioned two embodiments, which are not repeated herein in the present application.
Step 308: A switchover command is received.
It can be known form the aforementioned embodiment that, when a webpage is displayed on a screen, the content of a secondary container of the greatest importance is scaled up and displayed in a default manner, and when a user needs to browse the content of other secondary containers, the user can produce an interactive operation with a portable terminal through a gesture or a function control that is additionally provided by the portable terminal, to scale up and display the content of a target secondary container. When the portable terminal receives trigger information such as the user's gesture or the function control, the trigger signal is used as a switchover command, and the target secondary container is scaled up according to the switchover command. For example, the content of the target secondary container is double-clicked.
Step 309: A scaling factor u of the target secondary container is generated.
When a secondary container is switched, it may not be necessary to consider the importance of the webpage elements in the target secondary container, and adjustment is made only for the target secondary container and the screen of the portable terminal. Thus, the method of generating a scaling factor of the target secondary container may be: comparing the width of the screen of the portable terminal with the width of the primary container, and choosing the minimum value of the two; making multiplication calculation on the minimum value and the preset scale factor k, and dividing the result of the multiplication calculation by the width of the target secondary container, to obtain a first scaling factor u1; dividing a height value of the primary container by a height value of the target secondary container, to obtain a second scaling factor u2; and determining the minimum value in the u1 and the u2 as the scaling factor u, wherein, if u is less than 1, u is set as 1; or obtaining the preset scale factor of each secondary container through calculation according to the method of the aforementioned embodiment.
The method of generating a scaling factor u is not limited thereto, and may also be any other suitable methods, for example, a scaling factor u being generated according to a pixel value of a secondary container, which is not limited in the present application.
Step 310: The area of the target secondary container is adjusted u times, and the areas of other secondary containers are correspondingly adjusted to keep the total width of the secondary containers unchanged.
When a switchover command is triggered, the importance of the secondary containers is changed, and a target secondary container becomes a secondary container of greater importance. Thus, the area of the target secondary container needs to be scaled up before display, and in order to ensure that the total width of the adjusted secondary containers is unchanged, when the area of the target secondary container is scaled up, other secondary containers may be correspondingly scaled down; or according to the preset scale factor of each secondary container in the aforementioned embodiment, the target secondary container is scaled up according to its own preset scale factor, and the currently displayed secondary container is correspondingly scaled down.
Step 311: The adjusted secondary container is drawn, and elements of the adjusted secondary container are displayed on the screen.
For the adjusted secondary container, the area of the target secondary container as a secondary container of greater importance increases and the areas of other secondary containers are reduced, the overall layout of the webpage has changed, and after another drawing, the content of the target secondary container scaled up is clearly displayed on the screen. The method of drawing the adjusted secondary container is similar to the method of drawing the currently displayed secondary container, which is not repeated herein in the present application.
In the process of scaling up the target secondary container and scaling down other secondary containers, the process may be a traditional picture, for example, the target secondary container is scaled up while other secondary containers are scaled down, the switching process may also be completed in several steps through a timer setting, and the process may be set as an animation effect, improving the user's interactive experience.
In the webpage display method according to this embodiment, through an interactive operation between a user and a portable terminal, the content of a currently displayed secondary container is switched to the content of a target secondary container; in the switching process, the target secondary container is scaled up while the currently displayed secondary container is scaled down, which not only can guarantee the readability of the target secondary container but also can retain the detail composition of the current secondary container.
In the webpage display method according to the present application, source code of a webpage to be displayed is parsed to form tree-shaped nodes, and a primary container and secondary containers of the tree-shaped nodes are located, wherein each of the secondary containers contains some of the elements of the webpage to be displayed. Then the area of each of the secondary containers is adjusted, the adjusted secondary container is drawn, and elements of the webpage to be displayed which are contained in the secondary container are displayed on a screen. Compared with the prior art, in the embodiment of the present application, a webpage to be displayed is modularized, when some of the elements of the webpage are adjusted, actually an adjusted object is a secondary container that contains the elements, and thus, scale-up of the elements will not damage the detail composition of the secondary container. At the same time, as various secondary containers are mutually independent modules, when the area of a certain secondary container is adjusted, the composition of other secondary containers will not be influenced. It can be seen that the webpage display method and device according to the embodiment of the present application not only can guarantee the readability of a webpage, but also, on this basis, can retain the detail composition of the webpage, improving user experience.
The aforementioned preferred implementation process is further described below with reference to the preferred implementation shown in
Corresponding to the aforementioned implementation method, in an embodiment of the present application, a webpage display device is further provided.
Referring to
The device includes: an acquisition unit 11, a parsing unit 12, a composing unit 13, a first locating unit 14, a second locating unit 15, a first adjustment unit 16 and a drawing unit 17, wherein the acquisition unit 11 is configured to acquire source code of a webpage to be displayed; the parsing unit 12 is configured to parse the source code acquired by the acquisition unit 11 to form tree-shaped nodes; the composing unit 13 is configured to compose the tree-shaped nodes formed by the parsing unit 12 through parsing according to style specifications of the source code; the first locating unit 14 is configured to locate a primary container according to the width after the composition by the composing unit 13; the second location 15 is configured to locate at least one secondary container in the primary container, wherein each of the secondary containers contains some of the elements of the webpage to be displayed; the first adjustment unit 16 is configured to adjust the area of the secondary container located by the second locating unit 15; and the drawing unit 17 is configured to draw the secondary container adjusted by the first adjustment 16, and display the elements of the webpage to be displayed which are contained in the adjusted secondary container on a screen.
The first locating unit includes: a first judgment unit and a second judgment unit; the second locating unit includes: a third judgment unit; and the first adjustment unit includes: a first calculation unit, a first comparison unit and a scaling unit.
Reference can be made to the corresponding implementation processes in the aforementioned method for the implementation processes of the functions and roles of each unit in the device for details, which are not repeated herein.
In the webpage display device according to the present application, source code of a webpage to be displayed is parsed to form tree-shaped nodes, and a primary container and secondary containers of the tree-shaped nodes are located, wherein each of the secondary containers contains some of the elements of the webpage to be displayed. Then the area of each of the secondary containers is adjusted, the adjusted secondary container is drawn, and elements of the webpage to be displayed which are contained in the secondary container are displayed on a screen. Compared with the prior art, in the embodiment of the present application, a webpage to be displayed is modularized, when some of the elements of the webpage are adjusted, actually an adjusted object is a secondary container that contains the elements, and thus, scale-up of the elements will not damage the detail composition of the secondary container. At the same time, as various secondary containers are mutually independent modules, when the area of a certain secondary container is adjusted, the composition of other secondary containers will not be influenced. It can be seen that the webpage display method and device according to the embodiment of the present application not only can guarantee the readability of a webpage, but also, on this basis, can retain the detail composition of the webpage, improving user experience.
Referring to
On the basis of the aforementioned embodiment, the device of this embodiment includes: an acquisition unit 20, a parsing unit 21, a composing unit 22, a first judgment unit 23, a second judgment unit 24, a third judgment unit 25, a first calculation unit 26, a first comparison unit 27, a scaling unit 28 and a drawing unit 29, wherein the functions and connection modes of the acquisition unit 20, the parsing unit 21, the composing unit 22, and the drawing unit 29 are similar to those in the aforementioned embodiment, which are not repeated herein in the present application. The first judgment unit 23 is configured to judge whether a parent node of the current node is null or whether the parent node is the primary container; the second judgment unit 24 is configured to, when the parent node of the current node is null or is the primary container, judge whether the height of the current node is a fixed value; the third judgment unit 25 is configured to judge whether the parent node of the current node is the primary container; the first calculation unit 26 is configured to calculate the area of each of the secondary containers, and obtain an average value of the areas of all the secondary containers; the first comparison unit 27 is configured to compare the area of each of the secondary containers obtained by the first calculation unit 26 through calculation with the average value; and the scaling unit 28 is configured to, when the area of the secondary container is greater than the average value, scale up the secondary container according to a preset scale factor k, wherein, the k is greater than 1; at the same time, correspondingly scale down other secondary containers to keep the total width of the secondary containers unchanged.
On the basis of the aforementioned embodiment, in this embodiment, the first locating unit is configured to, when the height of the current node is not the fixed value, determine the current node as a primary container if the parent node is null; if the parent node of the current node is the primary container, when the width of the current node is greater than or equal to 50% of the width of a root node and greater than or equal to 90% of the width of the parent node, determine the current node as the primary container; and the second locating unit is configured to, when the parent node of the current node obtained by the third judgment unit through judgment is the primary container, if the width of the current node is 20% to 80% of the width of the parent node thereof, determine the current node as the secondary container.
Reference can be made to the corresponding implementation processes in the aforementioned method for the implementation processes of the functions and roles of each unit in the device for details, which are not repeated herein.
In the webpage display device according to this embodiment, the area of the secondary container is used to indicate the importance of the webpage content that is contained in the secondary container, which is convenient and simple to determine a secondary container to be displayed, avoiding a lot of operation processes, and thus the speed at which the webpage is displayed on a screen is increased, improving user experience.
In order to make it convenient for a user to switch the displayed content, on the basis of the aforementioned embodiment, in an embodiment of the present application, a third webpage display device is further provided.
Referring to
The device includes: an acquisition unit 30, a parsing unit 31, a composing unit 32, a first locating unit 33, a second locating unit 34, a first adjustment unit 35, a drawing unit 36, a receiving unit 37, a generation unit 38 and a second adjustment unit 39, wherein the functions, roles and connection relationships of the acquisition unit 30, the parsing unit 31, the composing unit 32, the first locating unit 33, the second locating unit 34, the first adjustment unit 35 and the drawing unit 36 are similar to those in the aforementioned embodiment, which are not repeated herein in the present application. The receiving unit 37 is configured to receive a switchover command to scale up and display the content of the target secondary container; the generation unit 38 is configured to generate a scaling factor u of the target secondary container; the second adjustment unit 39 is configured to, after the generation unit generates the scaling factor u, adjust the area of the target secondary container u times, and correspondingly adjust the areas of other secondary containers to keep the total width of the secondary containers unchanged.
On the basis of the aforementioned embodiment, in this embodiment, the drawing unit is further configured to draw the secondary container adjusted by the second adjustment unit, and display the elements of the secondary container on a screen.
The generation unit includes: a second comparison unit, a second calculation unit and a determination unit; the second comparison unit is configured to compare the width of the screen with the primary container, and choose the minimum value of the two; the second calculation unit is configured to make multiplication calculation on the minimum value and the preset scale factor k, and then divide the result of the multiplication calculation by the width of the target secondary container, to obtain a first scaling factor u1; and divide a height value of the primary container by a height value of the target secondary container, to obtain a second scaling factor u2; and the determination unit is configured to determine the minimum value in the u1 and the u2 obtained by the second calculation unit through calculation as the scaling factor u.
Reference can be made to the corresponding implementation processes in the aforementioned method for the implementation processes of the functions and roles of each unit in the device for details, which are not repeated herein.
In the webpage display device according to this embodiment, through an interactive operation between a user and a portable terminal, the content of a currently displayed secondary container is switched to the content of a target secondary container; in the switching process, the target secondary container is scaled up while the currently displayed secondary container is scaled down, which not only can guarantee the readability of the target secondary container but also can retain the detail composition of the current secondary container.
To sum up, in the webpage display method and device according to the present application, source code of a webpage to be displayed is parsed to form tree-shaped nodes, and a primary container and secondary containers of the tree-shaped nodes are located, wherein each of the secondary containers contains some of the elements of the webpage to be displayed. Then the area of each of the secondary containers is adjusted, the adjusted secondary container is drawn, and elements of the webpage to be displayed which are contained in the secondary container are displayed on a screen. Compared with the prior art, in the embodiments of the present application, a webpage to be displayed is modularized, when some of the elements of the webpage are adjusted, actually an adjusted object is a secondary container that contains the elements, and thus, scale-up of the elements will not damage the detail composition of the secondary container. At the same time, as various secondary containers are mutually independent modules, when the area of a certain secondary container is adjusted, the composition of other secondary containers will not be influenced. It can be seen that the webpage display method and device according to the embodiments of the present application not only can guarantee the readability of a webpage, but also, on this basis, can retain the detail composition of the webpage, improving user experience.
The present invention can be described in a general context of computer executable instructions executed by a computer, for example, program modules. Generally, the program modules include routines, programs, objects, components, data structures and so on which execute particular tasks or implement particular abstract data types. The present invention may also be practiced in distributed computing environments, and in the distributed computing environments, tasks are executed by remote processing devices connected via a communication network. In the distributed computing environments, the program modules may be located in both local and remote computer storage mediums that include storage devices.
The relational terms such as first and second are merely used to distinguish one entity or operation from another entity or operation, but may not necessarily require or imply that any such an actual relation or order exists between the entities or operations. Moreover, terms “comprise”, “include” or any other variations thereof are intended to cover non-exclusive inclusion, so that processes, methods, articles or devices that include a series of elements not only include those elements, but also include other elements not explicitly listed, or further include elements inherent in the processes, methods, articles or devices. Without more restrictions, an element defined by the wording of “including a . . . ” does not preclude the further inclusion of other identical elements in the processes, methods, products or devices that include this element.
The above are merely specific implementations of the present invention, and it should be noted that persons of ordinary skill in the art, without departing from the principles of the present invention, can further make some improvements and modifications, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
2013 1 0629615 | Nov 2013 | CN | national |
This application is a continuation application of International Application No. PCT/CN2014/078715, filed May 28, 2014, which is based upon and claims priority to Chinese Patent Application No. 201310629615.6, filed Nov. 29, 2013. The entire contents of the above referenced applications are incorporated herein by reference.
Number | Name | Date | Kind |
---|---|---|---|
20020065848 | Walker | May 2002 | A1 |
20060259860 | Kobashi | Nov 2006 | A1 |
20080281834 | Wu | Nov 2008 | A1 |
20110119571 | Decker | May 2011 | A1 |
20110289436 | Choi | Nov 2011 | A1 |
20120110437 | Pan | May 2012 | A1 |
20120131429 | Day | May 2012 | A1 |
20120162266 | Douglas | Jun 2012 | A1 |
20130080910 | Bingell | Mar 2013 | A1 |
20130212487 | Cote | Aug 2013 | A1 |
20140002504 | Farmer | Jan 2014 | A1 |
20140040711 | Brownlow | Feb 2014 | A1 |
20140063070 | Leventhal | Mar 2014 | A1 |
20140365873 | Willis | Dec 2014 | A1 |
20150082181 | Ames | Mar 2015 | A1 |
20150234798 | Mocanu | Aug 2015 | A1 |
Number | Date | Country |
---|---|---|
101499099 | Aug 2009 | CN |
101853293 | Oct 2010 | CN |
101951405 | Jan 2011 | CN |
102779167 | Nov 2012 | CN |
103064920 | Apr 2013 | CN |
103605783 | Feb 2014 | CN |
Entry |
---|
International Written Opinion for PCT/CN2014/078715, dated Sep. 3, 2014. |
International Preliminary Report on Patentability for PCT/CN2014/078715, dated May 31, 2016, 6 pages. |
First Notice issued by China State Intellectual Property Office, dated Mar. 9, 2016 for Chinese Patent Application No. 201310629615.6 with search report. |
Second Notice issued by China State Intellectual Property Office, dated Oct. 10, 2016 for Chinese Patent Application No. 201310629615.6. |
Third Notice issued by China State Intellectual Property Office, dated Apr. 26, 2017 for Chinese Patent Application No. 201310629615.6 with search report. |
“CSS Flexible Box Layout Module”, W3C Candidate Recommendation, Sep. 18, 2012 <https://www.w3.org/TR/2012/CR-css3-flexbox-20120918/>. |
International Application No. PCT/CN2014/078715, International Search Report and Written Opinion dated Jun. 4, 2015. |
Number | Date | Country | |
---|---|---|---|
20160275054 A1 | Sep 2016 | US |
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2014/078715 | May 2014 | US |
Child | 15167819 | US |