Index: Source/core/rendering/style/RenderStyle.cpp |
diff --git a/Source/core/rendering/style/RenderStyle.cpp b/Source/core/rendering/style/RenderStyle.cpp |
index e06cff5000b76ae6bdd6d1c0e078d5bf34d21cb4..b28acc9e5e761b018b9edd720c32b41aa2c3e093 100644 |
--- a/Source/core/rendering/style/RenderStyle.cpp |
+++ b/Source/core/rendering/style/RenderStyle.cpp |
@@ -395,6 +395,14 @@ StyleDifference RenderStyle::visualInvalidationDiff(const RenderStyle& other) co |
if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) |
diff.setNeedsFullLayout(); |
+ if (!diff.needsFullLayout() && surround->margin != other.surround->margin) { |
+ // Relative-positioned elements collapse their margins so need a full layout. |
+ if (position() == AbsolutePosition || position() == FixedPosition) |
+ diff.setNeedsPositionedMovementLayout(); |
+ else |
+ diff.setNeedsFullLayout(); |
+ } |
+ |
if (!diff.needsFullLayout() && position() != StaticPosition && surround->offset != other.surround->offset) { |
// Optimize for the case where a positioned layer is moving but not changing size. |
if (positionedObjectMovedOnly(surround->offset, other.surround->offset, m_box->width())) |
@@ -613,9 +621,6 @@ bool RenderStyle::diffNeedsFullLayout(const RenderStyle& other) const |
return true; |
if (surround.get() != other.surround.get()) { |
- if (surround->margin != other.surround->margin) |
- return true; |
- |
if (surround->padding != other.surround->padding) |
return true; |
} |