Bug 1216049 part 1 - Remove the use of Element::IsFullScreenAncestor() in Element::UnbindFromTree(). r?smaug
Since UnbindFromTree() would eventually be called synchronously for
every element unbound, we don't have to check whether the root of
unbound elements is a fullscreen ancestor.
MozReview-Commit-ID: F6mxNsVZ2yl
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1728,28 +1728,27 @@ Element::UnbindFromTree(bool aDeep, bool
// Make sure to unbind this node before doing the kids
nsIDocument* document =
HasFlag(NODE_FORCE_XBL_BINDINGS) ? OwnerDoc() : GetComposedDoc();
if (HasPointerLock()) {
nsIDocument::UnlockPointer();
}
+ if (OwnerDoc()->GetFullscreenElement() == this) {
+ // The element being removed is an ancestor of the full-screen element,
+ // exit full-screen state.
+ nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
+ NS_LITERAL_CSTRING("DOM"), OwnerDoc(),
+ nsContentUtils::eDOM_PROPERTIES,
+ "RemovedFullscreenElement");
+ // Fully exit full-screen.
+ nsIDocument::ExitFullscreenInDocTree(OwnerDoc());
+ }
if (aNullParent) {
- if (IsFullScreenAncestor()) {
- // The element being removed is an ancestor of the full-screen element,
- // exit full-screen state.
- nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
- NS_LITERAL_CSTRING("DOM"), OwnerDoc(),
- nsContentUtils::eDOM_PROPERTIES,
- "RemovedFullscreenElement");
- // Fully exit full-screen.
- nsIDocument::ExitFullscreenInDocTree(OwnerDoc());
- }
-
if (GetParent() && GetParent()->IsInUncomposedDoc()) {
// Update the editable descendant count in the ancestors before we
// lose the reference to the parent.
int32_t editableDescendantChange = -1 * EditableInclusiveDescendantCount(this);
if (editableDescendantChange != 0) {
nsIContent* parent = GetParent();
while (parent) {
parent->ChangeEditableDescendantCount(editableDescendantChange);