summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Wells <benwells@chromium.org>2015-08-06 14:23:26 +1000
committerBen Wells <benwells@chromium.org>2015-08-06 04:24:51 +0000
commit3e0f7f551a91b2e1af0714858f52cf5d86f026f5 (patch)
tree06eb596cc5592968aa8cacf6b43d6e43b361254c
parentacdf54994aff0f5f994d7f7113e9572d10e93d46 (diff)
downloadchromium_src-3e0f7f551a91b2e1af0714858f52cf5d86f026f5.zip
chromium_src-3e0f7f551a91b2e1af0714858f52cf5d86f026f5.tar.gz
chromium_src-3e0f7f551a91b2e1af0714858f52cf5d86f026f5.tar.bz2
Remove gap in ChromeOS hosted app frames which are showing the location.
For security reasons, hosted apps which have navigated away from their starting origin show the origin. On ChromeOS this caused a bug where a 2 pixel transparent gap was created between the frame and the location bar. This was because the for this type of frame, the toolbar was positioned to be calculated using the HeaderHeightForPainting. However the HeaderHeightForPainting was adjusted prior to the toolbar being positioned to account for the toolbar not painting the top two rows of pixels. The fix is to position the toolbar relative to the base height of the frame. TBR=sky@chromium.org BUG=508043 Review URL: https://codereview.chromium.org/1240733003 Cr-Commit-Position: refs/heads/master@{#339581} (cherry picked from commit cb03d6cb0f306228a7b7e3e4dfc1188d49b16556) Review URL: https://codereview.chromium.org/1272173003 . Cr-Commit-Position: refs/branch-heads/2454@{#243} Cr-Branched-From: 12bfc3360892ec53cd00fc239a47e5298beb063b-refs/heads/master@{#338390}
-rw-r--r--ash/frame/default_header_painter.cc17
-rw-r--r--ash/frame/default_header_painter.h5
-rw-r--r--ash/frame/header_painter.h8
-rw-r--r--chrome/browser/ui/views/frame/browser_header_painter_ash.cc4
-rw-r--r--chrome/browser/ui/views/frame/browser_header_painter_ash.h1
-rw-r--r--chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc2
6 files changed, 25 insertions, 12 deletions
diff --git a/ash/frame/default_header_painter.cc b/ash/frame/default_header_painter.cc
index 72d720e..a80a3c6 100644
--- a/ash/frame/default_header_painter.cc
+++ b/ash/frame/default_header_painter.cc
@@ -82,11 +82,10 @@ DefaultHeaderPainter::DefaultHeaderPainter()
active_frame_color_(kDefaultFrameColor),
inactive_frame_color_(kDefaultFrameColor),
caption_button_container_(NULL),
- height_(0),
+ painted_height_(0),
mode_(MODE_INACTIVE),
initial_paint_(true),
- activation_animation_(new gfx::SlideAnimation(this)) {
-}
+ activation_animation_(new gfx::SlideAnimation(this)) {}
DefaultHeaderPainter::~DefaultHeaderPainter() {
}
@@ -172,12 +171,16 @@ void DefaultHeaderPainter::LayoutHeader() {
SetHeaderHeightForPainting(caption_button_container_->height());
}
+int DefaultHeaderPainter::GetHeaderHeight() const {
+ return caption_button_container_->height();
+}
+
int DefaultHeaderPainter::GetHeaderHeightForPainting() const {
- return height_;
+ return painted_height_;
}
void DefaultHeaderPainter::SetHeaderHeightForPainting(int height) {
- height_ = height;
+ painted_height_ = height;
}
void DefaultHeaderPainter::SchedulePaintForTitle() {
@@ -269,7 +272,7 @@ void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) {
paint.setStrokeWidth(0);
float thickness = 1 / canvas->image_scale();
- SkScalar y = SkIntToScalar(height_) - SkFloatToScalar(thickness);
+ SkScalar y = SkIntToScalar(painted_height_) - SkFloatToScalar(thickness);
canvas->sk_canvas()->drawLine(0, y, SkIntToScalar(view_->width()), y, paint);
}
@@ -342,7 +345,7 @@ void DefaultHeaderPainter::UpdateSizeButtonImages(bool use_light_images) {
}
gfx::Rect DefaultHeaderPainter::GetLocalBounds() const {
- return gfx::Rect(view_->width(), height_);
+ return gfx::Rect(view_->width(), painted_height_);
}
gfx::Rect DefaultHeaderPainter::GetTitleBounds() const {
diff --git a/ash/frame/default_header_painter.h b/ash/frame/default_header_painter.h
index 662d4c1..a79f3d5 100644
--- a/ash/frame/default_header_painter.h
+++ b/ash/frame/default_header_painter.h
@@ -43,6 +43,7 @@ class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
int GetMinimumHeaderWidth() const override;
void PaintHeader(gfx::Canvas* canvas, Mode mode) override;
void LayoutHeader() override;
+ int GetHeaderHeight() const override;
int GetHeaderHeightForPainting() const override;
void SetHeaderHeightForPainting(int height) override;
void SchedulePaintForTitle() override;
@@ -104,8 +105,8 @@ class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
SkColor inactive_frame_color_;
FrameCaptionButtonContainerView* caption_button_container_;
- // The height of the header including the header/content separator.
- int height_;
+ // The height of the header to paint.
+ int painted_height_;
// Whether the header should be painted as active.
Mode mode_;
diff --git a/ash/frame/header_painter.h b/ash/frame/header_painter.h
index 0eb67ab..47ba306 100644
--- a/ash/frame/header_painter.h
+++ b/ash/frame/header_painter.h
@@ -33,8 +33,12 @@ class ASH_EXPORT HeaderPainter {
// Performs layout for the header.
virtual void LayoutHeader() = 0;
- // Gets / sets how much of the header is painted. This allows the tabstrip to
- // affect the header height. This height does not affect LayoutHeader().
+ // Get the height of the header.
+ virtual int GetHeaderHeight() const = 0;
+
+ // Gets / sets how much of the header is painted. This allows the header to
+ // paint under things (like the tabstrip) which have transparent /
+ // non-painting sections. This height does not affect LayoutHeader().
virtual int GetHeaderHeightForPainting() const = 0;
virtual void SetHeaderHeightForPainting(int height_for_painting) = 0;
diff --git a/chrome/browser/ui/views/frame/browser_header_painter_ash.cc b/chrome/browser/ui/views/frame/browser_header_painter_ash.cc
index 33d6aaf..7cbe56c 100644
--- a/chrome/browser/ui/views/frame/browser_header_painter_ash.cc
+++ b/chrome/browser/ui/views/frame/browser_header_painter_ash.cc
@@ -256,6 +256,10 @@ void BrowserHeaderPainterAsh::LayoutHeader() {
}
}
+int BrowserHeaderPainterAsh::GetHeaderHeight() const {
+ return caption_button_container_->height();
+}
+
int BrowserHeaderPainterAsh::GetHeaderHeightForPainting() const {
return painted_height_;
}
diff --git a/chrome/browser/ui/views/frame/browser_header_painter_ash.h b/chrome/browser/ui/views/frame/browser_header_painter_ash.h
index ec172ca..3f4e7a9 100644
--- a/chrome/browser/ui/views/frame/browser_header_painter_ash.h
+++ b/chrome/browser/ui/views/frame/browser_header_painter_ash.h
@@ -46,6 +46,7 @@ class BrowserHeaderPainterAsh : public ash::HeaderPainter,
int GetMinimumHeaderWidth() const override;
void PaintHeader(gfx::Canvas* canvas, Mode mode) override;
void LayoutHeader() override;
+ int GetHeaderHeight() const override;
int GetHeaderHeightForPainting() const override;
void SetHeaderHeightForPainting(int height) override;
void SchedulePaintForTitle() override;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
index f341dfc..ce87661 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -188,7 +188,7 @@ int BrowserNonClientFrameViewAsh::GetTopInset() const {
}
if (UsePackagedAppHeaderStyle() || UseWebAppHeaderStyle())
- return header_painter_->GetHeaderHeightForPainting();
+ return header_painter_->GetHeaderHeight();
int caption_buttons_bottom = caption_button_container_->bounds().bottom();