Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/FloatingObjects.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp |
| index fe47a39ebf3370113da807baf3b59eb5c40cff3e..8ba48acf09dfe3dbb963fcb3f59514a5fb700c5f 100644 |
| --- a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp |
| +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp |
| @@ -27,6 +27,7 @@ |
| #include "core/layout/LayoutBox.h" |
| #include "core/layout/LayoutView.h" |
| #include "core/layout/shapes/ShapeOutsideInfo.h" |
| +#include "core/paint/PaintLayer.h" |
| #include <algorithm> |
| @@ -66,7 +67,6 @@ FloatingObject::FloatingObject(LayoutBox* layoutObject, Type type, const LayoutR |
| , m_originatingLine(nullptr) |
| , m_frameRect(frameRect) |
| , m_type(type) |
| - , m_shouldPaint(shouldPaint) |
| , m_isDescendant(isDescendant) |
| , m_isPlaced(true) |
| , m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild) |
| @@ -74,17 +74,36 @@ FloatingObject::FloatingObject(LayoutBox* layoutObject, Type type, const LayoutR |
| , m_isInPlacedTree(false) |
| #endif |
| { |
| + m_shouldPaint = shouldPaint || shouldPaintForCompositedLayoutPart(); |
| +} |
| + |
| +bool FloatingObject::shouldPaintForCompositedLayoutPart() |
| +{ |
| + // HACK: only non-self-painting floats should paint. However, due to the fundamental compositing bug, some LayoutPart objects |
| + // may become self-painting due to being composited. This leads to a chicken-egg issue because layout may not depend on compositing. |
| + // If this is the case, set shouldPaint() to true even if the layer is technically self-painting. This lets the float which contains |
| + // a LayoutPart start painting as soon as it stops being composited, without having to re-layout the float. |
| + // This hack can be removed after SPv2. |
| + return m_layoutObject->layer() && m_layoutObject->layer()->isSelfPaintingOnlyBecauseIsCompositedPart(); |
| } |
| PassOwnPtr<FloatingObject> FloatingObject::create(LayoutBox* layoutObject) |
| { |
| OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(layoutObject)); |
| - newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will. |
| + |
| + // If a layer exists, the float will paint itself. Otherwise someone else will. |
| + newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() || newObj->shouldPaintForCompositedLayoutPart()); |
|
Xianzhu
2016/05/26 18:29:54
Nit: Remove extra space before '||'.
chrishtr
2016/05/26 18:49:29
Done.
|
| + |
| newObj->setIsDescendant(true); |
| return newObj; |
| } |
| +bool FloatingObject::shouldPaint() const |
| +{ |
| + return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer(); |
| +} |
| + |
| PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset, bool shouldPaint, bool isDescendant) const |
| { |
| return adoptPtr(new FloatingObject(layoutObject(), getType(), LayoutRect(frameRect().location() - offset, frameRect().size()), shouldPaint, isDescendant, isLowestNonOverhangingFloatInChild())); |