Web Inspector: Avoid creating and evaluating in the InspectorOverlay page on iOS...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Dec 2018 04:30:41 +0000 (04:30 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Dec 2018 04:30:41 +0000 (04:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192724
<rdar://problem/46745911>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2018-12-14
Reviewed by Devin Rousso.

iOS never installs the InspectorOverlay page as a page overlay.
It also uses its own node highlighting painting. Avoid any work
and resources associated with the overlay page for iOS.

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::paint):
(WebCore::InspectorOverlay::update):
(WebCore::InspectorOverlay::overlayPage):
(WebCore::evaluateCommandInOverlay):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@239247 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorOverlay.cpp

index 0472951..ed2d073 100644 (file)
@@ -1,3 +1,21 @@
+2018-12-14  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Avoid creating and evaluating in the InspectorOverlay page on iOS as it is unused
+        https://bugs.webkit.org/show_bug.cgi?id=192724
+        <rdar://problem/46745911>
+
+        Reviewed by Devin Rousso.
+
+        iOS never installs the InspectorOverlay page as a page overlay.
+        It also uses its own node highlighting painting. Avoid any work
+        and resources associated with the overlay page for iOS.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::paint):
+        (WebCore::InspectorOverlay::update):
+        (WebCore::InspectorOverlay::overlayPage):
+        (WebCore::evaluateCommandInOverlay):
+
 2018-12-14  Youenn Fablet  <youenn@apple.com>
 
         MediaRecorderPrivateAVFImpl should have a Ref<MediaRecorderPrivateWriter> as member
index 053dad8..3e3bc81 100644 (file)
@@ -180,8 +180,12 @@ void InspectorOverlay::paint(GraphicsContext& context)
     if (!shouldShowOverlay())
         return;
 
+    Page* overlayPage = this->overlayPage();
+    if (!overlayPage)
+        return;
+
     GraphicsContextStateSaver stateSaver(context);
-    FrameView* view = overlayPage()->mainFrame().view();
+    FrameView* view = overlayPage->mainFrame().view();
 
 #if PLATFORM(MAC)
     LocalDefaultSystemAppearance localAppearance(view->useDarkAppearance());
@@ -290,9 +294,12 @@ void InspectorOverlay::update()
     if (!view)
         return;
 
-    FrameView* overlayView = overlayPage()->mainFrame().view();
-    IntSize frameViewFullSize = view->sizeForVisibleContent(ScrollableArea::IncludeScrollbars);
-    overlayView->resize(frameViewFullSize);
+    Page* overlayPage = this->overlayPage();
+    if (overlayPage) {
+        FrameView* overlayView = overlayPage->mainFrame().view();
+        IntSize frameViewFullSize = view->sizeForVisibleContent(ScrollableArea::IncludeScrollbars);
+        overlayView->resize(frameViewFullSize);
+    }
 
     // Clear canvas and paint things.
     IntSize viewportSize = view->sizeForVisibleContent();
@@ -309,9 +316,12 @@ void InspectorOverlay::update()
         drawRulers();
 
     // Position DOM elements.
-    overlayPage()->mainFrame().document()->resolveStyle(Document::ResolveStyleType::Rebuild);
-    if (overlayView->needsLayout())
-        overlayView->layoutContext().layout();
+    if (overlayPage) {
+        overlayPage->mainFrame().document()->resolveStyle(Document::ResolveStyleType::Rebuild);
+        FrameView* overlayView = overlayPage->mainFrame().view();
+        if (overlayView->needsLayout())
+            overlayView->layoutContext().layout();
+    }
 
     forcePaint();
 }
@@ -702,6 +712,9 @@ void InspectorOverlay::drawPausedInDebuggerMessage()
 
 Page* InspectorOverlay::overlayPage()
 {
+#if PLATFORM(IOS_FAMILY)
+    return nullptr;
+#else
     if (m_overlayPage)
         return m_overlayPage.get();
 
@@ -746,6 +759,7 @@ Page* InspectorOverlay::overlayPage()
 #endif
 
     return m_overlayPage.get();
+#endif
 }
 
 void InspectorOverlay::forcePaint()
@@ -770,6 +784,9 @@ void InspectorOverlay::reset(const IntSize& viewportSize, const IntPoint& scroll
 
 static void evaluateCommandInOverlay(Page* page, Ref<JSON::Array>&& command)
 {
+    if (!page)
+        return;
+
     page->mainFrame().script().evaluate(ScriptSourceCode(makeString("dispatch(", command->toJSONString(), ')')));
 }