| Index: ash/wm/frame_painter.cc
|
| diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
|
| index b6ab6129b915127dbf8cb77615349137a3c780f5..34d427b4c06dc779c1e7e7608ab4135762cc48e5 100644
|
| --- a/ash/wm/frame_painter.cc
|
| +++ b/ash/wm/frame_painter.cc
|
| @@ -48,8 +48,6 @@ const int kTitleLogoSpacing = 5;
|
| const int kTitleIconOffsetX = 4;
|
| // Space between window edge and title text, when there is no icon.
|
| const int kTitleNoIconOffsetX = 8;
|
| -// Space between title text and top of window.
|
| -const int kTitleOffsetY = 10;
|
| // Color for the title text.
|
| const SkColor kTitleTextColor = SkColorSetRGB(40, 40, 40);
|
| // Size of header/content separator line below the header image.
|
| @@ -452,15 +450,7 @@ void FramePainter::PaintTitleBar(views::NonClientFrameView* view,
|
| // The window icon is painted by its own views::View.
|
| views::WidgetDelegate* delegate = frame_->widget_delegate();
|
| if (delegate && delegate->ShouldShowWindowTitle()) {
|
| - int title_x = GetTitleOffsetX();
|
| - int title_y = ui::LAYOUT_TOUCH == ui::GetDisplayLayout() ?
|
| - (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2
|
| - : kTitleOffsetY;
|
| - gfx::Rect title_bounds(
|
| - title_x,
|
| - std::max(0, title_y),
|
| - std::max(0, size_button_->x() - kTitleLogoSpacing - title_x),
|
| - title_font.GetHeight());
|
| + gfx::Rect title_bounds = GetTitleBounds(view, title_font);
|
| canvas->DrawStringInt(delegate->GetWindowTitle(),
|
| title_font,
|
| kTitleTextColor,
|
| @@ -532,6 +522,12 @@ void FramePainter::LayoutHeader(views::NonClientFrameView* view,
|
| gfx::Rect(kIconOffsetX, kIconOffsetY, kIconSize, kIconSize));
|
| }
|
|
|
| +void FramePainter::SchedulePaintForTitle(views::NonClientFrameView* view,
|
| + const gfx::Font& title_font) {
|
| + frame_->non_client_view()->SchedulePaintInRect(
|
| + GetTitleBounds(view, title_font));
|
| +}
|
| +
|
| ///////////////////////////////////////////////////////////////////////////////
|
| // aura::WindowObserver overrides:
|
|
|
| @@ -726,4 +722,18 @@ void FramePainter::SchedulePaintForHeader() {
|
| std::max(top_left_height, top_right_height)));
|
| }
|
|
|
| +gfx::Rect FramePainter::GetTitleBounds(views::NonClientFrameView* view,
|
| + const gfx::Font& title_font) {
|
| + int title_x = GetTitleOffsetX();
|
| + // Center the text in the middle of the caption - this way it adapts
|
| + // automatically to the caption height (which is given by the owner).
|
| + int title_y =
|
| + (view->GetBoundsForClientView().y() - title_font.GetHeight()) / 2;
|
| + return gfx::Rect(
|
| + title_x,
|
| + std::max(0, title_y),
|
| + std::max(0, size_button_->x() - kTitleLogoSpacing - title_x),
|
| + title_font.GetHeight());
|
| +}
|
| +
|
| } // namespace ash
|
|
|