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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 1016033011: omnibox: Don't paint children from inside OnPaint(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: omnibox: . Created 5 years, 9 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
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
index 3e6e20542af834c6d34e47926c157bd4a889019a..61f394ac0510b641e3754d58b2a2d361d6b50ab5 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -370,12 +370,6 @@ void OmniboxPopupContentsView::OnGestureEvent(ui::GestureEvent* event) {
////////////////////////////////////////////////////////////////////////////////
// OmniboxPopupContentsView, protected:
-void OmniboxPopupContentsView::PaintResultViews(gfx::Canvas* canvas) {
- canvas->DrawColor(result_view_at(0)->GetColor(
- OmniboxResultView::NORMAL, OmniboxResultView::BACKGROUND));
- View::PaintChildren(canvas, views::CullSet());
-}
-
int OmniboxPopupContentsView::CalculatePopupHeight() {
DCHECK_GE(static_cast<size_t>(child_count()), model_->result().size());
int popup_height = 0;
@@ -409,19 +403,6 @@ const char* OmniboxPopupContentsView::GetClassName() const {
}
void OmniboxPopupContentsView::OnPaint(gfx::Canvas* canvas) {
- gfx::Rect contents_bounds = GetContentsBounds();
- contents_bounds.set_height(
- contents_bounds.height() - bottom_shadow_->height() + kBorderInterior);
-
- gfx::Path path;
- MakeContentsPath(&path, contents_bounds);
- canvas->Save();
- canvas->sk_canvas()->clipPath(path,
- SkRegion::kIntersect_Op,
- true /* doAntialias */);
- PaintResultViews(canvas);
- canvas->Restore();
-
// Top border.
canvas->FillRect(
gfx::Rect(0, 0, width(), views::NonClientFrameView::kClientEdgeThickness),
@@ -435,7 +416,18 @@ void OmniboxPopupContentsView::OnPaint(gfx::Canvas* canvas) {
void OmniboxPopupContentsView::PaintChildren(gfx::Canvas* canvas,
const views::CullSet& cull_set) {
- // We paint our children inside OnPaint().
+ gfx::Rect contents_bounds = GetContentsBounds();
+ contents_bounds.Inset(0, views::NonClientFrameView::kClientEdgeThickness, 0,
+ bottom_shadow_->height() - kBorderInterior);
+
+ canvas->Save();
+ canvas->sk_canvas()->clipRect(gfx::RectToSkRect(contents_bounds),
+ SkRegion::kIntersect_Op,
+ true /* doAntialias */);
+ canvas->DrawColor(result_view_at(0)->GetColor(OmniboxResultView::NORMAL,
+ OmniboxResultView::BACKGROUND));
+ View::PaintChildren(canvas, cull_set);
+ canvas->Restore();
}
////////////////////////////////////////////////////////////////////////////////
@@ -456,17 +448,6 @@ const AutocompleteMatch& OmniboxPopupContentsView::GetMatchAtIndex(
return model_->result().match_at(index);
}
-void OmniboxPopupContentsView::MakeContentsPath(
- gfx::Path* path,
- const gfx::Rect& bounding_rect) {
- SkRect rect;
- rect.set(SkIntToScalar(bounding_rect.x()),
- SkIntToScalar(bounding_rect.y()),
- SkIntToScalar(bounding_rect.right()),
- SkIntToScalar(bounding_rect.bottom()));
- path->addRect(rect);
-}
-
size_t OmniboxPopupContentsView::GetIndexForPoint(
const gfx::Point& point) {
if (!HitTestPoint(point))
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698