Document::m_closeAfterStyleRecalc is unnecessary
https://bugs.webkit.org/show_bug.cgi?id=203143

Reviewed by Antti Koivisto.

Removed the code to defer implicit close until the style recalc is done
since we call FrameLoader::checkCompleted asynchronously via a timer these days.

* dom/Document.cpp:
(WebCore::Document::resolveStyle):
(WebCore::Document::implicitClose):
* dom/Document.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 5bab2e0..ef3679b 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2019-10-17  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Document::m_closeAfterStyleRecalc is unnecessary
+        https://bugs.webkit.org/show_bug.cgi?id=203143
+
+        Reviewed by Antti Koivisto.
+
+        Removed the code to defer implicit close until the style recalc is done
+        since we call FrameLoader::checkCompleted asynchronously via a timer these days.
+
+        * dom/Document.cpp:
+        (WebCore::Document::resolveStyle):
+        (WebCore::Document::implicitClose):
+        * dom/Document.h:
+
 2019-10-17  Dean Jackson  <dino@apple.com>
 
         texImage2D for a half-float texture only accepts null
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 37b7cc2..4b93768 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -1978,12 +1978,6 @@
         // FIXME: Assert ASSERT(!needsStyleRecalc()) here. Do we still have some cases where it's not true?
     }
 
-    // If we wanted to call implicitClose() during recalcStyle, do so now that we're finished.
-    if (m_closeAfterStyleRecalc) {
-        m_closeAfterStyleRecalc = false;
-        implicitClose();
-    }
-
     InspectorInstrumentation::didRecalculateStyle(*this);
 
     // Some animated images may now be inside the viewport due to style recalc,
@@ -2920,12 +2914,7 @@
 
 void Document::implicitClose()
 {
-    // If we're in the middle of recalcStyle, we need to defer the close until the style information is accurate and all elements are re-attached.
-    if (m_inStyleRecalc) {
-        m_closeAfterStyleRecalc = true;
-        return;
-    }
-
+    RELEASE_ASSERT(!m_inStyleRecalc);
     bool wasLocationChangePending = frame() && frame()->navigationScheduler().locationChangePending();
     bool doload = !parsing() && m_parser && !m_processingLoadEvent && !wasLocationChangePending;
     
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index ea16ce7..00568a9 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -1992,7 +1992,6 @@
 
     bool m_needsFullStyleRebuild { false };
     bool m_inStyleRecalc { false };
-    bool m_closeAfterStyleRecalc { false };
     bool m_inRenderTreeUpdate { false };
     bool m_isResolvingTreeStyle { false };