Commit 0e94f26e authored by bsep's avatar bsep Committed by Commit bot

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}
parent 1717bcb7
...@@ -284,6 +284,8 @@ crbug.com/487281 [ Mac ] fast/forms/select/menulist-narrow-width.html [ Failure ...@@ -284,6 +284,8 @@ crbug.com/487281 [ Mac ] fast/forms/select/menulist-narrow-width.html [ Failure
crbug.com/543110 [ Mac ] fast/text/international/text-shaping-arabic.html [ Failure ] 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/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 ] crbug.com/552433 [ Win7 Debug ] svg/W3C-SVG-1.1/coords-units-02-b.svg [ Failure ]
......
...@@ -1836,7 +1836,6 @@ bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters& ...@@ -1836,7 +1836,6 @@ bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
parameters.stepBase = 0; parameters.stepBase = 0;
} }
parameters.anchorRectInRootFrame = document().view()->contentsToRootFrame(pixelSnappedBoundingBox());
parameters.anchorRectInScreen = document().view()->contentsToScreen(pixelSnappedBoundingBox()); parameters.anchorRectInScreen = document().view()->contentsToScreen(pixelSnappedBoundingBox());
parameters.currentValue = value(); parameters.currentValue = value();
parameters.doubleValue = m_inputType->valueAsDouble(); parameters.doubleValue = m_inputType->valueAsDouble();
......
...@@ -5,9 +5,13 @@ ...@@ -5,9 +5,13 @@
#include "core/html/HTMLInputElement.h" #include "core/html/HTMLInputElement.h"
#include "core/dom/Document.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/HTMLBodyElement.h"
#include "core/html/HTMLFormElement.h" #include "core/html/HTMLFormElement.h"
#include "core/html/HTMLHtmlElement.h" #include "core/html/HTMLHtmlElement.h"
#include "core/html/forms/DateTimeChooser.h"
#include "core/testing/DummyPageHolder.h" #include "core/testing/DummyPageHolder.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include <memory> #include <memory>
...@@ -84,4 +88,20 @@ TEST(HTMLInputElementTest, ImageTypeCrash) ...@@ -84,4 +88,20 @@ TEST(HTMLInputElementTest, ImageTypeCrash)
input->setAttribute(HTMLNames::valueAttr, "aaa"); 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 } // namespace blink
...@@ -51,7 +51,6 @@ struct DateTimeSuggestion { ...@@ -51,7 +51,6 @@ struct DateTimeSuggestion {
struct DateTimeChooserParameters { struct DateTimeChooserParameters {
DISALLOW_NEW(); DISALLOW_NEW();
AtomicString type; AtomicString type;
IntRect anchorRectInRootFrame;
IntRect anchorRectInScreen; IntRect anchorRectInScreen;
// Locale name for which the chooser should be localized. This // Locale name for which the chooser should be localized. This
// might be an invalid name because it comes from HTML lang // might be an invalid name because it comes from HTML lang
......
...@@ -161,7 +161,7 @@ void DateTimeChooserImpl::writeDocument(SharedBuffer* data) ...@@ -161,7 +161,7 @@ void DateTimeChooserImpl::writeDocument(SharedBuffer* data)
addProperty("suggestionValues", suggestionValues, data); addProperty("suggestionValues", suggestionValues, data);
addProperty("localizedSuggestionValues", localizedSuggestionValues, data); addProperty("localizedSuggestionValues", localizedSuggestionValues, data);
addProperty("suggestionLabels", suggestionLabels, 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("showOtherDateEntry", LayoutTheme::theme().supportsCalendarPicker(m_parameters.type), data);
addProperty("otherDateLabel", otherDateLabelString, data); addProperty("otherDateLabel", otherDateLabelString, data);
addProperty("suggestionHighlightColor", LayoutTheme::theme().activeListBoxSelectionBackgroundColor().serialized(), data); addProperty("suggestionHighlightColor", LayoutTheme::theme().activeListBoxSelectionBackgroundColor().serialized(), data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment