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

Side by Side Diff: chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc

Issue 6462022: It turns out I had the sense of the GetLocalBounds bool wrong everywhere, so ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view. h" 5 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view. h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/i18n/bidi_line_iterator.h" 8 #include "base/i18n/bidi_line_iterator.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 paint.setAntiAlias(true); 970 paint.setAntiAlias(true);
971 971
972 SkShader* shader = SkShader::CreateBitmapShader( 972 SkShader* shader = SkShader::CreateBitmapShader(
973 contents_canvas.getDevice()->accessBitmap(false), 973 contents_canvas.getDevice()->accessBitmap(false),
974 SkShader::kClamp_TileMode, 974 SkShader::kClamp_TileMode,
975 SkShader::kClamp_TileMode); 975 SkShader::kClamp_TileMode);
976 paint.setShader(shader); 976 paint.setShader(shader);
977 shader->unref(); 977 shader->unref();
978 978
979 gfx::Path path; 979 gfx::Path path;
980 MakeContentsPath(&path, GetLocalBounds()); 980 MakeContentsPath(&path, GetContentsBounds());
981 canvas->AsCanvasSkia()->drawPath(path, paint); 981 canvas->AsCanvasSkia()->drawPath(path, paint);
982 982
983 // Now we paint the border, so it will be alpha-blended atop the contents. 983 // Now we paint the border, so it will be alpha-blended atop the contents.
984 // This looks slightly better in the corners than drawing the contents atop 984 // This looks slightly better in the corners than drawing the contents atop
985 // the border. 985 // the border.
986 PaintBorder(canvas); 986 PaintBorder(canvas);
987 } 987 }
988 988
989 void AutocompletePopupContentsView::Layout() { 989 void AutocompletePopupContentsView::Layout() {
990 UpdateBlurRegion(); 990 UpdateBlurRegion();
991 991
992 // Size our children to the available content area. 992 // Size our children to the available content area.
993 gfx::Rect contents_rect = GetLocalBounds(); 993 gfx::Rect contents_rect = GetContentsBounds();
994 int child_count = GetChildViewCount(); 994 int child_count = GetChildViewCount();
995 int top = contents_rect.y(); 995 int top = contents_rect.y();
996 for (int i = 0; i < child_count; ++i) { 996 for (int i = 0; i < child_count; ++i) {
997 View* v = GetChildViewAt(i); 997 View* v = GetChildViewAt(i);
998 if (v->IsVisible()) { 998 if (v->IsVisible()) {
999 v->SetBounds(contents_rect.x(), top, contents_rect.width(), 999 v->SetBounds(contents_rect.x(), top, contents_rect.width(),
1000 v->GetPreferredSize().height()); 1000 v->GetPreferredSize().height());
1001 top = v->bounds().bottom(); 1001 top = v->bounds().bottom();
1002 } 1002 }
1003 } 1003 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 return; 1108 return;
1109 1109
1110 // Provide a blurred background effect within the contents region of the 1110 // Provide a blurred background effect within the contents region of the
1111 // popup. 1111 // popup.
1112 DWM_BLURBEHIND bb = {0}; 1112 DWM_BLURBEHIND bb = {0};
1113 bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; 1113 bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
1114 bb.fEnable = true; 1114 bb.fEnable = true;
1115 1115
1116 // Translate the contents rect into widget coordinates, since that's what 1116 // Translate the contents rect into widget coordinates, since that's what
1117 // DwmEnableBlurBehindWindow expects a region in. 1117 // DwmEnableBlurBehindWindow expects a region in.
1118 gfx::Rect contents_rect = GetLocalBounds(); 1118 gfx::Rect contents_rect = GetContentsBounds();
1119 gfx::Point origin(contents_rect.origin()); 1119 gfx::Point origin(contents_rect.origin());
1120 views::View::ConvertPointToWidget(this, &origin); 1120 views::View::ConvertPointToWidget(this, &origin);
1121 contents_rect.set_origin(origin); 1121 contents_rect.set_origin(origin);
1122 1122
1123 gfx::Path contents_path; 1123 gfx::Path contents_path;
1124 MakeContentsPath(&contents_path, contents_rect); 1124 MakeContentsPath(&contents_path, contents_rect);
1125 base::win::ScopedGDIObject<HRGN> popup_region; 1125 base::win::ScopedGDIObject<HRGN> popup_region;
1126 popup_region.Set(contents_path.CreateNativeRegion()); 1126 popup_region.Set(contents_path.CreateNativeRegion());
1127 bb.hRgnBlur = popup_region.Get(); 1127 bb.hRgnBlur = popup_region.Get();
1128 DwmEnableBlurBehindWindow(GetWidget()->GetNativeView(), &bb); 1128 DwmEnableBlurBehindWindow(GetWidget()->GetNativeView(), &bb);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 views::View* child = GetChildViewAt(i); 1167 views::View* child = GetChildViewAt(i);
1168 gfx::Point point_in_child_coords(point); 1168 gfx::Point point_in_child_coords(point);
1169 View::ConvertPointToView(this, child, &point_in_child_coords); 1169 View::ConvertPointToView(this, child, &point_in_child_coords);
1170 if (child->HitTest(point_in_child_coords)) 1170 if (child->HitTest(point_in_child_coords))
1171 return i; 1171 return i;
1172 } 1172 }
1173 return AutocompletePopupModel::kNoMatch; 1173 return AutocompletePopupModel::kNoMatch;
1174 } 1174 }
1175 1175
1176 gfx::Rect AutocompletePopupContentsView::CalculateTargetBounds(int h) { 1176 gfx::Rect AutocompletePopupContentsView::CalculateTargetBounds(int h) {
1177 gfx::Rect location_bar_bounds(location_bar_->GetLocalBounds()); 1177 gfx::Rect location_bar_bounds(location_bar_->GetContentsBounds());
1178 const views::Border* border = location_bar_->border(); 1178 const views::Border* border = location_bar_->border();
1179 if (border) { 1179 if (border) {
1180 // Adjust for the border so that the bubble and location bar borders are 1180 // Adjust for the border so that the bubble and location bar borders are
1181 // aligned. 1181 // aligned.
1182 gfx::Insets insets; 1182 gfx::Insets insets;
1183 border->GetInsets(&insets); 1183 border->GetInsets(&insets);
1184 location_bar_bounds.Inset(insets.left(), 0, insets.right(), 0); 1184 location_bar_bounds.Inset(insets.left(), 0, insets.right(), 0);
1185 } else { 1185 } else {
1186 // The normal location bar is drawn using a background graphic that includes 1186 // The normal location bar is drawn using a background graphic that includes
1187 // the border, so we inset by enough to make the edges line up, and the 1187 // the border, so we inset by enough to make the edges line up, and the
(...skipping 13 matching lines...) Expand all
1201 opt_in_view_ = NULL; 1201 opt_in_view_ = NULL;
1202 PromoCounter* counter = model_->profile()->GetInstantPromoCounter(); 1202 PromoCounter* counter = model_->profile()->GetInstantPromoCounter();
1203 DCHECK(counter); 1203 DCHECK(counter);
1204 counter->Hide(); 1204 counter->Hide();
1205 if (opt_in) { 1205 if (opt_in) {
1206 browser::ShowInstantConfirmDialogIfNecessary( 1206 browser::ShowInstantConfirmDialogIfNecessary(
1207 location_bar_->GetWindow()->GetNativeWindow(), model_->profile()); 1207 location_bar_->GetWindow()->GetNativeWindow(), model_->profile());
1208 } 1208 }
1209 UpdatePopupAppearance(); 1209 UpdatePopupAppearance();
1210 } 1210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698