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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 currentElement = ElementTraversal::nextSkippingChildren(currentEleme
nt, this); | 740 currentElement = ElementTraversal::nextSkippingChildren(currentEleme
nt, this); |
741 continue; | 741 continue; |
742 } | 742 } |
743 HTMLElement* current = toHTMLElement(currentElement); | 743 HTMLElement* current = toHTMLElement(currentElement); |
744 | 744 |
745 // optgroup tags may not nest. However, both FireFox and IE will | 745 // optgroup tags may not nest. However, both FireFox and IE will |
746 // flatten the tree automatically, so we follow suit. | 746 // flatten the tree automatically, so we follow suit. |
747 // (http://www.w3.org/TR/html401/interact/forms.html#h-17.6) | 747 // (http://www.w3.org/TR/html401/interact/forms.html#h-17.6) |
748 if (current->hasTagName(optgroupTag)) { | 748 if (current->hasTagName(optgroupTag)) { |
749 m_listItems.append(current); | 749 m_listItems.append(current); |
750 if (current->firstChild()) { | 750 if (Element* nextElement = ElementTraversal::firstWithin(current)) { |
751 currentElement = ElementTraversal::firstWithin(current); | 751 currentElement = nextElement; |
752 continue; | 752 continue; |
753 } | 753 } |
754 } | 754 } |
755 | 755 |
756 if (current->hasTagName(optionTag)) { | 756 if (current->hasTagName(optionTag)) { |
757 m_listItems.append(current); | 757 m_listItems.append(current); |
758 | 758 |
759 if (updateSelectedStates && !m_multiple) { | 759 if (updateSelectedStates && !m_multiple) { |
760 HTMLOptionElement* option = toHTMLOptionElement(current); | 760 HTMLOptionElement* option = toHTMLOptionElement(current); |
761 if (!firstOption) | 761 if (!firstOption) |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 const Vector<HTMLElement*>& items = listItems(); | 1545 const Vector<HTMLElement*>& items = listItems(); |
1546 for (unsigned i = 0; i < items.size(); ++i) { | 1546 for (unsigned i = 0; i < items.size(); ++i) { |
1547 if (items[i]->hasTagName(optionTag)) | 1547 if (items[i]->hasTagName(optionTag)) |
1548 ++options; | 1548 ++options; |
1549 } | 1549 } |
1550 | 1550 |
1551 return options; | 1551 return options; |
1552 } | 1552 } |
1553 | 1553 |
1554 } // namespace | 1554 } // namespace |
OLD | NEW |