| OLD | NEW |
| 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 size_t HTMLSelectElement::searchOptionsForValue(const String& value, size_t list
IndexStart, size_t listIndexEnd) const | 948 size_t HTMLSelectElement::searchOptionsForValue(const String& value, size_t list
IndexStart, size_t listIndexEnd) const |
| 949 { | 949 { |
| 950 const Vector<HTMLElement*>& items = listItems(); | 950 const Vector<HTMLElement*>& items = listItems(); |
| 951 size_t loopEndIndex = std::min(items.size(), listIndexEnd); | 951 size_t loopEndIndex = std::min(items.size(), listIndexEnd); |
| 952 for (size_t i = listIndexStart; i < loopEndIndex; ++i) { | 952 for (size_t i = listIndexStart; i < loopEndIndex; ++i) { |
| 953 if (!items[i]->hasLocalName(optionTag)) | 953 if (!items[i]->hasLocalName(optionTag)) |
| 954 continue; | 954 continue; |
| 955 if (toHTMLOptionElement(items[i])->value() == value) | 955 if (toHTMLOptionElement(items[i])->value() == value) |
| 956 return i; | 956 return i; |
| 957 } | 957 } |
| 958 return notFound; | 958 return kNotFound; |
| 959 } | 959 } |
| 960 | 960 |
| 961 void HTMLSelectElement::restoreFormControlState(const FormControlState& state) | 961 void HTMLSelectElement::restoreFormControlState(const FormControlState& state) |
| 962 { | 962 { |
| 963 recalcListItems(); | 963 recalcListItems(); |
| 964 | 964 |
| 965 const Vector<HTMLElement*>& items = listItems(); | 965 const Vector<HTMLElement*>& items = listItems(); |
| 966 size_t itemsSize = items.size(); | 966 size_t itemsSize = items.size(); |
| 967 if (!itemsSize) | 967 if (!itemsSize) |
| 968 return; | 968 return; |
| 969 | 969 |
| 970 for (size_t i = 0; i < itemsSize; ++i) { | 970 for (size_t i = 0; i < itemsSize; ++i) { |
| 971 if (!items[i]->hasLocalName(optionTag)) | 971 if (!items[i]->hasLocalName(optionTag)) |
| 972 continue; | 972 continue; |
| 973 toHTMLOptionElement(items[i])->setSelectedState(false); | 973 toHTMLOptionElement(items[i])->setSelectedState(false); |
| 974 } | 974 } |
| 975 | 975 |
| 976 if (!multiple()) { | 976 if (!multiple()) { |
| 977 size_t foundIndex = searchOptionsForValue(state[0], 0, itemsSize); | 977 size_t foundIndex = searchOptionsForValue(state[0], 0, itemsSize); |
| 978 if (foundIndex != notFound) | 978 if (foundIndex != kNotFound) |
| 979 toHTMLOptionElement(items[foundIndex])->setSelectedState(true); | 979 toHTMLOptionElement(items[foundIndex])->setSelectedState(true); |
| 980 } else { | 980 } else { |
| 981 size_t startIndex = 0; | 981 size_t startIndex = 0; |
| 982 for (size_t i = 0; i < state.valueSize(); ++i) { | 982 for (size_t i = 0; i < state.valueSize(); ++i) { |
| 983 const String& value = state[i]; | 983 const String& value = state[i]; |
| 984 size_t foundIndex = searchOptionsForValue(value, startIndex, itemsSi
ze); | 984 size_t foundIndex = searchOptionsForValue(value, startIndex, itemsSi
ze); |
| 985 if (foundIndex == notFound) | 985 if (foundIndex == kNotFound) |
| 986 foundIndex = searchOptionsForValue(value, 0, startIndex); | 986 foundIndex = searchOptionsForValue(value, 0, startIndex); |
| 987 if (foundIndex == notFound) | 987 if (foundIndex == kNotFound) |
| 988 continue; | 988 continue; |
| 989 toHTMLOptionElement(items[foundIndex])->setSelectedState(true); | 989 toHTMLOptionElement(items[foundIndex])->setSelectedState(true); |
| 990 startIndex = foundIndex + 1; | 990 startIndex = foundIndex + 1; |
| 991 } | 991 } |
| 992 } | 992 } |
| 993 | 993 |
| 994 setOptionsChangedOnRenderer(); | 994 setOptionsChangedOnRenderer(); |
| 995 setNeedsValidityCheck(); | 995 setNeedsValidityCheck(); |
| 996 } | 996 } |
| 997 | 997 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 return true; | 1572 return true; |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 bool HTMLSelectElement::anonymousIndexedSetterRemove(unsigned index, ExceptionSt
ate& es) | 1575 bool HTMLSelectElement::anonymousIndexedSetterRemove(unsigned index, ExceptionSt
ate& es) |
| 1576 { | 1576 { |
| 1577 remove(index); | 1577 remove(index); |
| 1578 return true; | 1578 return true; |
| 1579 } | 1579 } |
| 1580 | 1580 |
| 1581 } // namespace | 1581 } // namespace |
| OLD | NEW |