Commit 5f6edace authored by tdresser@chromium.org's avatar tdresser@chromium.org

Revert 276728 "Fix slop region boundary handling."

> Fix slop region boundary handling.
> 
> Ensure the screenPosition of touches is never truncated to an integer.
> 
> Check if the unified gesture detector is enabled before disabling
> the inclusive slop region.
> 
> BUG=381174
> TEST=RenderWidgetHostViewAuraTest.TouchEventPositionsArentRounded
> 
> Review URL: https://codereview.chromium.org/328733003

TBR=tdresser@chromium.org

Review URL: https://codereview.chromium.org/330613003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276732 0039d316-1c4b-4281-b951-d872f2087c98
parent 7d89ba66
......@@ -10,7 +10,6 @@
#if defined(USE_AURA)
#include "ui/events/gestures/gesture_configuration.h"
#include "ui/events/gestures/unified_gesture_detector_enabled.h"
#elif defined(OS_ANDROID)
#include "ui/gfx/android/view_configuration.h"
#include "ui/gfx/screen.h"
......@@ -53,9 +52,8 @@ TouchEventQueue::Config GetTouchEventQueueConfig() {
config.touchmove_slop_suppression_length_dips =
ui::GestureConfiguration::max_touch_move_in_pixels_for_click();
config.touchmove_slop_suppression_region_includes_boundary =
ui::IsUnifiedGestureDetectorEnabled();
// TODO(jdduke): Remove when unified GR enabled, crbug.com/332418.
config.touchmove_slop_suppression_region_includes_boundary = false;
return config;
}
......
......@@ -348,8 +348,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
private:
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState);
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
TouchEventPositionsArentRounded);
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync);
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow);
FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
......
......@@ -1802,31 +1802,6 @@ TEST_F(RenderWidgetHostViewAuraTest, VisibleViewportTest) {
EXPECT_EQ(60, params.a.visible_viewport_size.height());
}
// Ensures that touch event positions are never truncated to integers.
TEST_F(RenderWidgetHostViewAuraTest, TouchEventPositionsArentRounded) {
const float kX = 30.58f;
const float kY = 50.23f;
view_->InitAsChild(NULL);
view_->Show();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
gfx::PointF(kX, kY),
0,
ui::EventTimeForNow());
view_->OnTouchEvent(&press);
EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type);
EXPECT_TRUE(view_->touch_event_.cancelable);
EXPECT_EQ(1U, view_->touch_event_.touchesLength);
EXPECT_EQ(blink::WebTouchPoint::StatePressed,
view_->touch_event_.touches[0].state);
EXPECT_EQ(kX, view_->touch_event_.touches[0].screenPosition.x);
EXPECT_EQ(kX, view_->touch_event_.touches[0].position.x);
EXPECT_EQ(kY, view_->touch_event_.touches[0].screenPosition.y);
EXPECT_EQ(kY, view_->touch_event_.touches[0].position.y);
}
// Tests that scroll ACKs are correctly handled by the overscroll-navigation
// controller.
TEST_F(RenderWidgetHostViewAuraOverscrollTest, WheelScrollEventOverscrolls) {
......
......@@ -314,7 +314,7 @@ blink::WebTouchPoint* UpdateWebTouchEventFromUIEvent(
point->position.x = event.x();
point->position.y = event.y();
const gfx::PointF& root_point = event.root_location_f();
const gfx::Point root_point = event.root_location();
point->screenPosition.x = root_point.x();
point->screenPosition.y = root_point.y();
......
......@@ -248,16 +248,13 @@ class EVENTS_EXPORT LocatedEvent : public Event {
// TODO(tdresser): Always return floating point location. See
// crbug.com/337824.
gfx::Point location() const { return gfx::ToFlooredPoint(location_); }
const gfx::PointF& location_f() const { return location_; }
gfx::PointF location_f() const { return location_; }
void set_root_location(const gfx::PointF& root_location) {
root_location_ = root_location;
}
gfx::Point root_location() const {
return gfx::ToFlooredPoint(root_location_);
}
const gfx::PointF& root_location_f() const {
return root_location_;
}
// Transform the locations using |inverted_root_transform|.
// This is applied to both |location_| and |root_location_|.
......
......@@ -123,8 +123,6 @@
'gestures/gesture_types.h',
'gestures/motion_event_aura.cc',
'gestures/motion_event_aura.h',
'gestures/unified_gesture_detector_enabled.cc',
'gestures/unified_gesture_detector_enabled.h',
'gestures/velocity_calculator.cc',
'gestures/velocity_calculator.h',
'ozone/events_ozone.cc',
......
......@@ -18,7 +18,6 @@
#include "ui/events/gestures/gesture_configuration.h"
#include "ui/events/gestures/gesture_sequence.h"
#include "ui/events/gestures/gesture_types.h"
#include "ui/events/gestures/unified_gesture_detector_enabled.h"
namespace ui {
......@@ -70,7 +69,28 @@ GestureProviderAura* CreateGestureProvider(GestureProviderAuraClient* client) {
// GestureRecognizerImpl, public:
GestureRecognizerImpl::GestureRecognizerImpl() {
use_unified_gesture_detector_ = IsUnifiedGestureDetectorEnabled();
// Default to not using the unified gesture detector.
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
const std::string unified_gd_enabled_switch =
command_line.HasSwitch(switches::kUnifiedGestureDetector) ?
command_line.GetSwitchValueASCII(switches::kUnifiedGestureDetector) :
switches::kUnifiedGestureDetectorAuto;
const bool kUseUnifiedGestureDetectorByDefault = false;
if (unified_gd_enabled_switch.empty() ||
unified_gd_enabled_switch == switches::kUnifiedGestureDetectorEnabled) {
use_unified_gesture_detector_ = true;
} else if (unified_gd_enabled_switch ==
switches::kUnifiedGestureDetectorDisabled) {
use_unified_gesture_detector_ = false;
} else if (unified_gd_enabled_switch ==
switches::kUnifiedGestureDetectorAuto) {
use_unified_gesture_detector_ = kUseUnifiedGestureDetectorByDefault;
} else {
LOG(ERROR) << "Invalid --unified-gesture-detector option: "
<< unified_gd_enabled_switch;
use_unified_gesture_detector_ = false;
}
}
GestureRecognizerImpl::~GestureRecognizerImpl() {
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/logging.h"
#include "ui/events/event_switches.h"
#include "ui/events/gestures/unified_gesture_detector_enabled.h"
namespace ui {
bool IsUnifiedGestureDetectorEnabled() {
const bool kUseUnifiedGestureDetectorByDefault = false;
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
const std::string unified_gd_enabled_switch =
command_line.HasSwitch(switches::kUnifiedGestureDetector) ?
command_line.GetSwitchValueASCII(switches::kUnifiedGestureDetector) :
switches::kUnifiedGestureDetectorAuto;
if (unified_gd_enabled_switch.empty() ||
unified_gd_enabled_switch == switches::kUnifiedGestureDetectorEnabled) {
return true;
}
if (unified_gd_enabled_switch == switches::kUnifiedGestureDetectorDisabled)
return false;
if (unified_gd_enabled_switch == switches::kUnifiedGestureDetectorAuto)
return kUseUnifiedGestureDetectorByDefault;
LOG(ERROR) << "Invalid --unified-gesture-detector option: "
<< unified_gd_enabled_switch;
return false;
}
} // namespace ui
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_EVENTS_GESTURES_UNIFIED_GESTURE_DETECTOR_ENABLED_H_
#define UI_EVENTS_GESTURES_UNIFIED_GESTURE_DETECTOR_ENABLED_H_
#include "ui/events/events_export.h"
namespace ui {
// Returns true iff the unified gesture detector is enabled for Aura.
EVENTS_EXPORT bool IsUnifiedGestureDetectorEnabled();
} // namespace ui
#endif // UI_EVENTS_GESTURES_UNIFIED_GESTURE_DETECTOR_ENABLED_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment