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

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: use element directly Created 7 years, 5 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
« no previous file with comments | « Source/core/css/PseudoStyleRequest.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index e8eace41de68bfe3bc709dc6e5d2f4dc0d4e7d02..6e0863ccab6260d75498f8439f6e282e13a90666 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -1264,7 +1264,7 @@ PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P
state.initForStyleResolve(document(), e, parentStyle);
- if (m_state.parentStyle()) {
+ if (pseudoStyleRequest.allowsInheritance(m_state.parentStyle())) {
state.setStyle(RenderStyle::create());
state.style()->inheritFrom(m_state.parentStyle());
} else {
@@ -1438,13 +1438,20 @@ 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();
}
+// FIXME: This helper is only needed because pseudoStyleForElement passes a null
+// element to adjustRenderStyle, so we can't just use element->isInTopLayer().
+static bool isInTopLayer(const Element* element, const RenderStyle* style)
+{
+ return (element && element->isInTopLayer()) || (style && style->styleType() == BACKDROP);
+}
+
static bool isDisplayFlexibleBox(EDisplay display)
{
return display == FLEX || display == INLINE_FLEX;
@@ -1513,7 +1520,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 (isInTopLayer(e, style) && (style->position() == StaticPosition || style->position() == RelativePosition))
style->setPosition(AbsolutePosition);
// Absolute/fixed positioned elements, floating elements and the document element need block-like outside display.
@@ -1569,7 +1576,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())
+ || isInTopLayer(e, style)
))
style->setZIndex(0);
« no previous file with comments | « Source/core/css/PseudoStyleRequest.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698