Commit 5fef4c48 authored by Xiyuan Xia's avatar Xiyuan Xia Committed by Commit Bot

Update DropTargetEvent ctor to use PointF

Update DropTargetEvent ctor to take gfx::PointF instead of
gfx::Point. No behavior change.

Bug: None
Change-Id: I0d38527bd73edc49a0dfb974a33ce95eec94af61
Reviewed-on: https://chromium-review.googlesource.com/1153433Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578849}
parent beea8ba5
...@@ -431,10 +431,8 @@ void DragDropController::DragUpdate(aura::Window* target, ...@@ -431,10 +431,8 @@ void DragDropController::DragUpdate(aura::Window* target,
aura::client::DragDropDelegate* delegate = aura::client::DragDropDelegate* delegate =
aura::client::GetDragDropDelegate(drag_window_); aura::client::GetDragDropDelegate(drag_window_);
if (delegate) { if (delegate) {
ui::DropTargetEvent e(*drag_data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent e(*drag_data_, event.location_f(),
drag_operation_); event.root_location_f(), drag_operation_);
e.set_location_f(event.location_f());
e.set_root_location_f(event.root_location_f());
e.set_flags(event.flags()); e.set_flags(event.flags());
ui::Event::DispatcherApi(&e).set_target(target); ui::Event::DispatcherApi(&e).set_target(target);
delegate->OnDragEntered(e); delegate->OnDragEntered(e);
...@@ -443,10 +441,8 @@ void DragDropController::DragUpdate(aura::Window* target, ...@@ -443,10 +441,8 @@ void DragDropController::DragUpdate(aura::Window* target,
aura::client::DragDropDelegate* delegate = aura::client::DragDropDelegate* delegate =
aura::client::GetDragDropDelegate(drag_window_); aura::client::GetDragDropDelegate(drag_window_);
if (delegate) { if (delegate) {
ui::DropTargetEvent e(*drag_data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent e(*drag_data_, event.location_f(),
drag_operation_); event.root_location_f(), drag_operation_);
e.set_location_f(event.location_f());
e.set_root_location_f(event.root_location_f());
e.set_flags(event.flags()); e.set_flags(event.flags());
ui::Event::DispatcherApi(&e).set_target(target); ui::Event::DispatcherApi(&e).set_target(target);
op = delegate->OnDragUpdated(e); op = delegate->OnDragUpdated(e);
...@@ -486,10 +482,8 @@ void DragDropController::Drop(aura::Window* target, ...@@ -486,10 +482,8 @@ void DragDropController::Drop(aura::Window* target,
aura::client::DragDropDelegate* delegate = aura::client::DragDropDelegate* delegate =
aura::client::GetDragDropDelegate(target); aura::client::GetDragDropDelegate(target);
if (delegate) { if (delegate) {
ui::DropTargetEvent e(*drag_data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent e(*drag_data_, event.location_f(),
drag_operation_); event.root_location_f(), drag_operation_);
e.set_location_f(event.location_f());
e.set_root_location_f(event.root_location_f());
e.set_flags(event.flags()); e.set_flags(event.flags());
ui::Event::DispatcherApi(&e).set_target(target); ui::Event::DispatcherApi(&e).set_target(target);
drag_operation_ = delegate->OnPerformDrop(e); drag_operation_ = delegate->OnPerformDrop(e);
......
...@@ -104,11 +104,11 @@ class DragAndDropSimulator { ...@@ -104,11 +104,11 @@ class DragAndDropSimulator {
if (!delegate) if (!delegate)
return false; return false;
gfx::Point event_location; gfx::PointF event_location;
gfx::Point event_root_location; gfx::PointF event_root_location;
CalculateEventLocations(location, &event_location, &event_root_location); CalculateEventLocations(location, &event_location, &event_root_location);
active_drag_event_->set_location(event_location); active_drag_event_->set_location_f(event_location);
active_drag_event_->set_root_location(event_root_location); active_drag_event_->set_root_location_f(event_root_location);
delegate->OnDragUpdated(*active_drag_event_); delegate->OnDragUpdated(*active_drag_event_);
delegate->OnPerformDrop(*active_drag_event_); delegate->OnPerformDrop(*active_drag_event_);
...@@ -126,8 +126,8 @@ class DragAndDropSimulator { ...@@ -126,8 +126,8 @@ class DragAndDropSimulator {
if (!delegate) if (!delegate)
return false; return false;
gfx::Point event_location; gfx::PointF event_location;
gfx::Point event_root_location; gfx::PointF event_root_location;
CalculateEventLocations(location, &event_location, &event_root_location); CalculateEventLocations(location, &event_location, &event_root_location);
active_drag_event_.reset(new ui::DropTargetEvent( active_drag_event_.reset(new ui::DropTargetEvent(
data, event_location, event_root_location, kDefaultSourceOperations)); data, event_location, event_root_location, kDefaultSourceOperations));
...@@ -146,16 +146,16 @@ class DragAndDropSimulator { ...@@ -146,16 +146,16 @@ class DragAndDropSimulator {
} }
void CalculateEventLocations(gfx::Point web_contents_relative_location, void CalculateEventLocations(gfx::Point web_contents_relative_location,
gfx::Point* out_event_location, gfx::PointF* out_event_location,
gfx::Point* out_event_root_location) { gfx::PointF* out_event_root_location) {
gfx::NativeView view = web_contents_->GetNativeView(); gfx::NativeView view = web_contents_->GetNativeView();
*out_event_location = web_contents_relative_location; *out_event_location = gfx::PointF(web_contents_relative_location);
gfx::Point root_location = web_contents_relative_location; gfx::Point root_location = web_contents_relative_location;
aura::Window::ConvertPointToTarget(view, view->GetRootWindow(), aura::Window::ConvertPointToTarget(view, view->GetRootWindow(),
&root_location); &root_location);
*out_event_root_location = root_location; *out_event_root_location = gfx::PointF(root_location);
} }
// These are ui::DropTargetEvent::source_operations_ being sent when manually // These are ui::DropTargetEvent::source_operations_ being sent when manually
......
...@@ -331,7 +331,8 @@ BrowserRootView::DropIndex BrowserRootView::GetDropIndexForEvent( ...@@ -331,7 +331,8 @@ BrowserRootView::DropIndex BrowserRootView::GetDropIndexForEvent(
DropTarget* target) { DropTarget* target) {
gfx::Point loc_in_view(event.location()); gfx::Point loc_in_view(event.location());
ConvertPointToTarget(this, target->GetViewForDrop(), &loc_in_view); ConvertPointToTarget(this, target->GetViewForDrop(), &loc_in_view);
ui::DropTargetEvent event_in_view(data, loc_in_view, loc_in_view, ui::DropTargetEvent event_in_view(data, gfx::PointF(loc_in_view),
gfx::PointF(loc_in_view),
event.source_operations()); event.source_operations());
return target->GetDropIndex(event_in_view); return target->GetDropIndex(event_in_view);
} }
......
...@@ -32,7 +32,7 @@ class BrowserRootViewBrowserTest : public InProcessBrowserTest { ...@@ -32,7 +32,7 @@ class BrowserRootViewBrowserTest : public InProcessBrowserTest {
IN_PROC_BROWSER_TEST_F(BrowserRootViewBrowserTest, ClearDropInfo) { IN_PROC_BROWSER_TEST_F(BrowserRootViewBrowserTest, ClearDropInfo) {
ui::OSExchangeData data; ui::OSExchangeData data;
data.SetURL(GURL("http://www.chromium.org/"), base::string16()); data.SetURL(GURL("http://www.chromium.org/"), base::string16());
ui::DropTargetEvent event(data, gfx::Point(), gfx::Point(), ui::DropTargetEvent event(data, gfx::PointF(), gfx::PointF(),
ui::DragDropTypes::DRAG_COPY); ui::DragDropTypes::DRAG_COPY);
BrowserRootView* root_view = browser_root_view(); BrowserRootView* root_view = browser_root_view();
...@@ -45,7 +45,7 @@ IN_PROC_BROWSER_TEST_F(BrowserRootViewBrowserTest, ClearDropInfo) { ...@@ -45,7 +45,7 @@ IN_PROC_BROWSER_TEST_F(BrowserRootViewBrowserTest, ClearDropInfo) {
IN_PROC_BROWSER_TEST_F(BrowserRootViewBrowserTest, PlainString) { IN_PROC_BROWSER_TEST_F(BrowserRootViewBrowserTest, PlainString) {
ui::OSExchangeData data; ui::OSExchangeData data;
data.SetString(base::ASCIIToUTF16("Plain string")); data.SetString(base::ASCIIToUTF16("Plain string"));
ui::DropTargetEvent event(data, gfx::Point(), gfx::Point(), ui::DropTargetEvent event(data, gfx::PointF(), gfx::PointF(),
ui::DragDropTypes::DRAG_COPY); ui::DragDropTypes::DRAG_COPY);
BrowserRootView* root_view = browser_root_view(); BrowserRootView* root_view = browser_root_view();
......
...@@ -75,7 +75,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarViewsBrowserTest, DragBrowserActions) { ...@@ -75,7 +75,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarViewsBrowserTest, DragBrowserActions) {
browser_action_drag_data.Write(profile(), &drop_data); browser_action_drag_data.Write(profile(), &drop_data);
ToolbarActionView* view = container->GetViewForId(extension_b()->id()); ToolbarActionView* view = container->GetViewForId(extension_b()->id());
// ...to the right of extension B. // ...to the right of extension B.
gfx::Point location(view->x() + view->width(), view->y()); gfx::PointF location(view->x() + view->width(), view->y());
ui::DropTargetEvent target_event( ui::DropTargetEvent target_event(
drop_data, location, location, ui::DragDropTypes::DRAG_MOVE); drop_data, location, location, ui::DragDropTypes::DRAG_MOVE);
...@@ -110,7 +110,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarViewsBrowserTest, DragBrowserActions) { ...@@ -110,7 +110,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarViewsBrowserTest, DragBrowserActions) {
BrowserActionDragData browser_action_drag_data2(extension_a()->id(), 1u); BrowserActionDragData browser_action_drag_data2(extension_a()->id(), 1u);
browser_action_drag_data2.Write(profile(), &drop_data2); browser_action_drag_data2.Write(profile(), &drop_data2);
// ...to the left of extension B (which is now at index 0). // ...to the left of extension B (which is now at index 0).
location = gfx::Point(view->x(), view->y()); location = gfx::PointF(view->x(), view->y());
ui::DropTargetEvent target_event2( ui::DropTargetEvent target_event2(
drop_data2, location, location, ui::DragDropTypes::DRAG_MOVE); drop_data2, location, location, ui::DragDropTypes::DRAG_MOVE);
...@@ -139,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarViewsBrowserTest, DragBrowserActions) { ...@@ -139,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarViewsBrowserTest, DragBrowserActions) {
BrowserActionDragData browser_action_drag_data3(extension_c()->id(), 2u); BrowserActionDragData browser_action_drag_data3(extension_c()->id(), 2u);
browser_action_drag_data3.Write(profile(), &drop_data3); browser_action_drag_data3.Write(profile(), &drop_data3);
// ...to the left of extension B (which is back in index 1 on the main bar). // ...to the left of extension B (which is back in index 1 on the main bar).
location = gfx::Point(view->x(), view->y()); location = gfx::PointF(view->x(), view->y());
ui::DropTargetEvent target_event3( ui::DropTargetEvent target_event3(
drop_data3, location, location, ui::DragDropTypes::DRAG_MOVE); drop_data3, location, location, ui::DragDropTypes::DRAG_MOVE);
...@@ -189,7 +189,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarViewsBrowserTest, MultipleWindows) { ...@@ -189,7 +189,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarViewsBrowserTest, MultipleWindows) {
browser_action_drag_data.Write(profile(), &drop_data); browser_action_drag_data.Write(profile(), &drop_data);
ToolbarActionView* view = first->GetViewForId(extension_b()->id()); ToolbarActionView* view = first->GetViewForId(extension_b()->id());
// ...to the right of extension B. // ...to the right of extension B.
gfx::Point location(view->x() + view->width(), view->y()); gfx::PointF location(view->x() + view->width(), view->y());
ui::DropTargetEvent target_event( ui::DropTargetEvent target_event(
drop_data, location, location, ui::DragDropTypes::DRAG_MOVE); drop_data, location, location, ui::DragDropTypes::DRAG_MOVE);
...@@ -421,7 +421,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsContainerOverflowTest, ...@@ -421,7 +421,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsContainerOverflowTest,
BrowserActionDragData browser_action_drag_data(extension_a()->id(), 0u); BrowserActionDragData browser_action_drag_data(extension_a()->id(), 0u);
browser_action_drag_data.Write(profile(), &drop_data); browser_action_drag_data.Write(profile(), &drop_data);
ToolbarActionView* view = overflow_bar()->GetViewForId(extension_c()->id()); ToolbarActionView* view = overflow_bar()->GetViewForId(extension_c()->id());
gfx::Point location(view->x(), view->y()); gfx::PointF location(view->x(), view->y());
ui::DropTargetEvent target_event( ui::DropTargetEvent target_event(
drop_data, location, location, ui::DragDropTypes::DRAG_MOVE); drop_data, location, location, ui::DragDropTypes::DRAG_MOVE);
...@@ -440,7 +440,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsContainerOverflowTest, ...@@ -440,7 +440,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsContainerOverflowTest,
BrowserActionDragData browser_action_drag_data2(extension_a()->id(), 1u); BrowserActionDragData browser_action_drag_data2(extension_a()->id(), 1u);
browser_action_drag_data2.Write(profile(), &drop_data2); browser_action_drag_data2.Write(profile(), &drop_data2);
view = main_bar()->GetViewForId(extension_b()->id()); view = main_bar()->GetViewForId(extension_b()->id());
location = gfx::Point(view->x(), view->y()); location = gfx::PointF(view->x(), view->y());
ui::DropTargetEvent target_event2( ui::DropTargetEvent target_event2(
drop_data2, location, location, ui::DragDropTypes::DRAG_MOVE); drop_data2, location, location, ui::DragDropTypes::DRAG_MOVE);
...@@ -457,7 +457,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsContainerOverflowTest, ...@@ -457,7 +457,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsContainerOverflowTest,
ui::OSExchangeData drop_data3; ui::OSExchangeData drop_data3;
BrowserActionDragData browser_action_drag_data3(extension_c()->id(), 2u); BrowserActionDragData browser_action_drag_data3(extension_c()->id(), 2u);
browser_action_drag_data3.Write(profile(), &drop_data3); browser_action_drag_data3.Write(profile(), &drop_data3);
location = gfx::Point(view->x(), view->y()); location = gfx::PointF(view->x(), view->y());
ui::DropTargetEvent target_event3( ui::DropTargetEvent target_event3(
drop_data3, location, location, ui::DragDropTypes::DRAG_MOVE); drop_data3, location, location, ui::DragDropTypes::DRAG_MOVE);
......
...@@ -172,7 +172,7 @@ TEST_F(DataDeviceTest, Destroy) { ...@@ -172,7 +172,7 @@ TEST_F(DataDeviceTest, Destroy) {
} }
TEST_F(DataDeviceTest, DataEventsDrop) { TEST_F(DataDeviceTest, DataEventsDrop) {
ui::DropTargetEvent event(data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent event(data_, gfx::PointF(), gfx::PointF(),
ui::DragDropTypes::DRAG_MOVE); ui::DragDropTypes::DRAG_MOVE);
ui::Event::DispatcherApi(&event).set_target(surface_->window()); ui::Event::DispatcherApi(&event).set_target(surface_->window());
...@@ -192,7 +192,7 @@ TEST_F(DataDeviceTest, DataEventsDrop) { ...@@ -192,7 +192,7 @@ TEST_F(DataDeviceTest, DataEventsDrop) {
} }
TEST_F(DataDeviceTest, DataEventsExit) { TEST_F(DataDeviceTest, DataEventsExit) {
ui::DropTargetEvent event(data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent event(data_, gfx::PointF(), gfx::PointF(),
ui::DragDropTypes::DRAG_MOVE); ui::DragDropTypes::DRAG_MOVE);
ui::Event::DispatcherApi(&event).set_target(surface_->window()); ui::Event::DispatcherApi(&event).set_target(surface_->window());
...@@ -212,7 +212,7 @@ TEST_F(DataDeviceTest, DataEventsExit) { ...@@ -212,7 +212,7 @@ TEST_F(DataDeviceTest, DataEventsExit) {
} }
TEST_F(DataDeviceTest, DeleteDataOfferDuringDrag) { TEST_F(DataDeviceTest, DeleteDataOfferDuringDrag) {
ui::DropTargetEvent event(data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent event(data_, gfx::PointF(), gfx::PointF(),
ui::DragDropTypes::DRAG_MOVE); ui::DragDropTypes::DRAG_MOVE);
ui::Event::DispatcherApi(&event).set_target(surface_->window()); ui::Event::DispatcherApi(&event).set_target(surface_->window());
...@@ -232,7 +232,7 @@ TEST_F(DataDeviceTest, DeleteDataOfferDuringDrag) { ...@@ -232,7 +232,7 @@ TEST_F(DataDeviceTest, DeleteDataOfferDuringDrag) {
} }
TEST_F(DataDeviceTest, NotAcceptDataEventsForSurface) { TEST_F(DataDeviceTest, NotAcceptDataEventsForSurface) {
ui::DropTargetEvent event(data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent event(data_, gfx::PointF(), gfx::PointF(),
ui::DragDropTypes::DRAG_MOVE); ui::DragDropTypes::DRAG_MOVE);
ui::Event::DispatcherApi(&event).set_target(surface_->window()); ui::Event::DispatcherApi(&event).set_target(surface_->window());
......
...@@ -108,10 +108,8 @@ void TestDragDropClient::DragUpdate(aura::Window* target, ...@@ -108,10 +108,8 @@ void TestDragDropClient::DragUpdate(aura::Window* target,
aura::client::DragDropDelegate* delegate = aura::client::DragDropDelegate* delegate =
aura::client::GetDragDropDelegate(drag_window_); aura::client::GetDragDropDelegate(drag_window_);
if (delegate) { if (delegate) {
ui::DropTargetEvent e(*drag_data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent e(*drag_data_, event.location_f(),
drag_operation_); event.root_location_f(), drag_operation_);
e.set_location_f(event.location_f());
e.set_root_location_f(event.root_location_f());
e.set_flags(event.flags()); e.set_flags(event.flags());
ui::Event::DispatcherApi(&e).set_target(target); ui::Event::DispatcherApi(&e).set_target(target);
delegate->OnDragEntered(e); delegate->OnDragEntered(e);
...@@ -121,10 +119,8 @@ void TestDragDropClient::DragUpdate(aura::Window* target, ...@@ -121,10 +119,8 @@ void TestDragDropClient::DragUpdate(aura::Window* target,
aura::client::DragDropDelegate* delegate = aura::client::DragDropDelegate* delegate =
aura::client::GetDragDropDelegate(drag_window_); aura::client::GetDragDropDelegate(drag_window_);
if (delegate) { if (delegate) {
ui::DropTargetEvent e(*drag_data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent e(*drag_data_, event.location_f(),
drag_operation_); event.root_location_f(), drag_operation_);
e.set_location_f(event.location_f());
e.set_root_location_f(event.root_location_f());
e.set_flags(event.flags()); e.set_flags(event.flags());
ui::Event::DispatcherApi(&e).set_target(target); ui::Event::DispatcherApi(&e).set_target(target);
delegate->OnDragUpdated(e); delegate->OnDragUpdated(e);
...@@ -140,10 +136,8 @@ void TestDragDropClient::Drop(aura::Window* target, ...@@ -140,10 +136,8 @@ void TestDragDropClient::Drop(aura::Window* target,
aura::client::DragDropDelegate* delegate = aura::client::DragDropDelegate* delegate =
aura::client::GetDragDropDelegate(target); aura::client::GetDragDropDelegate(target);
if (delegate) { if (delegate) {
ui::DropTargetEvent e(*drag_data_, gfx::Point(), gfx::Point(), ui::DropTargetEvent e(*drag_data_, event.location_f(),
drag_operation_); event.root_location_f(), drag_operation_);
e.set_location_f(event.location_f());
e.set_root_location_f(event.root_location_f());
e.set_flags(event.flags()); e.set_flags(event.flags());
ui::Event::DispatcherApi(&e).set_target(target); ui::Event::DispatcherApi(&e).set_target(target);
drag_operation_ = delegate->OnPerformDrop(e); drag_operation_ = delegate->OnPerformDrop(e);
......
...@@ -62,7 +62,8 @@ class DragDropDelegateTest : public testing::Test { ...@@ -62,7 +62,8 @@ class DragDropDelegateTest : public testing::Test {
drag_data_ = &data; drag_data_ = &data;
delegate()->OnDragEntered(ui::DropTargetEvent( delegate()->OnDragEntered(ui::DropTargetEvent(
*drag_data_, location, location, ui::DragDropTypes::DRAG_MOVE)); *drag_data_, gfx::PointF(location), gfx::PointF(location),
ui::DragDropTypes::DRAG_MOVE));
} }
// Simulates drag moves at given |location| in |window_|. // Simulates drag moves at given |location| in |window_|.
...@@ -70,7 +71,8 @@ class DragDropDelegateTest : public testing::Test { ...@@ -70,7 +71,8 @@ class DragDropDelegateTest : public testing::Test {
DCHECK_NE(nullptr, drag_data_); DCHECK_NE(nullptr, drag_data_);
delegate()->OnDragUpdated(ui::DropTargetEvent( delegate()->OnDragUpdated(ui::DropTargetEvent(
*drag_data_, location, location, ui::DragDropTypes::DRAG_MOVE)); *drag_data_, gfx::PointF(location), gfx::PointF(location),
ui::DragDropTypes::DRAG_MOVE));
} }
// Simulates drag finished with a drop at |location|. // Simulates drag finished with a drop at |location|.
...@@ -78,7 +80,8 @@ class DragDropDelegateTest : public testing::Test { ...@@ -78,7 +80,8 @@ class DragDropDelegateTest : public testing::Test {
DCHECK_NE(nullptr, drag_data_); DCHECK_NE(nullptr, drag_data_);
delegate()->OnPerformDrop(ui::DropTargetEvent( delegate()->OnPerformDrop(ui::DropTargetEvent(
*drag_data_, location, location, ui::DragDropTypes::DRAG_MOVE)); *drag_data_, gfx::PointF(location), gfx::PointF(location),
ui::DragDropTypes::DRAG_MOVE));
drag_data_ = nullptr; drag_data_ = nullptr;
} }
......
...@@ -222,13 +222,13 @@ DragDropControllerMus::CreateDropTargetEvent(Window* window, ...@@ -222,13 +222,13 @@ DragDropControllerMus::CreateDropTargetEvent(Window* window,
DCHECK(window->GetHost()); DCHECK(window->GetHost());
gfx::Point root_location = screen_location; gfx::Point root_location = screen_location;
window->GetHost()->ConvertScreenInPixelsToDIP(&root_location); window->GetHost()->ConvertScreenInPixelsToDIP(&root_location);
gfx::Point location = root_location; gfx::PointF location(root_location);
Window::ConvertPointToTarget(window->GetRootWindow(), window, &location); Window::ConvertPointToTarget(window->GetRootWindow(), window, &location);
std::unique_ptr<ui::DropTargetEvent> event = std::unique_ptr<ui::DropTargetEvent> event =
std::make_unique<ui::DropTargetEvent>( std::make_unique<ui::DropTargetEvent>(
current_drag_state_ ? current_drag_state_->drag_data current_drag_state_ ? current_drag_state_->drag_data
: *(os_exchange_data_.get()), : *(os_exchange_data_.get()),
location, root_location, effect_bitmask); location, gfx::PointF(root_location), effect_bitmask);
event->set_flags(event_flags); event->set_flags(event_flags);
ui::Event::DispatcherApi(event.get()).set_target(window); ui::Event::DispatcherApi(event.get()).set_target(window);
return event; return event;
......
...@@ -12,12 +12,12 @@ namespace ui { ...@@ -12,12 +12,12 @@ namespace ui {
// DropTargetEvent // DropTargetEvent
DropTargetEvent::DropTargetEvent(const OSExchangeData& data, DropTargetEvent::DropTargetEvent(const OSExchangeData& data,
const gfx::Point& location, const gfx::PointF& location,
const gfx::Point& root_location, const gfx::PointF& root_location,
int source_operations) int source_operations)
: LocatedEvent(ET_DROP_TARGET_EVENT, : LocatedEvent(ET_DROP_TARGET_EVENT,
gfx::PointF(location), location,
gfx::PointF(root_location), root_location,
EventTimeForNow(), EventTimeForNow(),
0), 0),
data_(data), data_(data),
......
...@@ -14,8 +14,8 @@ namespace ui { ...@@ -14,8 +14,8 @@ namespace ui {
class UI_BASE_EXPORT DropTargetEvent : public LocatedEvent { class UI_BASE_EXPORT DropTargetEvent : public LocatedEvent {
public: public:
DropTargetEvent(const OSExchangeData& data, DropTargetEvent(const OSExchangeData& data,
const gfx::Point& location, const gfx::PointF& location,
const gfx::Point& root_location, const gfx::PointF& root_location,
int source_operations); int source_operations);
const OSExchangeData& data() const { return data_; } const OSExchangeData& data() const { return data_; }
......
...@@ -1068,8 +1068,7 @@ TEST_F(MenuControllerTest, AsynchronousPerformDrop) { ...@@ -1068,8 +1068,7 @@ TEST_F(MenuControllerTest, AsynchronousPerformDrop) {
SetDropMenuItem(target, MenuDelegate::DropPosition::DROP_AFTER); SetDropMenuItem(target, MenuDelegate::DropPosition::DROP_AFTER);
ui::OSExchangeData drop_data; ui::OSExchangeData drop_data;
gfx::Rect bounds(target->bounds()); gfx::PointF location(target->origin());
gfx::Point location(bounds.x(), bounds.y());
ui::DropTargetEvent target_event(drop_data, location, location, ui::DropTargetEvent target_event(drop_data, location, location,
ui::DragDropTypes::DRAG_MOVE); ui::DragDropTypes::DRAG_MOVE);
controller->OnPerformDrop(source, target_event); controller->OnPerformDrop(source, target_event);
......
...@@ -1708,7 +1708,7 @@ TEST_F(TextfieldTest, DragAndDrop_AcceptDrop) { ...@@ -1708,7 +1708,7 @@ TEST_F(TextfieldTest, DragAndDrop_AcceptDrop) {
EXPECT_EQ(ui::OSExchangeData::STRING, formats); EXPECT_EQ(ui::OSExchangeData::STRING, formats);
EXPECT_TRUE(format_types.empty()); EXPECT_TRUE(format_types.empty());
EXPECT_TRUE(textfield_->CanDrop(data)); EXPECT_TRUE(textfield_->CanDrop(data));
gfx::Point drop_point(GetCursorPositionX(6), 0); gfx::PointF drop_point(GetCursorPositionX(6), 0);
ui::DropTargetEvent drop(data, drop_point, drop_point, ui::DropTargetEvent drop(data, drop_point, drop_point,
ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE); ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE);
EXPECT_EQ(ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE, EXPECT_EQ(ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE,
...@@ -1802,7 +1802,7 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheRight) { ...@@ -1802,7 +1802,7 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheRight) {
EXPECT_TRUE(format_types.empty()); EXPECT_TRUE(format_types.empty());
// Drop "ello" after "w". // Drop "ello" after "w".
const gfx::Point kDropPoint(GetCursorPositionX(7), cursor_y); const gfx::PointF kDropPoint(GetCursorPositionX(7), cursor_y);
EXPECT_TRUE(textfield_->CanDrop(data)); EXPECT_TRUE(textfield_->CanDrop(data));
ui::DropTargetEvent drop_a(data, kDropPoint, kDropPoint, operations); ui::DropTargetEvent drop_a(data, kDropPoint, kDropPoint, operations);
EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop_a)); EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop_a));
...@@ -1854,7 +1854,7 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheLeft) { ...@@ -1854,7 +1854,7 @@ TEST_F(TextfieldTest, DragAndDrop_ToTheLeft) {
// Drop " worl" after "h". // Drop " worl" after "h".
EXPECT_TRUE(textfield_->CanDrop(data)); EXPECT_TRUE(textfield_->CanDrop(data));
gfx::Point drop_point(GetCursorPositionX(1), cursor_y); gfx::PointF drop_point(GetCursorPositionX(1), cursor_y);
ui::DropTargetEvent drop_a(data, drop_point, drop_point, operations); ui::DropTargetEvent drop_a(data, drop_point, drop_point, operations);
EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop_a)); EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop_a));
EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnPerformDrop(drop_a)); EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnPerformDrop(drop_a));
...@@ -1890,7 +1890,7 @@ TEST_F(TextfieldTest, DragAndDrop_Canceled) { ...@@ -1890,7 +1890,7 @@ TEST_F(TextfieldTest, DragAndDrop_Canceled) {
textfield_->WriteDragDataForView(nullptr, point, &data); textfield_->WriteDragDataForView(nullptr, point, &data);
EXPECT_TRUE(textfield_->CanDrop(data)); EXPECT_TRUE(textfield_->CanDrop(data));
// Drag the text over somewhere valid, outside the current selection. // Drag the text over somewhere valid, outside the current selection.
gfx::Point drop_point(GetCursorPositionX(2), cursor_y); gfx::PointF drop_point(GetCursorPositionX(2), cursor_y);
ui::DropTargetEvent drop(data, drop_point, drop_point, ui::DropTargetEvent drop(data, drop_point, drop_point,
ui::DragDropTypes::DRAG_MOVE); ui::DragDropTypes::DRAG_MOVE);
EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop)); EXPECT_EQ(ui::DragDropTypes::DRAG_MOVE, textfield_->OnDragUpdated(drop));
......
...@@ -700,8 +700,8 @@ void DesktopDragDropClientAuraX11::OnXdndDrop( ...@@ -700,8 +700,8 @@ void DesktopDragDropClientAuraX11::OnXdndDrop(
xwindow_, target_current_context_->fetched_targets())); xwindow_, target_current_context_->fetched_targets()));
ui::DropTargetEvent event(data, ui::DropTargetEvent event(data,
target_window_location_, gfx::PointF(target_window_location_),
target_window_root_location_, gfx::PointF(target_window_root_location_),
target_current_context_->GetDragOperation()); target_current_context_->GetDragOperation());
if (target_current_context_->source_client()) { if (target_current_context_->source_client()) {
event.set_flags(target_current_context_->source_client() event.set_flags(target_current_context_->source_client()
...@@ -1095,8 +1095,8 @@ void DesktopDragDropClientAuraX11::DragTranslate( ...@@ -1095,8 +1095,8 @@ void DesktopDragDropClientAuraX11::DragTranslate(
event->reset(new ui::DropTargetEvent( event->reset(new ui::DropTargetEvent(
*(data->get()), *(data->get()),
location, gfx::PointF(location),
root_location, gfx::PointF(root_location),
drag_op)); drag_op));
if (target_current_context_->source_client()) { if (target_current_context_->source_client()) {
(*event)->set_flags( (*event)->set_flags(
......
...@@ -149,8 +149,8 @@ void DesktopDropTargetWin::Translate( ...@@ -149,8 +149,8 @@ void DesktopDropTargetWin::Translate(
aura::Window::ConvertPointToTarget(root_window_, target_window_, &location); aura::Window::ConvertPointToTarget(root_window_, target_window_, &location);
event->reset(new ui::DropTargetEvent( event->reset(new ui::DropTargetEvent(
*(data->get()), *(data->get()),
location, gfx::PointF(location),
root_location, gfx::PointF(root_location),
ui::DragDropTypes::DropEffectToDragOperation(effect))); ui::DragDropTypes::DropEffectToDragOperation(effect)));
(*event)->set_flags(ConvertKeyStateToAuraEventFlags(key_state)); (*event)->set_flags(ConvertKeyStateToAuraEventFlags(key_state));
if (target_window_changed) if (target_window_changed)
......
...@@ -64,8 +64,8 @@ int DropHelper::OnDrop(const OSExchangeData& data, ...@@ -64,8 +64,8 @@ int DropHelper::OnDrop(const OSExchangeData& data,
gfx::Point view_location(root_view_location); gfx::Point view_location(root_view_location);
View* root_view = drop_view->GetWidget()->GetRootView(); View* root_view = drop_view->GetWidget()->GetRootView();
View::ConvertPointToTarget(root_view, drop_view, &view_location); View::ConvertPointToTarget(root_view, drop_view, &view_location);
ui::DropTargetEvent drop_event(data, view_location, view_location, ui::DropTargetEvent drop_event(data, gfx::PointF(view_location),
drag_operation); gfx::PointF(view_location), drag_operation);
return drop_view->OnPerformDrop(drop_event); return drop_view->OnPerformDrop(drop_event);
} }
...@@ -127,9 +127,8 @@ void DropHelper::NotifyDragEntered(const OSExchangeData& data, ...@@ -127,9 +127,8 @@ void DropHelper::NotifyDragEntered(const OSExchangeData& data,
gfx::Point target_view_location(root_view_location); gfx::Point target_view_location(root_view_location);
View::ConvertPointToTarget(root_view_, target_view_, &target_view_location); View::ConvertPointToTarget(root_view_, target_view_, &target_view_location);
ui::DropTargetEvent enter_event(data, ui::DropTargetEvent enter_event(data, gfx::PointF(target_view_location),
target_view_location, gfx::PointF(target_view_location),
target_view_location,
drag_operation); drag_operation);
target_view_->OnDragEntered(enter_event); target_view_->OnDragEntered(enter_event);
} }
...@@ -142,9 +141,8 @@ int DropHelper::NotifyDragOver(const OSExchangeData& data, ...@@ -142,9 +141,8 @@ int DropHelper::NotifyDragOver(const OSExchangeData& data,
gfx::Point target_view_location(root_view_location); gfx::Point target_view_location(root_view_location);
View::ConvertPointToTarget(root_view_, target_view_, &target_view_location); View::ConvertPointToTarget(root_view_, target_view_, &target_view_location);
ui::DropTargetEvent enter_event(data, ui::DropTargetEvent enter_event(data, gfx::PointF(target_view_location),
target_view_location, gfx::PointF(target_view_location),
target_view_location,
drag_operation); drag_operation);
return target_view_->OnDragUpdated(enter_event); return target_view_->OnDragUpdated(enter_event);
} }
......
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