Web Inspector: node search does not work with elements on touch start listener
authorkpiascik@rim.com <kpiascik@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Oct 2012 18:04:27 +0000 (18:04 +0000)
committerkpiascik@rim.com <kpiascik@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Oct 2012 18:04:27 +0000 (18:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95252

Reviewed by Pavel Feldman.

Source/WebCore:

Added new InspectorInstrumentation::handleTouchEvent() method which
will prevent a touch handler from firing and inspect and element if we
are already searching for a node to highlight.
Now when a user has chosen to inspect element (magnifying glass icon)
and touches on a page the event will be directed to inspector and
handled appropriately.

Not testable.

* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::handleTouchEvent):
(WebCore):
* inspector/InspectorDOMAgent.h:
(InspectorDOMAgent):
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::handleTouchEventImpl):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::handleTouchEvent):
(WebCore):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleTouchEvent):

Source/WebKit/blackberry:

Removed calls to InspectorInstrumentation that no didn't work anyway.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPage::touchEvent):

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorDOMAgent.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/page/EventHandler.cpp
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog

index d1f4a1c..aaeac71 100644 (file)
@@ -1,3 +1,34 @@
+2012-10-11  Konrad Piascik  <kpiascik@rim.com>
+
+        Web Inspector: node search does not work with elements on touch start listener
+        https://bugs.webkit.org/show_bug.cgi?id=95252
+
+        Reviewed by Pavel Feldman.
+
+        Added new InspectorInstrumentation::handleTouchEvent() method which
+        will prevent a touch handler from firing and inspect and element if we
+        are already searching for a node to highlight.
+        Now when a user has chosen to inspect element (magnifying glass icon)
+        and touches on a page the event will be directed to inspector and
+        handled appropriately.
+
+        Not testable.
+
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::handleTouchEvent):
+        (WebCore):
+        * inspector/InspectorDOMAgent.h:
+        (InspectorDOMAgent):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore):
+        (WebCore::InspectorInstrumentation::handleTouchEventImpl):
+        * inspector/InspectorInstrumentation.h:
+        (InspectorInstrumentation):
+        (WebCore::InspectorInstrumentation::handleTouchEvent):
+        (WebCore):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleTouchEvent):
+
 2012-10-11  Otto Derek Cheung  <otcheung@rim.com>
 
         [BlackBerry] Credentials for HTTPS urls are saved in the HTTP protection space
index 36570bf..da149be 100644 (file)
@@ -957,6 +957,18 @@ bool InspectorDOMAgent::handleMousePress()
     return false;
 }
 
+bool InspectorDOMAgent::handleTouchEvent(Node* node)
+{
+    if (!m_searchingForNode)
+        return false;
+    if (node && m_inspectModeHighlightConfig) {
+        m_overlay->highlightNode(node, *m_inspectModeHighlightConfig);
+        inspect(node);
+        return true;
+    }
+    return false;
+}
+
 void InspectorDOMAgent::inspect(Node* inspectedNode)
 {
     ErrorString error;
index 2f61a0a..3b72652 100644 (file)
@@ -177,6 +177,7 @@ public:
 
     PassRefPtr<TypeBuilder::Runtime::RemoteObject> resolveNode(Node*, const String& objectGroup);
     bool handleMousePress();
+    bool handleTouchEvent(Node*);
     void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
     void inspect(Node*);
     void focusNode();
index e6040c6..81dded3 100644 (file)
@@ -262,6 +262,13 @@ void InspectorInstrumentation::didScrollImpl(InstrumentingAgents* instrumentingA
         pageAgent->didScroll();
 }
 
+bool InspectorInstrumentation::handleTouchEventImpl(InstrumentingAgents* instrumentingAgents, Node* node)
+{
+    if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
+        return domAgent->handleTouchEvent(node);
+    return false;
+}
+
 bool InspectorInstrumentation::handleMousePressImpl(InstrumentingAgents* instrumentingAgents)
 {
     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
index 99a97f2..4588865 100644 (file)
@@ -110,6 +110,7 @@ public:
 
     static void mouseDidMoveOverElement(Page*, const HitTestResult&, unsigned modifierFlags);
     static bool handleMousePress(Page*);
+    static bool handleTouchEvent(Page*, Node*);
     static bool forcePseudoState(Element*, CSSSelector::PseudoType);
 
     static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url);
@@ -298,6 +299,7 @@ private:
     static void didUpdateRegionLayoutImpl(InstrumentingAgents*, Document*, WebKitNamedFlow*);
 
     static void mouseDidMoveOverElementImpl(InstrumentingAgents*, const HitTestResult&, unsigned modifierFlags);
+    static bool handleTouchEventImpl(InstrumentingAgents*, Node*);
     static bool handleMousePressImpl(InstrumentingAgents*);
     static bool forcePseudoStateImpl(InstrumentingAgents*, Element*, CSSSelector::PseudoType);
 
@@ -605,6 +607,16 @@ inline void InspectorInstrumentation::mouseDidMoveOverElement(Page* page, const
 #endif
 }
 
+inline bool InspectorInstrumentation::handleTouchEvent(Page* page, Node* node)
+{
+#if ENABLE(INSPECTOR)
+    FAST_RETURN_IF_NO_FRONTENDS(false);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
+        return handleTouchEventImpl(instrumentingAgents, node);
+#endif
+    return false;
+}
+
 inline bool InspectorInstrumentation::handleMousePress(Page* page)
 {
 #if ENABLE(INSPECTOR)
index 2efcd6a..5ef0c61 100644 (file)
@@ -3699,6 +3699,9 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
             if (node->isTextNode())
                 node = node->parentNode();
 
+            if (InspectorInstrumentation::handleTouchEvent(m_frame->page(), node))
+                return true;
+
             Document* doc = node->document();
             if (!doc)
                 continue;
index 60b39bd..a331830 100644 (file)
@@ -4071,10 +4071,6 @@ bool WebPage::touchEvent(const Platform::TouchEvent& event)
     if (d->m_page->defersLoading())
         return false;
 
-    // FIXME: this checks if node search on inspector is enabled, though it might not be optimized.
-    if (InspectorInstrumentation::handleMousePress(d->m_mainFrame->page()))
-        return false;
-
     PluginView* pluginView = d->m_fullScreenPluginView.get();
     if (pluginView)
         return d->dispatchTouchEventToFullScreenPlugin(pluginView, event);
index 3fae0e4..7bb87a3 100644 (file)
@@ -1,3 +1,15 @@
+2012-10-11  Konrad Piascik  <kpiascik@rim.com>
+
+        Web Inspector: node search does not work with elements on touch start listener
+        https://bugs.webkit.org/show_bug.cgi?id=95252
+
+        Reviewed by Pavel Feldman.
+
+        Removed calls to InspectorInstrumentation that no didn't work anyway.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPage::touchEvent):
+
 2012-10-11  Chris Guan  <chris.guan@torchmobile.com.cn>
 
         [Blackberry] makes NavigatorContentUtils work