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

Unified Diff: chrome/browser/views/toolbar_star_toggle.cc

Issue 195099: Convert InfoBubble to using BubbleBorder. This also replaces the border grap... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months 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
« no previous file with comments | « chrome/browser/views/location_bar_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/toolbar_star_toggle.cc
===================================================================
--- chrome/browser/views/toolbar_star_toggle.cc (revision 26373)
+++ chrome/browser/views/toolbar_star_toggle.cc (working copy)
@@ -35,14 +35,25 @@
}
void ToolbarStarToggle::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
+ gfx::Rect bounds(host_->GetLocationStackBounds());
gfx::Point star_location;
views::View::ConvertPointToScreen(this, &star_location);
- // Shift the x location by 1 as visually the center of the star appears 1
- // pixel to the right. By doing this bubble arrow points to the center
- // of the star.
- gfx::Rect star_bounds(star_location.x() + 1, star_location.y(), width(),
- height());
- browser::ShowBookmarkBubbleView(host_->GetWindow(), star_bounds, this,
+ // The visual center of the star is not centered within the bounds. The star
+ // has a single central pixel; there are 13 pixels on the "inside" side of it
+ // (toward the location bar) and 16 on the "outside". This means we need to
+ // shift the bounds one pixel toward the location bar in order to place the
+ // star's outside edge at the horizontal center. However, even this isn't
+ // good enough in RTL mode, because the InfoBubble's arrow's central pixel is
+ // drawn with its left edge on the target rect center-line in both LTR and RTL
+ // modes. So in RTL mode, we need to shift the bounds one more pixel left, in
+ // order to place the star's central pixel on the right side of the bounds'
+ // center-line, so that the arrow's center will line up.
+ //
+ // TODO: If the InfoBubble used mirroring transformations maybe this could
+ // become symmetric (-1 : 1).
+ bounds.set_x(star_location.x() + (UILayoutIsRightToLeft() ? -2 : 1));
+ bounds.set_width(width());
+ browser::ShowBookmarkBubbleView(host_->GetWindow(), bounds, this,
host_->profile(), url, newly_bookmarked);
}
« no previous file with comments | « chrome/browser/views/location_bar_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698