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

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 e89db8af349ca5009b86f4ad2d9cc54e510963d5..9e576f2ed3487227fe9279c7ec20071dce5b0015 100644
--- a/Source/core/rendering/style/RenderStyle.cpp
+++ b/Source/core/rendering/style/RenderStyle.cpp
@@ -355,6 +355,16 @@ bool RenderStyle::inheritedDataShared(const RenderStyle* other) const
&& rareInheritedData.get() == other->rareInheritedData.get();
}
+static bool dependenceOnContentHeightHasChanged(const LengthBox& a, const LengthBox& 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.
+ if (a.top().isAuto() != b.top().isAuto() || a.bottom().isAuto() != b.bottom().isAuto())
mstensho (USE GERRIT) 2015/02/02 10:00:47 Just "return blablabla", instead of "if (blablabla
rhogan 2015/02/02 19:22:49 We would still need to resolve top/bottom in compu
+ return true;
+ return false;
+}
+
StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) const
{
// Note, we use .get() on each DataRef below because DataRef::operator== will do a deep
@@ -383,7 +393,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(surround->offset, other.surround->offset))
+ diff.setNeedsFullLayout();
+ else
+ diff.setNeedsPositionedMovementLayout();
}
if (diffNeedsPaintInvalidationLayer(other))

Powered by Google App Engine
This is Rietveld 408576698