diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-11-04 16:37:58 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-11-04 16:37:58 (GMT) |
commit | bc5ff9a1fc9982d8669324fde2103dd447486860 (patch) | |
tree | c6d2dec1e4a083e7128a3e6bd4fdb5be28290da6 /src/3rdparty/webkit/WebCore/dom/SelectElement.cpp | |
parent | 9a88c8808f8e084e77ee22f907366250f3a0ad2a (diff) | |
parent | 56b8d24c337d30c6bcdda101fbc664c4fd6d642d (diff) | |
download | Qt-bc5ff9a1fc9982d8669324fde2103dd447486860.zip Qt-bc5ff9a1fc9982d8669324fde2103dd447486860.tar.gz Qt-bc5ff9a1fc9982d8669324fde2103dd447486860.tar.bz2 |
Merge remote branch 'mainline/4.6' into 4.6
Diffstat (limited to 'src/3rdparty/webkit/WebCore/dom/SelectElement.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/dom/SelectElement.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp index 49713ba..3d2a549 100644 --- a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp +++ b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp @@ -479,12 +479,14 @@ bool SelectElement::appendFormData(SelectElementData& data, Element* element, Fo // We return the first one if it was a combobox select if (!successful && !data.multiple() && data.size() <= 1 && items.size()) { OptionElement* optionElement = toOptionElement(items[0]); - const AtomicString& value = optionElement->value(); - if (value.isNull()) - list.appendData(name, optionElement->text().stripWhiteSpace()); - else - list.appendData(name, value); - successful = true; + if (optionElement) { + const AtomicString& value = optionElement->value(); + if (value.isNull()) + list.appendData(name, optionElement->text().stripWhiteSpace()); + else + list.appendData(name, value); + successful = true; + } } return successful; @@ -874,13 +876,19 @@ void SelectElement::typeAheadFind(SelectElementData& data, Element* element, Key int index = (optionToListIndex(data, element, selected >= 0 ? selected : 0) + searchStartOffset) % itemCount; ASSERT(index >= 0); + // 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 + // String::startWith does not fold non-ASCII characters. This code can be changed + // to use startWith once that is fixed. + String prefixWithCaseFolded(prefix.foldCase()); for (int i = 0; i < itemCount; ++i, index = (index + 1) % itemCount) { OptionElement* optionElement = toOptionElement(items[index]); if (!optionElement || items[index]->disabled()) continue; + // Fold the option string and check if its prefix is equal to the folded prefix. String text = optionElement->textIndentedToRespectGroupLabel(); - if (stripLeadingWhiteSpace(text).startsWith(prefix, false)) { + if (stripLeadingWhiteSpace(text).foldCase().startsWith(prefixWithCaseFolded)) { setSelectedIndex(data, element, listToOptionIndex(data, element, index)); if (!data.usesMenuList()) listBoxOnChange(data, element); |