| 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..eff3aae9290e1e506abc86def572d67ae95ae4c9 100644
|
| --- a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
|
| @@ -27,6 +27,8 @@
|
| #include "core/layout/LayoutBox.h"
|
| #include "core/layout/LayoutView.h"
|
| #include "core/layout/shapes/ShapeOutsideInfo.h"
|
| +#include "core/paint/PaintLayer.h"
|
| +#include "platform/RuntimeEnabledFeatures.h"
|
|
|
| #include <algorithm>
|
|
|
| @@ -66,7 +68,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 +75,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() && !RuntimeEnabledFeatures::slimmingPaintV2Enabled();
|
| }
|
|
|
| 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());
|
| +
|
| 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()));
|
|
|