Remove the unnecessary null check for document
https://bugs.webkit.org/show_bug.cgi?id=209819

Reviewed by Ryosuke Niwa.

No new tests, covered by existing test.

* dom/Node.cpp:
(WebCore::Node::removedFromAncestor):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@259376 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 77b3697..8e208ee 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2020-04-01  Jack Lee  <shihchieh_lee@apple.com>
+
+        Remove the unnecessary null check for document
+        https://bugs.webkit.org/show_bug.cgi?id=209819
+
+        Reviewed by Ryosuke Niwa.
+
+        No new tests, covered by existing test.
+
+        * dom/Node.cpp:
+        (WebCore::Node::removedFromAncestor):
+
 2020-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Remove some PLATFORM(IOS_FAMILY) guards in TextFieldInputType
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp
index 8bfec61..0d6f4d2 100644
--- a/Source/WebCore/dom/Node.cpp
+++ b/Source/WebCore/dom/Node.cpp
@@ -1304,10 +1304,8 @@
     if (isInShadowTree() && !treeScope().rootNode().isShadowRoot())
         clearFlag(IsInShadowTreeFlag);
     if (removalType.disconnectedFromDocument) {
-        if (auto* document = &oldParentOfRemovedTree.treeScope().documentScope()) {
-            if (auto* cache = document->existingAXObjectCache())
-                cache->remove(*this);
-        }
+        if (auto* cache = oldParentOfRemovedTree.document().existingAXObjectCache())
+            cache->remove(*this);
     }
 }