- Revision
- 135414
- Author
- [email protected]
- Date
- 2012-11-21 10:09:22 -0800 (Wed, 21 Nov 2012)
Log Message
[chromium] Add flag to enable/disable touch adjustment at runtime.
https://bugs.webkit.org/show_bug.cgi?id=102534
Patch by Kevin Ellis <[email protected]> on 2012-11-21
Reviewed by Antonio Gomes.
Source/WebCore:
Add setting for enabling or disabling touch adjustment. Note that for
touch adjustment to apply, the compile flag must also be enabled. A
compile only option is insufficient as it does not allow developers to
quickly test the impact of touch adjustemnt without recompiling. Nor
does it allow end users to disable touch adjustemnt if they find that
touch adjustment is not working well for a particular site.
No new tests required.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleGestureEvent): Move enable check to adjustGesturePosition.
(WebCore::EventHandler::handleGestureTap): Move enable check to adjustGesturePosition.
(WebCore::EventHandler::shouldApplyTouchAdjustment): Checks if touch adjustment is enabled.
(WebCore):
(WebCore::EventHandler::adjustGesturePosition): Add check for enabling of touch adjustment.
(WebCore::EventHandler::sendContextMenuEventForGesture): Move enable check to adjustGesturePosition.
* page/EventHandler.h:
(EventHandler):
* page/Settings.in:
Source/WebKit/chromium:
Add setting for enabling or disabling touch adjustment.
For touch adjustemnt to apply, the compile option must
also be enabled.
* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setEnableTouchAdjustment):
(WebKit):
* src/WebSettingsImpl.h:
(WebSettingsImpl):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (135413 => 135414)
--- trunk/Source/WebCore/ChangeLog 2012-11-21 17:58:08 UTC (rev 135413)
+++ trunk/Source/WebCore/ChangeLog 2012-11-21 18:09:22 UTC (rev 135414)
@@ -1,3 +1,30 @@
+2012-11-21 Kevin Ellis <[email protected]>
+
+ [chromium] Add flag to enable/disable touch adjustment at runtime.
+ https://bugs.webkit.org/show_bug.cgi?id=102534
+
+ Reviewed by Antonio Gomes.
+
+ Add setting for enabling or disabling touch adjustment. Note that for
+ touch adjustment to apply, the compile flag must also be enabled. A
+ compile only option is insufficient as it does not allow developers to
+ quickly test the impact of touch adjustemnt without recompiling. Nor
+ does it allow end users to disable touch adjustemnt if they find that
+ touch adjustment is not working well for a particular site.
+
+ No new tests required.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleGestureEvent): Move enable check to adjustGesturePosition.
+ (WebCore::EventHandler::handleGestureTap): Move enable check to adjustGesturePosition.
+ (WebCore::EventHandler::shouldApplyTouchAdjustment): Checks if touch adjustment is enabled.
+ (WebCore):
+ (WebCore::EventHandler::adjustGesturePosition): Add check for enabling of touch adjustment.
+ (WebCore::EventHandler::sendContextMenuEventForGesture): Move enable check to adjustGesturePosition.
+ * page/EventHandler.h:
+ (EventHandler):
+ * page/Settings.in:
+
2012-11-21 Philippe Normand <[email protected]>
Unreviewed, build fix after r135410.
Modified: trunk/Source/WebCore/page/EventHandler.cpp (135413 => 135414)
--- trunk/Source/WebCore/page/EventHandler.cpp 2012-11-21 17:58:08 UTC (rev 135413)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2012-11-21 18:09:22 UTC (rev 135414)
@@ -2533,8 +2533,7 @@
HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent;
if (gestureEvent.type() == PlatformEvent::GestureTapDown) {
#if ENABLE(TOUCH_ADJUSTMENT)
- if (!gestureEvent.area().isEmpty())
- adjustGesturePosition(gestureEvent, adjustedPoint);
+ adjustGesturePosition(gestureEvent, adjustedPoint);
#endif
hitType |= HitTestRequest::Active;
} else if (gestureEvent.type() == PlatformEvent::GestureTap || gestureEvent.type() == PlatformEvent::GestureTapDownCancel)
@@ -2619,8 +2618,7 @@
// FIXME: Refactor this code to not hit test multiple times. We use the adjusted position to ensure that the correct node is targeted by the later redundant hit tests.
IntPoint adjustedPoint = gestureEvent.position();
#if ENABLE(TOUCH_ADJUSTMENT)
- if (!gestureEvent.area().isEmpty())
- adjustGesturePosition(gestureEvent, adjustedPoint);
+ adjustGesturePosition(gestureEvent, adjustedPoint);
#endif
PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition(),
@@ -2702,6 +2700,14 @@
#endif
#if ENABLE(TOUCH_ADJUSTMENT)
+bool EventHandler::shouldApplyTouchAdjustment(const PlatformGestureEvent& event) const
+{
+ if (m_frame->settings() && !m_frame->settings()->touchAdjustmentEnabled())
+ return false;
+ return !event.area().isEmpty();
+}
+
+
bool EventHandler::bestClickableNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode)
{
HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
@@ -2745,6 +2751,9 @@
bool EventHandler::adjustGesturePosition(const PlatformGestureEvent& gestureEvent, IntPoint& adjustedPoint)
{
+ if (!shouldApplyTouchAdjustment(gestureEvent))
+ return false;
+
Node* targetNode = 0;
switch (gestureEvent.type()) {
case PlatformEvent::GestureTap:
@@ -2875,8 +2884,7 @@
IntPoint adjustedPoint = event.position();
#if ENABLE(TOUCH_ADJUSTMENT)
- if (!event.area().isEmpty())
- adjustGesturePosition(event, adjustedPoint);
+ adjustGesturePosition(event, adjustedPoint);
#endif
PlatformMouseEvent mouseEvent(adjustedPoint, event.globalPosition(), RightButton, eventType, 1, false, false, false, false, WTF::currentTime());
// To simulate right-click behavior, we send a right mouse down and then
Modified: trunk/Source/WebCore/page/EventHandler.h (135413 => 135414)
--- trunk/Source/WebCore/page/EventHandler.h 2012-11-21 17:58:08 UTC (rev 135413)
+++ trunk/Source/WebCore/page/EventHandler.h 2012-11-21 18:09:22 UTC (rev 135414)
@@ -176,6 +176,8 @@
#endif
#if ENABLE(TOUCH_ADJUSTMENT)
+ bool shouldApplyTouchAdjustment(const PlatformGestureEvent&) const;
+
bool bestClickableNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode);
bool bestContextMenuNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode);
bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntRect& targetArea, Node*& targetNode);
Modified: trunk/Source/WebCore/page/Settings.in (135413 => 135414)
--- trunk/Source/WebCore/page/Settings.in 2012-11-21 17:58:08 UTC (rev 135413)
+++ trunk/Source/WebCore/page/Settings.in 2012-11-21 18:09:22 UTC (rev 135414)
@@ -140,6 +140,12 @@
requestAnimationFrameEnabled initial=true
deviceSupportsTouch initial=false
deviceSupportsMouse initial=true
+
+# For touch adjustment to apply, the compile option TOUCH_ADJUSTMENT must also be enabled.
+# This setting adds a means to dynamically disable the feature at runtime on systems with
+# support for touch adjustment.
+touchAdjustmentEnabled initial=true
+
needsDidFinishLoadOrderQuirk initial=false
fixedPositionCreatesStackingContext initial=false
syncXHRInDocumentsEnabled initial=true
Modified: trunk/Source/WebKit/chromium/ChangeLog (135413 => 135414)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-11-21 17:58:08 UTC (rev 135413)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-11-21 18:09:22 UTC (rev 135414)
@@ -1,3 +1,21 @@
+2012-11-21 Kevin Ellis <[email protected]>
+
+ [chromium] Add flag to enable/disable touch adjustment at runtime.
+ https://bugs.webkit.org/show_bug.cgi?id=102534
+
+ Reviewed by Antonio Gomes.
+
+ Add setting for enabling or disabling touch adjustment.
+ For touch adjustemnt to apply, the compile option must
+ also be enabled.
+
+ * public/WebSettings.h:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::setEnableTouchAdjustment):
+ (WebKit):
+ * src/WebSettingsImpl.h:
+ (WebSettingsImpl):
+
2012-11-21 Dan Carney <[email protected]>
IDBRequestTest needs a v8 context
Modified: trunk/Source/WebKit/chromium/public/WebSettings.h (135413 => 135414)
--- trunk/Source/WebKit/chromium/public/WebSettings.h 2012-11-21 17:58:08 UTC (rev 135413)
+++ trunk/Source/WebKit/chromium/public/WebSettings.h 2012-11-21 18:09:22 UTC (rev 135414)
@@ -97,6 +97,7 @@
virtual void setEditableLinkBehaviorNeverLive() = 0;
virtual void setEditingBehavior(EditingBehavior) = 0;
virtual void setEnableScrollAnimator(bool) = 0;
+ virtual void setEnableTouchAdjustment(bool) = 0;
virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0;
virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0;
virtual void setCSSStickyPositionEnabled(bool) = 0;
Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp (135413 => 135414)
--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp 2012-11-21 17:58:08 UTC (rev 135413)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp 2012-11-21 18:09:22 UTC (rev 135414)
@@ -610,6 +610,11 @@
#endif
}
+void WebSettingsImpl::setEnableTouchAdjustment(bool enabled)
+{
+ m_settings->setTouchAdjustmentEnabled(enabled);
+}
+
bool WebSettingsImpl::scrollAnimatorEnabled() const
{
#if ENABLE(SMOOTH_SCROLLING)
Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.h (135413 => 135414)
--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.h 2012-11-21 17:58:08 UTC (rev 135413)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.h 2012-11-21 18:09:22 UTC (rev 135414)
@@ -89,6 +89,7 @@
virtual void setEditableLinkBehaviorNeverLive();
virtual void setEditingBehavior(EditingBehavior);
virtual void setEnableScrollAnimator(bool);
+ virtual void setEnableTouchAdjustment(bool);
virtual void setExperimentalCSSCustomFilterEnabled(bool);
virtual void setExperimentalCSSGridLayoutEnabled(bool);
virtual void setCSSStickyPositionEnabled(bool);