Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: Source/core/rendering/RenderLayer.h

Issue 468633002: hasSelfPaintingLayerDescendant should clean m_hasSelfPaintingLayerDescendantDirty (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. 3 * Copyright (C) 2013 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const RenderLayer* compositingContainer() const; 107 const RenderLayer* compositingContainer() const;
108 108
109 void addChild(RenderLayer* newChild, RenderLayer* beforeChild = 0); 109 void addChild(RenderLayer* newChild, RenderLayer* beforeChild = 0);
110 RenderLayer* removeChild(RenderLayer*); 110 RenderLayer* removeChild(RenderLayer*);
111 111
112 void removeOnlyThisLayer(); 112 void removeOnlyThisLayer();
113 void insertOnlyThisLayer(); 113 void insertOnlyThisLayer();
114 114
115 void styleChanged(StyleDifference, const RenderStyle* oldStyle); 115 void styleChanged(StyleDifference, const RenderStyle* oldStyle);
116 116
117 // FIXME: Many people call this function while it has out-of-date informatio n.
117 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; } 118 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; }
118 119
119 void setLayerType(LayerType layerType) { m_layerType = layerType; } 120 void setLayerType(LayerType layerType) { m_layerType = layerType; }
120 121
121 bool isTransparent() const { return renderer()->isTransparent() || renderer( )->hasMask(); } 122 bool isTransparent() const { return renderer()->isTransparent() || renderer( )->hasMask(); }
122 RenderLayer* transparentPaintingAncestor(); 123 RenderLayer* transparentPaintingAncestor();
123 void beginTransparencyLayers(GraphicsContext*, const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, Paint Behavior); 124 void beginTransparencyLayers(GraphicsContext*, const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, Paint Behavior);
124 125
125 bool isReflection() const { return renderer()->isReplica(); } 126 bool isReflection() const { return renderer()->isReplica(); }
126 RenderLayerReflectionInfo* reflectionInfo() { return m_reflectionInfo.get(); } 127 RenderLayerReflectionInfo* reflectionInfo() { return m_reflectionInfo.get(); }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void dirtyVisibleContentStatus(); 180 void dirtyVisibleContentStatus();
180 void potentiallyDirtyVisibleContentStatus(EVisibility); 181 void potentiallyDirtyVisibleContentStatus(EVisibility);
181 182
182 bool hasBoxDecorationsOrBackground() const; 183 bool hasBoxDecorationsOrBackground() const;
183 bool hasVisibleBoxDecorations() const; 184 bool hasVisibleBoxDecorations() const;
184 // Returns true if this layer has visible content (ignoring any child layers ). 185 // Returns true if this layer has visible content (ignoring any child layers ).
185 bool isVisuallyNonEmpty() const; 186 bool isVisuallyNonEmpty() const;
186 // True if this layer container renderers that paint. 187 // True if this layer container renderers that paint.
187 bool hasNonEmptyChildRenderers() const; 188 bool hasNonEmptyChildRenderers() const;
188 189
189 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but we hit the same bugs as visible content above.
190 // Part of the issue is with subtree relayout: we don't check if our ancesto rs have some descendant flags dirty, missing some updates.
191 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD escendant; }
192
193 // Will ensure that hasNonCompositiedChild are up to date. 190 // Will ensure that hasNonCompositiedChild are up to date.
194 void updateScrollingStateAfterCompositingChange(); 191 void updateScrollingStateAfterCompositingChange();
195 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent; } 192 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent; }
196 bool hasNonCompositedChild() const { ASSERT(isAllowedToQueryCompositingState ()); return m_hasNonCompositedChild; } 193 bool hasNonCompositedChild() const { ASSERT(isAllowedToQueryCompositingState ()); return m_hasNonCompositedChild; }
197 194
198 bool usedTransparency() const { return m_usedTransparency; } 195 bool usedTransparency() const { return m_usedTransparency; }
199 196
200 // Gets the nearest enclosing positioned ancestor layer (also includes 197 // Gets the nearest enclosing positioned ancestor layer (also includes
201 // the <html> layer and the root layer). 198 // the <html> layer and the root layer).
202 RenderLayer* enclosingPositionedAncestor() const; 199 RenderLayer* enclosingPositionedAncestor() const;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, PaintLayerFlags, BorderRadiusClippingRule = IncludeSelfForBorderRadius); 534 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, PaintLayerFlags, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
538 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&); 535 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&);
539 536
540 void updateLayerPositionRecursive(); 537 void updateLayerPositionRecursive();
541 538
542 void setNextSibling(RenderLayer* next) { m_next = next; } 539 void setNextSibling(RenderLayer* next) { m_next = next; }
543 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } 540 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; }
544 void setFirstChild(RenderLayer* first) { m_first = first; } 541 void setFirstChild(RenderLayer* first) { m_first = first; }
545 void setLastChild(RenderLayer* last) { m_last = last; } 542 void setLastChild(RenderLayer* last) { m_last = last; }
546 543
544 void updateHasSelfPaintingLayerDescendant() const;
545
546 bool hasSelfPaintingLayerDescendant() const
547 {
548 if (m_hasSelfPaintingLayerDescendantDirty)
549 updateHasSelfPaintingLayerDescendant();
550 ASSERT(!m_hasSelfPaintingLayerDescendantDirty);
551 return m_hasSelfPaintingLayerDescendant;
552 }
553
547 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); } 554 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); }
548 555
549 void paintLayerContentsAndReflection(GraphicsContext*, const LayerPaintingIn fo&, PaintLayerFlags); 556 void paintLayerContentsAndReflection(GraphicsContext*, const LayerPaintingIn fo&, PaintLayerFlags);
550 void paintLayerByApplyingTransform(GraphicsContext*, const LayerPaintingInfo &, PaintLayerFlags, const LayoutPoint& translationOffset = LayoutPoint()); 557 void paintLayerByApplyingTransform(GraphicsContext*, const LayerPaintingInfo &, PaintLayerFlags, const LayoutPoint& translationOffset = LayoutPoint());
551 558
552 // Returns whether this layer should be painted during sofware painting (i.e ., not via calls from CompositedLayerMapping to draw into composited 559 // Returns whether this layer should be painted during sofware painting (i.e ., not via calls from CompositedLayerMapping to draw into composited
553 // layers). 560 // layers).
554 bool shouldPaintLayerInSoftwareMode(const LayerPaintingInfo&, PaintLayerFlag s paintFlags); 561 bool shouldPaintLayerInSoftwareMode(const LayerPaintingInfo&, PaintLayerFlag s paintFlags);
555 562
556 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPa intingInfo&, PaintLayerFlags); 563 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPa intingInfo&, PaintLayerFlags);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 645
639 LayerType m_layerType; 646 LayerType m_layerType;
640 647
641 // Self-painting layer is an optimization where we avoid the heavy RenderLay er painting 648 // Self-painting layer is an optimization where we avoid the heavy RenderLay er painting
642 // machinery for a RenderLayer allocated only to handle the overflow clip ca se. 649 // machinery for a RenderLayer allocated only to handle the overflow clip ca se.
643 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov erflow-only concept. 650 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov erflow-only concept.
644 unsigned m_isSelfPaintingLayer : 1; 651 unsigned m_isSelfPaintingLayer : 1;
645 652
646 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to 653 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to
647 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells). 654 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
648 unsigned m_hasSelfPaintingLayerDescendant : 1; 655 mutable unsigned m_hasSelfPaintingLayerDescendant : 1;
649 unsigned m_hasSelfPaintingLayerDescendantDirty : 1; 656 mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1;
650 657
651 const unsigned m_isRootLayer : 1; 658 const unsigned m_isRootLayer : 1;
652 659
653 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp arent layer, i.e., whether 660 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp arent layer, i.e., whether
654 // we ended up painting this layer or any desce ndants (and therefore need to 661 // we ended up painting this layer or any desce ndants (and therefore need to
655 // blend). 662 // blend).
656 663
657 unsigned m_visibleContentStatusDirty : 1; 664 unsigned m_visibleContentStatusDirty : 1;
658 unsigned m_hasVisibleContent : 1; 665 unsigned m_hasVisibleContent : 1;
659 unsigned m_visibleDescendantStatusDirty : 1; 666 unsigned m_visibleDescendantStatusDirty : 1;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 741
735 } // namespace blink 742 } // namespace blink
736 743
737 #ifndef NDEBUG 744 #ifndef NDEBUG
738 // Outside the WebCore namespace for ease of invocation from gdb. 745 // Outside the WebCore namespace for ease of invocation from gdb.
739 void showLayerTree(const blink::RenderLayer*); 746 void showLayerTree(const blink::RenderLayer*);
740 void showLayerTree(const blink::RenderObject*); 747 void showLayerTree(const blink::RenderObject*);
741 #endif 748 #endif
742 749
743 #endif // RenderLayer_h 750 #endif // RenderLayer_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698