Chromium Code Reviews| 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..7bbf27772b2e925d360db15201f076e19027db1d 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,34 @@ 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->set().find<FloatingObjectHashTranslator>(const_cast<LayoutBox*>(&floatBox)); |
| + if (it == ancestorFloatingObjects->set().end()) |
| + break; |
| + FloatingObject& floatingObject = **it; |
| + if (shouldPaint) { |
| + ASSERT(!floatingObject.shouldPaint()); |
| + if (ancestorBlock->hasSelfPaintingLayer() || !ancestorBlock->isOverhangingFloat(floatingObject) || ancestorBlock->createsNewFormattingContext()) { |
|
chrishtr
2016/02/02 19:32:04
Why is this the right set of conditions? Does this
Xianzhu
2016/02/02 20:19:07
The conditions are scattered in this file, mainly
|
| + 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()); |