Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: Source/WebCore/html/HTMLSelectElement.cpp

Issue 11091018: Merge 130717 - HTMLSelectElement::typeAheadFind depends on implementation dependent behavior (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/forms/select/select-typeahead-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * (C) 1999 Antti Koivisto (koivisto@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * 10 *
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 searchStartOffset = 0; 1507 searchStartOffset = 0;
1508 } 1508 }
1509 } 1509 }
1510 1510
1511 const Vector<HTMLElement*>& items = listItems(); 1511 const Vector<HTMLElement*>& items = listItems();
1512 int itemCount = items.size(); 1512 int itemCount = items.size();
1513 if (itemCount < 1) 1513 if (itemCount < 1)
1514 return; 1514 return;
1515 1515
1516 int selected = selectedIndex(); 1516 int selected = selectedIndex();
1517 int index = (optionToListIndex(selected >= 0 ? selected : 0) + searchStartOf fset) % itemCount; 1517 int index = optionToListIndex(selected >= 0 ? selected : 0) + searchStartOff set;
1518 ASSERT(index >= 0); 1518 if (index < 0)
1519 return;
1520 index %= itemCount;
1519 1521
1520 // Compute a case-folded copy of the prefix string before beginning the sear ch for 1522 // Compute a case-folded copy of the prefix string before beginning the sear ch for
1521 // a matching element. This code uses foldCase to work around the fact that 1523 // a matching element. This code uses foldCase to work around the fact that
1522 // String::startWith does not fold non-ASCII characters. This code can be ch anged 1524 // String::startWith does not fold non-ASCII characters. This code can be ch anged
1523 // to use startWith once that is fixed. 1525 // to use startWith once that is fixed.
1524 String prefixWithCaseFolded(prefix.foldCase()); 1526 String prefixWithCaseFolded(prefix.foldCase());
1525 for (int i = 0; i < itemCount; ++i, index = (index + 1) % itemCount) { 1527 for (int i = 0; i < itemCount; ++i, index = (index + 1) % itemCount) {
1526 HTMLElement* element = items[index]; 1528 HTMLElement* element = items[index];
1527 if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->dis abled()) 1529 if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->dis abled())
1528 continue; 1530 continue;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 1603
1602 const HTMLSelectElement* toHTMLSelectElement(const Node* node) 1604 const HTMLSelectElement* toHTMLSelectElement(const Node* node)
1603 { 1605 {
1604 ASSERT(!node || node->hasTagName(selectTag)); 1606 ASSERT(!node || node->hasTagName(selectTag));
1605 return static_cast<const HTMLSelectElement*>(node); 1607 return static_cast<const HTMLSelectElement*>(node);
1606 } 1608 }
1607 1609
1608 #endif 1610 #endif
1609 1611
1610 } // namespace 1612 } // namespace
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/select/select-typeahead-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698