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

Unified Diff: third_party/WebKit/Source/web/PopupMenuImpl.cpp

Issue 1454613002: Page popups should respect zoom factor of the anchor element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add 1.25 zoom tests Created 5 years, 1 month 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
Index: third_party/WebKit/Source/web/PopupMenuImpl.cpp
diff --git a/third_party/WebKit/Source/web/PopupMenuImpl.cpp b/third_party/WebKit/Source/web/PopupMenuImpl.cpp
index d8593b07d6207f08c8e4f17bbe72e2f1af6dfd21..fb5b708e805c7daee9cf85d58a25c2ec790db557 100644
--- a/third_party/WebKit/Source/web/PopupMenuImpl.cpp
+++ b/third_party/WebKit/Source/web/PopupMenuImpl.cpp
@@ -188,7 +188,7 @@ public:
addProperty("backgroundColor", m_backgroundColor.serialized(), m_buffer);
addProperty("color", baseStyle().visitedDependentColor(CSSPropertyColor).serialized(), m_buffer);
addProperty("textTransform", String(textTransformToString(baseStyle().textTransform())), m_buffer);
- addProperty("fontSize", baseFont().computedPixelSize(), m_buffer);
+ addProperty("fontSize", baseFont().specifiedSize(), m_buffer);
addProperty("fontStyle", String(fontStyleToString(baseFont().style())), m_buffer);
addProperty("fontVariant", String(fontVariantToString(baseFont().variant())), m_buffer);
@@ -289,10 +289,12 @@ void PopupMenuImpl::writeDocument(SharedBuffer* data)
context.finishGroupIfNecessary();
PagePopupClient::addString("],\n", data);
+ float zoom = zoomFactor();
addProperty("anchorRectInScreen", anchorRectInScreen, data);
+ addProperty("zoomFactor", zoom, data);
bool isRTL = !ownerStyle->isLeftToRightDirection();
addProperty("isRTL", isRTL, data);
- addProperty("paddingStart", isRTL ? ownerElement.clientPaddingRight().toDouble() : ownerElement.clientPaddingLeft().toDouble(), data);
+ addProperty("paddingStart", isRTL ? ownerElement.clientPaddingRight().toDouble() / zoom : ownerElement.clientPaddingLeft().toDouble() / zoom, data);
PagePopupClient::addString("};\n", data);
data->append(Platform::current()->loadResource("pickerCommon.js"));
data->append(Platform::current()->loadResource("listPicker.js"));
@@ -324,8 +326,11 @@ void PopupMenuImpl::addElementStyle(ItemIterationContext& context, HTMLElement&
addProperty("backgroundColor", backgroundColor.serialized(), data);
const FontDescription& baseFont = context.baseFont();
const FontDescription& fontDescription = style->font().fontDescription();
- if (baseFont.computedPixelSize() != fontDescription.computedPixelSize())
- addProperty("fontSize", fontDescription.computedPixelSize(), data);
+ if (baseFont.computedPixelSize() != fontDescription.computedPixelSize()) {
+ // We don't use FontDescription::specifiedSize() because this element
+ // might have its own zoom level.
+ addProperty("fontSize", fontDescription.computedSize() / zoomFactor(), data);
+ }
// Our UA stylesheet has font-weight:normal for OPTION.
if (FontWeightNormal != fontDescription.weight())
addProperty("fontWeight", String(fontWeightToString(fontDescription.weight())), data);
« no previous file with comments | « third_party/WebKit/Source/web/DateTimeChooserImpl.cpp ('k') | third_party/WebKit/Source/web/WebPagePopupImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698