summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/bubble_border.cc
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-19 23:09:07 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-19 23:09:07 +0000
commitf98903ef56ce35144860be0d69df5207ae9ace32 (patch)
tree7d874ef4188dcabf4138f976dfc1bd99ba1e6985 /chrome/browser/views/bubble_border.cc
parent1b882f5c0f0c50d9eefc9cb421a1157e6e1e45d4 (diff)
downloadchromium_src-f98903ef56ce35144860be0d69df5207ae9ace32.zip
chromium_src-f98903ef56ce35144860be0d69df5207ae9ace32.tar.gz
chromium_src-f98903ef56ce35144860be0d69df5207ae9ace32.tar.bz2
Subclassing the InfoBubble to handle anchoring bubbles basedon their content, not what they point to, like the one we wantto show for the extension apps.
BUG=41270 TEST=Run Chrome with --enable-extension-apps --app-launcher-new-tab and press the NewTab button. A panel should open that has a mini omnibox which should be situated right on top of the underlying omnibox. Review URL: http://codereview.chromium.org/1572045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44979 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/bubble_border.cc')
-rw-r--r--chrome/browser/views/bubble_border.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/chrome/browser/views/bubble_border.cc b/chrome/browser/views/bubble_border.cc
index d7bd07f..3548286 100644
--- a/chrome/browser/views/bubble_border.cc
+++ b/chrome/browser/views/bubble_border.cc
@@ -44,12 +44,14 @@ gfx::Rect BubbleBorder::GetBounds(const gfx::Rect& position_relative_to,
// of padding.
const int kArrowOverlap = 3;
int x = position_relative_to.x() + (position_relative_to.width() / 2);
+ int arrow_offset = override_arrow_x_offset_ ? override_arrow_x_offset_ :
+ arrow_x_offset_;
if (arrow_is_left())
- x -= arrow_x_offset_;
+ x -= arrow_offset;
else if (arrow_location_ == NONE)
x -= ((contents_size.width() / 2) + insets.left());
else
- x += (arrow_x_offset_ - border_size.width() + 1);
+ x += (arrow_offset - border_size.width() + 1);
int y = position_relative_to.y();
if (arrow_is_bottom())
y += (kArrowOverlap - border_size.height());
@@ -103,7 +105,7 @@ void BubbleBorder::InitClass() {
}
void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const {
- // Convenience shorthand variables
+ // Convenience shorthand variables.
int width = view.width();
int tl_width = top_left_->width();
int tl_height = top_left_->height();
@@ -223,9 +225,11 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const {
border_y = SkIntToScalar(top);
tip_y = SkIntToScalar(top - kArrowInteriorHeight);
}
+ int arrow_offset = override_arrow_x_offset_ ? override_arrow_x_offset_ :
+ arrow_x_offset_;
int arrow_width = arrow->width();
int arrow_center = arrow_is_left() ?
- arrow_x_offset_ : width - arrow_x_offset_ - 1;
+ arrow_offset : width - arrow_offset - 1;
int arrow_x = arrow_center - (arrow_width / 2);
SkScalar arrow_interior_x =
SkIntToScalar(arrow_center - kArrowInteriorHeight);