Chromium Code Reviews| Index: ui/touch_selection/touch_selection_controller.cc |
| diff --git a/content/browser/renderer_host/input/touch_selection_controller.cc b/ui/touch_selection/touch_selection_controller.cc |
| similarity index 92% |
| rename from content/browser/renderer_host/input/touch_selection_controller.cc |
| rename to ui/touch_selection/touch_selection_controller.cc |
| index bc913fde56e0bf997dfe5412ef147fce17e4e757..f5a4bda90a6d6704702a2c57a1099b78c54c544f 100644 |
| --- a/content/browser/renderer_host/input/touch_selection_controller.cc |
| +++ b/ui/touch_selection/touch_selection_controller.cc |
| @@ -2,24 +2,23 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "content/browser/renderer_host/input/touch_selection_controller.h" |
| +#include "ui/touch_selection/touch_selection_controller.h" |
| #include "base/auto_reset.h" |
| #include "base/logging.h" |
| -#include "third_party/WebKit/public/web/WebInputEvent.h" |
| -namespace content { |
| +namespace ui { |
| namespace { |
| -TouchHandleOrientation ToTouchHandleOrientation(cc::SelectionBoundType type) { |
| +TouchHandleOrientation ToTouchHandleOrientation(SelectionBound::Type type) { |
| switch (type) { |
| - case cc::SELECTION_BOUND_LEFT: |
| + case SelectionBound::LEFT: |
| return TOUCH_HANDLE_LEFT; |
| - case cc::SELECTION_BOUND_RIGHT: |
| + case SelectionBound::RIGHT: |
| return TOUCH_HANDLE_RIGHT; |
| - case cc::SELECTION_BOUND_CENTER: |
| + case SelectionBound::CENTER: |
| return TOUCH_HANDLE_CENTER; |
| - case cc::SELECTION_BOUND_EMPTY: |
| + case SelectionBound::EMPTY: |
| return TOUCH_HANDLE_ORIENTATION_UNDEFINED; |
| } |
| NOTREACHED() << "Invalid selection bound type: " << type; |
| @@ -53,15 +52,15 @@ TouchSelectionController::~TouchSelectionController() { |
| } |
| void TouchSelectionController::OnSelectionBoundsChanged( |
| - const cc::ViewportSelectionBound& start, |
| - const cc::ViewportSelectionBound& end) { |
| + const SelectionBound& start, |
| + const SelectionBound& end) { |
| if (start == start_ && end_ == end) |
| return; |
| start_ = start; |
| end_ = end; |
| - start_orientation_ = ToTouchHandleOrientation(start_.type); |
| - end_orientation_ = ToTouchHandleOrientation(end_.type); |
| + start_orientation_ = ToTouchHandleOrientation(start_.type()); |
|
jdduke (slow)
2014/12/01 20:38:04
I know I had a good reason for caching this, but I
|
| + end_orientation_ = ToTouchHandleOrientation(end_.type()); |
| if (!activate_selection_automatically_ && |
| !activate_insertion_automatically_) { |
| @@ -110,8 +109,7 @@ void TouchSelectionController::OnSelectionBoundsChanged( |
| HideAndDisallowShowingAutomatically(); |
| } |
| -bool TouchSelectionController::WillHandleTouchEvent( |
| - const ui::MotionEvent& event) { |
| +bool TouchSelectionController::WillHandleTouchEvent(const MotionEvent& event) { |
| if (is_insertion_active_) { |
| DCHECK(insertion_handle_); |
| return insertion_handle_->WillHandleTouchEvent(event); |
| @@ -395,34 +393,34 @@ void TouchSelectionController::DeactivateSelection() { |
| void TouchSelectionController::ResetCachedValuesIfInactive() { |
| if (is_selection_active_ || is_insertion_active_) |
| return; |
| - start_ = cc::ViewportSelectionBound(); |
| - end_ = cc::ViewportSelectionBound(); |
| + start_ = SelectionBound(); |
| + end_ = SelectionBound(); |
| start_orientation_ = TOUCH_HANDLE_ORIENTATION_UNDEFINED; |
| end_orientation_ = TOUCH_HANDLE_ORIENTATION_UNDEFINED; |
| } |
| const gfx::PointF& TouchSelectionController::GetStartPosition() const { |
| - return start_.edge_bottom; |
| + return start_.edge_bottom(); |
| } |
| const gfx::PointF& TouchSelectionController::GetEndPosition() const { |
| - return end_.edge_bottom; |
| + return end_.edge_bottom(); |
| } |
| gfx::Vector2dF TouchSelectionController::GetStartLineOffset() const { |
| - return gfx::ScaleVector2d(start_.edge_top - start_.edge_bottom, 0.5f); |
| + return gfx::ScaleVector2d(start_.edge_top() - start_.edge_bottom(), 0.5f); |
| } |
| gfx::Vector2dF TouchSelectionController::GetEndLineOffset() const { |
| - return gfx::ScaleVector2d(end_.edge_top - end_.edge_bottom, 0.5f); |
| + return gfx::ScaleVector2d(end_.edge_top() - end_.edge_bottom(), 0.5f); |
| } |
| bool TouchSelectionController::GetStartVisible() const { |
| - return start_.visible && !temporarily_hidden_; |
| + return start_.visible() && !temporarily_hidden_; |
| } |
| bool TouchSelectionController::GetEndVisible() const { |
| - return end_.visible && !temporarily_hidden_; |
| + return end_.visible() && !temporarily_hidden_; |
| } |
| TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( |
| @@ -432,4 +430,4 @@ TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( |
| : TouchHandle::ANIMATION_NONE; |
| } |
| -} // namespace content |
| +} // namespace ui |