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

Side by Side Diff: ui/events/event.h

Issue 1330233005: Remove outdated TODOs for issue 337824. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | ui/events/gesture_event_details.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef UI_EVENTS_EVENT_H_ 5 #ifndef UI_EVENTS_EVENT_H_
6 #define UI_EVENTS_EVENT_H_ 6 #define UI_EVENTS_EVENT_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/event_types.h" 10 #include "base/event_types.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 ~CancelModeEvent() override; 256 ~CancelModeEvent() override;
257 }; 257 };
258 258
259 class EVENTS_EXPORT LocatedEvent : public Event { 259 class EVENTS_EXPORT LocatedEvent : public Event {
260 public: 260 public:
261 ~LocatedEvent() override; 261 ~LocatedEvent() override;
262 262
263 float x() const { return location_.x(); } 263 float x() const { return location_.x(); }
264 float y() const { return location_.y(); } 264 float y() const { return location_.y(); }
265 void set_location(const gfx::PointF& location) { location_ = location; } 265 void set_location(const gfx::PointF& location) { location_ = location; }
266 // TODO(tdresser): Always return floating point location. See
267 // crbug.com/337824.
268 gfx::Point location() const { return gfx::ToFlooredPoint(location_); } 266 gfx::Point location() const { return gfx::ToFlooredPoint(location_); }
269 const gfx::PointF& location_f() const { return location_; } 267 const gfx::PointF& location_f() const { return location_; }
270 void set_root_location(const gfx::PointF& root_location) { 268 void set_root_location(const gfx::PointF& root_location) {
271 root_location_ = root_location; 269 root_location_ = root_location;
272 } 270 }
273 gfx::Point root_location() const { 271 gfx::Point root_location() const {
274 return gfx::ToFlooredPoint(root_location_); 272 return gfx::ToFlooredPoint(root_location_);
275 } 273 }
276 const gfx::PointF& root_location_f() const { 274 const gfx::PointF& root_location_f() const {
277 return root_location_; 275 return root_location_;
278 } 276 }
279 277
280 // Transform the locations using |inverted_root_transform|. 278 // Transform the locations using |inverted_root_transform|.
281 // This is applied to both |location_| and |root_location_|. 279 // This is applied to both |location_| and |root_location_|.
282 virtual void UpdateForRootTransform( 280 virtual void UpdateForRootTransform(
283 const gfx::Transform& inverted_root_transform); 281 const gfx::Transform& inverted_root_transform);
284 282
285 template <class T> void ConvertLocationToTarget(T* source, T* target) { 283 template <class T> void ConvertLocationToTarget(T* source, T* target) {
286 if (!target || target == source) 284 if (!target || target == source)
287 return; 285 return;
288 // TODO(tdresser): Rewrite ConvertPointToTarget to use PointF. See
289 // crbug.com/337824.
290 gfx::Point offset = gfx::ToFlooredPoint(location_); 286 gfx::Point offset = gfx::ToFlooredPoint(location_);
291 T::ConvertPointToTarget(source, target, &offset); 287 T::ConvertPointToTarget(source, target, &offset);
292 gfx::Vector2d diff = gfx::ToFlooredPoint(location_) - offset; 288 gfx::Vector2d diff = gfx::ToFlooredPoint(location_) - offset;
293 location_= location_ - diff; 289 location_= location_ - diff;
294 } 290 }
295 291
296 protected: 292 protected:
297 friend class LocatedEventTestApi; 293 friend class LocatedEventTestApi;
298 explicit LocatedEvent(const base::NativeEvent& native_event); 294 explicit LocatedEvent(const base::NativeEvent& native_event);
299 295
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 915
920 const GestureEventDetails& details() const { return details_; } 916 const GestureEventDetails& details() const { return details_; }
921 917
922 private: 918 private:
923 GestureEventDetails details_; 919 GestureEventDetails details_;
924 }; 920 };
925 921
926 } // namespace ui 922 } // namespace ui
927 923
928 #endif // UI_EVENTS_EVENT_H_ 924 #endif // UI_EVENTS_EVENT_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | ui/events/gesture_event_details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698