Title: [199380] trunk/Source
Revision
199380
Author
[email protected]
Date
2016-04-12 12:35:22 -0700 (Tue, 12 Apr 2016)

Log Message

Web Inspector: Keyboard shortcut for "Inspect Element" only works when Web Inspector is open.
https://bugs.webkit.org/show_bug.cgi?id=111193
<rdar://problem/13325889>

Reviewed by Timothy Hatcher.

Source/WebCore:

* inspector/InspectorClient.h:
(WebCore::InspectorClient::elementSelectionChanged):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setSearchingForNode):
Inform the client when element selection changes.

Source/WebInspectorUI:

* UserInterface/Controllers/DOMTreeManager.js:
(WebInspector.DOMTreeManager.prototype.set inspectModeEnabled):
(WebInspector.DOMTreeManager.set inspectModeEnabled.callback):
* UserInterface/Protocol/InspectorFrontendAPI.js:
(InspectorFrontendAPI.setElementSelectionEnabled):
Frontend API to enable element selection.

Source/WebKit2:

* UIProcess/API/C/WKInspector.cpp:
(WKInspectorIsElementSelectionActive):
(WKInspectorToggleElementSelection):
* UIProcess/API/C/WKInspector.h:
API for WebKit clients to toggle element selection.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::toggleElementSelection):
(WebKit::WebInspectorProxy::elementSelectionChanged):
* UIProcess/WebInspectorProxy.h:
(WebKit::WebInspectorProxy::isElementSelectionActive):
* UIProcess/WebInspectorProxy.messages.in:
UIProcess update according to the state of the page
and action to tell the page to toggle.
When starting, pre-connect the inspector. When the
state changes, if we were stopping and nothing was
selected, then disconnect. Otherwise, we will bring
the inspector to the front.

* WebProcess/WebCoreSupport/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::elementSelectionChanged):
* WebProcess/WebCoreSupport/WebInspectorClient.h:
Let the UIProcess update its cached state of whether or
not element selection is enabled or disabled.

* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::startElementSelection):
(WebKit::WebInspector::stopElementSelection):
(WebKit::WebInspector::elementSelectionChanged):
* WebProcess/WebPage/WebInspector.h:
* WebProcess/WebPage/WebInspector.messages.in:
Messages in both directions.
UIProcess -> InspectorProcess enable/disable.
WebProcess -> UIProcess updated element selection state.

* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::startElementSelection):
(WebKit::WebInspectorUI::stopElementSelection):
* WebProcess/WebPage/WebInspectorUI.h:
* WebProcess/WebPage/WebInspectorUI.messages.in:
Open the inspector and enable element selection.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (199379 => 199380)


--- trunk/Source/WebCore/ChangeLog	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebCore/ChangeLog	2016-04-12 19:35:22 UTC (rev 199380)
@@ -1,3 +1,17 @@
+2016-04-12  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Keyboard shortcut for "Inspect Element" only works when Web Inspector is open.
+        https://bugs.webkit.org/show_bug.cgi?id=111193
+        <rdar://problem/13325889>
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InspectorClient.h:
+        (WebCore::InspectorClient::elementSelectionChanged):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::setSearchingForNode):
+        Inform the client when element selection changes.
+
 2016-04-12  Chris Dumez  <[email protected]>
 
         Regression(r199360): assertion hit in Element::fastGetAttribute()

Modified: trunk/Source/WebCore/inspector/InspectorClient.h (199379 => 199380)


--- trunk/Source/WebCore/inspector/InspectorClient.h	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebCore/inspector/InspectorClient.h	2016-04-12 19:35:22 UTC (rev 199380)
@@ -62,6 +62,7 @@
     virtual void setShowPaintRects(bool) { }
     virtual void showPaintRect(const FloatRect&) { }
     virtual void didSetSearchingForNode(bool) { }
+    virtual void elementSelectionChanged(bool) { }
 
     virtual bool handleJavaScriptDialog(bool, const String*) { return false; }
 

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (199379 => 199380)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2016-04-12 19:35:22 UTC (rev 199380)
@@ -63,6 +63,8 @@
 #include "HTMLNames.h"
 #include "HTMLTemplateElement.h"
 #include "HitTestResult.h"
+#include "InspectorClient.h"
+#include "InspectorController.h"
 #include "InspectorHistory.h"
 #include "InspectorNodeFinder.h"
 #include "InspectorOverlay.h"
@@ -1015,7 +1017,9 @@
 {
     if (m_searchingForNode == enabled)
         return;
+
     m_searchingForNode = enabled;
+
     if (enabled) {
         m_inspectModeHighlightConfig = highlightConfigFromInspectorObject(errorString, highlightInspectorObject);
         if (!m_inspectModeHighlightConfig)
@@ -1024,6 +1028,9 @@
         hideHighlight(errorString);
 
     m_overlay->didSetSearchingForNode(m_searchingForNode);
+
+    if (InspectorClient* client = m_pageAgent->page().inspectorController().inspectorClient())
+        client->elementSelectionChanged(m_searchingForNode);
 }
 
 std::unique_ptr<HighlightConfig> InspectorDOMAgent::highlightConfigFromInspectorObject(ErrorString& errorString, const InspectorObject* highlightInspectorObject)

Modified: trunk/Source/WebInspectorUI/ChangeLog (199379 => 199380)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-04-12 19:35:22 UTC (rev 199380)
@@ -1,5 +1,20 @@
 2016-04-12  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: Keyboard shortcut for "Inspect Element" only works when Web Inspector is open.
+        https://bugs.webkit.org/show_bug.cgi?id=111193
+        <rdar://problem/13325889>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Controllers/DOMTreeManager.js:
+        (WebInspector.DOMTreeManager.prototype.set inspectModeEnabled):
+        (WebInspector.DOMTreeManager.set inspectModeEnabled.callback):
+        * UserInterface/Protocol/InspectorFrontendAPI.js:
+        (InspectorFrontendAPI.setElementSelectionEnabled):
+        Frontend API to enable element selection.
+
+2016-04-12  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: Should be able to expand Objects in Heap Allocations View to see exactly what it retains
         https://bugs.webkit.org/show_bug.cgi?id=156419
         <rdar://problem/25633863>

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (199379 => 199380)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2016-04-12 19:35:22 UTC (rev 199380)
@@ -233,7 +233,6 @@
 localizedStrings["Disable Breakpoints"] = "Disable Breakpoints";
 localizedStrings["Disable all breakpoints (%s)"] = "Disable all breakpoints (%s)";
 localizedStrings["Disable paint flashing"] = "Disable paint flashing";
-localizedStrings["Disable point to inspect mode (%s)"] = "Disable point to inspect mode (%s)";
 localizedStrings["Disabled"] = "Disabled";
 localizedStrings["Display"] = "Display";
 localizedStrings["Dock to bottom of window"] = "Dock to bottom of window";
@@ -292,7 +291,6 @@
 localizedStrings["Enable Breakpoints"] = "Enable Breakpoints";
 localizedStrings["Enable all breakpoints (%s)"] = "Enable all breakpoints (%s)";
 localizedStrings["Enable paint flashing"] = "Enable paint flashing";
-localizedStrings["Enable point to inspect mode (%s)"] = "Enable point to inspect mode (%s)";
 localizedStrings["Encoded"] = "Encoded";
 localizedStrings["Encoding"] = "Encoding";
 localizedStrings["End Capturing"] = "End Capturing";
@@ -675,6 +673,7 @@
 localizedStrings["Start Playback"] = "Start Playback";
 localizedStrings["Start Recording"] = "Start Recording";
 localizedStrings["Start Time"] = "Start Time";
+localizedStrings["Start element selection (%s)"] = "Start element selection (%s)";
 localizedStrings["Start recording (%s)\nCreate new recording (%s)"] = "Start recording (%s)\nCreate new recording (%s)";
 localizedStrings["State"] = "State";
 localizedStrings["Status"] = "Status";
@@ -683,6 +682,7 @@
 localizedStrings["Step out (%s or %s)"] = "Step out (%s or %s)";
 localizedStrings["Step over (%s or %s)"] = "Step over (%s or %s)";
 localizedStrings["Stop Recording"] = "Stop Recording";
+localizedStrings["Stop element selection (%s)"] = "Stop element selection (%s)";
 localizedStrings["Stop recording (%s)"] = "Stop recording (%s)";
 localizedStrings["Stop recording."] = "Stop recording.";
 localizedStrings["Storage"] = "Storage";

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (199379 => 199380)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2016-04-12 19:35:22 UTC (rev 199380)
@@ -327,8 +327,8 @@
 
     // The toolbar button for node inspection.
     if (this.debuggableType === WebInspector.DebuggableType.Web) {
-        var toolTip = WebInspector.UIString("Enable point to inspect mode (%s)").format(WebInspector._inspectModeKeyboardShortcut.displayName);
-        var activatedToolTip = WebInspector.UIString("Disable point to inspect mode (%s)").format(WebInspector._inspectModeKeyboardShortcut.displayName);
+        var toolTip = WebInspector.UIString("Start element selection (%s)").format(WebInspector._inspectModeKeyboardShortcut.displayName);
+        var activatedToolTip = WebInspector.UIString("Stop element selection (%s)").format(WebInspector._inspectModeKeyboardShortcut.displayName);
         this._inspectModeToolbarButton = new WebInspector.ActivateButtonToolbarItem("inspect", toolTip, activatedToolTip, null, "Images/Crosshair.svg");
         this._inspectModeToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleInspectMode, this);
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js (199379 => 199380)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js	2016-04-12 19:35:22 UTC (rev 199380)
@@ -448,13 +448,13 @@
 
     set inspectModeEnabled(enabled)
     {
-        function callback(error)
-        {
+        if (enabled === this._inspectModeEnabled)
+            return;
+
+        DOMAgent.setInspectModeEnabled(enabled, this._buildHighlightConfig(), (error) => {
             this._inspectModeEnabled = error ? false : enabled;
             this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.InspectModeStateChanged);
-        }
-
-        DOMAgent.setInspectModeEnabled(enabled, this._buildHighlightConfig(), callback.bind(this));
+        });
     }
 
     _buildHighlightConfig(mode = "all")

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js (199379 => 199380)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js	2016-04-12 19:35:22 UTC (rev 199380)
@@ -55,6 +55,11 @@
         }
     },
 
+    setElementSelectionEnabled: function(enabled)
+    {
+        WebInspector.domTreeManager.inspectModeEnabled = enabled;
+    },
+
     setDockingUnavailable: function(unavailable)
     {
         WebInspector.updateDockingAvailability(!unavailable);

Modified: trunk/Source/WebKit2/ChangeLog (199379 => 199380)


--- trunk/Source/WebKit2/ChangeLog	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/ChangeLog	2016-04-12 19:35:22 UTC (rev 199380)
@@ -1,3 +1,53 @@
+2016-04-12  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Keyboard shortcut for "Inspect Element" only works when Web Inspector is open.
+        https://bugs.webkit.org/show_bug.cgi?id=111193
+        <rdar://problem/13325889>
+
+        Reviewed by Timothy Hatcher.
+
+        * UIProcess/API/C/WKInspector.cpp:
+        (WKInspectorIsElementSelectionActive):
+        (WKInspectorToggleElementSelection):
+        * UIProcess/API/C/WKInspector.h:
+        API for WebKit clients to toggle element selection.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::toggleElementSelection):
+        (WebKit::WebInspectorProxy::elementSelectionChanged):
+        * UIProcess/WebInspectorProxy.h:
+        (WebKit::WebInspectorProxy::isElementSelectionActive):
+        * UIProcess/WebInspectorProxy.messages.in:
+        UIProcess update according to the state of the page
+        and action to tell the page to toggle.
+        When starting, pre-connect the inspector. When the
+        state changes, if we were stopping and nothing was
+        selected, then disconnect. Otherwise, we will bring
+        the inspector to the front.
+
+        * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
+        (WebKit::WebInspectorClient::elementSelectionChanged):
+        * WebProcess/WebCoreSupport/WebInspectorClient.h:
+        Let the UIProcess update its cached state of whether or
+        not element selection is enabled or disabled.
+
+        * WebProcess/WebPage/WebInspector.cpp:
+        (WebKit::WebInspector::startElementSelection):
+        (WebKit::WebInspector::stopElementSelection):
+        (WebKit::WebInspector::elementSelectionChanged):
+        * WebProcess/WebPage/WebInspector.h:
+        * WebProcess/WebPage/WebInspector.messages.in:
+        Messages in both directions.
+        UIProcess -> InspectorProcess enable/disable.
+        WebProcess -> UIProcess updated element selection state.
+
+        * WebProcess/WebPage/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::startElementSelection):
+        (WebKit::WebInspectorUI::stopElementSelection):
+        * WebProcess/WebPage/WebInspectorUI.h:
+        * WebProcess/WebPage/WebInspectorUI.messages.in:
+        Open the inspector and enable element selection.
+
 2016-04-11  Alex Christensen  <[email protected]>
 
         Build MiniBrowser with CMake on Mac

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp (199379 => 199380)


--- trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKInspector.cpp	2016-04-12 19:35:22 UTC (rev 199380)
@@ -120,4 +120,14 @@
     toImpl(inspectorRef)->togglePageProfiling();
 }
 
+bool WKInspectorIsElementSelectionActive(WKInspectorRef inspectorRef)
+{
+    return toImpl(inspectorRef)->isElementSelectionActive();
+}
+
+void WKInspectorToggleElementSelection(WKInspectorRef inspectorRef)
+{
+    toImpl(inspectorRef)->toggleElementSelection();
+}
+
 #endif // !PLATFORM(IOS)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h (199379 => 199380)


--- trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKInspector.h	2016-04-12 19:35:22 UTC (rev 199380)
@@ -61,6 +61,9 @@
 WK_EXPORT bool WKInspectorIsProfilingPage(WKInspectorRef inspector);
 WK_EXPORT void WKInspectorTogglePageProfiling(WKInspectorRef inspector);
 
+WK_EXPORT bool WKInspectorIsElementSelectionActive(WKInspectorRef inspector);
+WK_EXPORT void WKInspectorToggleElementSelection(WKInspectorRef inspector);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (199379 => 199380)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2016-04-12 19:35:22 UTC (rev 199380)
@@ -303,6 +303,20 @@
     m_isProfilingPage = !m_isProfilingPage;
 }
 
+void WebInspectorProxy::toggleElementSelection()
+{
+    if (!m_inspectedPage)
+        return;
+
+    if (m_elementSelectionActive) {
+        m_ignoreElementSelectionChange = true;
+        m_inspectedPage->process().send(Messages::WebInspector::StopElementSelection(), m_inspectedPage->pageID());
+    } else {
+        connect();
+        m_inspectedPage->process().send(Messages::WebInspector::StartElementSelection(), m_inspectedPage->pageID());
+    }
+}
+
 static WebProcessPool* s_mainInspectorProcessPool;
 static WebProcessPool* s_nestedInspectorProcessPool;
 
@@ -623,6 +637,21 @@
     platformInspectedURLChanged(urlString);
 }
 
+void WebInspectorProxy::elementSelectionChanged(bool active)
+{
+    m_elementSelectionActive = active;
+
+    if (m_ignoreElementSelectionChange) {
+        m_ignoreElementSelectionChange = false;
+        if (!m_isVisible)
+            close();
+        return;
+    }
+
+    if (!active && isConnected())
+        bringToFront();
+}
+
 void WebInspectorProxy::save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs)
 {
     platformSave(filename, content, base64Encoded, forceSaveAs);

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (199379 => 199380)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h	2016-04-12 19:35:22 UTC (rev 199380)
@@ -134,6 +134,9 @@
     bool isProfilingPage() const { return m_isProfilingPage; }
     void togglePageProfiling();
 
+    bool isElementSelectionActive() const { return m_elementSelectionActive; }
+    void toggleElementSelection();
+
     static bool isInspectorProcessPool(WebProcessPool&);
     static bool isInspectorPage(WebPageProxy&);
 
@@ -191,6 +194,7 @@
     void bringToFront();
     void attachAvailabilityChanged(bool);
     void inspectedURLChanged(const String&);
+    void elementSelectionChanged(bool);
 
     void save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs);
     void append(const String& filename, const String& content);
@@ -227,16 +231,18 @@
     static const unsigned initialWindowWidth;
     static const unsigned initialWindowHeight;
 
-    WebPageProxy* m_inspectedPage {nullptr};
-    WebPageProxy* m_inspectorPage {nullptr};
+    WebPageProxy* m_inspectedPage { nullptr };
+    WebPageProxy* m_inspectorPage { nullptr };
 
-    bool m_underTest {false};
-    bool m_isVisible {false};
-    bool m_isAttached {false};
-    bool m_canAttach {false};
-    bool m_isProfilingPage {false};
-    bool m_showMessageSent {false};
-    bool m_ignoreFirstBringToFront {false};
+    bool m_underTest { false };
+    bool m_isVisible { false };
+    bool m_isAttached { false };
+    bool m_canAttach { false };
+    bool m_isProfilingPage { false };
+    bool m_showMessageSent { false };    
+    bool m_ignoreFirstBringToFront { false };
+    bool m_elementSelectionActive { false };
+    bool m_ignoreElementSelectionChange { false };
 
     IPC::Attachment m_connectionIdentifier;
 
@@ -251,16 +257,16 @@
     String m_urlString;
 #elif PLATFORM(GTK)
     WebInspectorClientGtk m_client;
-    GtkWidget* m_inspectorView {nullptr};
-    GtkWidget* m_inspectorWindow {nullptr};
-    GtkWidget* m_headerBar {nullptr};
+    GtkWidget* m_inspectorView { nullptr };
+    GtkWidget* m_inspectorWindow { nullptr };
+    GtkWidget* m_headerBar { nullptr };
     String m_inspectedURLString;
 #elif PLATFORM(EFL)
-    Evas_Object* m_inspectorView {nullptr};
-    Ecore_Evas* m_inspectorWindow {nullptr};
+    Evas_Object* m_inspectorView { nullptr };
+    Ecore_Evas* m_inspectorWindow { nullptr };
 #endif
 #if ENABLE(INSPECTOR_SERVER)
-    int m_remoteInspectionPageId {0};
+    int m_remoteInspectionPageId { 0 };
 #endif
 };
 

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in (199379 => 199380)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in	2016-04-12 19:35:22 UTC (rev 199380)
@@ -27,6 +27,7 @@
     BringToFront()
 
     InspectedURLChanged(String urlString)
+    ElementSelectionChanged(bool active)
 
     Save(String filename, String content, bool base64Encoded, bool forceSaveAs)
     Append(String filename, String content)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp (199379 => 199380)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp	2016-04-12 19:35:22 UTC (rev 199380)
@@ -192,6 +192,11 @@
 }
 #endif
 
+void WebInspectorClient::elementSelectionChanged(bool active)
+{
+    m_page->inspector()->elementSelectionChanged(active);
+}
+
 void WebInspectorClient::pageOverlayDestroyed(PageOverlay&)
 {
 }

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h (199379 => 199380)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h	2016-04-12 19:35:22 UTC (rev 199380)
@@ -66,6 +66,8 @@
     void didSetSearchingForNode(bool) override;
 #endif
 
+    void elementSelectionChanged(bool) override;
+
     bool overridesShowPaintRects() const override { return true; }
     void showPaintRect(const WebCore::FloatRect&) override;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp (199379 => 199380)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp	2016-04-12 19:35:22 UTC (rev 199380)
@@ -209,6 +209,27 @@
     m_frontendConnection->send(Messages::WebInspectorUI::StopPageProfiling(), 0);
 }
 
+void WebInspector::startElementSelection()
+{
+    if (!m_page->corePage())
+        return;
+
+    m_frontendConnection->send(Messages::WebInspectorUI::StartElementSelection(), 0);
+}
+
+void WebInspector::stopElementSelection()
+{
+    if (!m_page->corePage())
+        return;
+
+    m_frontendConnection->send(Messages::WebInspectorUI::StopElementSelection(), 0);
+}
+
+void WebInspector::elementSelectionChanged(bool active)
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::ElementSelectionChanged(active), m_page->pageID());
+}
+
 bool WebInspector::canAttachWindow()
 {
     if (!m_page->corePage())

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h (199379 => 199380)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h	2016-04-12 19:35:22 UTC (rev 199380)
@@ -79,6 +79,10 @@
     void startPageProfiling();
     void stopPageProfiling();
 
+    void startElementSelection();
+    void stopElementSelection();
+    void elementSelectionChanged(bool);
+
     void sendMessageToBackend(const String&);
 
 #if ENABLE(INSPECTOR_SERVER)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in (199379 => 199380)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in	2016-04-12 19:35:22 UTC (rev 199380)
@@ -36,6 +36,9 @@
     StartPageProfiling()
     StopPageProfiling()
 
+    StartElementSelection()
+    StopElementSelection()
+
     SendMessageToBackend(String message)
 
 #if ENABLE(INSPECTOR_SERVER)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp (199379 => 199380)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp	2016-04-12 19:35:22 UTC (rev 199380)
@@ -233,6 +233,16 @@
     m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("setTimelineProfilingEnabled"), false);
 }
 
+void WebInspectorUI::startElementSelection()
+{
+    m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("setElementSelectionEnabled"), true);
+}
+
+void WebInspectorUI::stopElementSelection()
+{
+    m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("setElementSelectionEnabled"), false);
+}
+
 void WebInspectorUI::didSave(const String& url)
 {
     m_frontendAPIDispatcher.dispatchCommand(ASCIILiteral("savedURL"), url);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h (199379 => 199380)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h	2016-04-12 19:35:22 UTC (rev 199380)
@@ -63,6 +63,9 @@
     void startPageProfiling();
     void stopPageProfiling();
 
+    void startElementSelection();
+    void stopElementSelection();
+
     void attachedBottom() { setDockSide(DockSide::Bottom); }
     void attachedRight() { setDockSide(DockSide::Right); }
     void detached() { setDockSide(DockSide::Undocked); }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in (199379 => 199380)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in	2016-04-12 19:35:12 UTC (rev 199379)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in	2016-04-12 19:35:22 UTC (rev 199380)
@@ -36,6 +36,9 @@
     StartPageProfiling()
     StopPageProfiling()
 
+    StartElementSelection()
+    StopElementSelection()
+
     DidSave(String url)
     DidAppend(String url)
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to