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

Unified Diff: Source/core/dom/Element.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/dom/Document.cpp ('k') | Source/core/dom/ElementRareData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 655974630dee69d467fa9cd954fcae6341c410de..66fb5b92a82a6eba7ffdaee9ce5fd05651191c2d 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -205,6 +205,7 @@ Element::~Element()
ElementRareData* data = elementRareData();
data->setPseudoElement(BEFORE, 0);
data->setPseudoElement(AFTER, 0);
+ data->setPseudoElement(BACKDROP, 0);
data->clearShadow();
}
@@ -1292,7 +1293,10 @@ void Element::removedFrom(ContainerNode* insertionPoint)
if (Element* after = pseudoElement(AFTER))
after->removedFrom(insertionPoint);
+ if (Element* backdrop = pseudoElement(BACKDROP))
+ backdrop->removedFrom(insertionPoint);
document()->removeFromTopLayer(this);
+
if (containsFullScreenElement())
setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
@@ -1350,6 +1354,7 @@ void Element::attach(const AttachContext& context)
ContainerNode::attach(context);
createPseudoElementIfNeeded(AFTER);
+ createPseudoElementIfNeeded(BACKDROP);
if (hasRareData()) {
ElementRareData* data = elementRareData();
@@ -1382,6 +1387,7 @@ void Element::detach(const AttachContext& context)
ElementRareData* data = elementRareData();
data->setPseudoElement(BEFORE, 0);
data->setPseudoElement(AFTER, 0);
+ data->setPseudoElement(BACKDROP, 0);
data->setIsInCanvasSubtree(false);
data->resetComputedStyle();
data->resetDynamicRestyleObservations();
@@ -2418,7 +2424,10 @@ void Element::updatePseudoElement(PseudoId pseudoId, StyleChange change)
void Element::createPseudoElementIfNeeded(PseudoId pseudoId)
{
- if (!document()->styleSheetCollection()->usesBeforeAfterRules())
+ if ((pseudoId == BEFORE || pseudoId == AFTER) && !document()->styleSheetCollection()->usesBeforeAfterRules())
+ return;
+
+ if (pseudoId == BACKDROP && !isInTopLayer())
return;
if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(pseudoId)))
@@ -2429,7 +2438,10 @@ void Element::createPseudoElementIfNeeded(PseudoId pseudoId)
ASSERT(!isPseudoElement());
RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId);
+ if (pseudoId == BACKDROP)
+ document()->addToTopLayer(element.get(), this);
element->attach();
+
ensureElementRareData()->setPseudoElement(pseudoId, element.release());
}
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/ElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698