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

Side by Side Diff: ash/wm/custom_frame_view_ash.cc

Issue 11087065: Clip the header of ash windows to the frame height (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/custom_frame_view_ash.h" 5 #include "ash/wm/custom_frame_view_ash.h"
6 6
7 #include "ash/wm/frame_painter.h" 7 #include "ash/wm/frame_painter.h"
8 #include "ash/wm/workspace/frame_maximize_button.h" 8 #include "ash/wm/workspace/frame_maximize_button.h"
9 #include "grit/ash_resources.h" 9 #include "grit/ash_resources.h"
10 #include "grit/ui_strings.h" // Accessibility names 10 #include "grit/ui_strings.h" // Accessibility names
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/base/resource/resource_bundle.h" 12 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/compositor/layer_animator.h" 13 #include "ui/compositor/layer_animator.h"
14 #include "ui/gfx/canvas.h"
14 #include "ui/gfx/font.h" 15 #include "ui/gfx/font.h"
15 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
16 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
17 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
18 #include "ui/views/controls/button/image_button.h" 19 #include "ui/views/controls/button/image_button.h"
19 #include "ui/views/widget/native_widget_aura.h" 20 #include "ui/views/widget/native_widget_aura.h"
20 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
21 #include "ui/views/widget/widget_delegate.h" 22 #include "ui/views/widget/widget_delegate.h"
22 23
23 namespace { 24 namespace {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 122
122 void CustomFrameViewAsh::Layout() { 123 void CustomFrameViewAsh::Layout() {
123 // Use the shorter maximized layout headers. 124 // Use the shorter maximized layout headers.
124 frame_painter_->LayoutHeader(this, true); 125 frame_painter_->LayoutHeader(this, true);
125 } 126 }
126 127
127 void CustomFrameViewAsh::OnPaint(gfx::Canvas* canvas) { 128 void CustomFrameViewAsh::OnPaint(gfx::Canvas* canvas) {
128 if (frame_->IsFullscreen()) 129 if (frame_->IsFullscreen())
129 return; 130 return;
130 131
132 // Prevent bleeding paint onto the client area below the window frame, which
133 // may become visible when the WebContent is transparent.
134 canvas->Save();
135 canvas->ClipRect(gfx::Rect(0, 0, width(), NonClientTopBorderHeight()));
136
131 bool paint_as_active = ShouldPaintAsActive(); 137 bool paint_as_active = ShouldPaintAsActive();
132 int theme_image_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE : 138 int theme_image_id = paint_as_active ? IDR_AURA_WINDOW_HEADER_BASE_ACTIVE :
133 IDR_AURA_WINDOW_HEADER_BASE_INACTIVE; 139 IDR_AURA_WINDOW_HEADER_BASE_INACTIVE;
134 frame_painter_->PaintHeader( 140 frame_painter_->PaintHeader(
135 this, 141 this,
136 canvas, 142 canvas,
137 paint_as_active ? FramePainter::ACTIVE : FramePainter::INACTIVE, 143 paint_as_active ? FramePainter::ACTIVE : FramePainter::INACTIVE,
138 theme_image_id, 144 theme_image_id,
139 NULL); 145 NULL);
140 frame_painter_->PaintTitleBar(this, canvas, GetTitleFont()); 146 frame_painter_->PaintTitleBar(this, canvas, GetTitleFont());
141 frame_painter_->PaintHeaderContentSeparator(this, canvas); 147 frame_painter_->PaintHeaderContentSeparator(this, canvas);
148 canvas->Restore();
142 } 149 }
143 150
144 std::string CustomFrameViewAsh::GetClassName() const { 151 std::string CustomFrameViewAsh::GetClassName() const {
145 return kViewClassName; 152 return kViewClassName;
146 } 153 }
147 154
148 gfx::Size CustomFrameViewAsh::GetMinimumSize() { 155 gfx::Size CustomFrameViewAsh::GetMinimumSize() {
149 return frame_painter_->GetMinimumSize(this); 156 return frame_painter_->GetMinimumSize(this);
150 } 157 }
151 158
(...skipping 29 matching lines...) Expand all
181 if (frame_->IsFullscreen()) 188 if (frame_->IsFullscreen())
182 return 0; 189 return 0;
183 190
184 // Reserve enough space to see the buttons, including any offset from top and 191 // Reserve enough space to see the buttons, including any offset from top and
185 // reserving space for the separator line. 192 // reserving space for the separator line.
186 return close_button_->bounds().bottom() + 193 return close_button_->bounds().bottom() +
187 frame_painter_->HeaderContentSeparatorSize(); 194 frame_painter_->HeaderContentSeparatorSize();
188 } 195 }
189 196
190 } // namespace ash 197 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698