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

Unified Diff: chrome/browser/ui/views/infobars/infobar_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/infobars/infobar_view.cc
diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc
index dfe08f03ba20999b3b1e6c564c3e928ae0de9ea6..65fda4986e7511764340d7a0bf0a89793822fb94 100644
--- a/chrome/browser/ui/views/infobars/infobar_view.cc
+++ b/chrome/browser/ui/views/infobars/infobar_view.cc
@@ -17,6 +17,7 @@
#include "ui/accessibility/ax_view_state.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/compositor/clip_transform_recorder.h"
#include "ui/compositor/paint_context.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h"
@@ -241,9 +242,6 @@ void InfoBarView::ViewHierarchyChanged(
}
void InfoBarView::PaintChildren(const ui::PaintContext& context) {
- gfx::Canvas* canvas = context.canvas();
- canvas->Save();
-
// TODO(scr): This really should be the |fill_path_|, but the clipPath seems
// broken on non-Windows platforms (crbug.com/75154). For now, just clip to
// the bar bounds.
@@ -251,9 +249,10 @@ void InfoBarView::PaintChildren(const ui::PaintContext& context) {
// canvas->sk_canvas()->clipPath(fill_path_);
DCHECK_EQ(total_height(), height())
<< "Infobar piecewise heights do not match overall height";
- canvas->ClipRect(gfx::Rect(0, arrow_height(), width(), bar_height()));
+ ui::ClipTransformRecorder clip_transform_recorder(context);
+ clip_transform_recorder.ClipRect(
+ gfx::Rect(0, arrow_height(), width(), bar_height()));
views::View::PaintChildren(context);
- canvas->Restore();
}
void InfoBarView::ButtonPressed(views::Button* sender,

Powered by Google App Engine
This is Rietveld 408576698