diff options
-rw-r--r-- | chrome/browser/ui/touch/tabs/touch_tab_strip.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/browser_actions_container.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/base_tab_strip.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/side_tab_strip.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/tab_strip.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/tabs/tab_strip.h | 2 | ||||
-rw-r--r-- | views/accessibility/view_accessibility.cc | 2 | ||||
-rw-r--r-- | views/controls/menu/menu_controller.cc | 9 | ||||
-rw-r--r-- | views/view.cc | 11 | ||||
-rw-r--r-- | views/view.h | 10 | ||||
-rw-r--r-- | views/view_unittest.cc | 10 | ||||
-rw-r--r-- | views/widget/drop_helper.cc | 2 | ||||
-rw-r--r-- | views/widget/root_view.cc | 8 | ||||
-rw-r--r-- | views/widget/tooltip_manager_gtk.cc | 2 | ||||
-rw-r--r-- | views/widget/tooltip_manager_win.cc | 5 | ||||
-rw-r--r-- | views/window/non_client_view.cc | 6 | ||||
-rw-r--r-- | views/window/non_client_view.h | 2 |
19 files changed, 39 insertions, 50 deletions
diff --git a/chrome/browser/ui/touch/tabs/touch_tab_strip.cc b/chrome/browser/ui/touch/tabs/touch_tab_strip.cc index ce6efad..a907f22 100644 --- a/chrome/browser/ui/touch/tabs/touch_tab_strip.cc +++ b/chrome/browser/ui/touch/tabs/touch_tab_strip.cc @@ -41,7 +41,7 @@ void TouchTabStrip::SetBackgroundOffset(const gfx::Point& offset) { } bool TouchTabStrip::IsPositionInWindowCaption(const gfx::Point& point) { - views::View* v = GetViewForPoint(point); + views::View* v = GetEventHandlerForPoint(point); // If there is no control at this location, claim the hit was in the title // bar to get a move action. diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc index a80d48a..3b0230f 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -493,14 +493,14 @@ bool AutocompletePopupContentsView::OnMouseDragged( return true; } -views::View* AutocompletePopupContentsView::GetViewForPoint( +views::View* AutocompletePopupContentsView::GetEventHandlerForPoint( const gfx::Point& point) { // If there is no opt in view, then we want all mouse events. Otherwise let // any descendants of the opt-in view get mouse events. if (!opt_in_view_) return this; - views::View* child = views::View::GetViewForPoint(point); + views::View* child = views::View::GetEventHandlerForPoint(point); views::View* ancestor = child; while (ancestor && ancestor != opt_in_view_) ancestor = ancestor->parent(); diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h index c1e81a7..e29779a 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h @@ -83,7 +83,7 @@ class AutocompletePopupContentsView : public views::View, virtual bool OnMousePressed(const views::MouseEvent& event); virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); virtual bool OnMouseDragged(const views::MouseEvent& event); - virtual views::View* GetViewForPoint(const gfx::Point& point); + virtual views::View* GetEventHandlerForPoint(const gfx::Point& point); protected: virtual void PaintResultViews(gfx::CanvasSkia* canvas); diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 8a94fd4..be0ce6f 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -634,7 +634,7 @@ void BrowserActionsContainer::OnDragEntered( int BrowserActionsContainer::OnDragUpdated( const views::DropTargetEvent& event) { // First check if we are above the chevron (overflow) menu. - if (GetViewForPoint(event.location()) == chevron_) { + if (GetEventHandlerForPoint(event.location()) == chevron_) { if (show_menu_task_factory_.empty() && !overflow_menu_) StartShowFolderDropMenuTimer(); return ui::DragDropTypes::DRAG_MOVE; diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc index 1afbc1b..2e41285 100644 --- a/chrome/browser/ui/views/tabs/base_tab_strip.cc +++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc @@ -327,7 +327,7 @@ BaseTab* BaseTabStrip::GetTabAt(BaseTab* tab, const gfx::Point& tab_in_tab_coordinates) { gfx::Point local_point = tab_in_tab_coordinates; ConvertPointToView(tab, this, &local_point); - views::View* view = GetViewForPoint(local_point); + views::View* view = GetEventHandlerForPoint(local_point); if (!view) return NULL; // No tab contains the point. diff --git a/chrome/browser/ui/views/tabs/side_tab_strip.cc b/chrome/browser/ui/views/tabs/side_tab_strip.cc index fcc1dcd..4e54f30 100644 --- a/chrome/browser/ui/views/tabs/side_tab_strip.cc +++ b/chrome/browser/ui/views/tabs/side_tab_strip.cc @@ -93,7 +93,7 @@ void SideTabStrip::SetBackgroundOffset(const gfx::Point& offset) { } bool SideTabStrip::IsPositionInWindowCaption(const gfx::Point& point) { - return GetViewForPoint(point) == this; + return GetEventHandlerForPoint(point) == this; } void SideTabStrip::StartHighlight(int model_index) { diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index ae47e5b..7541747 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -170,7 +170,7 @@ void TabStrip::SetBackgroundOffset(const gfx::Point& offset) { } bool TabStrip::IsPositionInWindowCaption(const gfx::Point& point) { - views::View* v = GetViewForPoint(point); + views::View* v = GetEventHandlerForPoint(point); // If there is no control at this location, claim the hit was in the title // bar to get a move action. @@ -367,10 +367,10 @@ AccessibilityTypes::Role TabStrip::GetAccessibleRole() { return AccessibilityTypes::ROLE_PAGETABLIST; } -views::View* TabStrip::GetViewForPoint(const gfx::Point& point) { +views::View* TabStrip::GetEventHandlerForPoint(const gfx::Point& point) { // Return any view that isn't a Tab or this TabStrip immediately. We don't // want to interfere. - views::View* v = View::GetViewForPoint(point); + views::View* v = View::GetEventHandlerForPoint(point); if (v && v != this && v->GetClassName() != Tab::kViewClassName) return v; diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h index 82f3f35..7f0a339 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h @@ -77,7 +77,7 @@ class TabStrip : public BaseTabStrip, virtual void OnDragExited(); virtual int OnPerformDrop(const views::DropTargetEvent& event); virtual AccessibilityTypes::Role GetAccessibleRole(); - virtual views::View* GetViewForPoint(const gfx::Point& point); + virtual views::View* GetEventHandlerForPoint(const gfx::Point& point); virtual void OnThemeChanged(); protected: diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc index 89d886e..ae9f889 100644 --- a/views/accessibility/view_accessibility.cc +++ b/views/accessibility/view_accessibility.cc @@ -71,7 +71,7 @@ STDMETHODIMP ViewAccessibility::accHitTest( return S_FALSE; } - views::View* view = view_->GetViewForPoint(point); + views::View* view = view_->GetEventHandlerForPoint(point); if (view == view_) { // No child hit, return parent id. child->vt = VT_I4; diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index d4b0382..3fca407 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -1093,7 +1093,7 @@ void MenuController::CloseAllNestedMenus() { MenuItemView* MenuController::GetMenuItemAt(View* source, int x, int y) { // Walk the view hierarchy until we find a menu item (or the root). - View* child_under_mouse = source->GetViewForPoint(gfx::Point(x, y)); + View* child_under_mouse = source->GetEventHandlerForPoint(gfx::Point(x, y)); while (child_under_mouse && child_under_mouse->GetID() != MenuItemView::kMenuItemViewID) { child_under_mouse = child_under_mouse->parent(); @@ -1106,7 +1106,7 @@ MenuItemView* MenuController::GetMenuItemAt(View* source, int x, int y) { } MenuItemView* MenuController::GetEmptyMenuItemAt(View* source, int x, int y) { - View* child_under_mouse = source->GetViewForPoint(gfx::Point(x, y)); + View* child_under_mouse = source->GetEventHandlerForPoint(gfx::Point(x, y)); if (child_under_mouse && child_under_mouse->GetID() == MenuItemView::kEmptyMenuItemViewID) { return static_cast<MenuItemView*>(child_under_mouse); @@ -1119,7 +1119,8 @@ bool MenuController::IsScrollButtonAt(SubmenuView* source, int y, MenuPart::Type* part) { MenuScrollViewContainer* scroll_view = source->GetScrollViewContainer(); - View* child_under_mouse = scroll_view->GetViewForPoint(gfx::Point(x, y)); + View* child_under_mouse = + scroll_view->GetEventHandlerForPoint(gfx::Point(x, y)); if (child_under_mouse && child_under_mouse->IsEnabled()) { if (child_under_mouse == scroll_view->scroll_up_button()) { *part = MenuPart::SCROLL_UP; @@ -1772,7 +1773,7 @@ void MenuController::UpdateActiveMouseView(SubmenuView* event_source, View::ConvertPointToScreen(event_source->GetScrollViewContainer(), &target_menu_loc); View::ConvertPointToView(NULL, target_menu, &target_menu_loc); - target = target_menu->GetViewForPoint(target_menu_loc); + target = target_menu->GetEventHandlerForPoint(target_menu_loc); if (target == target_menu || !target->IsEnabled()) target = NULL; } diff --git a/views/view.cc b/views/view.cc index b36a3a4..fcd2a62f 100644 --- a/views/view.cc +++ b/views/view.cc @@ -734,12 +734,7 @@ ThemeProvider* View::GetThemeProvider() const { // Input ----------------------------------------------------------------------- -View* View::GetViewForPoint(const gfx::Point& point) { - return GetEventHandlerForPoint(point, NULL); -} - -View* View::GetEventHandlerForPoint(const gfx::Point& point, - gfx::Point* xpoint) { +View* View::GetEventHandlerForPoint(const gfx::Point& point) { // Walk the child Views recursively looking for the View that most // tightly encloses the specified point. for (int i = child_count() - 1; i >= 0; --i) { @@ -750,10 +745,8 @@ View* View::GetEventHandlerForPoint(const gfx::Point& point, gfx::Point point_in_child_coords(point); View::ConvertPointToView(this, child, &point_in_child_coords); if (child->HitTest(point_in_child_coords)) - return child->GetEventHandlerForPoint(point_in_child_coords, xpoint); + return child->GetEventHandlerForPoint(point_in_child_coords); } - if (xpoint) - xpoint->SetPoint(point.x(), point.y()); return this; } diff --git a/views/view.h b/views/view.h index dccc425..83af008 100644 --- a/views/view.h +++ b/views/view.h @@ -564,14 +564,8 @@ class View : public AcceleratorTarget { // The points (and mouse locations) in the following functions are in the // view's coordinates, except for a RootView. - // TODO(sad): Remove - // Returns the deepest descendant that contains the specified point. - virtual View* GetViewForPoint(const gfx::Point& point); - - // Returns the deepest descendant that contains the specified point, and the - // point in the returned view's coordinates. - virtual View* GetEventHandlerForPoint(const gfx::Point& point, - gfx::Point* xpoint); + // Returns the deepest visible descendant that contains the specified point. + virtual View* GetEventHandlerForPoint(const gfx::Point& point); // Return the cursor that should be used for this view or NULL if // the default cursor should be used. The provided point is in the diff --git a/views/view_unittest.cc b/views/view_unittest.cc index 2430cb1..8207c76b 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -792,11 +792,11 @@ TEST_F(ViewTest, HitTestMasks) { EXPECT_TRUE(v1->HitTest(ConvertPointToView(v1, v1_origin))); EXPECT_FALSE(v2->HitTest(ConvertPointToView(v2, v2_origin))); - // Test GetViewForPoint - EXPECT_EQ(v1, root_view->GetViewForPoint(v1_centerpoint)); - EXPECT_EQ(v2, root_view->GetViewForPoint(v2_centerpoint)); - EXPECT_EQ(v1, root_view->GetViewForPoint(v1_origin)); - EXPECT_EQ(root_view, root_view->GetViewForPoint(v2_origin)); + // Test GetEventHandlerForPoint + EXPECT_EQ(v1, root_view->GetEventHandlerForPoint(v1_centerpoint)); + EXPECT_EQ(v2, root_view->GetEventHandlerForPoint(v2_centerpoint)); + EXPECT_EQ(v1, root_view->GetEventHandlerForPoint(v1_origin)); + EXPECT_EQ(root_view, root_view->GetEventHandlerForPoint(v2_origin)); } TEST_F(ViewTest, Textfield) { diff --git a/views/widget/drop_helper.cc b/views/widget/drop_helper.cc index 29cca1c..4090a6b 100644 --- a/views/widget/drop_helper.cc +++ b/views/widget/drop_helper.cc @@ -80,7 +80,7 @@ View* DropHelper::CalculateTargetViewImpl( const OSExchangeData& data, bool check_can_drop, View** deepest_view) { - View* view = root_view_->GetViewForPoint(root_view_location); + View* view = root_view_->GetEventHandlerForPoint(root_view_location); if (view == deepest_view_) { // The view the mouse is over hasn't changed; reuse the target. return target_view_; diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc index 8d9b06b..9d4bbc3 100644 --- a/views/widget/root_view.cc +++ b/views/widget/root_view.cc @@ -201,7 +201,7 @@ bool RootView::OnMousePressed(const MouseEvent& event) { bool hit_disabled_view = false; // Walk up the tree until we find a view that wants the mouse event. - for (mouse_pressed_handler_ = GetViewForPoint(e.location()); + for (mouse_pressed_handler_ = GetEventHandlerForPoint(e.location()); mouse_pressed_handler_ && (mouse_pressed_handler_ != this); mouse_pressed_handler_ = mouse_pressed_handler_->parent()) { if (!mouse_pressed_handler_->IsEnabled()) { @@ -291,7 +291,7 @@ void RootView::OnMouseReleased(const MouseEvent& event, bool canceled) { void RootView::OnMouseMoved(const MouseEvent& event) { MouseEvent e(event, this); - View* v = GetViewForPoint(e.location()); + View* v = GetEventHandlerForPoint(e.location()); // Find the first enabled view, or the existing move handler, whichever comes // first. The check for the existing handler is because if a view becomes // disabled while handling moves, it's wrong to suddenly send ET_MOUSE_EXITED @@ -365,7 +365,7 @@ View::TouchStatus RootView::OnTouchEvent(const TouchEvent& event) { } // Walk up the tree until we find a view that wants the touch event. - for (touch_pressed_handler_ = GetViewForPoint(e.location()); + for (touch_pressed_handler_ = GetEventHandlerForPoint(e.location()); touch_pressed_handler_ && (touch_pressed_handler_ != this); touch_pressed_handler_ = touch_pressed_handler_->parent()) { if (!touch_pressed_handler_->IsEnabled()) { @@ -477,7 +477,7 @@ bool RootView::ConvertPointToMouseHandler(const gfx::Point& l, void RootView::UpdateCursor(const MouseEvent& e) { gfx::NativeCursor cursor = NULL; - View* v = GetViewForPoint(e.location()); + View* v = GetEventHandlerForPoint(e.location()); if (v && v != this) { gfx::Point l(e.location()); View::ConvertPointToView(this, v, &l); diff --git a/views/widget/tooltip_manager_gtk.cc b/views/widget/tooltip_manager_gtk.cc index 9ff4436..dfc0e39 100644 --- a/views/widget/tooltip_manager_gtk.cc +++ b/views/widget/tooltip_manager_gtk.cc @@ -86,7 +86,7 @@ bool TooltipManagerGtk::ShowTooltip(int x, int y, bool for_keyboard, view_loc.SetPoint(view->width() / 2, view->height() / 2); } else if (!for_keyboard) { RootView* root_view = widget_->GetRootView(); - view = root_view->GetViewForPoint(gfx::Point(x, y)); + view = root_view->GetEventHandlerForPoint(gfx::Point(x, y)); view_loc.SetPoint(x, y); View::ConvertPointFromWidget(view, &view_loc); } else { diff --git a/views/widget/tooltip_manager_win.cc b/views/widget/tooltip_manager_win.cc index 95a87b1..2d89a4a 100644 --- a/views/widget/tooltip_manager_win.cc +++ b/views/widget/tooltip_manager_win.cc @@ -146,7 +146,8 @@ LRESULT TooltipManagerWin::OnNotify(int w_param, if (last_view_out_of_sync_) { // View under the mouse is out of sync, determine it now. RootView* root_view = widget_->GetRootView(); - last_tooltip_view_ = root_view->GetViewForPoint(last_mouse_pos_); + last_tooltip_view_ = + root_view->GetEventHandlerForPoint(last_mouse_pos_); last_view_out_of_sync_ = false; } // Tooltip control is asking for the tooltip to display. @@ -268,7 +269,7 @@ int TooltipManagerWin::CalcTooltipHeight() { void TooltipManagerWin::UpdateTooltip(const gfx::Point& mouse_pos) { RootView* root_view = widget_->GetRootView(); - View* view = root_view->GetViewForPoint(mouse_pos); + View* view = root_view->GetEventHandlerForPoint(mouse_pos); if (view != last_tooltip_view_) { // NOTE: This *must* be sent regardless of the visibility of the tooltip. // It triggers Windows to ask for the tooltip again. diff --git a/views/window/non_client_view.cc b/views/window/non_client_view.cc index a3412ce..210bd10 100644 --- a/views/window/non_client_view.cc +++ b/views/window/non_client_view.cc @@ -158,7 +158,7 @@ void NonClientView::ViewHierarchyChanged(bool is_add, View* parent, } } -views::View* NonClientView::GetViewForPoint(const gfx::Point& point) { +views::View* NonClientView::GetEventHandlerForPoint(const gfx::Point& point) { // Because of the z-ordering of our child views (the client view is positioned // over the non-client frame view, if the client view ever overlaps the frame // view visually (as it does for the browser window), then it will eat mouse @@ -169,9 +169,9 @@ views::View* NonClientView::GetViewForPoint(const gfx::Point& point) { gfx::Point point_in_child_coords(point); View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); if (frame_view_->HitTest(point_in_child_coords)) - return frame_view_->GetViewForPoint(point_in_child_coords); + return frame_view_->GetEventHandlerForPoint(point_in_child_coords); - return View::GetViewForPoint(point); + return View::GetEventHandlerForPoint(point); } AccessibilityTypes::Role NonClientView::GetAccessibleRole() { diff --git a/views/window/non_client_view.h b/views/window/non_client_view.h index 3a4ea28..db1daff 100644 --- a/views/window/non_client_view.h +++ b/views/window/non_client_view.h @@ -214,7 +214,7 @@ class NonClientView : public View { protected: // NonClientView, View overrides: virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); - virtual views::View* GetViewForPoint(const gfx::Point& point); + virtual views::View* GetEventHandlerForPoint(const gfx::Point& point); private: // The frame that hosts this NonClientView. |