Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "ui/views/bubble/bubble_delegate.h" | 5 #include "ui/views/bubble/bubble_delegate.h" |
| 6 | 6 |
| 7 #include "ui/base/accessibility/accessible_view_state.h" | 7 #include "ui/base/accessibility/accessible_view_state.h" |
| 8 #include "ui/gfx/animation/slide_animation.h" | 8 #include "ui/gfx/animation/slide_animation.h" |
| 9 #include "ui/gfx/color_utils.h" | 9 #include "ui/gfx/color_utils.h" |
| 10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 | 169 |
| 170 void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget, | 170 void BubbleDelegateView::OnWidgetActivationChanged(Widget* widget, |
| 171 bool active) { | 171 bool active) { |
| 172 if (close_on_deactivate() && widget == GetWidget() && !active) | 172 if (close_on_deactivate() && widget == GetWidget() && !active) |
| 173 GetWidget()->Close(); | 173 GetWidget()->Close(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, | 176 void BubbleDelegateView::OnWidgetBoundsChanged(Widget* widget, |
| 177 const gfx::Rect& new_bounds) { | 177 const gfx::Rect& new_bounds) { |
| 178 if (anchor_widget() == widget) { | 178 if (anchor_widget() == widget) { |
| 179 if (move_with_anchor()) | 179 if (move_with_anchor()) { |
| 180 SizeToContents(); | 180 SizeToContents(); |
| 181 else | 181 } else { |
| 182 GetWidget()->Close(); | 182 // Do not close if the widget gets shrinked vertically without move. |
|
msw
2014/02/13 00:32:48
This seems odd, and I don't think this is the righ
oshima
2014/02/13 01:28:29
You're right that anchor position may change even
msw
2014/02/13 01:38:07
I don't see a reason offhand why the bookmark bubb
| |
| 183 gfx::Rect bounds = widget->GetWindowBoundsInScreen(); | |
| 184 if (bounds.origin() != new_bounds.origin() || | |
| 185 bounds.width() != new_bounds.width()) { | |
| 186 GetWidget()->Close(); | |
| 187 } | |
| 188 } | |
| 183 } | 189 } |
| 184 } | 190 } |
| 185 | 191 |
| 186 View* BubbleDelegateView::GetAnchorView() const { | 192 View* BubbleDelegateView::GetAnchorView() const { |
| 187 return ViewStorage::GetInstance()->RetrieveView(anchor_view_storage_id_); | 193 return ViewStorage::GetInstance()->RetrieveView(anchor_view_storage_id_); |
| 188 } | 194 } |
| 189 | 195 |
| 190 gfx::Rect BubbleDelegateView::GetAnchorRect() { | 196 gfx::Rect BubbleDelegateView::GetAnchorRect() { |
| 191 if (!GetAnchorView()) | 197 if (!GetAnchorView()) |
| 192 return anchor_rect_; | 198 return anchor_rect_; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 } | 348 } |
| 343 | 349 |
| 344 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { | 350 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { |
| 345 if (widget == GetWidget() && visible && anchor_widget() && | 351 if (widget == GetWidget() && visible && anchor_widget() && |
| 346 anchor_widget()->GetTopLevelWidget()) { | 352 anchor_widget()->GetTopLevelWidget()) { |
| 347 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); | 353 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); |
| 348 } | 354 } |
| 349 } | 355 } |
| 350 | 356 |
| 351 } // namespace views | 357 } // namespace views |
| OLD | NEW |