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

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: put backdrop in DOM-side top layer 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
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index b09bfc53c46a875974642defef39faee47f7396d..1635e21d747f8a32f4e92e7855c583ed4d07808e 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -1273,7 +1273,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 {
@@ -1447,13 +1447,19 @@ 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();
}
+// Helper function since we can't use element->isInTopLayer() when element is null.
+static bool isInTopLayer(const Element* element, const RenderStyle* style)
+{
+ return (element && element->isInTopLayer()) || (style && style->styleType() == BACKDROP);
esprehn 2013/07/04 08:34:07 If the backdrop is in the top layer, why do you ne
falken 2013/07/04 09:06:35 createPseudoElementIfNeeded asks for the backdrop'
falken 2013/07/04 12:18:01 OK I see now. The problem is just that StyleResolv
+}
+
static bool isDisplayFlexibleBox(EDisplay display)
{
return display == FLEX || display == INLINE_FLEX;
@@ -1522,7 +1528,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.
@@ -1578,7 +1584,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);

Powered by Google App Engine
This is Rietveld 408576698