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

Side by Side Diff: ui/views/touchui/touch_selection_controller_impl.cc

Issue 23449013: Re-enable TouchSelectionOriginatingFromWebpageTest with some fixes and logs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added TODO for removing LOGs Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/touch_editable_impl_aura_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/touchui/touch_selection_controller_impl.h" 5 #include "ui/views/touchui/touch_selection_controller_impl.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "grit/ui_strings.h" 9 #include "grit/ui_strings.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 canvas->DrawImageInt(*GetHandleImage()->ToImageSkia(), 186 canvas->DrawImageInt(*GetHandleImage()->ToImageSkia(),
187 kSelectionHandleHorizPadding, cursor_height()); 187 kSelectionHandleHorizPadding, cursor_height());
188 } 188 }
189 189
190 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { 190 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE {
191 event->SetHandled(); 191 event->SetHandled();
192 switch (event->type()) { 192 switch (event->type()) {
193 case ui::ET_GESTURE_SCROLL_BEGIN: 193 case ui::ET_GESTURE_SCROLL_BEGIN:
194 widget_->SetCapture(this); 194 widget_->SetCapture(this);
195 controller_->SetDraggingHandle(this); 195 controller_->SetDraggingHandle(this);
196 drag_offset_ = event->y() - cursor_height() - 196 drag_offset_ = event->y() - cursor_height() +
197 kSelectionHandleVerticalDragOffset; 197 kSelectionHandleVerticalDragOffset;
198 break; 198 break;
199 case ui::ET_GESTURE_SCROLL_UPDATE: { 199 case ui::ET_GESTURE_SCROLL_UPDATE: {
200 gfx::Point drag_pos(event->location().x(), 200 gfx::Point drag_pos(event->location().x(),
201 event->location().y() - drag_offset_); 201 event->location().y() - drag_offset_);
202 controller_->SelectionHandleDragged(drag_pos); 202 controller_->SelectionHandleDragged(drag_pos);
203 break; 203 break;
204 } 204 }
205 case ui::ET_GESTURE_SCROLL_END: 205 case ui::ET_GESTURE_SCROLL_END:
206 case ui::ET_SCROLL_FLING_START: 206 case ui::ET_SCROLL_FLING_START:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (draw_invisible_ == draw_invisible) 252 if (draw_invisible_ == draw_invisible)
253 return; 253 return;
254 draw_invisible_ = draw_invisible; 254 draw_invisible_ = draw_invisible;
255 SchedulePaint(); 255 SchedulePaint();
256 } 256 }
257 257
258 private: 258 private:
259 scoped_ptr<Widget> widget_; 259 scoped_ptr<Widget> widget_;
260 TouchSelectionControllerImpl* controller_; 260 TouchSelectionControllerImpl* controller_;
261 gfx::Rect selection_rect_; 261 gfx::Rect selection_rect_;
262
263 // Vertical offset between the scroll event position and the drag position
264 // reported to the client view (see the ASCII figure at the top of the file
265 // and its description for more details).
262 int drag_offset_; 266 int drag_offset_;
263 267
264 // If set to true, the handle will not draw anything, hence providing an empty 268 // If set to true, the handle will not draw anything, hence providing an empty
265 // widget. We need this because we may want to stop showing the handle while 269 // widget. We need this because we may want to stop showing the handle while
266 // it is being dragged. Since it is being dragged, we cannot destroy the 270 // it is being dragged. Since it is being dragged, we cannot destroy the
267 // handle. 271 // handle.
268 bool draw_invisible_; 272 bool draw_invisible_;
269 273
270 DISALLOW_COPY_AND_ASSIGN(EditingHandleView); 274 DISALLOW_COPY_AND_ASSIGN(EditingHandleView);
271 }; 275 };
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 534 }
531 535
532 ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create( 536 ui::TouchSelectionController* ViewsTouchSelectionControllerFactory::create(
533 ui::TouchEditable* client_view) { 537 ui::TouchEditable* client_view) {
534 if (switches::IsTouchEditingEnabled()) 538 if (switches::IsTouchEditingEnabled())
535 return new views::TouchSelectionControllerImpl(client_view); 539 return new views::TouchSelectionControllerImpl(client_view);
536 return NULL; 540 return NULL;
537 } 541 }
538 542
539 } // namespace views 543 } // namespace views
OLDNEW
« no previous file with comments | « content/browser/web_contents/touch_editable_impl_aura_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698