Changeset 150355 in webkit
- Timestamp:
- May 19, 2013, 3:52:34 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150354 r150355 1 2013-05-19 Simon Fraser <simon.fraser@apple.com> 2 3 Change the terminology used by rendering code when painting a given node and its children from "paintingRoot" to "subtreePaintRoot" 4 https://bugs.webkit.org/show_bug.cgi?id=116417 5 6 Reviewed by Sam Weinig. 7 8 PaintInfo and RenderLayer code referred to a "paintingRoot". This is only set when 9 FrameView::setNodeToDraw() has been called and is used to restrict painting to 10 some part of the subtree, but it could easily be misinterpreted, and confused with 11 the "rootLayer" used by RenderLayer (which is usually not the layer associated with 12 the paintingRoot). 13 14 Change the terminology from "paintingRoot" to "subtreePaintRoot" root to make the 15 purpose of this variable more obvious. 16 17 No behavior change. 18 19 * page/FrameView.cpp: Add a comment for setNodeToDraw(); in future this should 20 be called setSubtreePaintRoot() or something. Not done in this patch to avoid 21 risk; this function is exported from WebCore. 22 * rendering/InlineFlowBox.cpp: 23 (WebCore::InlineFlowBox::paint): 24 * rendering/PaintInfo.h: 25 (WebCore::PaintInfo::PaintInfo): 26 (WebCore::PaintInfo::updateSubtreePaintRootForChildren): 27 (WebCore::PaintInfo::shouldPaintWithinRoot): 28 * rendering/RenderBlock.cpp: 29 (WebCore::RenderBlock::paintContents): 30 * rendering/RenderBox.cpp: 31 (WebCore::RenderBox::paint): 32 * rendering/RenderLayer.cpp: 33 (WebCore::RenderLayer::paint): 34 (WebCore::RenderLayer::paintOverlayScrollbars): 35 (WebCore::RenderLayer::paintLayerContents): 36 (WebCore::RenderLayer::paintLayerByApplyingTransform): 37 (WebCore::RenderLayer::paintBackgroundForFragments): 38 (WebCore::RenderLayer::paintForegroundForFragments): 39 (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase): 40 (WebCore::RenderLayer::paintOutlineForFragments): 41 (WebCore::RenderLayer::paintMaskForFragments): 42 * rendering/RenderLayer.h: 43 (WebCore::RenderLayer::LayerPaintingInfo::LayerPaintingInfo): 44 * rendering/RenderObject.cpp: Add a comment to recommend changing the name of 45 paintingRootRect() to refer to a subtree paint. Not done in this patch to avoid 46 risk; this function is exported from WebCore. 47 * rendering/RenderSnapshottedPlugIn.cpp: 48 (WebCore::RenderSnapshottedPlugIn::paint): 49 * rendering/RenderTable.cpp: 50 (WebCore::RenderTable::paintObject): 51 * rendering/svg/RenderSVGContainer.cpp: 52 (WebCore::RenderSVGContainer::paint): 53 1 54 2013-05-19 Darin Adler <darin@apple.com> 2 55 -
trunk/Source/WebCore/page/FrameView.cpp
r150307 r150355 3582 3582 } 3583 3583 3584 // FIXME: change this to use the subtreePaint terminology. 3584 3585 void FrameView::setNodeToDraw(Node* node) 3585 3586 { -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r150258 r150355 1142 1142 PaintInfo childInfo(paintInfo); 1143 1143 childInfo.phase = paintPhase; 1144 childInfo.update PaintingRootForChildren(renderer());1144 childInfo.updateSubtreePaintRootForChildren(renderer()); 1145 1145 1146 1146 // Paint our children. -
trunk/Source/WebCore/rendering/PaintInfo.h
r144350 r150355 55 55 struct PaintInfo { 56 56 PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, PaintBehavior newPaintBehavior, 57 RenderObject* new PaintingRoot = 0, RenderRegion* region = 0, ListHashSet<RenderInline*>* newOutlineObjects = 0,57 RenderObject* newSubtreePaintRoot = 0, RenderRegion* region = 0, ListHashSet<RenderInline*>* newOutlineObjects = 0, 58 58 OverlapTestRequestMap* overlapTestRequests = 0, const RenderLayerModelObject* newPaintContainer = 0) 59 59 : context(newContext) … … 61 61 , phase(newPhase) 62 62 , paintBehavior(newPaintBehavior) 63 , paintingRoot(newPaintingRoot)63 , subtreePaintRoot(newSubtreePaintRoot) 64 64 , renderRegion(region) 65 65 , outlineObjects(newOutlineObjects) … … 69 69 } 70 70 71 void update PaintingRootForChildren(const RenderObject* renderer)71 void updateSubtreePaintRootForChildren(const RenderObject* renderer) 72 72 { 73 if (! paintingRoot)73 if (!subtreePaintRoot) 74 74 return; 75 75 76 76 // If we're the painting root, kids draw normally, and see root of 0. 77 if ( paintingRoot == renderer) {78 paintingRoot = 0;77 if (subtreePaintRoot == renderer) { 78 subtreePaintRoot = 0; 79 79 return; 80 80 } … … 83 83 bool shouldPaintWithinRoot(const RenderObject* renderer) const 84 84 { 85 return ! paintingRoot || paintingRoot == renderer;85 return !subtreePaintRoot || subtreePaintRoot == renderer; 86 86 } 87 87 … … 113 113 PaintPhase phase; 114 114 PaintBehavior paintBehavior; 115 RenderObject* paintingRoot; // used to draw just one element and its visual kids115 RenderObject* subtreePaintRoot; // used to draw just one element and its visual children 116 116 RenderRegion* renderRegion; 117 117 ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r150155 r150355 3117 3117 PaintInfo paintInfoForChild(paintInfo); 3118 3118 paintInfoForChild.phase = newPhase; 3119 paintInfoForChild.update PaintingRootForChildren(this);3119 paintInfoForChild.updateSubtreePaintRootForChildren(this); 3120 3120 3121 3121 // FIXME: Paint-time pagination is obsolete and is now only used by embedded WebViews inside AppKit -
trunk/Source/WebCore/rendering/RenderBox.cpp
r150259 r150355 1031 1031 // default implementation. Just pass paint through to the children 1032 1032 PaintInfo childInfo(paintInfo); 1033 childInfo.update PaintingRootForChildren(this);1033 childInfo.updateSubtreePaintRootForChildren(this); 1034 1034 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) 1035 1035 child->paint(childInfo, adjustedPaintOffset); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r150349 r150355 3472 3472 } 3473 3473 3474 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot, RenderRegion* region, PaintLayerFlags paintFlags)3474 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot, RenderRegion* region, PaintLayerFlags paintFlags) 3475 3475 { 3476 3476 OverlapTestRequestMap overlapTestRequests; 3477 3477 3478 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot, region, &overlapTestRequests);3478 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), subtreePaintRoot, region, &overlapTestRequests); 3479 3479 paintLayer(context, paintingInfo, paintFlags); 3480 3480 … … 3484 3484 } 3485 3485 3486 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot)3486 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject* subtreePaintRoot) 3487 3487 { 3488 3488 if (!m_containsDirtyOverlayScrollbars) 3489 3489 return; 3490 3490 3491 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot);3491 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), subtreePaintRoot); 3492 3492 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 3493 3493 … … 3872 3872 #endif 3873 3873 3874 // If this layer's renderer is a child of the paintingRoot, we render unconditionally, which3875 // is done by passing a nil paintingRoot down to our renderer (as if no paintingRoot was ever set).3876 // Else, our renderer tree may or may not contain the paintingroot, so we pass that root along3874 // If this layer's renderer is a child of the subtreePaintRoot, we render unconditionally, which 3875 // is done by passing a nil subtreePaintRoot down to our renderer (as if no subtreePaintRoot was ever set). 3876 // Otherwise, our renderer tree may or may not contain the subtreePaintRoot root, so we pass that root along 3877 3877 // so it will be tested against as we descend through the renderers. 3878 RenderObject* paintingRootForRenderer = 0;3879 if (localPaintingInfo. paintingRoot && !renderer()->isDescendantOf(localPaintingInfo.paintingRoot))3880 paintingRootForRenderer = localPaintingInfo.paintingRoot;3878 RenderObject* subtreePaintRootForRenderer = 0; 3879 if (localPaintingInfo.subtreePaintRoot && !renderer()->isDescendantOf(localPaintingInfo.subtreePaintRoot)) 3880 subtreePaintRootForRenderer = localPaintingInfo.subtreePaintRoot; 3881 3881 3882 3882 if (localPaintingInfo.overlapTestRequests && isSelfPaintingLayer) … … 3906 3906 if (shouldPaintContent && !selectionOnly) 3907 3907 paintBackgroundForFragments(layerFragments, context, transparencyLayerContext, paintingInfo.paintDirtyRect, haveTransparency, 3908 localPaintingInfo, paintBehavior, paintingRootForRenderer);3908 localPaintingInfo, paintBehavior, subtreePaintRootForRenderer); 3909 3909 } 3910 3910 … … 3916 3916 if (shouldPaintContent) 3917 3917 paintForegroundForFragments(layerFragments, context, transparencyLayerContext, paintingInfo.paintDirtyRect, haveTransparency, 3918 localPaintingInfo, paintBehavior, paintingRootForRenderer, selectionOnly, forceBlackText);3918 localPaintingInfo, paintBehavior, subtreePaintRootForRenderer, selectionOnly, forceBlackText); 3919 3919 } 3920 3920 3921 3921 if (shouldPaintOutline) 3922 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintBehavior, paintingRootForRenderer);3922 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintBehavior, subtreePaintRootForRenderer); 3923 3923 3924 3924 if (isPaintingCompositedForeground) { … … 3945 3945 if ((localPaintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && renderer()->hasMask() && !selectionOnly) { 3946 3946 // Paint the mask for the fragments. 3947 paintMaskForFragments(layerFragments, context, localPaintingInfo, paintingRootForRenderer);3947 paintMaskForFragments(layerFragments, context, localPaintingInfo, subtreePaintRootForRenderer); 3948 3948 } 3949 3949 … … 3981 3981 // Now do a paint with the root layer shifted to be us. 3982 3982 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior, 3983 adjustedSubPixelAccumulation, paintingInfo. paintingRoot, paintingInfo.region, paintingInfo.overlapTestRequests);3983 adjustedSubPixelAccumulation, paintingInfo.subtreePaintRoot, paintingInfo.region, paintingInfo.overlapTestRequests); 3984 3984 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags); 3985 3985 } … … 4127 4127 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragments, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 4128 4128 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 4129 RenderObject* paintingRootForRenderer)4129 RenderObject* subtreePaintRootForRenderer) 4130 4130 { 4131 4131 for (size_t i = 0; i < layerFragments.size(); ++i) { … … 4146 4146 // Paint the background. 4147 4147 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 4148 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());4148 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseBlockBackground, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 4149 4149 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 4150 4150 … … 4156 4156 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragments, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 4157 4157 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 4158 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackText)4158 RenderObject* subtreePaintRootForRenderer, bool selectionOnly, bool forceBlackText) 4159 4159 { 4160 4160 // Begin transparency if we have something to paint. … … 4179 4179 // interleaving of the fragments to work properly. 4180 4180 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds, layerFragments, 4181 context, localPaintingInfo, localPaintBehavior, paintingRootForRenderer);4181 context, localPaintingInfo, localPaintBehavior, subtreePaintRootForRenderer); 4182 4182 4183 4183 if (!selectionOnly) { 4184 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, context, localPaintingInfo, localPaintBehavior, paintingRootForRenderer);4185 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragments, context, localPaintingInfo, localPaintBehavior, paintingRootForRenderer);4186 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragments, context, localPaintingInfo, localPaintBehavior, paintingRootForRenderer);4184 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, context, localPaintingInfo, localPaintBehavior, subtreePaintRootForRenderer); 4185 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragments, context, localPaintingInfo, localPaintBehavior, subtreePaintRootForRenderer); 4186 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragments, context, localPaintingInfo, localPaintBehavior, subtreePaintRootForRenderer); 4187 4187 } 4188 4188 … … 4192 4192 4193 4193 void RenderLayer::paintForegroundForFragmentsWithPhase(PaintPhase phase, const LayerFragments& layerFragments, GraphicsContext* context, 4194 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer)4194 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, RenderObject* subtreePaintRootForRenderer) 4195 4195 { 4196 4196 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1; … … 4204 4204 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect); 4205 4205 4206 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect.rect()), phase, paintBehavior, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());4206 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.foregroundRect.rect()), phase, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 4207 4207 if (phase == PaintPhaseForeground) 4208 4208 paintInfo.overlapTestRequests = localPaintingInfo.overlapTestRequests; … … 4215 4215 4216 4216 void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 4217 PaintBehavior paintBehavior, RenderObject* paintingRootForRenderer)4217 PaintBehavior paintBehavior, RenderObject* subtreePaintRootForRenderer) 4218 4218 { 4219 4219 for (size_t i = 0; i < layerFragments.size(); ++i) { … … 4223 4223 4224 4224 // Paint our own outline 4225 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.rect()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());4225 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.rect()), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 4226 4226 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.outlineRect, DoNotIncludeSelfForBorderRadius); 4227 4227 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)); … … 4231 4231 4232 4232 void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 4233 RenderObject* paintingRootForRenderer)4233 RenderObject* subtreePaintRootForRenderer) 4234 4234 { 4235 4235 for (size_t i = 0; i < layerFragments.size(); ++i) { … … 4243 4243 // Paint the mask. 4244 4244 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 4245 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());4245 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseMask, PaintBehaviorNormal, subtreePaintRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 4246 4246 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 4247 4247 -
trunk/Source/WebCore/rendering/RenderLayer.h
r150349 r150355 625 625 // front. The hitTest method looks for mouse events by walking 626 626 // layers that intersect the point from front to back. 627 void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* paintingRoot = 0,627 void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = PaintBehaviorNormal, RenderObject* subtreePaintRoot = 0, 628 628 RenderRegion* = 0, PaintLayerFlags = 0); 629 629 bool hitTest(const HitTestRequest&, HitTestResult&); 630 630 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&); 631 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot = 0);631 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* subtreePaintRoot = 0); 632 632 633 633 struct ClipRectsContext { … … 917 917 918 918 struct LayerPaintingInfo { 919 LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSubPixelAccumulation, RenderObject* in PaintingRoot = 0, RenderRegion*inRegion = 0, OverlapTestRequestMap* inOverlapTestRequests = 0)919 LayerPaintingInfo(RenderLayer* inRootLayer, const LayoutRect& inDirtyRect, PaintBehavior inPaintBehavior, const LayoutSize& inSubPixelAccumulation, RenderObject* inSubtreePaintRoot = 0, RenderRegion*inRegion = 0, OverlapTestRequestMap* inOverlapTestRequests = 0) 920 920 : rootLayer(inRootLayer) 921 , paintingRoot(inPaintingRoot)921 , subtreePaintRoot(inSubtreePaintRoot) 922 922 , paintDirtyRect(inDirtyRect) 923 923 , subPixelAccumulation(inSubPixelAccumulation) … … 928 928 { } 929 929 RenderLayer* rootLayer; 930 RenderObject* paintingRoot; // only paint descendants of this object930 RenderObject* subtreePaintRoot; // only paint descendants of this object 931 931 LayoutRect paintDirtyRect; // relative to rootLayer; 932 932 LayoutSize subPixelAccumulation; -
trunk/Source/WebCore/rendering/RenderObject.cpp
r150259 r150355 1237 1237 } 1238 1238 1239 // FIXME: change this to use the subtreePaint terminology 1239 1240 LayoutRect RenderObject::paintingRootRect(LayoutRect& topLevelRect) 1240 1241 { -
trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp
r149871 r150355 102 102 PaintInfo paintInfoForChild(paintInfo); 103 103 paintInfoForChild.phase = newPhase; 104 paintInfoForChild.update PaintingRootForChildren(this);104 paintInfoForChild.updateSubtreePaintRootForChildren(this); 105 105 106 106 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { -
trunk/Source/WebCore/rendering/RenderTable.cpp
r149550 r150355 654 654 PaintInfo info(paintInfo); 655 655 info.phase = paintPhase; 656 info.update PaintingRootForChildren(this);656 info.updateSubtreePaintRootForChildren(this); 657 657 658 658 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { -
trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp
r148536 r150355 139 139 140 140 if (continueRendering) { 141 childPaintInfo.update PaintingRootForChildren(this);141 childPaintInfo.updateSubtreePaintRootForChildren(this); 142 142 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) 143 143 child->paint(childPaintInfo, IntPoint());
Note:
See TracChangeset
for help on using the changeset viewer.