Chromium side of maxTouchPoints implementation.
Intent to implement-and-ship: https://groups.google.com/a/chromium.org/forum/#!searchin/blink-dev/maxTouchPoints/blink-dev/ayzxdztUlOQ/rd-z_Jo3ocIJ navigator.maxTouchPoints is defined in the W3C Pointer Events standard draft: http://www.w3.org/TR/pointerevents/#widl-Navigator-maxTouchPoints Depends on blink revision 160153: https://src.chromium.org/viewvc/blink?view=revision&revision=160153 BUG=248918 Review URL: https://codereview.chromium.org/26764002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231203 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
AUTHORS
content
browser
web_contents
public
renderer
ui/base/touch
touch_device.cctouch_device.htouch_device_android.cctouch_device_aurax11.cctouch_device_ozone.cctouch_device_win.cc
webkit/common
1
AUTHORS
1
AUTHORS
@ -249,6 +249,7 @@ Sanjoy Pal <sanjoy.pal@samsung.com>
|
||||
Sanne Wouda <sanne.wouda@gmail.com>
|
||||
Sathish Kuppuswamy <sathish.kuppuswamy@intel.com>
|
||||
Satoshi Matsuzaki <satoshi.matsuzaki@gmail.com>
|
||||
Scott Blomquist <sblom@microsoft.com>
|
||||
Sean Bryant <sean@cyberwang.net>
|
||||
Seo Sanghyeon <sanxiyn@gmail.com>
|
||||
Seokju Kwon <seokju.kwon@gmail.com>
|
||||
|
@ -611,10 +611,12 @@ WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh,
|
||||
prefs.device_supports_mouse = false;
|
||||
#endif
|
||||
|
||||
prefs.touch_adjustment_enabled =
|
||||
!command_line.HasSwitch(switches::kDisableTouchAdjustment);
|
||||
prefs.compositor_touch_hit_testing =
|
||||
!command_line.HasSwitch(cc::switches::kDisableCompositorTouchHitTesting);
|
||||
prefs.pointer_events_max_touch_points = ui::MaxTouchPoints();
|
||||
|
||||
prefs.touch_adjustment_enabled =
|
||||
!command_line.HasSwitch(switches::kDisableTouchAdjustment);
|
||||
prefs.compositor_touch_hit_testing =
|
||||
!command_line.HasSwitch(cc::switches::kDisableCompositorTouchHitTesting);
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
|
||||
bool default_enable_scroll_animator = true;
|
||||
|
@ -160,6 +160,7 @@ IPC_STRUCT_TRAITS_BEGIN(WebPreferences)
|
||||
IPC_STRUCT_TRAITS_MEMBER(device_supports_touch)
|
||||
IPC_STRUCT_TRAITS_MEMBER(device_supports_mouse)
|
||||
IPC_STRUCT_TRAITS_MEMBER(touch_adjustment_enabled)
|
||||
IPC_STRUCT_TRAITS_MEMBER(pointer_events_max_touch_points)
|
||||
IPC_STRUCT_TRAITS_MEMBER(fixed_position_creates_stacking_context)
|
||||
IPC_STRUCT_TRAITS_MEMBER(sync_xhr_in_documents_enabled)
|
||||
IPC_STRUCT_TRAITS_MEMBER(deferred_image_decoding_enabled)
|
||||
|
@ -298,6 +298,7 @@ void ApplyWebPreferences(const WebPreferences& prefs, WebView* web_view) {
|
||||
|
||||
WebRuntimeFeatures::enableLazyLayout(prefs.lazy_layout_enabled);
|
||||
WebRuntimeFeatures::enableTouch(prefs.touch_enabled);
|
||||
settings->setMaxTouchPoints(prefs.pointer_events_max_touch_points);
|
||||
settings->setDeviceSupportsTouch(prefs.device_supports_touch);
|
||||
settings->setDeviceSupportsMouse(prefs.device_supports_mouse);
|
||||
settings->setEnableTouchAdjustment(prefs.touch_adjustment_enabled);
|
||||
|
@ -12,4 +12,8 @@ bool IsTouchDevicePresent() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int MaxTouchPoints() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -9,9 +9,23 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
// TODO(sblom): This is non-standard, and should be removed before
|
||||
// RuntimeEnabledFlags::PointerEventsMaxTouchPoints is marked stable.
|
||||
// Tracked by: http://crbug.com/308649
|
||||
const int kMaxTouchPointsUnknown = -1;
|
||||
|
||||
// Returns true if a touch device is available.
|
||||
UI_EXPORT bool IsTouchDevicePresent();
|
||||
|
||||
// Returns the maximum number of simultaneous touch contacts supported
|
||||
// by the device. In the case of devices with multiple digitizers (e.g.
|
||||
// multiple touchscreens), the value MUST be the maximum of the set of
|
||||
// maximum supported contacts by each individual digitizer.
|
||||
// For example, suppose a device has 3 touchscreens, which support 2, 5,
|
||||
// and 10 simultaneous touch contacts, respectively. This returns 10.
|
||||
// http://www.w3.org/TR/pointerevents/#widl-Navigator-maxTouchPoints
|
||||
UI_EXPORT int MaxTouchPoints();
|
||||
|
||||
} // namespace ui
|
||||
|
||||
#endif // UI_BASE_TOUCH_TOUCH_DEVICE_H_
|
||||
|
@ -10,4 +10,17 @@ bool IsTouchDevicePresent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Looks like the best we can do here is detect 1, 2+, or 5+ by
|
||||
// feature detecting:
|
||||
// FEATURE_TOUCHSCREEN (1),
|
||||
// FEATURE_TOUCHSCREEN_MULTITOUCH (2),
|
||||
// FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT (2+), or
|
||||
// FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHANDS (5+)
|
||||
//
|
||||
// Probably start from the biggest and detect down the list until we
|
||||
// find one that's supported and return its value.
|
||||
int MaxTouchPoints() {
|
||||
return kMaxTouchPointsUnknown;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -11,4 +11,8 @@ bool IsTouchDevicePresent() {
|
||||
return ui::TouchFactory::GetInstance()->IsTouchDevicePresent();
|
||||
}
|
||||
|
||||
int MaxTouchPoints() {
|
||||
return kMaxTouchPointsUnknown;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -11,4 +11,8 @@ bool IsTouchDevicePresent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int MaxTouchPoints() {
|
||||
return kMaxTouchPointsUnknown;
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -14,4 +14,8 @@ bool IsTouchDevicePresent() {
|
||||
((value & NID_INTEGRATED_TOUCH) || (value & NID_EXTERNAL_TOUCH));
|
||||
}
|
||||
|
||||
int MaxTouchPoints() {
|
||||
return GetSystemMetrics(SM_MAXIMUMTOUCHES);
|
||||
}
|
||||
|
||||
} // namespace ui
|
||||
|
@ -90,6 +90,7 @@ WebPreferences::WebPreferences()
|
||||
device_supports_touch(false),
|
||||
device_supports_mouse(true),
|
||||
touch_adjustment_enabled(true),
|
||||
pointer_events_max_touch_points(0),
|
||||
fixed_position_creates_stacking_context(false),
|
||||
sync_xhr_in_documents_enabled(true),
|
||||
deferred_image_decoding_enabled(false),
|
||||
|
@ -140,6 +140,7 @@ struct WEBKIT_COMMON_EXPORT WebPreferences {
|
||||
bool device_supports_touch;
|
||||
bool device_supports_mouse;
|
||||
bool touch_adjustment_enabled;
|
||||
int pointer_events_max_touch_points;
|
||||
bool fixed_position_creates_stacking_context;
|
||||
bool sync_xhr_in_documents_enabled;
|
||||
bool deferred_image_decoding_enabled;
|
||||
|
Reference in New Issue
Block a user