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

Issue 265713007: views: Update event-related API to use PointF/RectF instead of Point/Rect.

Created:
6 years, 7 months ago by sadrul
Modified:
6 years, 5 months ago
Reviewers:
CC:
chromium-reviews, chrome-apps-syd-reviews_chromium.org, tdanderson+views_chromium.org, yusukes+watch_chromium.org, yukishiino+watch_chromium.org, benquan, tfarina, penghuang+watch_chromium.org, dcheng, nona+watch_chromium.org, Dane Wallinga, dyu1, estade+watch_chromium.org, rouslan+autofillwatch_chromium.org, kalyank, ben+views_chromium.org, James Su, Ilya Sherman, ben+ash_chromium.org
Visibility:
Public.

Description

views: Update event-related API to use PointF/RectF instead of Point/Rect. * View - GetEventHandlerForRect() - GetEventHandlerForPoint() - HitTestPoint() - HitTestRect() - ExceededDragThreshold() - GetDragOperations() - WriteDragData() - DoDrag() * DragController - WriteDragDataForView() - GetDragOperationsForView() - CanStartDragForView() * TabStrip - IsPositionInWindowCaption() - IsRectInWindowCaption() BUG=337824

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+200 lines, -202 lines) Patch
M ash/drag_drop/drag_drop_controller_unittest.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M ash/drag_drop/drag_drop_interactive_uitest.cc View 1 chunk +3 lines, -3 lines 0 comments Download
M ash/frame/custom_frame_view_ash.h View 1 chunk +1 line, -1 line 0 comments Download
M ash/frame/custom_frame_view_ash.cc View 3 chunks +4 lines, -3 lines 0 comments Download
M ash/shelf/shelf_button.h View 1 chunk +1 line, -1 line 0 comments Download
M ash/shelf/shelf_button.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/autofill/autofill_dialog_views.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/autofill/autofill_dialog_views.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/autofill/decorated_textfield.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/autofill/decorated_textfield.cc View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/bookmarks/bookmark_bar_view.h View 2 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc View 5 chunks +12 lines, -10 lines 0 comments Download
M chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc View 2 chunks +3 lines, -6 lines 0 comments Download
M chrome/browser/ui/views/frame/glass_browser_frame_view.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/frame/opaque_browser_frame_view.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/frame/opaque_browser_frame_view.cc View 3 chunks +4 lines, -9 lines 1 comment Download
M chrome/browser/ui/views/location_bar/location_bar_view.h View 1 chunk +4 lines, -4 lines 0 comments Download
M chrome/browser/ui/views/location_bar/location_bar_view.cc View 3 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/profiles/avatar_menu_bubble_view.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/profiles/avatar_menu_button.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/profiles/avatar_menu_button.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/tabs/tab.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/tabs/tab_strip.h View 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/views/tabs/tab_strip.cc View 3 chunks +9 lines, -10 lines 0 comments Download
M chrome/browser/ui/views/toolbar/browser_actions_container.h View 1 chunk +4 lines, -4 lines 0 comments Download
M chrome/browser/ui/views/toolbar/browser_actions_container.cc View 3 chunks +9 lines, -7 lines 0 comments Download
M chrome/browser/ui/views/toolbar/toolbar_origin_chip_view.h View 1 chunk +4 lines, -4 lines 0 comments Download
M chrome/browser/ui/views/toolbar/toolbar_origin_chip_view.cc View 2 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/ui/views/toolbar/toolbar_view.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/toolbar/toolbar_view.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/app_list/views/speech_view.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M ui/base/dragdrop/drag_utils_aura.cc View 1 chunk +0 lines, -1 line 0 comments Download
M ui/gfx/skia_util.h View 1 chunk +1 line, -0 lines 0 comments Download
M ui/gfx/skia_util.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M ui/message_center/views/bounded_label.h View 1 chunk +1 line, -1 line 0 comments Download
M ui/message_center/views/bounded_label.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/message_center/views/notification_view.h View 1 chunk +1 line, -1 line 0 comments Download
M ui/message_center/views/notification_view.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M ui/views/controls/image_view.h View 1 chunk +1 line, -1 line 0 comments Download
M ui/views/controls/image_view.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/views/controls/label.h View 1 chunk +1 line, -1 line 0 comments Download
M ui/views/controls/label.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/views/controls/link.h View 1 chunk +1 line, -1 line 0 comments Download
M ui/views/controls/link.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/views/controls/textfield/textfield.h View 1 chunk +4 lines, -4 lines 0 comments Download
M ui/views/controls/textfield/textfield.cc View 3 chunks +7 lines, -6 lines 0 comments Download
M ui/views/controls/textfield/textfield_unittest.cc View 5 chunks +10 lines, -10 lines 0 comments Download
M ui/views/drag_controller.h View 1 chunk +4 lines, -5 lines 0 comments Download
M ui/views/rect_based_targeting_utils.h View 1 chunk +7 lines, -7 lines 0 comments Download
M ui/views/rect_based_targeting_utils.cc View 2 chunks +9 lines, -9 lines 1 comment Download
M ui/views/view.h View 7 chunks +10 lines, -10 lines 0 comments Download
M ui/views/view.cc View 10 chunks +24 lines, -25 lines 0 comments Download
M ui/views/widget/root_view.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/views/window/non_client_view.h View 2 chunks +2 lines, -2 lines 0 comments Download
M ui/views/window/non_client_view.cc View 3 chunks +6 lines, -7 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
sadrul
6 years, 7 months ago (2014-05-02 06:42:13 UTC) #1
tdresser
Should we modify some existing tests to use non-integral floating point values? https://codereview.chromium.org/265713007/diff/1/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc File chrome/browser/ui/views/frame/opaque_browser_frame_view.cc ...
6 years, 7 months ago (2014-05-02 13:19:05 UTC) #2
sky
Sadrul, could you outline the motivation for going floating point here? Are you looking at ...
6 years, 7 months ago (2014-05-02 14:42:16 UTC) #3
sadrul
On 2014/05/02 14:42:16, sky wrote: > Sadrul, could you outline the motivation for going floating ...
6 years, 7 months ago (2014-05-02 18:19:49 UTC) #4
sky
On 2014/05/02 18:19:49, sadrul wrote: > On 2014/05/02 14:42:16, sky wrote: > > Sadrul, could ...
6 years, 7 months ago (2014-05-02 21:21:15 UTC) #5
sadrul
On 2014/05/02 21:21:15, sky wrote: > On 2014/05/02 18:19:49, sadrul wrote: > > On 2014/05/02 ...
6 years, 7 months ago (2014-05-05 19:40:10 UTC) #6
sky
Until we have a compelling reason to actually consume fractional locations in views code I'm ...
6 years, 7 months ago (2014-05-05 20:55:38 UTC) #7
sadrul
On 2014/05/05 20:55:38, sky wrote: > Until we have a compelling reason to actually consume ...
6 years, 7 months ago (2014-05-05 22:49:48 UTC) #8
sky
6 years, 7 months ago (2014-05-06 00:28:59 UTC) #9
On Mon, May 5, 2014 at 3:49 PM,  <sadrul@chromium.org> wrote:
> On 2014/05/05 20:55:38, sky wrote:
>>
>> Until we have a compelling reason to actually consume fractional
>> locations in views code I'm for the simple approach. I tend to prefer
>> having new methods for getting the floating point locations and making
>> the current API returned floored locations.
>
>
> We already have LocatedEvent::location() and LocatedEvent::location_f().
> Perhaps
> we should change to:
>
>   LocatedEvent:
>     const gfx::Point& location() const { return location_; }
>     const gfx::PointF& location_f() const { return location_f_; }
>
>     gfx::Point location_;
>     gfx::Point location_f_;
>
> LocatedEvent::location_ gets updated from location_f_ in the ctor (instead
> of
> doing the flooring in every call to location()). Does that sound reasonable?

SGTM
>
>
>
>> On Mon, May 5, 2014 at 12:40 PM,  <mailto:sadrul@chromium.org> wrote:
>> > On 2014/05/02 21:21:15, sky wrote:
>> >>
>> >> On 2014/05/02 18:19:49, sadrul wrote:
>> >> > On 2014/05/02 14:42:16, sky wrote:
>> >> > > Sadrul, could you outline the motivation for going floating point
>> >> > > here? Are you looking at moving views to floating point as well?
>> >> >
>> >> > tldr: Some, but not necessarily all of it.
>> >> >
>> >> > For Events, we now have floating-point locations. We need to clean-up
>> >> > the
>> >> > left-over TODOs from that change (Tim has been working on this:
>> >> > https://codereview.chromium.org/139983009/). I want to avoid having
>> >> > to
>> >> > get
>> >
>> > the
>> >>
>> >> > event-location and always have to do a gfx::ToFlooredPoint() on it
>> >> immediately.
>> >> > So I am trying to change the views API that deal with events to also
>> >> > use
>> >> > floating points. This also ties in well with doing the
>> >> > coordinate-conversion
>> >> > correctly
>> >> > (https://code.google.com/p/chromium/issues/detail?id=364074).
>> >> > The
>> >> > primary motivations for these are
>> >> > developer-friendliness/code-cleanliness,
>> >
>> > and
>> >>
>> >> > correctness. (it may make sense to eventually convert all of views to
>> >> > use
>> >> > floats, but I am not targeting that at the moment).
>> >
>> >
>> >> If you're not going to make everything floating point, is there any
>> >> value
>> >> in
>> >> converting part of it? Fractional hit testing only matters if we can
>> >> position
>> >> views at fractional points, right?
>> >
>> >
>> > Right. But since we can have (and do want) fractional locations for
>> > events,
>> > it
>> > makes sense to have at least some of the API be also aware of fractional
>> > locations. I do agree that having only parts of the API deal with
>> > fractional
>> > points is not a very nice state. It may make sense to try to convert all
>> > of
>> > the
>> > API to be aware of this, although that does sound like quite a lot of
>> > work,
>> > but
>> > perhaps it's worth it? The alternative is to require the code that deal
>> > with
>> > event locations to always do a gfx::ToFlooredPoint() immediately
>> > (https://codereview.chromium.org/139983009/), or add a
>> > LocatedEvent::GetLocation() [sic] that does this. While I don't like the
>> > latter
>> > approach, I could be convinced that it is the lesser of the evils.
>> >
>> > https://codereview.chromium.org/265713007/
>
>
>> To unsubscribe from this group and stop receiving emails from it, send an
>
> email
>>
>> to mailto:chromium-reviews+unsubscribe@chromium.org.
>
>
>
>
> https://codereview.chromium.org/265713007/

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698