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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.h

Issue 1892473002: Update PaintLayer::needsPaintPhaseXXX flags when add/remove layer on style change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 PaintLayer* firstChild() const { return m_first; } 224 PaintLayer* firstChild() const { return m_first; }
225 PaintLayer* lastChild() const { return m_last; } 225 PaintLayer* lastChild() const { return m_last; }
226 226
227 // TODO(wangxianzhu): Find a better name for it. 'paintContainer' might be g ood but 227 // TODO(wangxianzhu): Find a better name for it. 'paintContainer' might be g ood but
228 // we can't use it for now because it conflicts with PaintInfo::paintContain er. 228 // we can't use it for now because it conflicts with PaintInfo::paintContain er.
229 PaintLayer* compositingContainer() const; 229 PaintLayer* compositingContainer() const;
230 230
231 void addChild(PaintLayer* newChild, PaintLayer* beforeChild = 0); 231 void addChild(PaintLayer* newChild, PaintLayer* beforeChild = 0);
232 PaintLayer* removeChild(PaintLayer*); 232 PaintLayer* removeChild(PaintLayer*);
233 233
234 void removeOnlyThisLayer(); 234 void removeOnlyThisLayerAfterStyleChange();
235 void insertOnlyThisLayer(); 235 void insertOnlyThisLayerAfterStyleChange();
236 236
237 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle); 237 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle);
238 238
239 // FIXME: Many people call this function while it has out-of-date informatio n. 239 // FIXME: Many people call this function while it has out-of-date informatio n.
240 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; } 240 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; }
241 241
242 void setLayerType(PaintLayerType layerType) { m_layerType = layerType; ASSER T(static_cast<PaintLayerType>(m_layerType) == layerType); } 242 void setLayerType(PaintLayerType layerType) { m_layerType = layerType; ASSER T(static_cast<PaintLayerType>(m_layerType) == layerType); }
243 243
244 bool isTransparent() const { return layoutObject()->isTransparent() || layou tObject()->style()->hasBlendMode() || layoutObject()->hasMask(); } 244 bool isTransparent() const { return layoutObject()->isTransparent() || layou tObject()->style()->hasBlendMode() || layoutObject()->hasMask(); }
245 245
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 void setPreviousPaintingClipRects(ClipRects& clipRects) { m_previousPainting ClipRects = &clipRects; } 653 void setPreviousPaintingClipRects(ClipRects& clipRects) { m_previousPainting ClipRects = &clipRects; }
654 654
655 LayoutRect previousPaintDirtyRect() const { return m_previousPaintDirtyRect; } 655 LayoutRect previousPaintDirtyRect() const { return m_previousPaintDirtyRect; }
656 void setPreviousPaintDirtyRect(const LayoutRect& rect) { m_previousPaintDirt yRect = rect; } 656 void setPreviousPaintDirtyRect(const LayoutRect& rect) { m_previousPaintDirt yRect = rect; }
657 657
658 PaintLayerPainter::PaintResult previousPaintResult() const { return static_c ast<PaintLayerPainter::PaintResult>(m_previousPaintResult); } 658 PaintLayerPainter::PaintResult previousPaintResult() const { return static_c ast<PaintLayerPainter::PaintResult>(m_previousPaintResult); }
659 void setPreviousPaintResult(PaintLayerPainter::PaintResult result) { m_previ ousPaintResult = static_cast<unsigned>(result); ASSERT(m_previousPaintResult == static_cast<unsigned>(result)); } 659 void setPreviousPaintResult(PaintLayerPainter::PaintResult result) { m_previ ousPaintResult = static_cast<unsigned>(result); ASSERT(m_previousPaintResult == static_cast<unsigned>(result)); }
660 660
661 // Used to skip PaintPhaseDescendantOutlinesOnly for layers that have never had descendant outlines. 661 // Used to skip PaintPhaseDescendantOutlinesOnly for layers that have never had descendant outlines.
662 // Once it's set we never clear it because it's not easy to track if all out lines have been removed. 662 // Once it's set we never clear it because it's not easy to track if all out lines have been removed.
663 // For more details, see core/paint/REAME.md#Empty paint phase optimization.
663 bool needsPaintPhaseDescendantOutlines() const { return m_needsPaintPhaseDes cendantOutlines; } 664 bool needsPaintPhaseDescendantOutlines() const { return m_needsPaintPhaseDes cendantOutlines; }
664 void setNeedsPaintPhaseDescendantOutlines() { ASSERT(isSelfPaintingLayer()); m_needsPaintPhaseDescendantOutlines = true; } 665 void setNeedsPaintPhaseDescendantOutlines() { ASSERT(isSelfPaintingLayer()); m_needsPaintPhaseDescendantOutlines = true; }
665 666
666 // Similar to above, but for PaintPhaseFloat. 667 // Similar to above, but for PaintPhaseFloat.
667 bool needsPaintPhaseFloat() const { return m_needsPaintPhaseFloat; } 668 bool needsPaintPhaseFloat() const { return m_needsPaintPhaseFloat; }
668 void setNeedsPaintPhaseFloat() { ASSERT(isSelfPaintingLayer()); m_needsPaint PhaseFloat = true; } 669 void setNeedsPaintPhaseFloat() { ASSERT(isSelfPaintingLayer()); m_needsPaint PhaseFloat = true; }
669 670
670 bool needsPaintPhaseDescendantBlockBackgrounds() const { return m_needsPaint PhaseDescendantBlockBackgrounds; } 671 bool needsPaintPhaseDescendantBlockBackgrounds() const { return m_needsPaint PhaseDescendantBlockBackgrounds; }
671 void setNeedsPaintPhaseDescendantBlockBackgrounds() { ASSERT(isSelfPaintingL ayer()); m_needsPaintPhaseDescendantBlockBackgrounds = true; } 672 void setNeedsPaintPhaseDescendantBlockBackgrounds() { ASSERT(isSelfPaintingL ayer()); m_needsPaintPhaseDescendantBlockBackgrounds = true; }
672 673
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 756
756 void markCompositingContainerChainForNeedsRepaint(); 757 void markCompositingContainerChainForNeedsRepaint();
757 758
758 PaintLayerRareData& ensureRareData() 759 PaintLayerRareData& ensureRareData()
759 { 760 {
760 if (!m_rareData) 761 if (!m_rareData)
761 m_rareData = adoptPtr(new PaintLayerRareData); 762 m_rareData = adoptPtr(new PaintLayerRareData);
762 return *m_rareData; 763 return *m_rareData;
763 } 764 }
764 765
766 void mergeNeedsPaintPhaseFlagsFrom(const PaintLayer& layer)
767 {
768 m_needsPaintPhaseDescendantOutlines |= layer.m_needsPaintPhaseDescendant Outlines;
769 m_needsPaintPhaseFloat |= layer.m_needsPaintPhaseFloat;
770 m_needsPaintPhaseDescendantBlockBackgrounds |= layer.m_needsPaintPhaseDe scendantBlockBackgrounds;
771 }
772
765 unsigned m_layerType : 2; // PaintLayerType 773 unsigned m_layerType : 2; // PaintLayerType
766 774
767 // Self-painting layer is an optimization where we avoid the heavy Layer pai nting 775 // Self-painting layer is an optimization where we avoid the heavy Layer pai nting
768 // machinery for a Layer allocated only to handle the overflow clip case. 776 // machinery for a Layer allocated only to handle the overflow clip case.
769 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov erflow-only concept. 777 // FIXME(crbug.com/332791): Self-painting layer should be merged into the ov erflow-only concept.
770 unsigned m_isSelfPaintingLayer : 1; 778 unsigned m_isSelfPaintingLayer : 1;
771 779
772 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to 780 // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to
773 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells). 781 // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
774 mutable unsigned m_hasSelfPaintingLayerDescendant : 1; 782 mutable unsigned m_hasSelfPaintingLayerDescendant : 1;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 871
864 } // namespace blink 872 } // namespace blink
865 873
866 #ifndef NDEBUG 874 #ifndef NDEBUG
867 // Outside the WebCore namespace for ease of invocation from gdb. 875 // Outside the WebCore namespace for ease of invocation from gdb.
868 void showLayerTree(const blink::PaintLayer*); 876 void showLayerTree(const blink::PaintLayer*);
869 void showLayerTree(const blink::LayoutObject*); 877 void showLayerTree(const blink::LayoutObject*);
870 #endif 878 #endif
871 879
872 #endif // Layer_h 880 #endif // Layer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698