Diff
Modified: trunk/Source/WebCore/ChangeLog (106810 => 106811)
--- trunk/Source/WebCore/ChangeLog 2012-02-06 16:39:23 UTC (rev 106810)
+++ trunk/Source/WebCore/ChangeLog 2012-02-06 16:57:13 UTC (rev 106811)
@@ -1,3 +1,31 @@
+2012-02-06 Alexander Pavlov <[email protected]>
+
+ Web Inspector: [Meta] Allow emulation of touch events
+ https://bugs.webkit.org/show_bug.cgi?id=77096
+
+ Reviewed by Pavel Feldman.
+
+ This is the inspector part of the change, core part implementation tracked in bug 77105.
+
+ * English.lproj/localizedStrings.js:
+ * inspector/Inspector.json:
+ * inspector/InspectorDOMAgent.cpp:
+ (DOMAgentState):
+ (WebCore::InspectorDOMAgent::clearFrontend):
+ (WebCore::InspectorDOMAgent::restore):
+ (WebCore):
+ (WebCore::InspectorDOMAgent::updateTouchEventEmulationInDocuments):
+ (WebCore::InspectorDOMAgent::setTouchEmulationEnabled):
+ * inspector/InspectorDOMAgent.h:
+ (InspectorDOMAgent):
+ * inspector/front-end/DOMAgent.js:
+ (WebInspector.DOMAgent.prototype._captureDOM):
+ (WebInspector.DOMAgent.prototype._emulateTouchEventsChanged):
+ * inspector/front-end/Settings.js:
+ (WebInspector.Settings):
+ * inspector/front-end/SettingsScreen.js:
+ (WebInspector.SettingsScreen):
+
2012-02-06 Chris Guan <[email protected]>
[Blackberry] Non-supported about: operations never stops loading
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js
(Binary files differ)
Modified: trunk/Source/WebCore/inspector/Inspector.json (106810 => 106811)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-02-06 16:39:23 UTC (rev 106810)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-02-06 16:57:13 UTC (rev 106811)
@@ -1508,6 +1508,14 @@
{ "name": "nodeId", "$ref": "NodeId", "description": "New id of the moved node." }
],
"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
}
],
"events": [
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (106810 => 106811)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2012-02-06 16:39:23 UTC (rev 106810)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2012-02-06 16:57:13 UTC (rev 106811)
@@ -78,6 +78,7 @@
#include "RenderStyle.h"
#include "RenderStyleConstants.h"
#include "ScriptEventListener.h"
+#include "Settings.h"
#include "StylePropertySet.h"
#include "StyleSheetList.h"
#include "Text.h"
@@ -96,6 +97,10 @@
namespace DOMAgentState {
static const char documentRequested[] = "documentRequested";
+
+#if ENABLE(TOUCH_EVENTS)
+static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled";
+#endif
};
static const size_t maxTextSize = 10000;
@@ -213,6 +218,9 @@
m_frontend = 0;
m_instrumentingAgents->setInspectorDOMAgent(0);
m_state->setBoolean(DOMAgentState::documentRequested, false);
+#if ENABLE(TOUCH_EVENTS)
+ updateTouchEventEmulationInPage(false);
+#endif
reset();
}
@@ -221,6 +229,9 @@
// 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()
@@ -391,6 +402,14 @@
m_childrenRequested.clear();
}
+#if ENABLE(TOUCH_EVENTS)
+void InspectorDOMAgent::updateTouchEventEmulationInPage(bool enabled)
+{
+ m_state->setBoolean(DOMAgentState::touchEventEmulationEnabled, enabled);
+ m_pageAgent->mainFrame()->settings()->setTouchEventEmulationEnabled(enabled);
+}
+#endif
+
Node* InspectorDOMAgent::nodeForId(int id)
{
if (!id)
@@ -1041,6 +1060,19 @@
*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::resolveNode(ErrorString* error, int nodeId, const String* const objectGroup, RefPtr<InspectorObject>& result)
{
String objectGroupName = objectGroup ? *objectGroup : "";
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.h (106810 => 106811)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.h 2012-02-06 16:39:23 UTC (rev 106810)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.h 2012-02-06 16:57:13 UTC (rev 106811)
@@ -142,6 +142,7 @@
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);
Node* highlightedNode() const;
@@ -216,6 +217,10 @@
void discardBindings();
+#if ENABLE(TOUCH_EVENTS)
+ void updateTouchEventEmulationInPage(bool);
+#endif
+
InspectorPageAgent* m_pageAgent;
InspectorClient* m_client;
InjectedScriptManager* m_injectedScriptManager;
Modified: trunk/Source/WebCore/inspector/front-end/DOMAgent.js (106810 => 106811)
--- trunk/Source/WebCore/inspector/front-end/DOMAgent.js 2012-02-06 16:39:23 UTC (rev 106810)
+++ trunk/Source/WebCore/inspector/front-end/DOMAgent.js 2012-02-06 16:57:13 UTC (rev 106811)
@@ -662,6 +662,10 @@
InspectorBackend.registerDOMDispatcher(new WebInspector.DOMDispatcher(this));
if (WebInspector.experimentsSettings.freeFlowDOMEditing.isEnabled())
new WebInspector.DOMModelResourceBinding(this);
+
+ if (WebInspector.settings.emulateTouchEvents.get())
+ this._emulateTouchEventsChanged();
+ WebInspector.settings.emulateTouchEvents.addChangeListener(this._emulateTouchEventsChanged, this);
}
WebInspector.DOMAgent.Events = {
@@ -1157,6 +1161,11 @@
}
DOMAgent.getOuterHTML(node.ownerDocument.id, callback);
+ },
+
+ _emulateTouchEventsChanged: function()
+ {
+ DOMAgent.setTouchEmulationEnabled(WebInspector.settings.emulateTouchEvents.get());
}
}
Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (106810 => 106811)
--- trunk/Source/WebCore/inspector/front-end/Settings.js 2012-02-06 16:39:23 UTC (rev 106810)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js 2012-02-06 16:57:13 UTC (rev 106811)
@@ -88,6 +88,7 @@
this.userAgent = this.createSetting("userAgent", "");
this.showScriptFolders = this.createSetting("showScriptFolders", true);
this.dockToRight = this.createSetting("dockToRight", false);
+ this.emulateTouchEvents = this.createSetting("emulateTouchEvents", false);
// If there are too many breakpoints in a storage, it is likely due to a recent bug that caused
// periodical breakpoints duplication leading to inspector slowness.
Modified: trunk/Source/WebCore/inspector/front-end/SettingsScreen.js (106810 => 106811)
--- trunk/Source/WebCore/inspector/front-end/SettingsScreen.js 2012-02-06 16:39:23 UTC (rev 106810)
+++ trunk/Source/WebCore/inspector/front-end/SettingsScreen.js 2012-02-06 16:57:13 UTC (rev 106811)
@@ -38,13 +38,17 @@
this._leftColumnElement = document.createElement("td");
this._rightColumnElement = document.createElement("td");
+ var p;
- if (Preferences.showDockToRight) {
- var p = this._appendSection(WebInspector.UIString("General"));
- p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Dock to right"), WebInspector.settings.dockToRight));
+ if (Preferences.showDockToRight || Preferences.exposeDisableCache) {
+ p = this._appendSection(WebInspector.UIString("General"));
+ if (Preferences.showDockToRight)
+ p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Dock to right"), WebInspector.settings.dockToRight));
+ if (Preferences.exposeDisableCache)
+ p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled));
}
- var p = this._appendSection(WebInspector.UIString("Elements"));
+ p = this._appendSection(WebInspector.UIString("Elements"));
p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Word wrap"), WebInspector.settings.domWordWrap));
p = this._appendSection(WebInspector.UIString("Styles"));
@@ -63,10 +67,9 @@
[ WebInspector.UIString("Tab character"), WebInspector.TextEditorModel.Indent.TabCharacter ]
], WebInspector.settings.textEditorIndent));
- p = this._appendSection(WebInspector.UIString("Network"), true);
- if (Preferences.exposeDisableCache)
- p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled));
+ p = this._appendSection(WebInspector.UIString("User Agent"), true);
p.appendChild(this._createUserActionControl());
+ p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Emulate touch events"), WebInspector.settings.emulateTouchEvents));
p = this._appendSection(WebInspector.UIString("Scripts"), true);
p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show script folders"), WebInspector.settings.showScriptFolders));