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

Unified Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 17654008: Implement the ::backdrop pseudo-element for modal <dialog>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add helper function and descendant selector test Created 7 years, 6 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/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index c72643e50dc939b355312672aab8077f2b6b0d7e..1c89f9c765bea8bd2ba16a4699d00bd37d4b82e8 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -1229,7 +1229,7 @@ PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P
state.initForStyleResolve(document(), e, parentStyle);
- if (m_state.parentStyle()) {
+ if (pseudoStyleRequest.pseudoId != BACKDROP && m_state.parentStyle()) { // The spec disallows inheritance for ::backdrop.
esprehn 2013/07/03 23:44:29 Lets add a method on PseudoStyleRequest which is a
falken 2013/07/04 08:20:12 Done. That looks a lot better.
state.setStyle(RenderStyle::create());
state.style()->inheritFrom(m_state.parentStyle());
} else {
@@ -1403,13 +1403,17 @@ static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool s
// CSS requires text-decoration to be reset at each DOM element for tables,
// inline blocks, inline tables, run-ins, shadow DOM crossings, floating elements,
// and absolute or relatively positioned elements.
-static bool doesNotInheritTextDecoration(RenderStyle* style, Element* e)
+static bool doesNotInheritTextDecoration(const RenderStyle* style, const Element* e)
{
return style->display() == TABLE || style->display() == INLINE_TABLE || style->display() == RUN_IN
|| style->display() == INLINE_BLOCK || style->display() == INLINE_BOX || isAtShadowBoundary(e)
|| style->isFloating() || style->hasOutOfFlowPosition();
}
+static bool isRenderedInTopLayer(const RenderStyle* style, const Element* e) {
+ return (e && e->isInTopLayer()) || (style && style->styleType() == BACKDROP);
esprehn 2013/07/03 23:44:29 This looks bad, the PseudoElement for ::backdrop s
falken 2013/07/04 08:20:12 Even with the new patch, I have to keep this helpe
+}
+
static bool isDisplayFlexibleBox(EDisplay display)
{
return display == FLEX || display == INLINE_FLEX;
@@ -1478,7 +1482,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty
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))
+ if (isRenderedInTopLayer(style, e) && (style->position() == StaticPosition || style->position() == RelativePosition))
style->setPosition(AbsolutePosition);
// Absolute/fixed positioned elements, floating elements and the document element need block-like outside display.
@@ -1534,7 +1538,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty
|| style->hasBlendMode()
|| style->position() == StickyPosition
|| (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings()->fixedPositionCreatesStackingContext())
- || (e && e->isInTopLayer())
+ || isRenderedInTopLayer(style, e)
))
style->setZIndex(0);

Powered by Google App Engine
This is Rietveld 408576698