summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 19:01:53 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 19:01:53 +0000
commit1be43c466bc7ce23f83d3585746d2921f0f40b06 (patch)
treee25acf5c2adca0d3f2865e0dfcf37654433558d9 /webkit/glue
parentd32f33cdb8675bbce52158e1a9eff26d8d6f6927 (diff)
downloadchromium_src-1be43c466bc7ce23f83d3585746d2921f0f40b06.zip
chromium_src-1be43c466bc7ce23f83d3585746d2921f0f40b06.tar.gz
chromium_src-1be43c466bc7ce23f83d3585746d2921f0f40b06.tar.bz2
The autocomplete popup menu was using the style of the edit field it is associated with. This is wrong, its font should be independent of the edit field.
TEST=Open a page with a form that has an input field that uses a huge font. Bring up the autocomplete popup, the items should use a normal size font. BUG=7372,6326 Review URL: http://codereview.chromium.org/20030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/webview_impl.cc24
1 files changed, 18 insertions, 6 deletions
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index b2a6a6d..61fde57 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -36,6 +36,7 @@
#include "base/compiler_specific.h"
MSVC_PUSH_WARNING_LEVEL(0);
#include "CSSStyleSelector.h"
+#include "CSSValueKeywords.h"
#include "Cursor.h"
#include "Document.h"
#include "DocumentLoader.h"
@@ -132,6 +133,20 @@ class AutocompletePopupMenuClient
: text_field_(text_field),
selected_index_(default_suggestion_index),
webview_(webview) {
+ FontDescription font_description;
+#if defined(OS_WIN)
+ theme()->systemFont(CSSValueWebkitControl, text_field->document(),
+ font_description);
+#else
+ NOTIMPLEMENTED();
+#endif
+ // Use a smaller font size to match IE/Firefox.
+ // TODO(jcampan): http://crbug.com/7376 use the system size instead of a
+ // fixed font size value.
+ font_description.setComputedSize(12.0);
+ Font font(font_description, 0, 0);
+ font.update(text_field->document()->styleSelector()->fontSelector());
+ style_.reset(new PopupMenuStyle(Color::black, Color::white, font, true));
SetSuggestions(suggestions);
}
virtual ~AutocompletePopupMenuClient() {
@@ -150,15 +165,11 @@ class AutocompletePopupMenuClient
}
virtual PopupMenuStyle itemStyle(unsigned listIndex) const {
- return menuStyle();
+ return *style_;
}
virtual PopupMenuStyle menuStyle() const {
- RenderStyle* style = text_field_->renderStyle() ?
- text_field_->renderStyle() :
- text_field_->computedStyle();
- return PopupMenuStyle(style->color(), Color::white, style->font(),
- style->visibility() == VISIBLE);
+ return *style_;
}
virtual int clientInsetLeft() const {
@@ -250,6 +261,7 @@ class AutocompletePopupMenuClient
std::vector<WebCore::String> suggestions_;
int selected_index_;
WebViewImpl* webview_;
+ scoped_ptr<PopupMenuStyle> style_;
};
static const WebCore::PopupContainerSettings kAutocompletePopupSettings = {