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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 1661523002: Update should paint flag when a float's composited scrolling status changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows build Created 4 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/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 491f7a8af2b8332511ba74428a2479dfd93a63ed..6b3c711e2edd091839610d2bdaa78406332b9aba 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -2045,7 +2045,7 @@ void LayoutBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan
// Only issue paint invaldiations for the object if it is overhanging, is not in its own layer, and
// is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter
// condition is replaced with being a descendant of us.
- if (logicalBottomForFloat(floatingObject) > logicalHeight()
+ if (isOverhangingFloat(floatingObject)
&& !floatingObject.layoutObject()->hasSelfPaintingLayer()
&& (floatingObject.shouldPaint() || (paintAllDescendants && floatingObject.layoutObject()->isDescendantOf(this)))) {
@@ -2461,7 +2461,7 @@ bool LayoutBlockFlow::hasOverhangingFloat(LayoutBox* layoutBox)
if (it == floatingObjectSet.end())
return false;
- return logicalBottomForFloat(*it->get()) > logicalHeight();
+ return isOverhangingFloat(**it);
}
void LayoutBlockFlow::addIntrudingFloats(LayoutBlockFlow* prev, LayoutUnit logicalLeftOffset, LayoutUnit logicalTopOffset)
@@ -2628,6 +2628,39 @@ LayoutUnit LayoutBlockFlow::logicalRightFloatOffsetForLine(LayoutUnit logicalTop
return fixedOffset;
}
+void LayoutBlockFlow::setAncestorShouldPaintFloatingObject(const LayoutBox& floatBox, bool shouldPaint)
+{
+ ASSERT(floatBox.isFloating());
+ ASSERT(!floatBox.hasSelfPaintingLayer());
+ for (LayoutObject* ancestor = floatBox.parent(); ancestor && ancestor->isLayoutBlockFlow(); ancestor = ancestor->parent()) {
+ LayoutBlockFlow* ancestorBlock = toLayoutBlockFlow(ancestor);
+ FloatingObjects* ancestorFloatingObjects = ancestorBlock->m_floatingObjects.get();
+ if (!ancestorFloatingObjects)
+ break;
+ FloatingObjectSet::iterator it = ancestorFloatingObjects->mutableSet().find<FloatingObjectHashTranslator>(const_cast<LayoutBox*>(&floatBox));
+ if (it == ancestorFloatingObjects->mutableSet().end())
+ break;
+
+ FloatingObject& floatingObject = **it;
+ if (shouldPaint) {
+ ASSERT(!floatingObject.shouldPaint());
+ // This repeats the logic in addOverhangingFloats() about shouldPaint flag:
+ // - The nearest enclosing block in which the float doesn't overhang paints the float;
+ // - Or even if the float overhangs, if the ancestor block has self-painting layer, it
+ // paints the float.
+ if (ancestorBlock->hasSelfPaintingLayer() || !ancestorBlock->isOverhangingFloat(floatingObject)) {
+ floatingObject.setShouldPaint(true);
+ return;
+ }
+ } else if (floatingObject.shouldPaint()) {
+ floatingObject.setShouldPaint(false);
+ return;
+ }
+ }
+ // We should have found the ancestor to update shouldPaint flag.
+ ASSERT_NOT_REACHED();
+}
+
IntRect alignSelectionRectToDevicePixels(LayoutRect& rect)
{
LayoutUnit roundedX = LayoutUnit(rect.x().round());
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | third_party/WebKit/Source/core/paint/PaintLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698