Title: [125028] trunk/Source/WebCore
Revision
125028
Author
apav...@chromium.org
Date
2012-08-08 06:11:54 -0700 (Wed, 08 Aug 2012)

Log Message

Web Inspector: move setTouchEventEmulationEnabled from DOMAgent to PageAgent
https://bugs.webkit.org/show_bug.cgi?id=93437

Reviewed by Pavel Feldman.

* inspector/Inspector.json:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::clearFrontend):
(WebCore::InspectorDOMAgent::restore):
* inspector/InspectorDOMAgent.h:
(InspectorDOMAgent):
* inspector/InspectorPageAgent.cpp:
(PageAgentState):
(WebCore::InspectorPageAgent::clearFrontend):
(WebCore::InspectorPageAgent::restore):
(WebCore):
(WebCore::InspectorPageAgent::updateTouchEventEmulationInPage):
(WebCore::InspectorPageAgent::setTouchEmulationEnabled):
* inspector/InspectorPageAgent.h:
* inspector/front-end/DOMAgent.js:
(WebInspector.DOMAgent.prototype._emulateTouchEventsChanged):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125027 => 125028)


--- trunk/Source/WebCore/ChangeLog	2012-08-08 13:04:58 UTC (rev 125027)
+++ trunk/Source/WebCore/ChangeLog	2012-08-08 13:11:54 UTC (rev 125028)
@@ -1,3 +1,27 @@
+2012-08-08  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: move setTouchEventEmulationEnabled from DOMAgent to PageAgent
+        https://bugs.webkit.org/show_bug.cgi?id=93437
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/Inspector.json:
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::clearFrontend):
+        (WebCore::InspectorDOMAgent::restore):
+        * inspector/InspectorDOMAgent.h:
+        (InspectorDOMAgent):
+        * inspector/InspectorPageAgent.cpp:
+        (PageAgentState):
+        (WebCore::InspectorPageAgent::clearFrontend):
+        (WebCore::InspectorPageAgent::restore):
+        (WebCore):
+        (WebCore::InspectorPageAgent::updateTouchEventEmulationInPage):
+        (WebCore::InspectorPageAgent::setTouchEmulationEnabled):
+        * inspector/InspectorPageAgent.h:
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.DOMAgent.prototype._emulateTouchEventsChanged):
+
 2012-08-08  Alexis Menard  <alexis.men...@openbossa.org>
 
         Unreviewed build fix for Qt on Linux.

Modified: trunk/Source/WebCore/inspector/Inspector.json (125027 => 125028)


--- trunk/Source/WebCore/inspector/Inspector.json	2012-08-08 13:04:58 UTC (rev 125027)
+++ trunk/Source/WebCore/inspector/Inspector.json	2012-08-08 13:11:54 UTC (rev 125028)
@@ -396,6 +396,14 @@
                     { "name": "result", "type": "boolean", "description": "If true, <code>setDeviceOrientationOverride</code> can safely be invoked on the agent." }
                 ],
                 "hidden": true
+            },
+            {
+                "name": "setTouchEmulationEnabled",
+                "parameters": [
+                    { "name": "enabled", "type": "boolean", "description": "Whether the touch event emulation should be enabled." }
+                ],
+                "description": "Toggles mouse event-based touch event emulation.",
+                "hidden": true
             }
         ],
         "events": [
@@ -1880,14 +1888,6 @@
                 "description": "Moves node into the new container, places it before the given anchor."
             },
             {
-                "name": "setTouchEmulationEnabled",
-                "parameters": [
-                    { "name": "enabled", "type": "boolean", "description": "Whether the touch event emulation should be enabled." }
-                ],
-                "description": "Toggles mouse event-based touch event emulation.",
-                "hidden": true
-            },
-            {
                 "name": "undo",
                 "description": "Undoes the last performed action.",
                 "hidden": true

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (125027 => 125028)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2012-08-08 13:04:58 UTC (rev 125027)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2012-08-08 13:11:54 UTC (rev 125028)
@@ -104,10 +104,6 @@
 
 namespace DOMAgentState {
 static const char documentRequested[] = "documentRequested";
-
-#if ENABLE(TOUCH_EVENTS)
-static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
-#endif
 };
 
 static const size_t maxTextSize = 10000;
@@ -240,9 +236,6 @@
     m_frontend = 0;
     m_instrumentingAgents->setInspectorDOMAgent(0);
     m_state->setBoolean(DOMAgentState::documentRequested, false);
-#if ENABLE(TOUCH_EVENTS)
-    updateTouchEventEmulationInPage(false);
-#endif
     reset();
 }
 
@@ -251,9 +244,6 @@
     // Reset document to avoid early return from setDocument.
     m_document = 0;
     setDocument(m_pageAgent->mainFrame()->document());
-#if ENABLE(TOUCH_EVENTS)
-    updateTouchEventEmulationInPage(m_state->getBoolean(DOMAgentState::touchEventEmulationEnabled));
-#endif
 }
 
 Vector<Document*> InspectorDOMAgent::documents()
@@ -459,15 +449,6 @@
     m_childrenRequested.clear();
 }
 
-#if ENABLE(TOUCH_EVENTS)
-void InspectorDOMAgent::updateTouchEventEmulationInPage(bool enabled)
-{
-    m_state->setBoolean(DOMAgentState::touchEventEmulationEnabled, enabled);
-    if (m_pageAgent->mainFrame() && m_pageAgent->mainFrame()->settings())
-        m_pageAgent->mainFrame()->settings()->setTouchEventEmulationEnabled(enabled);
-}
-#endif
-
 Node* InspectorDOMAgent::nodeForId(int id)
 {
     if (!id)
@@ -1108,19 +1089,6 @@
     *newNodeId = pushNodePathToFrontend(node);
 }
 
-void InspectorDOMAgent::setTouchEmulationEnabled(ErrorString* error, bool enabled)
-{
-#if ENABLE(TOUCH_EVENTS)
-    if (m_state->getBoolean(DOMAgentState::touchEventEmulationEnabled) == enabled)
-        return;
-    UNUSED_PARAM(error);
-    updateTouchEventEmulationInPage(enabled);
-#else
-    *error = "Touch events emulation not supported";
-    UNUSED_PARAM(enabled);
-#endif
-}
-
 void InspectorDOMAgent::undo(ErrorString* errorString)
 {
     ExceptionCode ec = 0;

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (125027 => 125028)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2012-08-08 13:04:58 UTC (rev 125027)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h	2012-08-08 13:11:54 UTC (rev 125028)
@@ -144,7 +144,6 @@
     virtual void highlightNode(ErrorString*, int nodeId, const RefPtr<InspectorObject>& highlightConfig);
     virtual void highlightFrame(ErrorString*, const String& frameId, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor);
     virtual void moveTo(ErrorString*, int nodeId, int targetNodeId, const int* anchorNodeId, int* newNodeId);
-    virtual void setTouchEmulationEnabled(ErrorString*, bool);
     virtual void undo(ErrorString*);
     virtual void redo(ErrorString*);
     virtual void markUndoableState(ErrorString*);
@@ -229,10 +228,6 @@
 
     void discardBindings();
 
-#if ENABLE(TOUCH_EVENTS)
-    void updateTouchEventEmulationInPage(bool);
-#endif
-
     InspectorPageAgent* m_pageAgent;
     InjectedScriptManager* m_injectedScriptManager;
     InspectorOverlay* m_overlay;

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (125027 => 125028)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-08-08 13:04:58 UTC (rev 125027)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-08-08 13:11:54 UTC (rev 125028)
@@ -93,6 +93,9 @@
 static const char pageAgentFontScaleFactorOverride[] = "pageAgentFontScaleFactorOverride";
 static const char pageAgentFitWindow[] = "pageAgentFitWindow";
 static const char showPaintRects[] = "showPaintRects";
+#if ENABLE(TOUCH_EVENTS)
+static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
+#endif
 }
 
 static bool decodeSharedBuffer(PassRefPtr<SharedBuffer> buffer, const String& textEncodingName, String* result)
@@ -335,6 +338,9 @@
 {
     ErrorString error;
     disable(&error);
+#if ENABLE(TOUCH_EVENTS)
+    updateTouchEventEmulationInPage(false);
+#endif
     m_frontend = 0;
 }
 
@@ -353,6 +359,9 @@
 
         if (m_inspectorAgent->didCommitLoadFired())
             frameNavigated(m_page->mainFrame()->loader()->documentLoader());
+#if ENABLE(TOUCH_EVENTS)
+        updateTouchEventEmulationInPage(m_state->getBoolean(PageAgentState::touchEventEmulationEnabled));
+#endif
     }
 }
 
@@ -973,6 +982,15 @@
     InspectorInstrumentation::mediaQueryResultChanged(document);
 }
 
+#if ENABLE(TOUCH_EVENTS)
+void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled)
+{
+    m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled);
+    if (mainFrame() && mainFrame()->settings())
+        mainFrame()->settings()->setTouchEventEmulationEnabled(enabled);
+}
+#endif
+
 void InspectorPageAgent::setGeolocationOverride(ErrorString* error, const double* latitude, const double* longitude, const double* accuracy)
 {
 #if ENABLE (GEOLOCATION)
@@ -1070,6 +1088,19 @@
     return deviceOrientation;
 }
 
+void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabled)
+{
+#if ENABLE(TOUCH_EVENTS)
+    if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabled)
+        return;
+    UNUSED_PARAM(error);
+    updateTouchEventEmulationInPage(enabled);
+#else
+    *error = "Touch events emulation not supported";
+    UNUSED_PARAM(enabled);
+#endif
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.h (125027 => 125028)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.h	2012-08-08 13:04:58 UTC (rev 125027)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.h	2012-08-08 13:11:54 UTC (rev 125028)
@@ -117,6 +117,7 @@
     virtual void setDeviceOrientationOverride(ErrorString*, double, double, double);
     virtual void clearDeviceOrientationOverride(ErrorString*);
     virtual void canOverrideDeviceOrientation(ErrorString*, bool*);
+    virtual void setTouchEmulationEnabled(ErrorString*, bool);
 
     // Geolocation override helpers.
     GeolocationPosition* overrideGeolocationPosition(GeolocationPosition*);
@@ -154,6 +155,9 @@
 private:
     InspectorPageAgent(InstrumentingAgents*, Page*, InspectorAgent*, InspectorState*, InjectedScriptManager*, InspectorClient*, InspectorOverlay*);
     void updateViewMetrics(int, int, double, bool);
+#if ENABLE(TOUCH_EVENTS)
+    void updateTouchEventEmulationInPage(bool);
+#endif
 
     PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(Frame*);
     PassRefPtr<TypeBuilder::Page::FrameResourceTree> buildObjectForFrameTree(Frame*);

Modified: trunk/Source/WebCore/inspector/front-end/DOMAgent.js (125027 => 125028)


--- trunk/Source/WebCore/inspector/front-end/DOMAgent.js	2012-08-08 13:04:58 UTC (rev 125027)
+++ trunk/Source/WebCore/inspector/front-end/DOMAgent.js	2012-08-08 13:11:54 UTC (rev 125028)
@@ -1278,7 +1278,7 @@
             this._addTouchEventsScriptId = scriptId;
         }
 
-        DOMAgent.setTouchEmulationEnabled(emulationEnabled);
+        PageAgent.setTouchEmulationEnabled(emulationEnabled);
     },
 
     markUndoableState: function()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to