summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-11-06 14:50:21 (GMT)
committeraxis <qt-info@nokia.com>2009-11-06 14:50:21 (GMT)
commitd1aa89647824cbaf9af4fc943d4514018973ddc1 (patch)
treee8e13c32613a896311117fc39c45fe8b6f27144d /src/3rdparty/webkit/WebCore/dom/SelectElement.cpp
parent351ba8b9ca4f0db176c9e3553d105be0ef35c844 (diff)
parentdaf5f511ee813fc4fffba64bed558d0413270388 (diff)
downloadQt-d1aa89647824cbaf9af4fc943d4514018973ddc1.zip
Qt-d1aa89647824cbaf9af4fc943d4514018973ddc1.tar.gz
Qt-d1aa89647824cbaf9af4fc943d4514018973ddc1.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/3rdparty/webkit/WebCore/dom/SelectElement.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SelectElement.cpp22
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);