Commit e0782495 authored by reni@webkit.org's avatar reni@webkit.org

HTML listbox is not resized horizontally when zooming

https://bugs.webkit.org/show_bug.cgi?id=20445

Reviewed by Darin Adler.

Source/WebCore:

If any style changes happens on a HTMLSelectElement, we need to set the m_optionsChanged property
of its renderer (RenderListBox) otherwise its size won't follow the changed content.

Test: fast/transforms/listbox-zoom.html

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::didRecalcStyle):
* html/HTMLSelectElement.h:

LayoutTests:

A test with a zoomed listbox is added to check whether the styleChange is catched.

* fast/transforms/listbox-zoom.html: Added.
* fast/transforms/listbox-zoom-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 208a24a1
2013-10-02 Renata Hodovan <reni@webkit.org>
HTML listbox is not resized horizontally when zooming
https://bugs.webkit.org/show_bug.cgi?id=20445
Reviewed by Darin Adler.
A test with a zoomed listbox is added to check whether the styleChange is catched.
* fast/transforms/listbox-zoom.html: Added.
* fast/transforms/listbox-zoom-expected.txt: Added.
2013-10-01 Santosh Mahto <santosh.ma@samsung.com>
contenteditable justify commands applied to next paragraph as well
The test passes if both dimensions (not only height) of the listbox is resized according to the zoom.
PASS expected width: 55 width +/-10 allowance.
<html>
<head>
<script>
if (window.testRunner)
testRunner.dumpAsText()
function runTest() {
document.getElementById('toZoom').style.zoom = 2;
// Comparing the result to the expectation.
var expectedWidth = 55;
var realWidth = window.getComputedStyle(document.getElementById("toZoom")).getPropertyCSSValue('width').getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
var result = "";
if (Math.abs(expectedWidth - realWidth) > 10)
result = "FAIL";
else
result = "PASS";
result += " expected width: " + expectedWidth + " width +/-10 allowance.";
document.getElementById('result').innerHTML = result;
}
</script>
</head>
<body onload="runTest()">
<select id="toZoom" MULTIPLE>
<option value="first">first
<option value="second">second
</select>
<div>The test passes if both dimensions (not only height) of the listbox is resized according to the zoom.</div>
<div id="result"/>
</body>
</html>
2013-10-02 Renata Hodovan <reni@webkit.org>
HTML listbox is not resized horizontally when zooming
https://bugs.webkit.org/show_bug.cgi?id=20445
Reviewed by Darin Adler.
If any style changes happens on a HTMLSelectElement, we need to set the m_optionsChanged property
of its renderer (RenderListBox) otherwise its size won't follow the changed content.
Test: fast/transforms/listbox-zoom.html
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::didRecalcStyle):
* html/HTMLSelectElement.h:
2013-10-01 Santosh Mahto <santosh.ma@samsung.com>
contenteditable justify commands applied to next paragraph as well
......@@ -86,6 +86,14 @@ PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(const QualifiedName& tag
return adoptRef(new HTMLSelectElement(tagName, document, form));
}
void HTMLSelectElement::didRecalcStyle(Style::Change styleChange)
{
// Even though the options didn't necessarily change, we will call setOptionsChangedOnRenderer for its side effect
// of recomputing the width of the element. We need to do that if the style change included a change in zoom level.
setOptionsChangedOnRenderer();
HTMLFormControlElement::didRecalcStyle(styleChange);
}
const AtomicString& HTMLSelectElement::formControlType() const
{
DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple", AtomicString::ConstructFromLiteral));
......
......@@ -137,7 +137,9 @@ private:
virtual void defaultEventHandler(Event*);
void dispatchChangeEventForMenuList();
virtual void didRecalcStyle(Style::Change) OVERRIDE FINAL;
void recalcListItems(bool updateSelectedStates = true) const;
void deselectItems(HTMLOptionElement* excludeElement = 0);
......
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