Summary of the invention
In view of the above problems, the present invention has been proposed in order to provide a kind of page elements treating apparatus that overcomes the problems referred to above or address the above problem at least in part and corresponding page elements disposal route.
According to one aspect of the present invention, a kind of page elements treating apparatus is provided, comprising: at least one DOM object handler, be arranged on the browser side, each DOM object handler is configured to store the customized treatment of specific DOM object; Page resolver is configured to obtain the page in the loading of browser side, and the page elements that obtains the page is resolved, and each page elements is converted to the DOM object; The DOM processor is couple to page resolver and at least one DOM object handler, is configured to call at least one DOM object handler of setting, at least one customized treatment that arranges in the DOM object of conversion; The tree maker is couple to the DOM processor, is configured to utilize the final dom tree of DOM object generation through the customized treatment that arranges, and dom tree is played up.
Alternatively, the DOM processor is configured to also whether inquiry exists the DOM object handler that current DOM object is processed in the object handles registration table, wherein, is registered with the register information of at least one DOM object handler of setting in the object handles registration table; If find the DOM object handler that this DOM object is processed according to register information, and call.
Alternatively, the DOM processor also is configured to call this DOM object handler when having the DOM object handler that current DOM object is processed in the browser, the customized treatment that this DOM object is arranged; When not existing for the DOM object handler that current DOM object processes in the browser, this DOM object is carried out default process.
Alternatively, each DOM object handler stores specific DOM object has been loaded the processing mode that the event ContentReady that triggers when finishing processes.
Alternatively, each DOM object handler also stores the HTML that obtains the page is all loaded the processing mode that the event DocumentReady that triggers when finishing processes.
Alternatively, the DOM processor is arranged in the render engine of browser.
Alternatively, the DOM processor is configured to utilize at least one DOM object handler of interface interchange that browser provides plays up web page element.
Alternatively, the DOM object comprises: the text box element; Password Input frame element.
According to another aspect of the present invention, a kind of page elements disposal route also is provided, in the browser side at least one DOM object handler is set, wherein each DOM object handler stores the customized treatment of specific DOM object, the method comprises: load in the browser side and obtain the page, and the page elements that obtains the page resolved, each page elements is converted to the DOM object; Call at least one DOM object handler of setting, at least one customized treatment that arranges in the DOM object of conversion; After at least one customized treatment that arranges in the DOM object of conversion, also comprise: utilize the final dom tree of DOM object generation through the customized treatment that arranges; Dom tree is played up.
Alternatively, call at least one DOM object handler of setting, comprise: whether inquiry exists the DOM object handler that current DOM object is processed in the object handles registration table, wherein, is registered with the register information of at least one DOM object handler of setting in the object handles registration table; If find the DOM object handler that this DOM object is processed according to register information, and call.
Alternatively, call at least one DOM object handler of setting, to at least one customized treatment that arranges in the DOM object of conversion, comprise: when having the DOM object handler that current DOM object is processed in the browser, call this DOM object handler, the customized treatment that this DOM object is arranged; When not existing for the DOM object handler that current DOM object processes in the browser, this DOM object is carried out default process.
Alternatively, each DOM object handler stores specific DOM object has been loaded the processing mode that the event ContentReady that triggers when finishing processes.
Alternatively, each DOM object handler also stores the HTML that obtains the page is all loaded the processing mode that the event DocumentReady that triggers when finishing processes.
Alternatively, call at least one DOM object handler of setting, comprising: at least one the DOM object handler of interface interchange that provides according to browser, web page element is played up.
Alternatively, when browser is the IE browser, the client at browser place arranges first interface IElementBehaviorFactory, the second interface IElementBehavior and the 3rd interface IDocHostUIHandler at the WebBrowser plug-in unit, wherein, first interface and the second interface are used for calling each DOM object handler, and the 3rd interface is used for each DOM object handler is registered to the object handles registration table; Call at least one DOM object handler of setting, comprising: the behavior title BehaviorName that core engine provides according to the client at browser place, at least one the DOM object handler that is connected with first interface by the second interface interchange; And the page elements sign TAG that provides according to client of core engine calls element behavior Notification Method, the stress state of notice customer terminal webpage element when loading corresponding page elements.
Alternatively, core engine is called at least one DOM object handler, comprising: core engine is with to obtain the 4th interface IElementBehaviorSite that the page provides related, by the 4th interface determine current DOM to as if surely existing customized treatment.
Alternatively, the DOM object comprises: the text box element; Password Input frame element.
In embodiments of the present invention, for each DOM object, in the browser side DOM object handler of it being carried out customized treatment is set, in the acquisition process of the page, the customized treatment that the DOM object handler of utilizing the DOM processor to call selection arranges the DOM object.This shows, the page elements treating apparatus that adopts the embodiment of the invention to provide, can process for each DOM object respectively, the mode of its processing is to carry out Selection and call by the DOM processor, the web page contents that presents thus can be realized the personalized customization processing, and be not to be according to the desired fixed form of network application and Information Provider, and then realized the purpose that the user can carry out personalized customization to content that web browser presents, satisfy different users' preference, improve user's impression and experience.
Above-mentioned explanation only is the general introduction of technical solution of the present invention, for can clearer understanding technological means of the present invention, and can be implemented according to the content of instructions, and for above and other objects of the present invention, feature and advantage can be become apparent, below especially exemplified by the specific embodiment of the present invention.
Embodiment
Exemplary embodiment of the present disclosure is described below with reference to accompanying drawings in more detail.Although shown exemplary embodiment of the present disclosure in the accompanying drawing, yet should be appreciated that and to realize the disclosure and the embodiment that should do not set forth limits here with various forms.On the contrary, it is in order to understand the disclosure more thoroughly that these embodiment are provided, and can with the scope of the present disclosure complete convey to those skilled in the art.
Mention in the correlation technique, present web browser usually presents web page contents according to the desired mode of network application and Information Provider, and does not take into full account the user to the preference of page presentation mode when presenting webpage.Therefore although existing web browser has different render engines, to present effect basic identical when it, and this is so that the abundant content that presents of personalized customization web browser of user reduces user's impression experience.
For solving the problems of the technologies described above, the embodiment of the invention provides a kind of and has carried out the device that page elements is processed in the browser side, be used for realizing that improved web page element processing mode, this device can allow the user to come the presentation mode of personalized customization web page element, thereby strengthen the display effect of the page.
Fig. 1 shows the structural representation of the page elements treating apparatus of one embodiment of the invention.Referring to Fig. 1, this device comprises at least one DOM object handler 110, page resolver 120 and the DOM processor 130 that is arranged on the browser side.
Wherein, DOM object handler 110 comprises at least one, and sets in advance in the browser side, stores the customized treatment of specific DOM object in each DOM object handler 110.The quantity of DOM object handler can be 1, also can be 2, also can be 3,4,5 or more, and concrete quantity determines according to the quantity of specific DOM object and the quantity of customized treatment.Among Fig. 1 in order to illustrate that it is set to 3.
When a page that obtains was processed, page resolver 120 loaded this in the browser side and obtains the page, and the page elements that obtains the page is resolved.Consider that the page and page elements can not directly process, therefore, page resolver 120 is converted to the DOM object with each page elements in resolving, processes for follow-up DOM processor 130.
Referring to Fig. 1, DOM processor 130 is couple to page resolver 120 and at least one DOM object handler 110.After page resolver 120 is resolved end, start DOM processor 130.DOM processor 130 selects at least one as DOM object that current preparation is processed in the DOM object of conversion, calls at least one DOM object handler 110 of setting, the customized treatment that the DOM object of selecting is arranged.
In embodiments of the present invention, for each DOM object, in the browser side DOM object handler of it being carried out customized treatment is set, in the acquisition process of the page, the customized treatment that the DOM object handler of utilizing the DOM processor to call selection arranges the DOM object.This shows, the device that the browsing device net page element that adopts the embodiment of the invention to provide is processed, can process for each DOM object respectively, the mode of its processing is to carry out Selection and call by the DOM processor, the web page contents that presents thus can be realized the personalized customization processing, and be not to be according to the desired fixed form of network application and Information Provider, and then realized the purpose that the user can carry out personalized customization to content that web browser presents, satisfy different users' preference, improve user's impression and experience.
Referring to Fig. 1, the device that browser carries out the web page element processing also comprises tree maker 140, is couple to DOM processor 130.After DOM processor 130 called DOM object handler 110, and the DOM object is carried out the customized treatment end, tree maker 140 utilized the final dom tree of DOM object generation through the customized treatment that arranges, and dom tree is played up.
Wherein, call operation for DOM object handler 110, DOM processor 130 need to be known the address of each DOM object handler 110, and then call accordingly, if in the situation that the DOM object handler is more and memory address is disperseed relatively, will there be certain difficulty in calling of DOM processor 130.A kind of preferred method of calling now is provided, in this example, the object handles registration table is set, the register information of all DOM object handler of registration in this form, register information herein can comprise memory address, each DOM object handler of each DOM object handler customization operations, whether be called etc.DOM processor 130 can inquire about whether there is the DOM object handler that current DOM object is processed in the object handles registration table.Optionally, if Query Result is yes, DOM processor 130 will find the DOM object handler 110 that this DOM object is processed according to register information, and calls.Optionally, if Query Result is no, then prove the current DOM object handler 110 that this DOM object is processed that do not exist.
In the process of calling, if when DOM processor 130 is determined to have the DOM object handler that current DOM object is processed in the browsers, call this DOM object handler, the customized treatment that this DOM object is arranged.And DOM processor 130 carries out default process to this DOM object when determining not exist in the browsers DOM object handler that current DOM object processes.
For each DOM object, all have at least two events, one is that this DOM object has loaded the event ContentReady that triggers when finishing, another is that whole HTML has loaded the event DocumentReady that triggers when finishing.For web page element is customized, being contemplated that of the embodiment of the invention: when the ContentReady event of the DOM object corresponding with web page element is triggered, just be invoked at web browser place customized treatment prepared in advance, thereby realize the customized treatment to the particular webpage element.Corresponding with this design, store in each DOM object handler 110 specific DOM object has been loaded the processing mode that the event ContentReady that triggers when finishing processes.Further, because the DOM object also exists full page to load the event that triggers when finishing, therefore, each DOM object handler 110 can also store the HTML that obtains the page is all loaded the processing mode that the event DocumentReady that triggers when finishing processes.
Because what finally present is a complete webpage, and in the prior art presenting of webpage present after playing up end by render engine, therefore, present for ease of the page, the DOM processor that the embodiment of the invention provides is arranged in the render engine of browser.
In the prior art, render engine is mostly just controlled corresponding DOM object according to the JS code in the html web page, render engine provide and the JS code between interface.And the JS code is controlled by network application self or service provider usually, and therefore, the Webpage that render engine renders is similar.And in this example, at least one DOM object handler 110 of interface interchange that web page element is played up that DOM processor 130 can utilize that browser provides can realize user's personalized customization from this interface.
Preferably, the DOM object of mentioning in the various embodiments described above comprises text box element, Password Input frame element.Certainly, the DOM object not only comprises above-mentioned two kinds of elements, and other web page element all can be realized.
The each several part framework that above-mentioned browser carries out the device of page elements processing provides according to its function, and actual framework is not limited in each part mentioned above, can also comprise other parts, module, device etc.
Fig. 2 shows the process flow diagram according to a kind of page elements disposal route of the embodiment of the invention, in the browser side at least one DOM object handler is set, and wherein each DOM object handler stores the customized treatment of specific DOM object.The treatment scheme of the method comprises that step S202 is to step S204.
Step S202, load in the browser side and to obtain the page, and the page elements that obtains the page is resolved, each page elements is converted to the DOM object.
Step S204, call at least one DOM object handler of setting, at least one customized treatment that arranges in the DOM object of step S202 conversion.
In embodiments of the present invention, for each DOM object, in the browser side DOM object handler of it being carried out customized treatment is set, in the acquisition process of the page, calls the customized treatment that the DOM object handler of selection arranges the DOM object.This shows, the device that the browsing device net page element that adopts the embodiment of the invention to provide is processed, can process for each DOM object respectively, the mode of its processing is to carry out Selection and call according to the DOM object, the web page contents that presents thus can be realized the personalized customization processing, and be not to be according to the desired fixed form of network application and Information Provider, and then realized the purpose that the user can carry out personalized customization to content that web browser presents, satisfy different users' preference, improve user's impression and experience.
Referring to flow process shown in Figure 2, step S204 utilizes the final dom tree of DOM object generation through the customized treatment that arranges, and to dom tree is played up, the webpage after playing up is presented to the user after implementing.
Mention at least one DOM object handler of calling setting among the step S204, the address that to know allocating object (each DOM object handler) by calling, and then call accordingly, in the situation that if the DOM object handler is more and memory address is relatively disperseed, call and to have certain difficulty.A kind of preferred method of calling now is provided, in this example, the object handles registration table is set, the register information of all DOM object handler of registration in this form, register information herein can comprise memory address, each DOM object handler of each DOM object handler customization operations, whether be called etc.Its concrete call method sees also Fig. 3.
Fig. 3 shows the according to an embodiment of the invention process flow diagram of the call method of DOM object handler.Referring to Fig. 3, this step comprises that step S302 is to step S306.
Step S302, whether inquiry exists the DOM object handler that current DOM object is processed in the object handles registration table.
Step S304, when the Query Result of step S302 when being, find the DOM object handler that this DOM object is processed according to register information, and call.
Step S306, when the Query Result of step S302 when being no, determine not exist the DOM object handler of processing as current DOM object.
In the process of calling, when having the DOM object handler that current DOM object is processed in the browser, call this DOM object handler, the customized treatment that this DOM object is arranged.And when not existing for the DOM object handler that current DOM object processes in the browser, then directly this DOM object is carried out default process.
For each DOM object, all have at least two events, one is that this DOM object has loaded the event ContentReady that triggers when finishing, another is that whole HTML has loaded the event DocumentReady that triggers when finishing.For web page element is customized, being contemplated that of the embodiment of the invention: when the ContentReady event of the DOM object corresponding with web page element is triggered, just be invoked at web browser place customized treatment prepared in advance, thereby realize the customized treatment to the particular webpage element.Corresponding with this design, store in each DOM object handler specific DOM object has been loaded the processing mode that the event ContentReady that triggers when finishing processes.Further, because the DOM object also exists full page to load the event that triggers when finishing, therefore, each DOM object handler can also store the HTML that obtains the page is all loaded the processing mode that the event DocumentReady that triggers when finishing processes.
In the prior art, render engine is mostly just controlled corresponding DOM object according to the JS code in the html web page, render engine provide and the JS code between interface.And the JS code is controlled by network application self or service provider usually, and therefore, the Webpage that render engine renders is similar.And in this example, browser provides the interface that can play up web page element, utilizes at least one DOM object handler of this interface interchange, realizes user's personalized customization.
Embodiment one
The browser that is mentioned in the embodiment of the invention can be for multiple, and for example the Internet Explorer(of Microsoft is called for short IE), Mozilla Firefox, Chrome, the Opera of Google and Safari of Apple etc.
The concrete disposal route of the web page element that now as an example of the IE browser example the embodiment of the invention is provided is at length set forth and is illustrated.
When browser is the IE browser, the client at browser place arranges first interface IElementBehaviorFactory, the second interface IElementBehavior and the 3rd interface IDocHostUIHandler at the WebBrowser plug-in unit, wherein, first interface and the second interface are used for calling each DOM object handler, and the 3rd interface is used for each DOM object handler is registered to the object handles registration table.
For the particular procedure for each web page element, may need to realize
The behavior of IElementBehavior(element)
Implementing the IElementBehavior Interface(carries out the element behavior interface)
Implementing the Notify Method(carries out Notification Method)
Implementing the Init Method(carries out initial method)
Implementing the Detach Method(carries out separation method)
The behavior of IElementBehaviorFactory(element behavior factory)
IElementNamespaceFactory(element NameSpace factor interface)
IElementNamespaceFactoryCallback(element NameSpace callback interface)
After initialization arranges, the client WebBrowser(web browser in the IE browser) plug-in unit realizes that the concrete treatment step of web page element is as follows:
Step 1, client WebBrowser plug-in unit are realized IElementBehaviorFactory interface and IElementBehavior interface.
Step 2, client WebBrowser plug-in unit are realized the IDocHostUIHandler interface.
Annotate: the WebBrowser plug-in unit here is exactly in the embodiment of par-ticular processor in IE for specific DOM object, realize that the IDocHostUIHandler interface is used for par-ticular processor is registered to object registry by the DOM processor adopting, realize that IElementBehaviorFactory and IElementBehavior interface are used for illustrating that concrete customized treatment realizes.
When step 3, page creation, MSHTML can call the GetHostInfo method of IDocHostUIHandler, and client-side program provides page elements TAG and corresponding Behavior Name to MSHTML
Annotate: MSHTML is corresponding to core engine, and this step is inquired about all DOM object handler tabulations corresponding to the DOM processor.
When step 4, page loading, the Behavior Name that provide more than the basis is provided MSHTML, calls one by one the FindBehavior method of IElementBehaviorFactory, provides the IElementBehavior Interface realization by client.
Herein, preferred,, and the corresponding interface IElementBehaviorSite that provides with the page is related, to determine whether the customization behavior.
If step 5 client provides the IElementBehavior realization, MSHTML calls element behavior Notification Method when loading the page elements of corresponding TAG, the stress state of notice customer terminal webpage element.
Annotate: element behavior Notification Method is realized utilizing IElementBehavior::Notify in IE.
Wherein, it should be noted that step 4 and step 5 are looked into corresponding to the DOM processor calls corresponding DOM object handler the DOM object is processed.
The method of present embodiment is not only for the IE browser, and for other browsers, its implementation is similar.
Preferably, the DOM object of mentioning in the various embodiments described above comprises text box element, Password Input frame element.Certainly, the DOM object not only comprises above-mentioned two kinds of elements, and other web page element all can be realized.Now describe as an example of the text box element example.
Embodiment two
For the Textarea(text box) units of pages, the input frame of a large amount of literal of input in webpage is provided for the user, but under current webpage presentation mode, the user only can textarea in the simple literal of input, and can't input the contents such as the literal of subscribing form, image.And by providing at the browser place customization of textarea is played up, can be so that the content that input is enriched more in textarea.
Concrete operations for the text box element in this example provide corresponding explanation.
1, at first, carry out event definition, in the GetHostInfo of IDocHostUIHandler method, carry out self-defined to structure and the sign of browser.At the text box element div layer is set, utilizes the scheduling of pCSSBuffer pointer, the operation that will be referred to the text box element all is pulled on the div layer to be carried out.
2, in the FindBehavior method of IElementBehaviorFactory, return the realization object CTextAreaElementBehavior of IElementBehavior, and preserve the IElementBehaviorSite pointer to object that MSHTML provides.
When 3, MSHTML calls text box element behavior notice (CTextAreaElementBehavior::Notify) method, the operation that relates to the text box element is implemented.
When loading the text box element of corresponding TAG, call element behavior Notification Method, the stress state of notice client text box element.At the div layer content in the text box element is processed, this processing relate to the width of adjusting the text box element content, highly, result of broadcast etc.
After the processing of div layer finishes, the treatment effect of the content of text box element and div layer is overlapping, the effect after overlapping is presented to the user.
Use the embodiment of the invention can realize utilizing browser to carry out the method that page elements (text box element) is processed, realize user's personalized customization, improve user's impression and experience.
Adopt apparatus and method provided by the invention, can reach following beneficial effect:
In embodiments of the present invention, for each DOM object, in the browser side DOM object handler of it being carried out customized treatment is set, in the acquisition process of the page, the customized treatment that the DOM object handler of utilizing the DOM processor to call selection arranges the DOM object.This shows, the device that the browsing device net page element that adopts the embodiment of the invention to provide is processed, can process for each DOM object respectively, the mode of its processing is to carry out Selection and call by the DOM processor, the web page contents that presents thus can be realized the personalized customization processing, and be not to be according to the desired fixed form of network application and Information Provider, and then realized the purpose that the user can carry out personalized customization to content that web browser presents, satisfy different users' preference, improve user's impression and experience.
Intrinsic not relevant with any certain computer, virtual system or miscellaneous equipment with demonstration at this algorithm that provides.Various general-purpose systems also can be with using based on the teaching at this.According to top description, it is apparent constructing the desired structure of this type systematic.In addition, the present invention is not also for any certain programmed language.Should be understood that and to utilize various programming languages to realize content of the present invention described here, and the top description that language-specific is done is in order to disclose preferred forms of the present invention.
In the instructions that provides herein, a large amount of details have been described.Yet, can understand, embodiments of the invention can be put into practice in the situation of these details not having.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand one or more in each inventive aspect, in the description to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes in the above.Yet the method for the disclosure should be construed to the following intention of reflection: namely the present invention for required protection requires the more feature of feature clearly put down in writing than institute in each claim.Or rather, as following claims reflected, inventive aspect was to be less than all features of the disclosed single embodiment in front.Therefore, follow claims of embodiment and incorporate clearly thus this embodiment into, wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and can adaptively change and they are arranged in one or more equipment different from this embodiment the module in the equipment among the embodiment.Can be combined into a module or unit or assembly to the module among the embodiment or unit or assembly, and can be divided into a plurality of submodules or subelement or sub-component to them in addition.In such feature and/or process or unit at least some are mutually repelling, and can adopt any combination to disclosed all features in this instructions (comprising claim, summary and the accompanying drawing followed) and so all processes or the unit of disclosed any method or equipment make up.Unless in addition clearly statement, disclosed each feature can be by providing identical, being equal to or the alternative features of similar purpose replaces in this instructions (comprising claim, summary and the accompanying drawing followed).
In addition, those skilled in the art can understand, although embodiment more described herein comprise some feature rather than further feature included among other embodiment, the combination of the feature of different embodiment means and is within the scope of the present invention and forms different embodiment.For example, in the following claims, the one of any of embodiment required for protection can be used with array mode arbitrarily.
All parts embodiment of the present invention can realize with hardware, perhaps realizes with the software module of moving at one or more processor, and perhaps the combination with them realizes.It will be understood by those of skill in the art that and to use in practice microprocessor or digital signal processor (DSP) to realize according to some or all some or repertoire of parts in the page elements treating apparatus of the embodiment of the invention.The present invention can also be embodied as be used to part or all equipment or the device program (for example, computer program and computer program) of carrying out method as described herein.Such realization program of the present invention can be stored on the computer-readable medium, perhaps can have the form of one or more signal.Such signal can be downloaded from internet website and obtain, and perhaps provides at carrier signal, perhaps provides with any other form.
It should be noted above-described embodiment the present invention will be described rather than limit the invention, and those skilled in the art can design alternative embodiment in the situation of the scope that does not break away from claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and is not listed in element or step in the claim.Being positioned at word " " before the element or " one " does not get rid of and has a plurality of such elements.The present invention can realize by means of the hardware that includes some different elements and by means of the computing machine of suitably programming.In having enumerated the unit claim of some devices, several in these devices can be to come imbody by same hardware branch.The use of word first, second and C grade does not represent any order.Can be title with these word explanations.