summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_external_delegate.cc
diff options
context:
space:
mode:
authorcsharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-03 22:46:12 +0000
committercsharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-03 22:46:12 +0000
commitdbd6e233e79f70d872715059dca782a962414d07 (patch)
treed57005b394d77713547cdcc6f09b1273ae7638b3 /chrome/browser/autofill/autofill_external_delegate.cc
parent1cb3e109e8ff278a27f278b4c1612fd5c9f165f8 (diff)
downloadchromium_src-dbd6e233e79f70d872715059dca782a962414d07.zip
chromium_src-dbd6e233e79f70d872715059dca782a962414d07.tar.gz
chromium_src-dbd6e233e79f70d872715059dca782a962414d07.tar.bz2
Convert element_bounds to Screen Space for New Autofill UI
This prevents each implementation from having to indepently do this. (This change also gets the views view to display the autofill popup in the correct location). BUG= Review URL: https://chromiumcodereview.appspot.com/11606008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/autofill_external_delegate.cc')
-rw-r--r--chrome/browser/autofill/autofill_external_delegate.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/autofill/autofill_external_delegate.cc b/chrome/browser/autofill/autofill_external_delegate.cc
index 6281ee9..ea2045e 100644
--- a/chrome/browser/autofill/autofill_external_delegate.cc
+++ b/chrome/browser/autofill/autofill_external_delegate.cc
@@ -164,13 +164,23 @@ void AutofillExternalDelegate::OnShowPasswordSuggestions(
void AutofillExternalDelegate::EnsurePopupForElement(
const gfx::Rect& element_bounds) {
+ // Convert element_bounds to be in screen space. If |web_contents_| is NULL
+ // then assume the element_bounds is already in screen space (since we don't
+ // have any other way of converting to screen space).
+ gfx::Rect element_bounds_in_screen_space = element_bounds;
+ if (web_contents_) {
+ gfx::Rect client_area;
+ web_contents_->GetContainerBounds(&client_area);
+ element_bounds_in_screen_space += client_area.OffsetFromOrigin();
+ }
+
// |controller_| owns itself.
controller_ = AutofillPopupControllerImpl::GetOrCreate(
controller_,
this,
// web_contents() may be NULL during testing.
web_contents() ? web_contents()->GetView()->GetContentNativeView() : NULL,
- element_bounds);
+ element_bounds_in_screen_space);
}
void AutofillExternalDelegate::ApplyAutofillSuggestions(