diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 20:10:16 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 20:10:16 +0000 |
commit | 7e7c82a55f155887f30816d30d54ce5e8d8f38c4 (patch) | |
tree | 0d4e6bad63be82a95570f068c4e425ce087841dd /views/view.cc | |
parent | 4110e83d3fa76393b865b078948a724f831f816b (diff) | |
download | chromium_src-7e7c82a55f155887f30816d30d54ce5e8d8f38c4.zip chromium_src-7e7c82a55f155887f30816d30d54ce5e8d8f38c4.tar.gz chromium_src-7e7c82a55f155887f30816d30d54ce5e8d8f38c4.tar.bz2 |
Attempt 2 at:
Changes the tab close button to a dot, unless you're near the button
or the tab is selected.
The only difference between this and the first is that I missed a
remove from the set if the view was deleted, which resulted in a
crash. I've added an interactive test case that covers this.
BUG=45743
TEST=none
Review URL: http://codereview.chromium.org/2863003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/view.cc')
-rw-r--r-- | views/view.cc | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/views/view.cc b/views/view.cc index 012240a..988e76b 100644 --- a/views/view.cc +++ b/views/view.cc @@ -132,6 +132,21 @@ void View::SetBounds(const gfx::Rect& bounds) { } } +void View::RegisterForMouseNearEvents(const gfx::Insets& insets) { + RootView* root = GetRootView(); + if (insets.empty()) { + near_insets_.reset(NULL); + if (root) + root->UnregisterViewForNearNotification(this); + } else { + near_insets_.reset( + new gfx::Insets(insets.top(), insets.left(), insets.bottom(), + insets.right())); + if (root) + root->RegisterViewForNearNotification(this); + } +} + gfx::Rect View::GetLocalBounds(bool include_border) const { if (include_border || !border_.get()) return gfx::Rect(0, 0, width(), height()); @@ -537,7 +552,7 @@ void View::AddChildView(int index, View* v) { UpdateTooltip(); RootView* root = GetRootView(); if (root) - RegisterChildrenForVisibleBoundsNotification(root, v); + RegisterChildrenForRootNotifications(root, v); if (layout_manager_.get()) layout_manager_->ViewAdded(this, v); @@ -609,7 +624,7 @@ void View::DoRemoveChildView(View* a_view, RootView* root = GetRootView(); if (root) - UnregisterChildrenForVisibleBoundsNotification(root, a_view); + UnregisterChildrenForRootNotifications(root, a_view); a_view->PropagateRemoveNotifications(this); a_view->SetParent(NULL); @@ -1440,24 +1455,26 @@ ThemeProvider* View::GetThemeProvider() const { } // static -void View::RegisterChildrenForVisibleBoundsNotification( - RootView* root, View* view) { +void View::RegisterChildrenForRootNotifications(RootView* root, View* view) { DCHECK(root && view); if (view->GetNotifyWhenVisibleBoundsInRootChanges()) root->RegisterViewForVisibleBoundsNotification(view); + if (view->near_insets_.get()) + root->RegisterViewForNearNotification(view); for (int i = 0; i < view->GetChildViewCount(); ++i) - RegisterChildrenForVisibleBoundsNotification(root, view->GetChildViewAt(i)); + RegisterChildrenForRootNotifications(root, view->GetChildViewAt(i)); } // static -void View::UnregisterChildrenForVisibleBoundsNotification( +void View::UnregisterChildrenForRootNotifications( RootView* root, View* view) { DCHECK(root && view); if (view->GetNotifyWhenVisibleBoundsInRootChanges()) root->UnregisterViewForVisibleBoundsNotification(view); + if (view->near_insets_.get()) + root->UnregisterViewForNearNotification(view); for (int i = 0; i < view->GetChildViewCount(); ++i) - UnregisterChildrenForVisibleBoundsNotification(root, - view->GetChildViewAt(i)); + UnregisterChildrenForRootNotifications(root, view->GetChildViewAt(i)); } void View::AddDescendantToNotify(View* view) { |