Fix date picker datalist suggestion dropdown size with use-zoom-for-dsf.
When a date picker has a suggestion list it's supposed to be the same
width as the input element. With use-zoom-for-dsf on I discovered that
it was too wide because the width that was being passed in was using
"root frame" coords that were not scaled correctly.
BUG=621221
Review-Url: https://codereview.chromium.org/2095113002
Cr-Commit-Position: refs/heads/master@{#403394}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index cc8e68d..36d0f1f 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -284,6 +284,8 @@
crbug.com/543110 [ Mac ] fast/text/international/text-shaping-arabic.html [ Failure ]
+crbug.com/621221 [ Win Linux ] virtual/scalefactor200withzoom/fast/hidpi/static/data-suggestion-picker-appearance.html [ NeedsRebaseline ]
+
crbug.com/548904 [ Linux Win ] fast/writing-mode/Kusa-Makura-background-canvas.html [ Failure Pass ]
crbug.com/552433 [ Win7 Debug ] svg/W3C-SVG-1.1/coords-units-02-b.svg [ Failure ]
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
index 10bfbaa3..dc8ac7c 100644
--- a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
@@ -1836,7 +1836,6 @@
parameters.stepBase = 0;
}
- parameters.anchorRectInRootFrame = document().view()->contentsToRootFrame(pixelSnappedBoundingBox());
parameters.anchorRectInScreen = document().view()->contentsToScreen(pixelSnappedBoundingBox());
parameters.currentValue = value();
parameters.doubleValue = m_inputType->valueAsDouble();
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
index bb5c667..9dabccd 100644
--- a/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLInputElementTest.cpp
@@ -5,9 +5,13 @@
#include "core/html/HTMLInputElement.h"
#include "core/dom/Document.h"
+#include "core/frame/FrameHost.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/VisualViewport.h"
#include "core/html/HTMLBodyElement.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLHtmlElement.h"
+#include "core/html/forms/DateTimeChooser.h"
#include "core/testing/DummyPageHolder.h"
#include "testing/gtest/include/gtest/gtest.h"
#include <memory>
@@ -84,4 +88,20 @@
input->setAttribute(HTMLNames::valueAttr, "aaa");
}
+TEST(HTMLInputElementTest, DateTimeChooserSizeParamRespectsScale)
+{
+ std::unique_ptr<DummyPageHolder> pageHolder = DummyPageHolder::create();
+ Document* document = &(pageHolder->document());
+ document->view()->frame().host()->visualViewport().setScale(2.f);
+ document->body()->setInnerHTML("<input type='date' style='width:200px;height:50px' />", ASSERT_NO_EXCEPTION);
+ document->view()->updateAllLifecyclePhases();
+ HTMLInputElement* input = toHTMLInputElement(document->body()->firstChild());
+
+ DateTimeChooserParameters params;
+ bool success = input->setupDateTimeChooserParameters(params);
+ EXPECT_TRUE(success);
+ EXPECT_EQ("date", params.type);
+ EXPECT_EQ(IntRect(16, 16, 400, 100), params.anchorRectInScreen);
+}
+
} // namespace blink
diff --git a/third_party/WebKit/Source/core/html/forms/DateTimeChooser.h b/third_party/WebKit/Source/core/html/forms/DateTimeChooser.h
index b2f1782..f52d2288 100644
--- a/third_party/WebKit/Source/core/html/forms/DateTimeChooser.h
+++ b/third_party/WebKit/Source/core/html/forms/DateTimeChooser.h
@@ -51,7 +51,6 @@
struct DateTimeChooserParameters {
DISALLOW_NEW();
AtomicString type;
- IntRect anchorRectInRootFrame;
IntRect anchorRectInScreen;
// Locale name for which the chooser should be localized. This
// might be an invalid name because it comes from HTML lang
diff --git a/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp b/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp
index 1541bda..5e18e7d 100644
--- a/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp
+++ b/third_party/WebKit/Source/web/DateTimeChooserImpl.cpp
@@ -161,7 +161,7 @@
addProperty("suggestionValues", suggestionValues, data);
addProperty("localizedSuggestionValues", localizedSuggestionValues, data);
addProperty("suggestionLabels", suggestionLabels, data);
- addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectInRootFrame.width()), data);
+ addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectInScreen.width()), data);
addProperty("showOtherDateEntry", LayoutTheme::theme().supportsCalendarPicker(m_parameters.type), data);
addProperty("otherDateLabel", otherDateLabelString, data);
addProperty("suggestionHighlightColor", LayoutTheme::theme().activeListBoxSelectionBackgroundColor().serialized(), data);