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

Side by Side Diff: third_party/WebKit/Source/core/layout/FloatingObjects.cpp

Issue 2651253003: Revert of Fix shouldPaint issue when a composited floating iframe becomes non-self-painting (Closed)
Patch Set: Created 3 years, 11 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 11 matching lines...) Expand all
22 * Boston, MA 02110-1301, USA. 22 * Boston, MA 02110-1301, USA.
23 */ 23 */
24 24
25 #include "core/layout/FloatingObjects.h" 25 #include "core/layout/FloatingObjects.h"
26 26
27 #include "core/layout/LayoutBlockFlow.h" 27 #include "core/layout/LayoutBlockFlow.h"
28 #include "core/layout/LayoutBox.h" 28 #include "core/layout/LayoutBox.h"
29 #include "core/layout/LayoutView.h" 29 #include "core/layout/LayoutView.h"
30 #include "core/layout/api/LineLayoutBlockFlow.h" 30 #include "core/layout/api/LineLayoutBlockFlow.h"
31 #include "core/layout/shapes/ShapeOutsideInfo.h" 31 #include "core/layout/shapes/ShapeOutsideInfo.h"
32 #include "core/paint/PaintLayer.h"
33 #include "platform/RuntimeEnabledFeatures.h"
32 #include "wtf/PtrUtil.h" 34 #include "wtf/PtrUtil.h"
33 #include <algorithm> 35 #include <algorithm>
34 #include <memory> 36 #include <memory>
35 37
36 using namespace WTF; 38 using namespace WTF;
37 39
38 namespace blink { 40 namespace blink {
39 41
40 struct SameSizeAsFloatingObject { 42 struct SameSizeAsFloatingObject {
41 void* pointers[2]; 43 void* pointers[2];
(...skipping 27 matching lines...) Expand all
69 FloatingObject::FloatingObject(LayoutBox* layoutObject, 71 FloatingObject::FloatingObject(LayoutBox* layoutObject,
70 Type type, 72 Type type,
71 const LayoutRect& frameRect, 73 const LayoutRect& frameRect,
72 bool shouldPaint, 74 bool shouldPaint,
73 bool isDescendant, 75 bool isDescendant,
74 bool isLowestNonOverhangingFloatInChild) 76 bool isLowestNonOverhangingFloatInChild)
75 : m_layoutObject(layoutObject), 77 : m_layoutObject(layoutObject),
76 m_originatingLine(nullptr), 78 m_originatingLine(nullptr),
77 m_frameRect(frameRect), 79 m_frameRect(frameRect),
78 m_type(type), 80 m_type(type),
79 m_shouldPaint(shouldPaint),
80 m_isDescendant(isDescendant), 81 m_isDescendant(isDescendant),
81 m_isPlaced(true), 82 m_isPlaced(true),
82 m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild) 83 m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild)
83 #if DCHECK_IS_ON() 84 #if DCHECK_IS_ON()
84 , 85 ,
85 m_isInPlacedTree(false) 86 m_isInPlacedTree(false)
86 #endif 87 #endif
87 { 88 {
89 m_shouldPaint = shouldPaint || shouldPaintForCompositedLayoutPart();
90 }
91
92 bool FloatingObject::shouldPaintForCompositedLayoutPart() {
93 // HACK: only non-self-painting floats should paint. However, due to the
94 // fundamental compositing bug, some LayoutPart objects may become
95 // self-painting due to being composited. This leads to a chicken-egg issue
96 // because layout may not depend on compositing.
97 // If this is the case, set shouldPaint() to true even if the layer is
98 // technically self-painting. This lets the float which contains a LayoutPart
99 // start painting as soon as it stops being composited, without having to
100 // re-layout the float.
101 // This hack can be removed after SPv2.
102 return m_layoutObject->layer() &&
103 m_layoutObject->layer()->isSelfPaintingOnlyBecauseIsCompositedPart() &&
104 !RuntimeEnabledFeatures::slimmingPaintV2Enabled();
88 } 105 }
89 106
90 std::unique_ptr<FloatingObject> FloatingObject::create( 107 std::unique_ptr<FloatingObject> FloatingObject::create(
91 LayoutBox* layoutObject) { 108 LayoutBox* layoutObject) {
92 std::unique_ptr<FloatingObject> newObj = 109 std::unique_ptr<FloatingObject> newObj =
93 WTF::wrapUnique(new FloatingObject(layoutObject)); 110 WTF::wrapUnique(new FloatingObject(layoutObject));
94 111
95 // If a layer exists, the float will paint itself. Otherwise someone else 112 // If a layer exists, the float will paint itself. Otherwise someone else
96 // will. 113 // will.
97 newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer()); 114 newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() ||
115 newObj->shouldPaintForCompositedLayoutPart());
98 116
99 newObj->setIsDescendant(true); 117 newObj->setIsDescendant(true);
100 118
101 return newObj; 119 return newObj;
102 } 120 }
103 121
122 bool FloatingObject::shouldPaint() const {
123 return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer();
124 }
125
104 std::unique_ptr<FloatingObject> FloatingObject::copyToNewContainer( 126 std::unique_ptr<FloatingObject> FloatingObject::copyToNewContainer(
105 LayoutSize offset, 127 LayoutSize offset,
106 bool shouldPaint, 128 bool shouldPaint,
107 bool isDescendant) const { 129 bool isDescendant) const {
108 return WTF::wrapUnique(new FloatingObject( 130 return WTF::wrapUnique(new FloatingObject(
109 layoutObject(), getType(), 131 layoutObject(), getType(),
110 LayoutRect(frameRect().location() - offset, frameRect().size()), 132 LayoutRect(frameRect().location() - offset, frameRect().size()),
111 shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild())); 133 shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild()));
112 } 134 }
113 135
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 const FloatingObject* floatingObject) { 748 const FloatingObject* floatingObject) {
727 return String::format("%p (%gx%g %gx%g)", floatingObject, 749 return String::format("%p (%gx%g %gx%g)", floatingObject,
728 floatingObject->frameRect().x().toFloat(), 750 floatingObject->frameRect().x().toFloat(),
729 floatingObject->frameRect().y().toFloat(), 751 floatingObject->frameRect().y().toFloat(),
730 floatingObject->frameRect().maxX().toFloat(), 752 floatingObject->frameRect().maxX().toFloat(),
731 floatingObject->frameRect().maxY().toFloat()); 753 floatingObject->frameRect().maxY().toFloat());
732 } 754 }
733 #endif 755 #endif
734 756
735 } // namespace blink 757 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/FloatingObjects.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698