Index: third_party/WebKit/Source/core/dom/Element.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp |
index 7aae88c83b5a16951b3eb756e306129b334a7f90..dc3d493be62c531e6017c1bd1bbd75d7156b9b2a 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -1540,10 +1540,6 @@ Node::InsertionNotificationRequest Element::insertedInto( |
// by the time we reach updateId |
ContainerNode::insertedInto(insertionPoint); |
- if (containsFullScreenElement() && parentElement() && |
- !parentElement()->containsFullScreenElement()) |
- setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true); |
- |
DCHECK(!hasRareData() || !elementRareData()->hasPseudoElements()); |
if (!insertionPoint->isInTreeScope()) |
@@ -1589,19 +1585,6 @@ void Element::removedFrom(ContainerNode* insertionPoint) { |
DCHECK(!hasRareData() || !elementRareData()->hasPseudoElements()); |
- if (Fullscreen::isCurrentFullScreenElement(*this)) { |
- setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); |
- if (insertionPoint->isElementNode()) { |
- toElement(insertionPoint)->setContainsFullScreenElement(false); |
- toElement(insertionPoint) |
- ->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries( |
- false); |
- } |
- } |
- |
- if (Fullscreen* fullscreen = Fullscreen::fromIfExists(document())) |
- fullscreen->elementRemoved(*this); |
- |
if (document().page()) |
document().page()->pointerLockController().elementRemoved(this); |
@@ -1634,7 +1617,11 @@ void Element::removedFrom(ContainerNode* insertionPoint) { |
document().styleEngine().styleInvalidator().clearInvalidation(*this); |
} |
- document().removeFromTopLayer(this); |
+ if (isInTopLayer()) { |
+ if (isFullscreen()) |
+ Fullscreen::elementRemoved(*this); |
+ document().removeFromTopLayer(this); |
+ } |
clearElementFlag(IsInCanvasSubtree); |
@@ -3355,40 +3342,6 @@ void Element::setFloatingPointAttribute(const QualifiedName& attributeName, |
setAttribute(attributeName, AtomicString::number(value)); |
} |
-void Element::setContainsFullScreenElement(bool flag) { |
- setElementFlag(ContainsFullScreenElement, flag); |
- document().styleEngine().ensureUAStyleForFullscreen(); |
- pseudoStateChanged(CSSSelector::PseudoFullScreenAncestor); |
-} |
- |
-// Unlike Node::parentOrShadowHostElement, this can cross frame boundaries. |
-static Element* nextAncestorElement(Element* element) { |
- DCHECK(element); |
- if (element->parentOrShadowHostElement()) |
- return element->parentOrShadowHostElement(); |
- |
- Frame* frame = element->document().frame(); |
- if (!frame || !frame->owner()) |
- return nullptr; |
- |
- // Find the next LocalFrame on the ancestor chain, and return the |
- // corresponding <iframe> element for the remote child if it exists. |
- while (frame->tree().parent() && frame->tree().parent()->isRemoteFrame()) |
- frame = frame->tree().parent(); |
- |
- if (frame->owner() && frame->owner()->isLocal()) |
- return toHTMLFrameOwnerElement(frame->owner()); |
- |
- return nullptr; |
-} |
- |
-void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries( |
- bool flag) { |
- for (Element* element = nextAncestorElement(this); element; |
- element = nextAncestorElement(element)) |
- element->setContainsFullScreenElement(flag); |
-} |
- |
void Element::setIsInTopLayer(bool inTopLayer) { |
if (isInTopLayer() == inTopLayer) |
return; |
@@ -3400,6 +3353,10 @@ void Element::setIsInTopLayer(bool inTopLayer) { |
lazyReattachIfAttached(); |
} |
+void Element::setIsFullscreen(bool isFullscreen) { |
+ setElementFlag(IsFullscreen, isFullscreen); |
+} |
+ |
void Element::requestPointerLock() { |
if (document().page()) |
document().page()->pointerLockController().requestPointerLock(this); |
@@ -4006,7 +3963,7 @@ bool Element::supportsStyleSharing() const { |
return false; |
if (hasAnimations()) |
return false; |
- if (Fullscreen::isCurrentFullScreenElement(*this)) |
+ if (Fullscreen::isFullscreenElement(*this)) |
return false; |
return true; |
} |