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

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

Issue 2009353003: Add a hack to set shouldPaint to true for force-composited iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "core/layout/FloatingObjects.h" 24 #include "core/layout/FloatingObjects.h"
25 25
26 #include "core/layout/LayoutBlockFlow.h" 26 #include "core/layout/LayoutBlockFlow.h"
27 #include "core/layout/LayoutBox.h" 27 #include "core/layout/LayoutBox.h"
28 #include "core/layout/LayoutView.h" 28 #include "core/layout/LayoutView.h"
29 #include "core/layout/shapes/ShapeOutsideInfo.h" 29 #include "core/layout/shapes/ShapeOutsideInfo.h"
30 #include "core/paint/PaintLayer.h"
31 #include "platform/RuntimeEnabledFeatures.h"
30 32
31 #include <algorithm> 33 #include <algorithm>
32 34
33 using namespace WTF; 35 using namespace WTF;
34 36
35 namespace blink { 37 namespace blink {
36 38
37 struct SameSizeAsFloatingObject { 39 struct SameSizeAsFloatingObject {
38 void* pointers[2]; 40 void* pointers[2];
39 LayoutRect rect; 41 LayoutRect rect;
(...skipping 19 matching lines...) Expand all
59 m_type = FloatLeft; 61 m_type = FloatLeft;
60 else if (type == RightFloat) 62 else if (type == RightFloat)
61 m_type = FloatRight; 63 m_type = FloatRight;
62 } 64 }
63 65
64 FloatingObject::FloatingObject(LayoutBox* layoutObject, Type type, const LayoutR ect& frameRect, bool shouldPaint, bool isDescendant, bool isLowestNonOverhanging FloatInChild) 66 FloatingObject::FloatingObject(LayoutBox* layoutObject, Type type, const LayoutR ect& frameRect, bool shouldPaint, bool isDescendant, bool isLowestNonOverhanging FloatInChild)
65 : m_layoutObject(layoutObject) 67 : m_layoutObject(layoutObject)
66 , m_originatingLine(nullptr) 68 , m_originatingLine(nullptr)
67 , m_frameRect(frameRect) 69 , m_frameRect(frameRect)
68 , m_type(type) 70 , m_type(type)
69 , m_shouldPaint(shouldPaint)
70 , m_isDescendant(isDescendant) 71 , m_isDescendant(isDescendant)
71 , m_isPlaced(true) 72 , m_isPlaced(true)
72 , m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild) 73 , m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild)
73 #if ENABLE(ASSERT) 74 #if ENABLE(ASSERT)
74 , m_isInPlacedTree(false) 75 , m_isInPlacedTree(false)
75 #endif 76 #endif
76 { 77 {
78 m_shouldPaint = shouldPaint || shouldPaintForCompositedLayoutPart();
79 }
80
81 bool FloatingObject::shouldPaintForCompositedLayoutPart()
82 {
83 // HACK: only non-self-painting floats should paint. However, due to the fun damental compositing bug, some LayoutPart objects
84 // may become self-painting due to being composited. This leads to a chicken -egg issue because layout may not depend on compositing.
85 // If this is the case, set shouldPaint() to true even if the layer is techn ically self-painting. This lets the float which contains
86 // a LayoutPart start painting as soon as it stops being composited, without having to re-layout the float.
87 // This hack can be removed after SPv2.
88 return m_layoutObject->layer() && m_layoutObject->layer()->isSelfPaintingOnl yBecauseIsCompositedPart() && !RuntimeEnabledFeatures::slimmingPaintV2Enabled();
77 } 89 }
78 90
79 PassOwnPtr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject) 91 PassOwnPtr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject)
80 { 92 {
81 OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(layoutObject)); 93 OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(layoutObject));
82 newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will. 94
95 // If a layer exists, the float will paint itself. Otherwise someone else wi ll.
96 newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() || newObj->shou ldPaintForCompositedLayoutPart());
97
83 newObj->setIsDescendant(true); 98 newObj->setIsDescendant(true);
84 99
85 return newObj; 100 return newObj;
86 } 101 }
87 102
103 bool FloatingObject::shouldPaint() const
104 {
105 return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer();
106 }
107
88 PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const 108 PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const
89 { 109 {
90 return adoptPtr(new FloatingObject(layoutObject(), getType(), LayoutRect(fra meRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, is LowestNonOverhangingFloatInChild())); 110 return adoptPtr(new FloatingObject(layoutObject(), getType(), LayoutRect(fra meRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, is LowestNonOverhangingFloatInChild()));
91 } 111 }
92 112
93 PassOwnPtr<FloatingObject> FloatingObject::unsafeClone() const 113 PassOwnPtr<FloatingObject> FloatingObject::unsafeClone() const
94 { 114 {
95 OwnPtr<FloatingObject> cloneObject = adoptPtr(new FloatingObject(layoutObjec t(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false)); 115 OwnPtr<FloatingObject> cloneObject = adoptPtr(new FloatingObject(layoutObjec t(), getType(), m_frameRect, m_shouldPaint, m_isDescendant, false));
96 cloneObject->m_isPlaced = m_isPlaced; 116 cloneObject->m_isPlaced = m_isPlaced;
97 return cloneObject; 117 return cloneObject;
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 } 638 }
619 639
620 String ValueToString<FloatingObject*>::toString(const FloatingObject* floatingOb ject) 640 String ValueToString<FloatingObject*>::toString(const FloatingObject* floatingOb ject)
621 { 641 {
622 return String::format("%p (%gx%g %gx%g)", floatingObject, floatingObject->fr ameRect().x().toFloat(), floatingObject->frameRect().y().toFloat(), floatingObje ct->frameRect().maxX().toFloat(), floatingObject->frameRect().maxY().toFloat()); 642 return String::format("%p (%gx%g %gx%g)", floatingObject, floatingObject->fr ameRect().x().toFloat(), floatingObject->frameRect().y().toFloat(), floatingObje ct->frameRect().maxX().toFloat(), floatingObject->frameRect().maxY().toFloat());
623 } 643 }
624 #endif 644 #endif
625 645
626 646
627 } // namespace blink 647 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/FloatingObjects.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698