Not all Renderlayer need to create its backing Store, only the RenderObject tree of the Web page Renderlayer meet the following conditions:
1 Transform: Geometric transformations
2 Video: Page <video>
3 Canvas: Page <canvas>
4 Plugin
5 Frame
6 3DTransforms
7 Animation
8 FILTERS:CSS Filter
9 Positioning of Position:css
Clipscompositingdescendants: Crop area synthesized to descendants
NOTE:THIS Specifies whether the RL needs a compositing layer for intrinsic reasons.//use needstobecomposited () to Det Ermine if a RL actually needs a compositing layer.//staticbool renderlayercompositor::requirescompositinglayer (const Ren derlayer* layer) const{renderobject* renderer = Layer->renderer (); The compositing state of a reflection should match this of its reflected layer. if (Layer->isreflection ()) {renderer = Renderer->parent ();//The Renderreplica ' s parent is the object being Reflected. Layer = Torenderboxmodelobject (renderer)->layer (); }//The root layer always had a compositing layer, but it could not have backing. return Requirescompositingfortransform (renderer) | | Requirescompositingforvideo (renderer) | | Requirescompositingforcanvas (renderer) | | Requirescompositingforplugin (renderer) | | Requirescompositingforframe (renderer) | | (Canrender3dtransforms () && Renderer->style ()->backfacevisibility () = = Backfacevisibilityhidden) | | Clipscompositingdescendants (layer) | | Requirescompositingforanimation (renderer) | | Requirescompositingforfilters (renderer) | | Requirescompositingforposition (renderer, layer);}
Each time you create a DOM node, you find that the style is present or the style is changed, and WebKit creates the corresponding RenderObject node and sets its new style. At the same time, request to update the RenderObject node's father-the whole Renderlayer tree style, Renderlayer will update the status of the synthesizer.
Create a RenderObject and set a new style:
#8 Webcore::renderobject::setstyle (this=0xc16f18, style= ...) renderobject.cpp:1744
#9 Webcore::renderobject::setanimatablestyle (this=0xc16f18, style= ...) renderobject.cpp:1645
#10 Webcore::noderendererfactory::createrenderer (this)webcore/dom/noderenderingcontext.cpp:291
? #11 webcore::noderendererfactory::createrendererifneeded (THIS=0X7FFFFFFFCB50)noderenderingcontext.cpp:324
#12 webcore::node::createrendererifneeded (THIS=0XC0AA80) webcore/dom/node.cpp:1378
#13 Webcore::element::attach (THIS=0XC0AA80) at webkit/source/webcore/dom/element.cpp:941
#14 Webcore::executetask (task= ...) webcore/html/parser/htmlconstructionsite.cpp:102
#15 webcore::htmlconstructionsite::executequeuedtasks (this=) webcore/html/parser/htmlconstructionsite.cpp : 142
#16 Webcore::htmltreebuilder::constructtreefromatomictoken (this=0xc89840, token=) htmltreebuilder.cpp:475
#17 Webcore::htmltreebuilder::constructtreefromtoken (this=0xc89840, rawtoken= ...)
Update the box model:
#5 Renderboxmodelobject::styledidchange (This, diff=webcore::styledifferenceequal, Oldstyle) renderboxmodelobject.cpp:445
#6 Renderbox::styledidchange (This, diff=webcore::styledifferenceequal, oldstyle=0x0)renderbox.cpp:233
? #7 Webcore::renderblock::styledidchange (This=0xc16f18, diff=webcore::styledifferenceequal, oldStyle=0x0) renderblock.cpp:315
required to update the style of the whole Renderlayer tree:
#4 webcore::renderlayer::stylechanged (this=0xc3d838, oldstyle=0x0) webcore/rendering/renderlayer.cpp:4886
Renderlayer will update the status of the synthesizer:
#3 renderlayercompositor::updatelayercompositingstate (layer, shouldrepaint=Compositingchangerepaintnow )renderlayercompositor.cpp:558
and first update the back-end storage area:
#2 renderlayercompositor::updatebacking (layer,shouldrepaint=Compositingchangerepaintnow) renderlayercompositor.cpp:495
First check if you need back-end storage:
BOOL Renderlayercompositor::updatebacking (renderlayer* layer, Compositingchangerepaint shouldrepaint) {bool Layerchanged = false; if (<span style= "Background-color:rgb (51, 255, 51);" >needsToBeComposited</span> (layer)) {Enablecompositingmode (); if (!layer->backing ()) {//If we need to repaint, does so before making backing If (Shouldrepaint = = Compositingchangerepaintnow) repaintoncompositingchange (layer); Layer-><span style= "Background-color:rgb (51, 255, 51); >ensureBacking</span> (); The Renderlayer ' s needs to update repaint rects here, because the target//Repaintcontainer D after becoming a composited layer. https://bugs.webkit.org/show_bug.cgi?id=80641 if (layer->parent ()) Layer->computerepain Trects (); Layerchanged = true; }
To create a back-end store:
renderlayerbacking* renderlayer::<span style= "Background-color:rgb (51, 255, 51); >ensureBacking</span> () { if (!m_backing) { m_backing = adoptptr (new renderlayerbacking (this)); Compositor ()->layerbecamecomposited (this), #if ENABLE (css_filters) updateorremovefiltereffect (); #endif } return M_backing.get ();}
Here is my test page:
Creation of the backing Store (v)