Invention content
The present invention is directed to solve at least some of the technical problems in related technologies.
For this purpose, an object of the present invention is to provide a kind of webpage exhibiting method, this method can be provided in browserRendering efficiency is improved during Night, reduces size of code.
It is another object of the present invention to propose a kind of webpage demonstration device.
In order to achieve the above objectives, the webpage exhibiting method that first aspect present invention embodiment proposes, including:Obtain browserPage elements in the webpage of loading;During the page elements are rendered, judging the background colour of the page elements isIt is no to belong to pre-set color, and when the background colour is the pre-set color, the background colour is changed, page member after being changedElement, and the background colour of page elements deepens before compared to modification after the modification;Show comprising page elements after the modificationWebpage.
The webpage exhibiting method that first aspect present invention embodiment proposes, by the way that the color of web page element is revised as depthColor can realize the Night of browser;Change the background colour of respective page element when rendering page elements, do not need to be slottingEnter scripted code and CSS codes, improve rendering efficiency.
Optionally, the process for rendering the page elements includes the drawing modification to the page elements, described to repairChange the background colour, including:
The color value that drafting function indicates used by the determining drawing modification to the page elements, the face of the instructionColor value is the color value of modified background colour;
The drafting function is called to carry out drawing modification to the element.
Optionally, the pre-set color all colours more shallow than pre-set color value for color value;Or the pre-set colorIncluding white.
Optionally, the modification background colour, including:
The background colour is revised as black.
Optionally, before whether the background colour for judging the page elements belongs to pre-set color, the method further includes:
Judge whether the browser has currently enabled Night, and judging result is has enabled Night.
Optionally, night module is enabled to the browser in the following way:
After receiving the instruction input by user for enabling Night, Night is enabled to the browser;
When current time belongs to preset time period, Night is enabled to the browser;
When current environment brightness value is less than predetermined luminance value, Night is enabled to the browser.
In order to achieve the above objectives, the webpage demonstration device that second aspect of the present invention embodiment proposes, including:Acquisition module,For obtaining the page elements in the webpage of browser loading;Processing module, for during the page elements are rendered,Judge whether the background colour of the page elements belongs to pre-set color, and when the background colour is the pre-set color, changeThe background colour, page elements after being changed, and the background colour of page elements deepens before compared to modification after the modification;ExhibitionExisting module, for showing the webpage for including page elements after the modification.
Optionally, the process for rendering the page elements includes the drawing modification to the page elements, the placeReason module is specifically used for:
The color value that drafting function indicates used by the determining drawing modification to the page elements, the face of the instructionColor value is the color value of modified background colour;
The drafting function is called to carry out drawing modification to the element.
Optionally, the pre-set color all colours more shallow than pre-set color value for color value;Or the pre-set colorIncluding white.
Optionally, the processing module is specifically used for:
The background colour is revised as black.
Optionally, described device further includes:
Judgment module, for judging whether the browser has currently enabled Night, and judging result is has enabledNight.
Optionally, night module is enabled to the browser in the following way:
After receiving the instruction input by user for enabling Night, Night is enabled to the browser;
When current time belongs to preset time period, Night is enabled to the browser;
When current environment brightness is less than predetermined luminance value, Night is enabled to the browser.
The webpage demonstration device that second aspect of the present invention embodiment proposes, by the way that the color of web page element is revised as depthColor can realize the Night of browser;Change the background colour of respective page element when rendering page elements, do not need to be slottingEnter scripted code and CSS codes, improve rendering efficiency.
In order to achieve the above objectives, the client device that third aspect present invention embodiment proposes, including:Housing, processor,Memory, circuit board and power circuit, wherein, circuit board is placed in the space interior that housing surrounds, and processor and memory are setIt puts on circuit boards;Power circuit, for powering for each circuit or device of client device;Memory is used to store and can holdLine program code;Processor is run and executable program code pair by reading the executable program code stored in memoryThe program answered, for performing:Obtain the page elements in the webpage of browser loading;In the process for rendering the page elementsIn, judge whether the background colour of the page elements belongs to pre-set color, and when the background colour is the pre-set color, repairChange the background colour, page elements after being changed, and the background colour of page elements deepens before compared to modification after the modification;Show the webpage for including page elements after the modification.
Optionally, the process for rendering the page elements includes the drawing modification to the page elements, described to repairChange the background colour, including:
The color value that drafting function indicates used by the determining drawing modification to the page elements, the face of the instructionColor value is the color value of modified background colour;
The drafting function is called to carry out drawing modification to the element.
Optionally, the pre-set color all colours more shallow than pre-set color value for color value;Or the pre-set colorIncluding white.
Optionally, the modification background colour, including:
The background colour is revised as black.
Optionally, before whether the background colour for judging the page elements belongs to pre-set color, the method further includes:
Judge whether the browser has currently enabled Night, and judging result is has enabled Night.
Optionally, night module is enabled to the browser in the following way:
After receiving the instruction input by user for enabling Night, Night is enabled to the browser;
When current time belongs to preset time period, Night is enabled to the browser;
When current environment brightness value is less than predetermined luminance value, Night is enabled to the browser.
The client device that third aspect present invention embodiment proposes, by the way that the color of web page element is revised as dark color,It can realize the Night of browser;Change the background colour of respective page element when rendering page elements, do not need to be inserted intoScripted code and CSS codes improve rendering efficiency.
The additional aspect of the present invention and advantage will be set forth in part in the description, and will partly become from the following descriptionIt obtains significantly or is recognized by the practice of the present invention.
Specific embodiment
The embodiment of the present invention is described below in detail, the example of the embodiment is shown in the drawings, wherein from beginning to endSame or similar label represents same or similar element or the element with same or like function.Below with reference to attachedThe embodiment of figure description is exemplary, and is only used for explaining the present invention, and is not considered as limiting the invention.On the contrary, thisThe embodiment of invention includes falling into all changes in the range of the spirit and intension of attached claims, modification and equivalentObject.
Fig. 1 is the flow diagram for the webpage exhibiting method that one embodiment of the invention proposes, this method includes:
S11:Obtain the page elements in the webpage of browser loading.
Wherein, the executive agent of the present embodiment can refer to browser kernel, can be specifically the rendering of browser kernelModule.
When browser loads webpage, browser can obtain the page elements (element) in the webpage from server.
S12:During the page elements are rendered, judge whether the background colour of the page elements belongs to default faceColor, and when the background colour is the pre-set color, change the background colour, page elements after being changed, and described repairThe background colour for changing rear page elements deepens before compared to modification.
Wherein, when rendering, referring to Fig. 2, a page elements (element) corresponds to a document node (domNode), in general, a dom node corresponds to a rendering objects (RenderObject).Browser kernel is to screen drawingIt is preceding all to call drafting (paint) function that a rendering layer (RenderLayer) is signed in the corresponding regions of RenderObjectIn.
Specifically, the process for rendering the page elements includes the drawing modification to the page elements, it is described to repairChange the background colour, including:
The color value that drafting function indicates used by the determining drawing modification to the page elements, the face of the instructionColor value is the color value of modified background colour;
The drafting function is called to carry out drawing modification to the element.
Preset color can include a kind of color or at least two colors.The present embodiment is white with preset colorFor.Therefore, it is possible to judge that whether the background colour of page elements is white.
Similar, modified color value can be preset, when changing background colour, the color value for changing back scenery is setFor preset modified color value.Preset modified color can specifically refer to black.
S13:Show the webpage for including page elements after the modification.
Page elements after modification background colour can be plotted to the page by browser kernel by calling paint functionsPosition where element can be presented in webpage later.
Optionally, the present embodiment can carry out after Night is enabled, that is, referring to Fig. 3, may be used also before S11To include:
S10:Judge whether to enable Night, if so, performing S11 and its subsequent step, otherwise, perform S14.
When the present embodiment can be particularly applicable in Night, thus can with it is first determined whether enable Night, withJust processing shown in FIG. 1 is carried out when starting Night.
User is browser is used when in night, can be very dazzling since most of page is all white background, forNight, browser often provide that a function is dimmed white background, this function is commonly referred to as Night.
Specifically, whether browser kernel can be triggered to judge whether to enable night according to the function of providing NightBetween pattern.
Wherein, the Night that enables includes at least one in following item:
After receiving the instruction input by user for enabling Night, Night is enabled to the browser;It is for example, rightThe function setting switch of Night should be provided, when user's selection is opened, enable Night;
When current time belongs to preset time period, Night is enabled to the browser;Night is enabled for example, pre-settingBetween pattern period, browser enable after can detect current time, if current time opens within the preset periodUse Night;
When current environment brightness is less than predetermined luminance value, Night is enabled to the browser;For example, default setting is brightAngle value, browser can detect current environment brightness value after enabling, if current environment brightness value is less than predetermined luminance value, openDynamic Night.
S14:Normal processing.
Specifically, when user does not select Night, webpage loading is carried out according to the scene of normal day modeWith show, do not need to modification background color value.
In the present embodiment, the color of web page element is revised as dark color, can realize the Night of browser;It is renderingChange the background colour of web page element during page elements, do not need to be inserted into scripted code and CSS codes, size of code can be reduced, carriedHigh rendering efficiency;In addition, the present embodiment can be specifically to the background of page elements in the drawing modification included in render processColor is modified, due to just needing specific context color originally when drawing, when drawing, change background colour may not need speciallyThe background colour of each page elements of additional modifications can further reduce workload and improve rendering efficiency.
Fig. 4 is the structure diagram for the webpage demonstration device that another embodiment of the present invention proposes, which includes obtainingModule 41, processing module 42 and display module 43.
Specifically, the device 40 can be located at browser kernel, can be specifically the rendering module of browser kernel.
Acquisition module 41 is used for the page elements in the webpage for obtaining browser loading;
When browser loads webpage, browser can obtain the page elements (element) in the webpage from server.
Processing module 42 be used to during the page elements are rendered, judging the page elements background colour whetherBelong to pre-set color, and when the background colour is the pre-set color, change the background colour, page member after being changedElement, and the background colour of page elements deepens before compared to modification after the modification;
Wherein, when rendering, referring to Fig. 2, a page elements (element) corresponds to a document node (domNode), in general, a dom node corresponds to a rendering objects (RenderObject).Browser kernel is to screen drawingIt is preceding all to call drafting (paint) function that a rendering layer (RenderLayer) is signed in the corresponding regions of RenderObjectIn.
Optionally, the process for rendering the page elements includes the drawing modification to the page elements, the placeReason module 42 is specifically used for:
The color value that drafting function indicates used by the determining drawing modification to the page elements, the face of the instructionColor value is the color value of modified background colour;
The drafting function is called to carry out drawing modification to the element.
Optionally, preset color can include a kind of color or at least two colors.The present embodiment is with preset faceFor color is white.Therefore, processing module may determine that whether the background colour of page elements is white.
Similar, the color value for belonging to dark can be preset, when changing background colour, the color value of back scenery will be changedIt is set as preset modified color value.Preset modified color can specifically refer to black.
Display module 43 is used to show the webpage for including page elements after the modification.
Page elements after modification background colour can be plotted to the page by browser kernel by calling paint functionsPosition where element can be presented in webpage later.
Optionally, the present embodiment can carry out after user selects Night, i.e., referring to Fig. 5, the present embodiment is alsoIt can include judgment module 44, it is shown in Fig. 4 to be used after Night is enabled for judging whether to enable NightModule performs respective handling.On the other hand, it when not having to enable Night, can normally handle.Specifically, when user does not haveWhen selecting Night, carry out webpage loading according to the scene of normal day mode and show, do not need to the face of modification backgroundColor value.
Wherein, the Night that enables includes at least one in following item:
After receiving the instruction input by user for enabling Night, Night is enabled to the browser;It is for example, rightThe function setting switch of Night should be provided, when user's selection is opened, enable Night;
When current time belongs to preset time period, Night is enabled to the browser;Night is enabled for example, pre-settingBetween pattern period, browser enable after can detect current time, if current time opens within the preset periodUse Night;
When current environment brightness is less than predetermined luminance value, Night is enabled to the browser;For example, default setting is brightAngle value, browser can detect current environment brightness value after enabling, if current environment brightness value is less than predetermined luminance value, openDynamic Night.
In the present embodiment, the color of web page element is revised as dark color, can realize the Night of browser;It is renderingChange the background colour of web page element during page elements, do not need to be inserted into scripted code and CSS codes, size of code can be reduced, carriedHigh rendering efficiency;In addition, the present embodiment can be specifically to the background of page elements in the drawing modification included in render processColor is modified, due to just needing specific context color originally when drawing, when drawing, change background colour may not need speciallyThe background colour of each page elements of additional modifications can further reduce workload and improve rendering efficiency.
The embodiment of the present invention additionally provides a kind of client device, which includes housing, processor, storageDevice, circuit board and power circuit, wherein, circuit board is placed in the space interior that housing surrounds, and processor and memory are arranged onOn circuit board;Power circuit, for powering for each circuit or device of client device;Memory is used to store executable journeySequence code;Processor is corresponding with executable program code to run by reading the executable program code stored in memoryProgram, for performing:
S11’:Obtain the page elements in the webpage of browser loading.
When browser loads webpage, browser can obtain the page elements (element) in the webpage from server.
S12’:During the page elements are rendered, judge whether the background colour of the page elements belongs to defaultColor, and when the background colour is the pre-set color, the background colour is changed, page elements after being changed, and it is describedThe background colour of page elements deepens before compared to modification after modification.
Wherein, when rendering, referring to Fig. 2, a page elements (element) corresponds to a document node (domNode), in general, a dom node corresponds to a rendering objects (RenderObject).Browser kernel is to screen drawingIt is preceding all to call drafting (paint) function that a rendering layer (RenderLayer) is signed in the corresponding regions of RenderObjectIn.
Specifically, the process for rendering the page elements includes the drawing modification to the page elements, it is described to repairChange the background colour, including:
The color value that drafting function indicates used by the determining drawing modification to the page elements, the face of the instructionColor value is the color value of modified background colour;
The drafting function is called to carry out drawing modification to the element.
Preset color can include a kind of color or at least two colors.The present embodiment is white with preset colorFor.Therefore, it is possible to judge that whether the background colour of page elements is white.
Similar, modified color value can be preset, when changing background colour, the color value for changing back scenery is setFor preset modified color value.Preset modified color can specifically refer to black.
S13’:Show the webpage for including page elements after the modification.
Page elements after modification background colour can be plotted to the page by browser kernel by calling paint functionsPosition where element can be presented in webpage later.
Optionally, the present embodiment can carry out after Night is enabled, that is, can also include before S11 ':
S10’:Judge whether to enable Night, if so, performing S11 ' and its subsequent step, otherwise, perform S14 '.
When the present embodiment can be particularly applicable in Night, thus can with it is first determined whether enable Night, withJust processing shown in FIG. 1 is carried out when enabling Night.
User is browser is used when in night, can be very dazzling since most of page is all white background, forNight, browser often provide that a function is dimmed white background, this function is commonly referred to as Night.
Specifically, whether browser kernel can be triggered to judge whether to enable night according to the function of providing NightBetween pattern.
Wherein, the Night that enables includes at least one in following item:
After receiving the instruction input by user for enabling Night, Night is enabled to the browser;It is for example, rightThe function setting switch of Night should be provided, when user's selection is opened, enable Night;
When current time belongs to preset time period, Night is enabled to the browser;Night is enabled for example, pre-settingBetween pattern period, browser enable after can detect current time, if current time opens within the preset periodUse Night;
When current environment brightness is less than predetermined luminance value, Night is enabled to the browser;For example, default setting is brightAngle value, browser can detect current environment brightness value after enabling, if current environment brightness value is less than predetermined luminance value, openDynamic Night.
S14’:Normal processing.
Specifically, when user does not select Night, webpage loading is carried out according to the scene of normal day modeWith show, do not need to modification background color value.
In the present embodiment, the color of web page element is revised as dark color, can realize the Night of browser;It is renderingChange the background colour of web page element during page elements, do not need to be inserted into scripted code and CSS codes, size of code can be reduced, carriedHigh rendering efficiency;In addition, the present embodiment can be specifically to the background of page elements in the drawing modification included in render processColor is modified, due to just needing specific context color originally when drawing, when drawing, change background colour may not need speciallyThe background colour of each page elements of additional modifications can further reduce workload and improve rendering efficiency.
It should be noted that in the description of the present invention, term " first ", " second " etc. are only used for description purpose, withoutIt is understood that indicate or implying relative importance.In addition, in the description of the present invention, unless otherwise indicated, the meaning of " multiple "It is two or more.
Any process described otherwise above or method description are construed as in flow chart or herein, represent to includeModule, segment or the portion of the code of the executable instruction of one or more the step of being used to implement specific logical function or processPoint, and the range of the preferred embodiment of the present invention includes other realization, wherein can not press shown or discuss suitableSequence, including according to involved function by it is basic simultaneously in the way of or in the opposite order, to perform function, this should be of the inventionEmbodiment person of ordinary skill in the field understood.
It should be appreciated that each section of the present invention can be realized with hardware, software, firmware or combination thereof.Above-mentionedIn embodiment, software that multiple steps or method can in memory and by suitable instruction execution system be performed with storageOr firmware is realized.If for example, with hardware come realize in another embodiment, can be under well known in the artAny one of row technology or their combination are realized:With for the logic gates to data-signal realization logic functionDiscrete logic, have suitable combinational logic gate circuit application-specific integrated circuit, programmable gate array (PGA), sceneProgrammable gate array (FPGA) etc..
Those skilled in the art are appreciated that realize all or part of step that above-described embodiment method carriesSuddenly it is that relevant hardware can be instructed to complete by program, the program can be stored in a kind of computer-readable storage mediumIn matter, the program when being executed, one or a combination set of the step of including embodiment of the method.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing module, it can alsoThat each unit is individually physically present, can also two or more units be integrated in a module.Above-mentioned integrated mouldThe form that hardware had both may be used in block is realized, can also be realized in the form of software function module.The integrated module is such asFruit is realized in the form of software function module and is independent product sale or in use, can also be stored in a computerIn read/write memory medium.
Storage medium mentioned above can be read-only memory, disk or CD etc..
In the description of this specification, reference term " one embodiment ", " example ", " is specifically shown " some embodiments "The description of example " or " some examples " etc. means specific features, structure, material or the spy for combining the embodiment or example descriptionPoint is contained at least one embodiment of the present invention or example.In the present specification, schematic expression of the above terms are notCentainly refer to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described can be anyOne or more embodiments or example in combine in an appropriate manner.
Although the embodiments of the present invention has been shown and described above, it is to be understood that above-described embodiment is exampleProperty, it is impossible to limitation of the present invention is interpreted as, those of ordinary skill in the art within the scope of the invention can be to above-mentionedEmbodiment is changed, changes, replacing and modification.