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

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

Issue 2810583002: SELECT popup: Make OPTIONs taller for touchscreen. (Closed)
Patch Set: . Created 3 years, 8 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 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 4103844e88fc18f01b1741a5e7cf28efd6d5e22e..5186a47f77fde5c402c122d0396ba40f4e8f9ce9 100644
--- a/third_party/WebKit/Source/web/PopupMenuImpl.cpp
+++ b/third_party/WebKit/Source/web/PopupMenuImpl.cpp
@@ -263,10 +263,29 @@ void PopupMenuImpl::WriteDocument(SharedBuffer* data) {
owner_element.VisibleBoundsInVisualViewport(),
owner_element.GetDocument().View());
+ float scale_factor = chrome_client_->WindowToViewportScalar(1.f);
PagePopupClient::AddString(
"<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", data);
data->Append(Platform::Current()->LoadResource("pickerCommon.css"));
data->Append(Platform::Current()->LoadResource("listPicker.css"));
+ if (!RuntimeEnabledFeatures::forceTallerSelectPopupEnabled())
+ PagePopupClient::AddString("@media (any-pointer:coarse) {", data);
+ int padding = static_cast<int>(roundf(4 * scale_factor));
+ int min_height = static_cast<int>(roundf(24 * scale_factor));
+ PagePopupClient::AddString(String::Format("option, optgroup {"
+ "padding-top: %dpx;"
+ "padding-bottom: %dpx;"
+ "min-height: %dpx;"
+ "display: flex;"
+ "align-items: center;"
+ "}",
+ padding, padding, min_height),
+ data);
+ if (!RuntimeEnabledFeatures::forceTallerSelectPopupEnabled()) {
+ // Closes @media.
+ PagePopupClient::AddString("}", data);
+ }
+
PagePopupClient::AddString(
"</style></head><body><div id=main>Loading...</div><script>\n"
"window.dialogArguments = {\n",
@@ -292,7 +311,6 @@ void PopupMenuImpl::WriteDocument(SharedBuffer* data) {
PagePopupClient::AddString("],\n", data);
AddProperty("anchorRectInScreen", anchor_rect_in_screen, data);
- float scale_factor = chrome_client_->WindowToViewportScalar(1.f);
AddProperty("zoomFactor", 1, data);
AddProperty("scaleFactor", scale_factor, data);
bool is_rtl = !owner_style->IsLeftToRightDirection();
« no previous file with comments | « third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5 ('k') | third_party/WebKit/Source/web/WebRuntimeFeatures.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698