A kind of method and apparatus realizing page layout switch
[technical field]
The present invention relates to Computer Applied Technology field, particularly to a kind of method and apparatus realizing page layout switch.
[background technology]
For the web kernel of current main flow, in the loading procedure of web page, the web engine of terminal can create a window, is then rendered in window by the content of pages of web page. If user clicks the link on web page, new web page can be loaded, a kind of page layout switch mode is that the web page newly loaded is rendered into original window, and the mode of another kind of page layout switch is to create a window again, and the web page newly loaded is rendered into newly created window.
For directly rendering the mode of the web page of new loading at original window, need first to eliminate the rendering effect of a web page, there will be new web page when not yet rendering complete, window does not have web page to show, make that page layout switch occurs display blank, display resource in waste terminal, brings poor bandwagon effect to user on the other hand on the one hand.
For rendering the mode of the web page of new loading at newly created window, need to open multiple window, occupy the display resource in terminal, the content being shown to user is more numerous and diverse, is not particularly suitable for for this display of mobile terminal resource (screen is generally less) more in short supply in the case of.
[summary of the invention]
In view of this, the invention provides a kind of method and apparatus realizing page layout switch, in order to more effectively utilize the display resource of terminal, improve Consumer's Experience.
Concrete technical scheme is as follows:
The invention provides a kind of method realizing page layout switch, the window of establishment comprises N number of whole overlap or the painting canvas arranged that partly overlaps, and described N is the positive integer more than 1; The method includes:
From server end get the first page content to render time, the first page content of acquisition is rendered in described window in current not shown first painting canvas;
If described window is presently in existence the second painting canvas showing second page content, then until described in render end after, hide described second painting canvas and also show described first painting canvas.
According to the present invention one preferred implementation, when starting web application, or when response user asks, create described window.
According to the present invention one preferred implementation, if described window currently not yet exists the second painting canvas having had shown that second page content, then it is visible for arranging the first painting canvas currently rendered, and other painting canvas are hiding.
According to the present invention one preferred implementation, the method also includes: obtain switching mode and/or animation information;
Hide painting canvas according to the Stealth Modus in described switching mode and/or animation information, or carry out show canvas according to the display mode in described switching mode and/or animation information.
According to the present invention one preferred implementation, described acquisition switching mode and/or animation information include:
Obtain the switching mode and/or animation information that pre-set; Or,
Switching mode and/or animation information is obtained from server end.
According to the present invention one preferred implementation, described obtain switching mode from server end and/or animation information includes:
The switching mode and/or animation information that send with the described content of pages to render is obtained from server end.
According to the present invention one preferred implementation, the switching mode and/or the animation information that send with the described content of pages to render include:
For the display mode of the described content of pages place painting canvas to render and/or animation information and Stealth Modus and/or animation information; Or,
For the display mode of the described content of pages place painting canvas to render and/or animation information and for the Stealth Modus of painting canvas currently having shown that and/or animation information.
According to the present invention one preferred implementation, the window of establishment comprises N number of painting canvas all overlapped and includes:
The window of described establishment comprises N number of painting canvas, and described N number of painting canvas is at x, and the position of y-coordinate is the same, and the position in z-axis exists skew, wherein x, and the plane that y-axis is constituted is the plane parallel with screen, z-axis and screen vertical.
According to the present invention one preferred implementation, described server is cloud server, and described window is the window that the web engine on card form desktop creates.
Present invention also offers a kind of device realizing page layout switch, this device includes:
Creating unit, for creating the window comprising N number of whole overlap or the painting canvas arranged that partly overlaps, described N is the positive integer more than 1;
First acquiring unit, for obtaining the first page content to render from server end;
Rendering unit, for being rendered in described window in current not shown first painting canvas by the first page content that described first acquiring unit obtains;
Switch unit, if being presently in existence, for described window, the second painting canvas showing second page content, then after described rendering unit renders end, hiding described second painting canvas and showing described first painting canvas.
According to the present invention one preferred implementation, described creating unit is when starting web application, or when response user asks, creates described window.
According to the present invention one preferred implementation, described switch unit, if being additionally operable to described window currently not yet there is the second painting canvas having had shown that second page content, then it is visible for arranging the first painting canvas that described rendering unit currently renders, and other painting canvas are hiding.
According to the present invention one preferred implementation, this device also includes: second acquisition unit, is used for obtaining switching mode and/or animation information;
Described switch unit hides painting canvas according to the Stealth Modus in described switching mode and/or animation information, or carrys out show canvas according to the display mode in described switching mode and/or animation information.
According to the present invention one preferred implementation, described second acquisition unit, specifically for obtaining the switching mode and/or animation information pre-set, or obtain switching mode and/or animation information from server end.
According to the present invention one preferred implementation, described second acquisition unit obtains the switching mode and/or animation information that send with the described content of pages to render from server end.
According to the present invention one preferred implementation, the switching mode and/or the animation information that send with the described content of pages to render include:
For the display mode of the described content of pages place painting canvas to render and/or animation information and Stealth Modus and/or animation information; Or,
For the display mode of the described content of pages place painting canvas to render and/or animation information and for the Stealth Modus of painting canvas currently having shown that and/or animation information.
According to the present invention one preferred implementation, described creating unit specifically for comprising N number of painting canvas in the window created, described N number of painting canvas is at x, the position of y-coordinate is the same, there is skew in the position in z-axis, wherein x, the plane that y-axis is constituted is the plane parallel with screen, z-axis and screen vertical.
According to the present invention one preferred implementation, this device is arranged in the web engine on card form desktop, and described server is cloud server.
As can be seen from the above technical solutions, the present invention, by overlapping multiple painting canvas in a page rendering window, in current for page rendering to not shown painting canvas, will hide the painting canvas currently having shown that and shows the painting canvas newly rendered after rendering end. This mode makes the display resource that content of pages can make full use of terminal screen display, do not split by multiple windows, when there is page layout switch, the content of pages not rendered will not be shown, the painting canvas only rendered just can replace the painting canvas having shown that, more efficiently utilizes the display resource of terminal, improve Consumer's Experience.
[accompanying drawing explanation]
The method flow diagram realizing page layout switch that Fig. 1 provides for the embodiment of the present invention one;
The schematic diagram of the page rendering window that Fig. 2 provides for the embodiment of the present invention one;
The method flow diagram realizing page layout switch that Fig. 3 provides for the embodiment of the present invention two;
The structure drawing of device that Fig. 4 provides for the embodiment of the present invention three.
[detailed description of the invention]
In order to make the object, technical solutions and advantages of the present invention clearly, describe the present invention below in conjunction with the drawings and specific embodiments.
The core concept of the present invention is in that, renders the content of pages before and after page layout switch respectively by the mode of multi views, and the switching realized between different views by the mode of animation is shown in a window. Below in conjunction with embodiment one and embodiment two, method provided by the invention is described in detail.
Embodiment one,
The method flow diagram realizing page layout switch that Fig. 1 provides for the embodiment of the present invention one, as shown in fig. 1, this flow process can specifically include following steps:
In a step 101, when starting web application, web engine creates a window comprising N number of painting canvas (or being called page rendering window), and wherein N is the positive integer more than 1, and painting canvas overlaps in the window. What is called overlaps and refers to these painting canvas position of coordinate on x, y-axis is consistent, and in z-axis, the position of coordinate exists skew, x, the plane that y-axis is constituted is the plane parallel with terminal screen, and z-axis is vertical with terminal screen, as shown in Figure 2, Fig. 2 takes 3 for N. In window, N number of painting canvas can be all overlap, it is also possible to is the setting that partly overlaps, if partly overlapping setting, then these painting canvas position part of coordinate on x, y-axis is identical.
It addition, web engine can also when one page rendering window of user's manual creation, namely response user sets up the operation of window when setting up a page rendering window, the N number of painting canvas of layout in this page rendering window. Such as when user's operation requests in terminal sets up a page rendering window, web engine creates a page rendering window comprising N number of painting canvas.
In a step 102, when web engine gets, from server end, the content of pages to render, being rendered in one of them current not shown painting canvas, and to arrange this painting canvas be visible, other painting canvas are hiding.
This step 102 is web engine renders step performed when window renders first content of pages at current page, if the first of this page rendering window content of pages, then it is rendered in one of them current not shown painting canvas, can giving tacit consent to first painting canvas of display, it is visible for arranging this painting canvas. So this content of pages just can be shown in this painting canvas.
In this step, web engine can judge after getting the content of pages to render whether current window has had the painting canvas of display, namely whether it is first content of pages rendered, if the painting canvas that current window does not have shown that, then illustrate it is first painting canvas rendered, can this painting canvas be directly set visible, it is also possible to it is visible after content of pages renders end that this painting canvas is set.
In embodiments of the present invention, painting canvas can be realized by the mode of View (view), under this preferred implementation, can by arrange the display properties in View arrange visible and hide, setVisibility (View.VISIBLE) such as can be adopted in Andriod system to arrange View normally show, adopt setVisibility (View.INVISIBLE) that View is set and hide.
Certainly, the embodiment of the present invention is not limited to this visible with hiding implementation, the mode of the level such as adjusting painting canvas can also be adopted, the level of the painting canvas that namely will show improves, it is placed on topmost one layer (namely in z-axis distance screen closest), the level of the painting canvas that will hide reduces, for instance be placed under the painting canvas of display (namely in z-axis the distance of distance screen compare display painting canvas farther out).
It addition, when showing this painting canvas, it is possible to adopt the display mode in the switching mode pre-set and animation information to show the content of pages of this painting canvas. The switching mode pre-set and animation information will describe in detail in subsequent step 104.
When user clicks the link generation page layout switch in the page, in step 103, web engine from server end get the content of pages to render time, be rendered in one of them current not shown painting canvas.
Web engine judges after getting the content of pages to render whether current window has had the painting canvas of display equally, judges that current window has the painting canvas having shown that in this step, it is therefore desirable to perform page layout switch, namely performs step 104.
At step 104, the switching mode that pre-sets and animation are performed after end to be rendered to hide currently displaying painting canvas and to show the painting canvas newly rendered.
When web engine obtains second content of pages from server end, this second content of pages is rendered in one of them current not shown painting canvas, such as it is shown in second painting canvas, this painting canvas is hiding, after this second content of pages renders end, show this second painting canvas newly rendered, hide first painting canvas shown before. When carrying out the switching that painting canvas shows, switching mode and animation can be pre-set, here switching mode and animation allow for the transition problem of painting canvas switching and arrange, including display mode and Stealth Modus, display mode is for the painting canvas newly rendered, and Stealth Modus is for the painting canvas having shown that.
Wherein switching mode can include but not limited to: vertical hidden vertical existing mode (is namely hidden currently displaying painting canvas immediately and shows the painting canvas newly rendered immediately), fade out the mode of coming out gradually (namely gradually hide currently displaying painting canvas and gradually show the painting canvas newly rendered), the vertical hidden mode that comes out gradually (is namely hidden currently displaying painting canvas immediately and gradually shows the painting canvas newly rendered), fade out vertical existing mode (namely gradually hide currently displaying painting canvas and show the painting canvas newly rendered immediately) etc.
Additionally each switching mode can corresponding different animation, for instance can realize by arranging the attributes such as transparency, move mode, convergent-divergent, rotation for the animation that fades out or come out gradually. This part animation can pass through to perform respective algorithms and realize, it is possible to adopts existing algorithm, is not described in detail in this.
In the present embodiment, switching mode and animation all adopt the mode pre-set, and web engine switches according to the execution that arranges obtained in advance. This arranges and can be fixedly installed, it is also possible to carried out self-defined setting by user, for instance providing a user oriented interface, user switches over the setting of mode and animation by this interface, and web engine switches according to the execution that arranges of this user.
Except the mode pre-set, web engine can also obtain switching mode and animation from server end, and this mode will be described in embodiment two.
Certainly, the mode that page layout switch occurs is not limited to the mode of clickthrough in the page of the user described in the present embodiment, can also be that such as user has been manually entered new web page address, thus other modes such as the new page request initiated, as long as current window has had shown that painting canvas, web engine has initiated again new page request can according to the mode in the present embodiment, by in a new content of pages not shown painting canvas shown in, substitute currently displaying painting canvas after end to be rendered and display.
In subsequent process, the painting canvas that originally display was hidden later becomes again current not shown painting canvas, it is possible to continue to be used in subsequent page handoff procedure. The processing procedure of subsequent page request is similar with above-mentioned steps 103 and step 104, repeats no more.
Visible, the embodiment of the present invention sets up multiple painting canvas in one page rendering window, it is preferable that the size of each painting canvas is consistent with page rendering window. Each only one of which painting canvas is visible, and other painting canvas are hidden, and loads a new page every time and all renders in not shown painting canvas, and after having rendered, current visible painting canvas is hidden, and replaces with the painting canvas newly rendered and shows.
Embodiment two,
The method flow diagram realizing page layout switch that Fig. 3 provides for the embodiment of the present invention two, as shown in Figure 3, this flow process can specifically include following steps:
Step 301, with step 101, repeats no more.
In step 302, web engine obtains the content of pages and switching mode to render and animation information from server end.
In the present embodiment, when web engine is to after server end requests for page content, server end carries, in the http returning to web engine responds, the content of pages to render, and also carries switching mode and animation information simultaneously. For example, it is possible to increase field in http message head to carry switching mode and animation information, it is also possible to increase field in http message content and carry switching mode and animation information.
The switching mode carried and animation information can be the display mode of this page and the Stealth Modus of animation information and this page and animation information, it is also possible to be the display mode of this page and animation information and Stealth Modus and the animation information currently having shown that the page.
In step 303, being rendered into by the content of pages of acquisition in one of them current not shown painting canvas, and to arrange this painting canvas be visible, other painting canvas are hiding.
Equally, in this step, web engine judges after getting the content of pages to render whether current window has had the painting canvas of display, the painting canvas that in this step, current window does not have shown that, explanation is first painting canvas rendered, can this painting canvas be directly set visible, it is also possible to it is visible after content of pages renders end that this painting canvas is set.
It addition, when showing this painting canvas, it is possible to adopt the display mode in the switching mode obtained and animation information and animation information to show the content of pages of this painting canvas.
When user clicks the link generation page layout switch in the page, in step 304, web engine obtains the content of pages and switching mode to render and animation information from server end.
In step 305, the content of pages of acquisition is rendered in one of them current not shown painting canvas.
Web engine judges after getting the content of pages to render whether current window has had the painting canvas of display equally, judges that current window has the painting canvas having shown that in this step, it is therefore desirable to perform page layout switch, namely performs step 306.
Within step 306, render according to the switching mode obtained in step 304 and animation information after end until painting canvas, to hide currently displaying painting canvas and to show the painting canvas newly rendered.
If the switching mode obtained in the present embodiment and animation information are the display mode of this page and the Stealth Modus of animation information and this page and animation information, after then painting canvas renders end in this step, show, according to the display mode in the switching mode obtained in step 304, the painting canvas newly rendered, hide currently displaying painting canvas according to the Stealth Modus in the switching mode obtained in step 302 and animation information and animation information.
If the switching mode obtained in the present embodiment and animation information are the display mode of this page and animation information and Stealth Modus and the animation information currently having shown that the page, after then painting canvas renders end in this step, hide currently displaying painting canvas according to the Stealth Modus in the switching mode obtained in step 304 and animation information and animation information, show, according to the display mode in the switching mode obtained in step 304 and animation information and animation information, the painting canvas newly rendered.
It should be noted that, except the switching mode described in the present embodiment and animation information together obtain from server end with the content of pages to render, web engine first can also obtain switching mode and animation information from server end, the content of pages to render is obtained again from server end, the content of pages to render be can also first obtain, then switching mode and animation information obtained from server end.
Above-described embodiment is described there is switching mode and animation information simultaneously, in actual use, it is also possible to only preset or obtain the one in switching mode and animation information, the another kind of form adopting acquiescence.
Being above the description that method provided by the present invention is carried out, three pairs of devices provided by the invention are described in detail by the examples below.
Embodiment three,
The structure drawing of device that Fig. 4 provides for the embodiment of the present invention three, this device can arrange with in web engine, as shown in Figure 4, this device can specifically include: creating unit the 01, first acquiring unit 02, rendering unit 03 and switch unit 04, it is also possible to farther include second acquisition unit 05.
Wherein creating unit 01 is responsible for creating the page rendering window comprising N number of whole overlap or the painting canvas arranged that partly overlaps, and N is the positive integer more than 1. When starting web application, or when response user asks, creating unit 01 creates page rendering window.
First acquiring unit 02 is responsible for obtaining, from server end, the content of pages to render. The content of pages that first acquiring unit 02 obtains is rendered in page rendering window in a current not shown painting canvas by rendering unit 03.
Wherein, the first acquiring unit 02 can be user when manually entering url, after web engine sends web request to server end, obtains the content of pages to render from server end; When can also be the link that user clicks on the page, after web engine sends web request to server end, obtain the content of pages to render from server end. Can also is that the web engine that other situations trigger sends web request to server end.
If page rendering window currently not yet exists the painting canvas having shown that, then switch unit 04 arranges the painting canvas that rendering unit 03 currently renders is visible, and other painting canvas are hiding. This situation is web engine renders situation when window renders first content of pages at current page.
If page rendering window is presently in existence the painting canvas of display, then after switch unit 04 unit 03 to be rendered renders end, hide the painting canvas currently having shown that and show the painting canvas that rendering unit newly renders. The situation that this situation is corresponding when being that page layout switch occurs.
When there is page layout switch, in order to realize the transition problem of switching, it is possible to arrange switching mode and/or animation information. Namely second acquisition unit 05 obtains switching mode and/or animation information, and wherein switching mode includes Stealth Modus and display mode. Switch unit 04 hides painting canvas according to Stealth Modus therein and/or animation information, carrys out show canvas according to display mode therein and/or animation information.
The above-mentioned switching mode related to can include but not limited to: vertical hidden vertical existing mode, fades out the mode of coming out gradually, the vertical hidden mode or fade out the mode of coming out gradually of coming out gradually. Additionally each switching mode can corresponding different animation, for instance can realize by arranging the attributes such as transparency, move mode, convergent-divergent, rotation for the animation that fades out or come out gradually. This part animation can pass through to perform respective algorithms and realize, it is possible to adopts existing algorithm, is not described in detail in this.
Above-mentioned switching mode and animation information can adopt the mode pre-set, can also obtain from server end, namely second acquisition unit 05 can obtain the switching mode and/or animation information that pre-set, or obtain switching mode and/or animation information from server end. Above-mentioned pre-setting can be fixedly installed, it is also possible to is carried out self-defined setting by user, for instance providing a user oriented interface, user switches over the setting of mode and animation by this interface.
Switching mode is obtained and/or during animation information from server end, it is preferable that second acquisition unit 05 can obtain the switching mode and/or animation information that send with the content of pages to render from server end when adopting. When web engine is to after server end requests for page content, server end carries, in the http returning to web engine responds, the content of pages to render, and also carries switching mode and/or animation information simultaneously. For example, it is possible to increase field in http message head to carry switching mode and/or animation information, it is also possible to increase field in http message content and carry switching mode and/or animation information.
Specifically, the switching mode and the animation information that send with the content of pages to render include: for the display mode of content of pages place painting canvas to render and animation information and Stealth Modus and animation information; Or, for the display mode of content of pages place painting canvas to render and animation information and for the Stealth Modus of painting canvas currently having shown that and animation information.
The above-mentioned method and apparatus of the embodiment of the present invention can apply to but is not limited to following several application scenarios:
Such as, for the card form desktop just risen at present, namely there is the web engine that multiple card form shows on the desktop of mobile terminal, each web engine function is each independent, interact with cloud server respectively, by cloud server active push or should ask send content of pages. The above-mentioned method of the embodiment of the present invention just can be applied in each web engine. Such as there is a web engine on card form desktop to be responsible for loading Weather information, the window that this web engine creates includes two painting canvas, and the two painting canvas is completely overlapped. Under default situations, cloud server pushes Pekinese's weather to the window of this web engine, Pekinese's weather page is loaded on the first painting canvas by web engine, first painting canvas is set for display, second painting canvas is hiding, after first painting canvas renders, user just can see Pekinese's Weather information on window. When user carries out the switching of region on this web engine, for instance user clicks the link of this region, Nanjing, then this web engine is just asked to cloud server and obtains the weather page in Nanjing, is loaded on the second painting canvas by the weather page in this Nanjing. Owing to the second painting canvas is hiding, therefore the render process of the second painting canvas will not be seen by the user. After the second painting canvas renders, showing the second painting canvas and hide the first painting canvas, the weather page in such Nanjing just visually substitutes Pekinese's weather page and displays. In the switching display process of the second painting canvas to the first painting canvas, it is possible to adopt and hide the first painting canvas gradually and show switching mode and the animated of the second painting canvas gradually.
Again such as, when user opens mobile phone browser, then mobile phone browser automatically creates a window comprising two painting canvas, and the two painting canvas is completely overlapped. When user opens a news pages by mobile phone browser, the content of this news pages being loaded on one of them painting canvas of window of establishment, be called the first painting canvas for the time being, and arrange this first painting canvas for display, the second painting canvas is hiding. After the content of this news pages renders, on the first painting canvas, just show the content of this news pages. When user has hit a link in this news pages at the process mid-point browsing this news pages, so mobile phone browser just sends request to server and obtains the content of pages that this link is corresponding, assume this link corresponding be also a news pages, so the news pages newly obtained just is rendered on the second painting canvas by mobile phone browser, owing to the second painting canvas is hiding, the new news pages obtained will not be seen by the user in render process. After the new news pages obtained has rendered, show that the first painting canvas hidden by the second painting canvas so that the new news pages obtained visually substitutes original news pages user and displays. In the switching display process of the second painting canvas to the first painting canvas, it is possible to adopt and hide the first painting canvas gradually and show switching mode and the animated of the second painting canvas gradually.
Again such as, when user opens cell-phone customer terminal, then cell-phone customer terminal automatically creates a window comprising two painting canvas, and the two painting canvas is completely overlapped. When user opens a video page by client, the content of this video page being loaded on first painting canvas of window of establishment, and arrange this first painting canvas for display, the second painting canvas is hiding. After the content of this video page renders, on the first painting canvas, just show the content of this video page. When user is manually entered the address of another video page, client can send request to server and obtain the video page content that this address is corresponding, and the video page newly obtained is loaded on the second painting canvas, owing to the second painting canvas is hiding, therefore the render process of the second painting canvas will not be seen by the user equally. After the second painting canvas renders, show that the first painting canvas hidden by the second painting canvas so that the new video page obtained visually substitutes original video page and displays. In the switching display process of the second painting canvas to the first painting canvas, it is possible to adopt and hide the first painting canvas gradually and show switching mode and the animated of the second painting canvas immediately.
By above description it can be seen that method and apparatus provided by the invention possesses advantages below:
1) the invention enables the display resource that content of pages can make full use of terminal screen to display, do not split by multiple windows; When there is page layout switch, the content of pages not rendered will not be shown, and the painting canvas only rendered just can replace the painting canvas having shown that, more efficiently utilizes the display resource of terminal, improves Consumer's Experience.
2) switching mode and animation can be defined by the present invention so that handoff procedure is more smooth and interesting, improves Consumer's Experience.
In several embodiments provided by the present invention, it should be understood that disclosed apparatus and method, it is possible to realize by another way. Such as, device embodiment described above is merely schematic, for instance, the division of described unit, it is only a kind of logic function and divides, actual can have other dividing mode when realizing.
It addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it is also possible to be that unit is individually physically present, it is also possible to two or more unit are integrated in a unit.
The above-mentioned integrated unit realized with the form of SFU software functional unit, it is possible to be stored in a computer read/write memory medium. Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions with so that a computer equipment (can be personal computer, server, or the network equipment etc.) or processor (processor) perform the part steps of method described in each embodiment of the present invention. And aforesaid storage medium includes: USB flash disk, portable hard drive, read only memory (Read-OnlyMemory, ROM), the various media that can store program code such as random access memory (RandomAccessMemory, RAM), magnetic disc or CD.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all within the spirit and principles in the present invention, any amendment of making, equivalent replacement, improvement etc., should be included within the scope of protection of the invention.