Index: Source/WebCore/testing/InternalSettings.cpp |
diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp |
index 2239e10b5a0a530da59d7612815d88ae529dc56f..9ab62ea9a0aab0f30ca16939881fe1115533b976 100644 |
--- a/Source/WebCore/testing/InternalSettings.cpp |
+++ b/Source/WebCore/testing/InternalSettings.cpp |
@@ -477,4 +477,38 @@ void InternalSettings::setUseLegacyBackgroundSizeShorthandBehavior(bool enabled, |
settings()->setUseLegacyBackgroundSizeShorthandBehavior(enabled); |
} |
+void InternalSettings::setPrimaryPointerDevices(const String& pointerDevice, ExceptionCode& ec) |
+{ |
+ InternalSettingsGuardForSettings(); |
+ settings()->setPrimaryPointerDevices(PointerDeviceUnknown); |
+ |
+ // Allow setting multiple devices by passing comma seperated list ("mouse,touch") |
+ size_t ix = 0; |
+ size_t comma_position; |
+ do { |
+ comma_position = pointerDevice.find(',', ix); |
Rick Byers
2013/04/10 14:57:51
Is there any other code here or in WTF somewhere f
bokan
2013/04/10 16:03:29
Done, replaced with WTFString::split
|
+ |
+ String value; |
+ if(comma_position == notFound) |
+ value = pointerDevice.substring(ix); |
+ else |
+ value = pointerDevice.substring(ix, comma_position-ix); |
+ |
+ ix = comma_position+1; |
+ |
+ if (value == "mouse") |
+ settings()->setPrimaryPointerDevices(settings()->primaryPointerDevices() | PointerDeviceMouse); |
+ else if (value == "touch") |
+ settings()->setPrimaryPointerDevices(settings()->primaryPointerDevices() | PointerDeviceTouch); |
+ else if (value == "none") |
+ settings()->setPrimaryPointerDevices(settings()->primaryPointerDevices() | PointerDeviceNone); |
+ else if (value == "unknown") |
+ settings()->setPrimaryPointerDevices(settings()->primaryPointerDevices() | PointerDeviceUnknown); |
+ else { |
+ ec = SYNTAX_ERR; |
+ return; |
+ } |
+ } while(comma_position != notFound && ix < pointerDevice.length()); |
+} |
+ |
} |