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

Unified Diff: chrome/browser/ui/views/toolbar/app_menu_button.cc

Issue 1411833006: Refactoring to make adding ink drop animations easier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor ink drop animations (nits in ui/views/ Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/toolbar/app_menu_button.cc
diff --git a/chrome/browser/ui/views/toolbar/app_menu_button.cc b/chrome/browser/ui/views/toolbar/app_menu_button.cc
index bca918dde15b0032e60a10732195ac498688d31c..6a1e4882c198b6471421f539d58a03aa209f853b 100644
--- a/chrome/browser/ui/views/toolbar/app_menu_button.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu_button.cc
@@ -211,6 +211,17 @@ void AppMenuButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
SetPaintToLayer(false);
}
+gfx::Point AppMenuButton::CalculateInkDropCenter() const {
+ // ToolbarView extends the bounds of the app button to the right in maximized
+ // mode. So instead of using the center point of local bounds, we use the
+ // center point (adjusted for RTL layouts) of the preferred size, which
+ // doesn't change in maximized mode.
+ const int visible_width = GetPreferredSize().width();
+ return gfx::Point(
+ (GetMirroredXWithWidthInView(0, visible_width) + visible_width) / 2,
+ height() / 2);
+}
+
const char* AppMenuButton::GetClassName() const {
return "AppMenuButton";
}
@@ -259,15 +270,7 @@ bool AppMenuButton::CanDrop(const ui::OSExchangeData& data) {
void AppMenuButton::Layout() {
MenuButton::Layout();
-
- // ToolbarView extends the bounds of the app button to the right in maximized
- // mode. So instead of using the center point of local bounds, we use the
- // center point (adjusted for RTL layouts) of preferred size which doesn't
- // change in maximized mode.
- const int visible_width = GetPreferredSize().width();
- ink_drop_animation_controller_->SetInkDropCenter(gfx::Point(
- (GetMirroredXWithWidthInView(0, visible_width) + visible_width) / 2,
- height() / 2));
+ ink_drop_animation_controller_->SetInkDropCenter(CalculateInkDropCenter());
}
void AppMenuButton::OnDragEntered(const ui::DropTargetEvent& event) {
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu_button.h ('k') | chrome/browser/ui/views/toolbar/toolbar_action_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698