Index: Source/core/css/resolver/StyleResolver.cpp |
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
index 64d994cb7cc6c6ae2b3d07dbfc7e497f9fd7304b..4b8b2814c320159aae0f59eaaf0b56fbb67d1736 100644 |
--- a/Source/core/css/resolver/StyleResolver.cpp |
+++ b/Source/core/css/resolver/StyleResolver.cpp |
@@ -1543,6 +1543,10 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty |
if (e && e->hasTagName(legendTag)) |
style->setDisplay(BLOCK); |
+ // Per the spec, position 'static' and 'relative' in the top layer compute to 'absolute'. |
+ if (e && e->isInTopLayer() && (style->position() == StaticPosition || style->position() == RelativePosition)) |
+ style->setPosition(AbsolutePosition); |
+ |
// Absolute/fixed positioned elements, floating elements and the document element need block-like outside display. |
if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->document()->documentElement() == e)) |
style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), !document()->inQuirksMode())); |
@@ -1577,12 +1581,6 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty |
style->setFloating(NoFloat); |
style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), !document()->inQuirksMode())); |
} |
- |
- // Per the spec, position 'static' and 'relative' in the top layer compute to 'absolute'. |
- if (e && e->isInTopLayer() && (style->position() == StaticPosition || style->position() == RelativePosition)) { |
- style->setPosition(AbsolutePosition); |
- style->setDisplay(BLOCK); |
- } |
} |
// Make sure our z-index value is only applied if the object is positioned. |