Commit 59c66ce1 authored by ddkilzer's avatar ddkilzer
Browse files

LayoutTests:

        Reviewed by Darin.

        - test for http://bugs.webkit.org/show_bug.cgi?id=13013
          REGRESSION: Selection box does not scroll to where the focus jumps when pressing an alphanumeric key

        * fast/forms/listbox-typeahead-scroll-expected.txt: Added.
        * fast/forms/listbox-typeahead-scroll.html: Added.

WebCore:

        Reviewed by Darin.

        - fix http://bugs.webkit.org/show_bug.cgi?id=13013
          REGRESSION: Selection box does not scroll to where the focus jumps when pressing an alphanumeric key

        Test: fast/forms/listbox-typeahead-scroll.html

        * html/HTMLSelectElement.cpp:
        (WebCore::HTMLSelectElement::setSelectedIndex): Reordered to set the active selection's
        anchor and end before selecting the option, since the active selection is used to
        decide where to scroll when the selection is made.
        (WebCore::HTMLSelectElement::defaultEventHandler): Removed redundant check.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d7c16778
2007-03-10 Mitz Pettel <mitz@webkit.org>
Reviewed by Darin.
- test for http://bugs.webkit.org/show_bug.cgi?id=13013
REGRESSION: Selection box does not scroll to where the focus jumps when pressing an alphanumeric key
* fast/forms/listbox-typeahead-scroll-expected.txt: Added.
* fast/forms/listbox-typeahead-scroll.html: Added.
2007-03-10 Mitz Pettel <mitz@webkit.org>
 
Reviewed by Darin.
Test for http://bugs.webkit.org/show_bug.cgi?id=13013 REGRESSION: Selection box does not scroll to where the focus jumps when pressing an alphanumeric key.
SUCCESS
<p>
Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=13013">http://bugs.webkit.org/show_bug.cgi?id=13013</a>
REGRESSION: Selection box does not scroll to where the focus jumps when pressing an alphanumeric key</i>.
</p>
<select id="list" size="3">
<option>aardvark</option>
<option>blue</option>
<option>navy</option>
<option>indigo</option>
<option>azure</option>
</select>
<div id="result">Cannot run interactively.</div>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
var list = document.getElementById("list");
list.focus();
eventSender.keyDown("a");
document.body.offsetTop;
eventSender.keyDown("z");
var result = document.getElementById("result");
result.innerText = list.scrollTop > 0 ? "SUCCESS" : "FAIL";
}
</script>
2007-03-10 Mitz Pettel <mitz@webkit.org>
Reviewed by Darin.
- fix http://bugs.webkit.org/show_bug.cgi?id=13013
REGRESSION: Selection box does not scroll to where the focus jumps when pressing an alphanumeric key
Test: fast/forms/listbox-typeahead-scroll.html
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::setSelectedIndex): Reordered to set the active selection's
anchor and end before selecting the option, since the active selection is used to
decide where to scroll when the selection is made.
(WebCore::HTMLSelectElement::defaultEventHandler): Removed redundant check.
2007-03-10 Mitz Pettel <mitz@webkit.org>
 
Reviewed by Darin.
......
......@@ -179,6 +179,10 @@ void HTMLSelectElement::setSelectedIndex(int optionIndex, bool deselect, bool fi
int lastOnChangeIndex = m_lastOnChangeIndex;
if (listIndex >= 0) {
if (m_activeSelectionAnchorIndex < 0 || deselect)
setActiveSelectionAnchorIndex(listIndex);
if (m_activeSelectionEndIndex < 0 || deselect)
setActiveSelectionEndIndex(listIndex);
element = static_cast<HTMLOptionElement*>(items[listIndex]);
element->setSelected(true);
} else if (deselect)
......@@ -187,13 +191,6 @@ void HTMLSelectElement::setSelectedIndex(int optionIndex, bool deselect, bool fi
if (deselect)
deselectItems(element);
if (listIndex >= 0) {
if (m_activeSelectionAnchorIndex < 0 || deselect)
setActiveSelectionAnchorIndex(listIndex);
if (m_activeSelectionEndIndex < 0 || deselect)
setActiveSelectionEndIndex(listIndex);
}
ASSERT(m_lastOnChangeIndex == -1 || m_lastOnChangeIndex == optionIndex);
if (fireOnChange && usesMenuList() && lastOnChangeIndex != optionIndex)
onChange();
......@@ -601,7 +598,7 @@ void HTMLSelectElement::defaultEventHandler(Event* evt)
if (evt->defaultHandled())
return;
if (!evt->defaultHandled() && evt->type() == keypressEvent && evt->isKeyboardEvent()) {
if (evt->type() == keypressEvent && evt->isKeyboardEvent()) {
KeyboardEvent* keyboardEvent = static_cast<KeyboardEvent*>(evt);
if (!keyboardEvent->ctrlKey() && !keyboardEvent->altKey() && !keyboardEvent->metaKey() &&
......
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