From 8995b83bcbfbb68245f779b64e5517627c6cc6ea Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 17 Oct 2012 16:21:14 +0200 Subject: Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592) New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes --- Source/WebCore/html/HTMLSelectElement.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Source/WebCore/html/HTMLSelectElement.cpp') diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp index 914b55de8..936b1d146 100644 --- a/Source/WebCore/html/HTMLSelectElement.cpp +++ b/Source/WebCore/html/HTMLSelectElement.cpp @@ -106,7 +106,7 @@ void HTMLSelectElement::optionSelectedByUser(int optionIndex, bool fireOnChangeN // User interaction such as mousedown events can cause list box select elements to send change events. // This produces that same behavior for changes triggered by other code running on behalf of the user. if (!usesMenuList()) { - updateSelectedState(optionIndex, allowMultipleSelection, false); + updateSelectedState(optionToListIndex(optionIndex), allowMultipleSelection, false); setNeedsValidityCheck(); if (fireOnChangeNow) listBoxOnChange(); @@ -1289,7 +1289,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event) // Convert to coords relative to the list box if needed. MouseEvent* mouseEvent = static_cast(event); - IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); + IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), UseTransforms | SnapOffsetForTransforms)); int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toSize(localOffset)); if (listIndex >= 0) { if (!disabled()) { @@ -1309,7 +1309,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event) if (mouseEvent->button() != LeftButton || !mouseEvent->buttonDown()) return; - IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); + IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), UseTransforms | SnapOffsetForTransforms)); int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toSize(localOffset)); if (listIndex >= 0) { if (!disabled()) { @@ -1514,8 +1514,10 @@ void HTMLSelectElement::typeAheadFind(KeyboardEvent* event) return; int selected = selectedIndex(); - int index = (optionToListIndex(selected >= 0 ? selected : 0) + searchStartOffset) % itemCount; - ASSERT(index >= 0); + int index = optionToListIndex(selected >= 0 ? selected : 0) + searchStartOffset; + if (index < 0) + return; + index %= itemCount; // Compute a case-folded copy of the prefix string before beginning the search for // a matching element. This code uses foldCase to work around the fact that -- cgit v1.2.1