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

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

Issue 2654843004: Fix shouldPaint issue when a composited floating iframe becomes non-self-painting (Closed)
Patch Set: Rename setAncestorShouldPaintFloatingObject to updateAncestorShouldPaintFloatingObject Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | no next file » | 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
3 * reserved. 3 * 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 m_needsPaintPhaseDescendantOutlines(false), 150 m_needsPaintPhaseDescendantOutlines(false),
151 m_previousPaintPhaseDescendantOutlinesWasEmpty(false), 151 m_previousPaintPhaseDescendantOutlinesWasEmpty(false),
152 m_needsPaintPhaseFloat(false), 152 m_needsPaintPhaseFloat(false),
153 m_previousPaintPhaseFloatWasEmpty(false), 153 m_previousPaintPhaseFloatWasEmpty(false),
154 m_needsPaintPhaseDescendantBlockBackgrounds(false), 154 m_needsPaintPhaseDescendantBlockBackgrounds(false),
155 m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty(false), 155 m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty(false),
156 m_hasDescendantWithClipPath(false), 156 m_hasDescendantWithClipPath(false),
157 m_hasNonIsolatedDescendantWithBlendMode(false), 157 m_hasNonIsolatedDescendantWithBlendMode(false),
158 m_hasAncestorWithClipPath(false), 158 m_hasAncestorWithClipPath(false),
159 m_hasRootScrollerAsDescendant(false), 159 m_hasRootScrollerAsDescendant(false),
160 m_selfPaintingStatusChanged(false),
160 m_layoutObject(layoutObject), 161 m_layoutObject(layoutObject),
161 m_parent(0), 162 m_parent(0),
162 m_previous(0), 163 m_previous(0),
163 m_next(0), 164 m_next(0),
164 m_first(0), 165 m_first(0),
165 m_last(0), 166 m_last(0),
166 m_staticInlinePosition(0), 167 m_staticInlinePosition(0),
167 m_staticBlockPosition(0), 168 m_staticBlockPosition(0),
168 m_ancestorOverflowLayer(nullptr) { 169 m_ancestorOverflowLayer(nullptr) {
169 updateStackingNode(); 170 updateStackingNode();
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 } else { 1510 } else {
1510 // The ancestor layer is also inside the pagination layer, so we need to 1511 // The ancestor layer is also inside the pagination layer, so we need to
1511 // subtract the visual distance from the ancestor layer to the pagination 1512 // subtract the visual distance from the ancestor layer to the pagination
1512 // layer. 1513 // layer.
1513 offset.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)); 1514 offset.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer));
1514 } 1515 }
1515 return offset; 1516 return offset;
1516 } 1517 }
1517 1518
1518 void PaintLayer::didUpdateNeedsCompositedScrolling() { 1519 void PaintLayer::didUpdateNeedsCompositedScrolling() {
1519 bool wasSelfPaintingLayer = isSelfPaintingLayer();
1520 updateSelfPaintingLayer(); 1520 updateSelfPaintingLayer();
1521
1522 // If the floating object becomes non-self-painting, so some ancestor should
1523 // paint it; if it becomes self-painting, it should paint itself and no
1524 // ancestor should paint it.
1525 if (wasSelfPaintingLayer != isSelfPaintingLayer() &&
1526 m_layoutObject->isFloating())
1527 LayoutBlockFlow::setAncestorShouldPaintFloatingObject(*layoutBox());
1528 } 1521 }
1529 1522
1530 void PaintLayer::updateStackingNode() { 1523 void PaintLayer::updateStackingNode() {
1531 DCHECK(!m_stackingNode); 1524 DCHECK(!m_stackingNode);
1532 if (requiresStackingNode()) 1525 if (requiresStackingNode())
1533 m_stackingNode = WTF::makeUnique<PaintLayerStackingNode>(this); 1526 m_stackingNode = WTF::makeUnique<PaintLayerStackingNode>(this);
1534 else 1527 else
1535 m_stackingNode = nullptr; 1528 m_stackingNode = nullptr;
1536 } 1529 }
1537 1530
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 LayoutRect childLocalRect(localRect); 2779 LayoutRect childLocalRect(localRect);
2787 childLayer->convertToLayerCoords(this, childOffset); 2780 childLayer->convertToLayerCoords(this, childOffset);
2788 childLocalRect.moveBy(-childOffset); 2781 childLocalRect.moveBy(-childOffset);
2789 2782
2790 if (childLayer->backgroundIsKnownToBeOpaqueInRect(childLocalRect)) 2783 if (childLayer->backgroundIsKnownToBeOpaqueInRect(childLocalRect))
2791 return true; 2784 return true;
2792 } 2785 }
2793 return false; 2786 return false;
2794 } 2787 }
2795 2788
2796 bool PaintLayer::isSelfPaintingLayerForIntrinsicOrScrollingReasons() const {
2797 return layoutObject()->layerTypeRequired() == NormalPaintLayer ||
2798 (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) ||
2799 needsCompositedScrolling();
2800 }
2801
2802 bool PaintLayer::shouldBeSelfPaintingLayer() const { 2789 bool PaintLayer::shouldBeSelfPaintingLayer() const {
2803 if (layoutObject()->isLayoutPart() && 2790 if (layoutObject()->isLayoutPart() &&
2804 toLayoutPart(layoutObject())->requiresAcceleratedCompositing()) 2791 toLayoutPart(layoutObject())->requiresAcceleratedCompositing())
2805 return true; 2792 return true;
2806 return isSelfPaintingLayerForIntrinsicOrScrollingReasons();
2807 }
2808 2793
2809 bool PaintLayer::isSelfPaintingOnlyBecauseIsCompositedPart() const { 2794 return layoutObject()->layerTypeRequired() == NormalPaintLayer ||
2810 return shouldBeSelfPaintingLayer() && 2795 (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) ||
2811 !isSelfPaintingLayerForIntrinsicOrScrollingReasons(); 2796 needsCompositedScrolling();
2812 } 2797 }
2813 2798
2814 void PaintLayer::updateSelfPaintingLayer() { 2799 void PaintLayer::updateSelfPaintingLayer() {
2815 bool isSelfPaintingLayer = shouldBeSelfPaintingLayer(); 2800 bool isSelfPaintingLayer = shouldBeSelfPaintingLayer();
2816 if (this->isSelfPaintingLayer() == isSelfPaintingLayer) 2801 if (this->isSelfPaintingLayer() == isSelfPaintingLayer)
2817 return; 2802 return;
2818 2803
2819 m_isSelfPaintingLayer = isSelfPaintingLayer; 2804 m_isSelfPaintingLayer = isSelfPaintingLayer;
2805 m_selfPaintingStatusChanged = true;
2820 2806
2821 if (PaintLayer* parent = this->parent()) { 2807 if (PaintLayer* parent = this->parent()) {
2822 parent->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 2808 parent->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
2823 2809
2824 if (PaintLayer* enclosingSelfPaintingLayer = 2810 if (PaintLayer* enclosingSelfPaintingLayer =
2825 parent->enclosingSelfPaintingLayer()) { 2811 parent->enclosingSelfPaintingLayer()) {
2826 if (isSelfPaintingLayer) 2812 if (isSelfPaintingLayer)
2827 mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer); 2813 mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer);
2828 else 2814 else
2829 enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this); 2815 enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this);
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3235 } 3221 }
3236 3222
3237 void showLayerTree(const blink::LayoutObject* layoutObject) { 3223 void showLayerTree(const blink::LayoutObject* layoutObject) {
3238 if (!layoutObject) { 3224 if (!layoutObject) {
3239 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3225 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3240 return; 3226 return;
3241 } 3227 }
3242 showLayerTree(layoutObject->enclosingLayer()); 3228 showLayerTree(layoutObject->enclosingLayer());
3243 } 3229 }
3244 #endif 3230 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698