Index: third_party/WebKit/Source/core/layout/LayoutObject.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
index 051799571158e80164251832a3a2a3e5358c8d66..5b140a579dc9fd3338295218f7d4a30f0c64667e 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp |
@@ -1923,10 +1923,16 @@ void LayoutObject::firstLineStyleDidChange(const ComputedStyle& oldStyle, const |
setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange); |
} |
-void LayoutObject::markContainingBlocksForOverflowRecalc() |
+void LayoutObject::markAncestorsForOverflowRecalcIfNeeded() |
{ |
- for (LayoutBlock* container = containingBlock(); container && !container->childNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock()) |
- container->setChildNeedsOverflowRecalcAfterStyleChange(); |
+ LayoutObject* object = this; |
+ do { |
+ // Cell and row need to propagate the flag to their containing section and row as their containing block is the table wrapper. |
+ // This enables us to only recompute overflow the modified sections / rows. |
+ object = object->isTableCell() || object->isTableRow() ? object->parent() : object->containingBlock(); |
+ if (object) |
+ object->setChildNeedsOverflowRecalcAfterStyleChange(); |
+ } while (object); |
} |
void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() |
@@ -1934,7 +1940,7 @@ void LayoutObject::setNeedsOverflowRecalcAfterStyleChange() |
bool neededRecalc = needsOverflowRecalcAfterStyleChange(); |
setSelfNeedsOverflowRecalcAfterStyleChange(); |
if (!neededRecalc) |
- markContainingBlocksForOverflowRecalc(); |
+ markAncestorsForOverflowRecalcIfNeeded(); |
} |
void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style) |
@@ -2004,6 +2010,13 @@ void LayoutObject::setStyle(PassRefPtr<ComputedStyle> style) |
container->setNeedsOverflowRecalcAfterStyleChange(); |
} |
+ if (diff.visualOverflowChanged() && !needsLayout()) { |
+ if (isLayoutBlock()) |
+ setNeedsOverflowRecalcAfterStyleChange(); |
+ else |
+ setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange); |
Xianzhu
2016/03/22 17:02:05
Nit: please add a TODO here and reference bug 4370
|
+ } |
+ |
if (diff.needsPaintInvalidationLayer() || updatedDiff.needsPaintInvalidationLayer()) |
setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
else if (diff.needsPaintInvalidationObject() || updatedDiff.needsPaintInvalidationObject()) |
@@ -2104,7 +2117,7 @@ void LayoutObject::styleDidChange(StyleDifference diff, const ComputedStyle* old |
// Ditto. |
if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_style->position()) |
- markContainingBlocksForOverflowRecalc(); |
+ markAncestorsForOverflowRecalcIfNeeded(); |
setNeedsLayoutAndPrefWidthsRecalc(LayoutInvalidationReason::StyleChange); |
} else if (diff.needsPositionedMovementLayout()) { |