diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-19 23:57:15 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-19 23:57:15 +0000 |
commit | 15439c427e330329f5171063768add65d9d3f655 (patch) | |
tree | 38c1e8ada60e85b41402c6341283f50d0b87cfe6 /webkit | |
parent | 0972b650910fab48048e566bd93a5777d8cb31b8 (diff) | |
download | chromium_src-15439c427e330329f5171063768add65d9d3f655.zip chromium_src-15439c427e330329f5171063768add65d9d3f655.tar.gz chromium_src-15439c427e330329f5171063768add65d9d3f655.tar.bz2 |
Reported crashers indicate that the autofill popup-menu is showing for a detached text field.
I am not sure how this could happen as when the text field has to have focus for the autofill popup to show and the popup is closed when it loses focus.
This CL is a work-around the crasher.
Hopefully someone will trigger the DCHECK and provide more info.
BUG=7708
TEST=Exercise the autofill.
Review URL: http://codereview.chromium.org/21528
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10063 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webview_impl.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 7959b6f..77d5442 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -187,7 +187,9 @@ class AutocompletePopupMenuClient : public WebCore::PopupMenuClient { } virtual int clientPaddingLeft() const { #if defined(OS_WIN) - return theme()->popupInternalPaddingLeft(text_field_->computedStyle()); + // Bug http://crbug.com/7708 seems to indicate the style can be NULL. + WebCore::RenderStyle* style = GetTextFieldStyle(); + return style ? theme()->popupInternalPaddingLeft(style) : 0; #else NOTIMPLEMENTED(); return 0; @@ -195,7 +197,9 @@ class AutocompletePopupMenuClient : public WebCore::PopupMenuClient { } virtual int clientPaddingRight() const { #if defined(OS_WIN) - return theme()->popupInternalPaddingRight(text_field_->computedStyle()); + // Bug http://crbug.com/7708 seems to indicate the style can be NULL. + WebCore::RenderStyle* style = GetTextFieldStyle(); + return style ? theme()->popupInternalPaddingRight(style) : 0; #else NOTIMPLEMENTED(); return 0; @@ -263,6 +267,17 @@ class AutocompletePopupMenuClient : public WebCore::PopupMenuClient { WebCore::HTMLInputElement* text_field() const { return text_field_.get(); } + + WebCore::RenderStyle* GetTextFieldStyle() const { + WebCore::RenderStyle* style = text_field_->computedStyle(); + if (!style) { + // It seems we can only have an NULL style in a TextField if the node is + // dettached, in which case we the popup shoud not be showing. + NOTREACHED() << "Please report this in http://crbug.com/7708 and include " + "the page you were visiting."; + } + return style; + } private: RefPtr<WebCore::HTMLInputElement> text_field_; |