Chromium Code Reviews| Index: Source/core/dom/Element.cpp |
| diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
| index 921392e15075276481840f28c6b872207fe33766..4b5c6a42e665e6e1295f3313561481a43994f9aa 100644 |
| --- a/Source/core/dom/Element.cpp |
| +++ b/Source/core/dom/Element.cpp |
| @@ -205,6 +205,11 @@ Element::~Element() |
| ElementRareData* data = elementRareData(); |
| data->setPseudoElement(BEFORE, 0); |
| data->setPseudoElement(AFTER, 0); |
| + |
| + if (Element* backdrop = data->pseudoElement(BACKDROP)) |
| + document()->removeFromTopLayer(backdrop); |
|
esprehn
2013/07/04 08:34:07
Lets just do this inside releasePseudoElement(). I
falken
2013/07/04 12:18:01
Done.
|
| + data->setPseudoElement(BACKDROP, 0); |
| + |
| data->clearShadow(); |
| } |
| @@ -1292,7 +1297,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 +1358,7 @@ void Element::attach(const AttachContext& context) |
| ContainerNode::attach(context); |
| createPseudoElementIfNeeded(AFTER); |
| + createPseudoElementIfNeeded(BACKDROP); |
| if (hasRareData()) { |
| ElementRareData* data = elementRareData(); |
| @@ -1382,6 +1391,11 @@ void Element::detach(const AttachContext& context) |
| ElementRareData* data = elementRareData(); |
| data->setPseudoElement(BEFORE, 0); |
| data->setPseudoElement(AFTER, 0); |
| + |
| + if (Element* backdrop = data->pseudoElement(BACKDROP)) |
| + document()->removeFromTopLayer(backdrop); |
|
esprehn
2013/07/04 08:34:07
Yeah lets do this in releasePseudoElement, then yo
falken
2013/07/04 12:18:01
Done.
|
| + data->setPseudoElement(BACKDROP, 0); |
| + |
| data->setIsInCanvasSubtree(false); |
| data->resetComputedStyle(); |
| data->resetDynamicRestyleObservations(); |
| @@ -2415,15 +2429,21 @@ void Element::updatePseudoElement(PseudoId pseudoId, StyleChange change) |
| // is false, otherwise we could continously create and destroy PseudoElements |
| // when RenderObject::isChildAllowed on our parent returns false for the |
| // PseudoElement's renderer for each style recalc. |
| - if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(pseudoId))) |
| + if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(pseudoId))) { |
| + if (pseudoId == BACKDROP) |
| + document()->removeFromTopLayer(element); |
|
esprehn
2013/07/04 08:34:07
Remove.
falken
2013/07/04 12:18:01
Done.
|
| elementRareData()->setPseudoElement(pseudoId, 0); |
| + } |
| } else if (change >= Inherit || needsStyleRecalc()) |
| createPseudoElementIfNeeded(pseudoId); |
| } |
| 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))) |
| @@ -2436,6 +2456,9 @@ void Element::createPseudoElementIfNeeded(PseudoId pseudoId) |
| RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId); |
| element->attach(); |
| ensureElementRareData()->setPseudoElement(pseudoId, element.release()); |
| + |
| + if (pseudoId == BACKDROP) |
| + document()->addToTopLayer(pseudoElement(BACKDROP), this); |
| } |
| PseudoElement* Element::pseudoElement(PseudoId pseudoId) const |