Title: [206093] trunk/Source/WebCore
Revision
206093
Author
commit-qu...@webkit.org
Date
2016-09-19 04:30:28 -0700 (Mon, 19 Sep 2016)

Log Message

Web Inspector: ⇧⌘C should highlight node under cursor without re-moving mouse
https://bugs.webkit.org/show_bug.cgi?id=162128

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-09-19
Reviewed by Brian Burg.

* inspector/InspectorDOMAgent.h:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorDOMAgent::mouseDidMoveOverElement):
(WebCore::InspectorDOMAgent::highlightMousedOverNode):
(WebCore::InspectorDOMAgent::setSearchingForNode):
When the inspector is connected, remember the last moused over node.
This produces far more consistent results of highlighting under
the cursor when pressing and releasing the keyboard shortcut keys,
without having to move the mouse. Even when using the shortcut to
first connect the inspector this produces far more consistent
results because releasing the keys for the shortcut produce new
mouseDidMoveOverElement events.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206092 => 206093)


--- trunk/Source/WebCore/ChangeLog	2016-09-19 11:29:36 UTC (rev 206092)
+++ trunk/Source/WebCore/ChangeLog	2016-09-19 11:30:28 UTC (rev 206093)
@@ -1,3 +1,24 @@
+2016-09-19  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: ⇧⌘C should highlight node under cursor without re-moving mouse
+        https://bugs.webkit.org/show_bug.cgi?id=162128
+
+        Reviewed by Brian Burg.
+
+        * inspector/InspectorDOMAgent.h:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
+        (WebCore::InspectorDOMAgent::mouseDidMoveOverElement):
+        (WebCore::InspectorDOMAgent::highlightMousedOverNode):
+        (WebCore::InspectorDOMAgent::setSearchingForNode):
+        When the inspector is connected, remember the last moused over node.
+        This produces far more consistent results of highlighting under
+        the cursor when pressing and releasing the keyboard shortcut keys,
+        without having to move the mouse. Even when using the shortcut to
+        first connect the inspector this produces far more consistent
+        results because releasing the keys for the shortcut produce new
+        mouseDidMoveOverElement events.
+
 2016-09-19  Nael Ouedraogo  <nael.ouedra...@crf.canon.fr>
 
         JSDOMBindings' toArguments() should return a more descriptive object

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (206092 => 206093)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2016-09-19 11:29:36 UTC (rev 206092)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2016-09-19 11:30:28 UTC (rev 206093)
@@ -241,12 +241,13 @@
 {
     m_history.reset();
     m_domEditor.reset();
+    m_mousedOverNode = nullptr;
 
     ErrorString unused;
-    setSearchingForNode(unused, false, 0);
+    setSearchingForNode(unused, false, nullptr);
     hideHighlight(unused);
 
-    m_instrumentingAgents.setInspectorDOMAgent(0);
+    m_instrumentingAgents.setInspectorDOMAgent(nullptr);
     m_documentRequested = false;
     reset();
 }
@@ -1005,10 +1006,17 @@
 
 void InspectorDOMAgent::mouseDidMoveOverElement(const HitTestResult& result, unsigned)
 {
+    m_mousedOverNode = result.innerNode();
+
     if (!m_searchingForNode)
         return;
 
-    Node* node = result.innerNode();
+    highlightMousedOverNode();
+}
+
+void InspectorDOMAgent::highlightMousedOverNode()
+{
+    Node* node = m_mousedOverNode.get();
     while (node && node->nodeType() == Node::TEXT_NODE)
         node = node->parentNode();
     if (node && m_inspectModeHighlightConfig)
@@ -1026,6 +1034,7 @@
         m_inspectModeHighlightConfig = highlightConfigFromInspectorObject(errorString, highlightInspectorObject);
         if (!m_inspectModeHighlightConfig)
             return;
+        highlightMousedOverNode();
     } else
         hideHighlight(errorString);
 

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (206092 => 206093)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2016-09-19 11:29:36 UTC (rev 206092)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2016-09-19 11:30:28 UTC (rev 206093)
@@ -215,6 +215,7 @@
     InspectorPageAgent* pageAgent() { return m_pageAgent; }
 
 private:
+    void highlightMousedOverNode();
     void setSearchingForNode(ErrorString&, bool enabled, const Inspector::InspectorObject* highlightConfig);
     std::unique_ptr<HighlightConfig> highlightConfigFromInspectorObject(ErrorString&, const Inspector::InspectorObject* highlightInspectorObject);
 
@@ -270,6 +271,7 @@
     SearchResults m_searchResults;
     std::unique_ptr<RevalidateStyleAttributeTask> m_revalidateStyleAttrTask;
     RefPtr<Node> m_nodeToFocus;
+    RefPtr<Node> m_mousedOverNode;
     bool m_searchingForNode { false };
     std::unique_ptr<HighlightConfig> m_inspectModeHighlightConfig;
     std::unique_ptr<InspectorHistory> m_history;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to