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

Unified 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 side-by-side diff with in-line comments
Download patch
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 f4437142911e1c22e18794c4470b42812eaf8bb2..27b7106d621bf77e56958fa8705e16db4859c454 100644
--- a/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
+++ b/third_party/WebKit/Source/core/layout/FloatingObjects.cpp
@@ -29,6 +29,8 @@
#include "core/layout/LayoutView.h"
#include "core/layout/api/LineLayoutBlockFlow.h"
#include "core/layout/shapes/ShapeOutsideInfo.h"
+#include "core/paint/PaintLayer.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "wtf/PtrUtil.h"
#include <algorithm>
#include <memory>
@@ -76,7 +78,6 @@
m_originatingLine(nullptr),
m_frameRect(frameRect),
m_type(type),
- m_shouldPaint(shouldPaint),
m_isDescendant(isDescendant),
m_isPlaced(true),
m_isLowestNonOverhangingFloatInChild(isLowestNonOverhangingFloatInChild)
@@ -85,6 +86,22 @@
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();
}
std::unique_ptr<FloatingObject> FloatingObject::create(
@@ -94,11 +111,16 @@
// If a layer exists, the float will paint itself. Otherwise someone else
// will.
- newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer());
+ newObj->setShouldPaint(!layoutObject->hasSelfPaintingLayer() ||
+ newObj->shouldPaintForCompositedLayoutPart());
newObj->setIsDescendant(true);
return newObj;
+}
+
+bool FloatingObject::shouldPaint() const {
+ return m_shouldPaint && !m_layoutObject->hasSelfPaintingLayer();
}
std::unique_ptr<FloatingObject> FloatingObject::copyToNewContainer(
« 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