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

Unified Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 882173002: When a positioned object's dependence on content height changes we need to layout. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 5 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: Source/core/rendering/style/RenderStyle.cpp
diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp
index be595d725d6471f9c5e1dfc6c64d90aa8e361c49..3c3cef1695f91d2ae874cbd2111c87885b59a4df 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -355,6 +355,14 @@ bool RenderStyle::inheritedDataShared(const RenderStyle* other) const
&& rareInheritedData.get() == other->rareInheritedData.get();
}
+static bool dependenceOnContentHeightHasChanged(const RenderStyle& a, const RenderStyle& b)
+{
+ // If top or bottom become auto/non-auto then it means we either have to solve height based
+ // on the content or stop doing so (http://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-height)
+ // - either way requires a layout.
+ return a.logicalTop().isAuto() != b.logicalTop().isAuto() || a.logicalBottom().isAuto() != b.logicalBottom().isAuto();
+}
+
StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) const
{
// Note, we use .get() on each DataRef below because DataRef::operator== will do a deep
@@ -383,7 +391,10 @@ StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) co
if (!diff.needsFullLayout() && position() != StaticPosition && surround->offset != other.surround->offset) {
// Optimize for the case where a positioned layer is moving but not changing size.
- diff.setNeedsPositionedMovementLayout();
+ if (dependenceOnContentHeightHasChanged(*this, other))
+ diff.setNeedsFullLayout();
+ else
+ diff.setNeedsPositionedMovementLayout();
}
if (diffNeedsPaintInvalidationLayer(other))

Powered by Google App Engine
This is Rietveld 408576698