Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: Source/WebCore/testing/InternalSettings.cpp

Issue 13818030: Added primary input devices setting to blink to allow media queries for hover/pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698