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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 1054783003: views: Access the Canvas through recorders not through PaintContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 0df91c50890cf0fbaced7059db20dfe64618db42..d7bc3dc69c46a046133a095ea915f30b65861746 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -75,6 +75,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/theme_provider.h"
#include "ui/compositor/paint_context.h"
+#include "ui/compositor/paint_recorder.h"
#include "ui/events/event.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/canvas.h"
@@ -1221,21 +1222,22 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) {
void LocationBarView::PaintChildren(const ui::PaintContext& context) {
View::PaintChildren(context);
- gfx::Canvas* canvas = context.canvas();
+ ui::PaintRecorder recorder(context);
// For non-InstantExtendedAPI cases, if necessary, show focus rect. As we need
// the focus rect to appear on top of children we paint here rather than
// OnPaint().
// Note: |Canvas::DrawFocusRect| paints a dashed rect with gray color.
if (show_focus_rect_ && HasFocus())
- canvas->DrawFocusRect(omnibox_view_->bounds());
+ recorder.canvas()->DrawFocusRect(omnibox_view_->bounds());
// Maximized popup windows don't draw the horizontal edges. We implement this
// by simply expanding the paint area outside the view by the edge thickness.
gfx::Rect border_rect(GetContentsBounds());
if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0))
border_rect.Inset(-kPopupEdgeThickness, 0);
- views::Painter::PaintPainterAt(canvas, border_painter_.get(), border_rect);
+ views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(),
+ border_rect);
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698