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 22 matching lines...) Expand all Loading... |
33 #include "core/dom/Attribute.h" | 33 #include "core/dom/Attribute.h" |
34 #include "core/dom/EventNames.h" | 34 #include "core/dom/EventNames.h" |
35 #include "core/dom/ExceptionCodePlaceholder.h" | 35 #include "core/dom/ExceptionCodePlaceholder.h" |
36 #include "core/dom/KeyboardEvent.h" | 36 #include "core/dom/KeyboardEvent.h" |
37 #include "core/dom/MouseEvent.h" | 37 #include "core/dom/MouseEvent.h" |
38 #include "core/dom/NodeRenderingContext.h" | 38 #include "core/dom/NodeRenderingContext.h" |
39 #include "core/dom/NodeTraversal.h" | 39 #include "core/dom/NodeTraversal.h" |
40 #include "core/html/FormController.h" | 40 #include "core/html/FormController.h" |
41 #include "core/html/FormDataList.h" | 41 #include "core/html/FormDataList.h" |
42 #include "core/html/HTMLFormElement.h" | 42 #include "core/html/HTMLFormElement.h" |
| 43 #include "core/html/HTMLOptGroupElement.h" |
43 #include "core/html/HTMLOptionElement.h" | 44 #include "core/html/HTMLOptionElement.h" |
44 #include "core/html/HTMLOptionsCollection.h" | 45 #include "core/html/HTMLOptionsCollection.h" |
45 #include "core/page/EventHandler.h" | 46 #include "core/page/EventHandler.h" |
46 #include "core/page/Frame.h" | 47 #include "core/page/Frame.h" |
47 #include "core/page/Page.h" | 48 #include "core/page/Page.h" |
48 #include "core/page/SpatialNavigation.h" | 49 #include "core/page/SpatialNavigation.h" |
49 #include "core/platform/LocalizedStrings.h" | 50 #include "core/platform/LocalizedStrings.h" |
50 #include "core/platform/PlatformMouseEvent.h" | 51 #include "core/platform/PlatformMouseEvent.h" |
51 #include "core/rendering/RenderListBox.h" | 52 #include "core/rendering/RenderListBox.h" |
52 #include "core/rendering/RenderMenuList.h" | 53 #include "core/rendering/RenderMenuList.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 if (usesMenuList()) | 333 if (usesMenuList()) |
333 return new (document()->renderArena()) RenderMenuList(this); | 334 return new (document()->renderArena()) RenderMenuList(this); |
334 return new (document()->renderArena()) RenderListBox(this); | 335 return new (document()->renderArena()) RenderListBox(this); |
335 } | 336 } |
336 | 337 |
337 bool HTMLSelectElement::childShouldCreateRenderer(const NodeRenderingContext& ch
ildContext) const | 338 bool HTMLSelectElement::childShouldCreateRenderer(const NodeRenderingContext& ch
ildContext) const |
338 { | 339 { |
339 if (!HTMLFormControlElementWithState::childShouldCreateRenderer(childContext
)) | 340 if (!HTMLFormControlElementWithState::childShouldCreateRenderer(childContext
)) |
340 return false; | 341 return false; |
341 if (!usesMenuList()) | 342 if (!usesMenuList()) |
342 return childContext.node()->hasTagName(HTMLNames::optionTag) || childCon
text.node()->hasTagName(HTMLNames::optgroupTag); | 343 return childContext.node()->hasTagName(HTMLNames::optionTag) || isHTMLOp
tGroupElement(childContext.node()); |
343 return false; | 344 return false; |
344 } | 345 } |
345 | 346 |
346 PassRefPtr<HTMLCollection> HTMLSelectElement::selectedOptions() | 347 PassRefPtr<HTMLCollection> HTMLSelectElement::selectedOptions() |
347 { | 348 { |
348 updateListItemSelectedStates(); | 349 updateListItemSelectedStates(); |
349 return ensureCachedHTMLCollection(SelectedOptions); | 350 return ensureCachedHTMLCollection(SelectedOptions); |
350 } | 351 } |
351 | 352 |
352 PassRefPtr<HTMLOptionsCollection> HTMLSelectElement::options() | 353 PassRefPtr<HTMLOptionsCollection> HTMLSelectElement::options() |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 for (Element* currentElement = ElementTraversal::firstWithin(this); currentE
lement; ) { | 739 for (Element* currentElement = ElementTraversal::firstWithin(this); currentE
lement; ) { |
739 if (!currentElement->isHTMLElement()) { | 740 if (!currentElement->isHTMLElement()) { |
740 currentElement = ElementTraversal::nextSkippingChildren(currentEleme
nt, this); | 741 currentElement = ElementTraversal::nextSkippingChildren(currentEleme
nt, this); |
741 continue; | 742 continue; |
742 } | 743 } |
743 HTMLElement* current = toHTMLElement(currentElement); | 744 HTMLElement* current = toHTMLElement(currentElement); |
744 | 745 |
745 // optgroup tags may not nest. However, both FireFox and IE will | 746 // optgroup tags may not nest. However, both FireFox and IE will |
746 // flatten the tree automatically, so we follow suit. | 747 // flatten the tree automatically, so we follow suit. |
747 // (http://www.w3.org/TR/html401/interact/forms.html#h-17.6) | 748 // (http://www.w3.org/TR/html401/interact/forms.html#h-17.6) |
748 if (current->hasTagName(optgroupTag)) { | 749 if (isHTMLOptGroupElement(current)) { |
749 m_listItems.append(current); | 750 m_listItems.append(current); |
750 if (Element* nextElement = ElementTraversal::firstWithin(current)) { | 751 if (Element* nextElement = ElementTraversal::firstWithin(current)) { |
751 currentElement = nextElement; | 752 currentElement = nextElement; |
752 continue; | 753 continue; |
753 } | 754 } |
754 } | 755 } |
755 | 756 |
756 if (current->hasTagName(optionTag)) { | 757 if (current->hasTagName(optionTag)) { |
757 m_listItems.append(current); | 758 m_listItems.append(current); |
758 | 759 |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 { | 1573 { |
1573 if (!value) { | 1574 if (!value) { |
1574 ec = TypeMismatchError; | 1575 ec = TypeMismatchError; |
1575 return false; | 1576 return false; |
1576 } | 1577 } |
1577 setOption(index, value.get(), ec); | 1578 setOption(index, value.get(), ec); |
1578 return true; | 1579 return true; |
1579 } | 1580 } |
1580 | 1581 |
1581 } // namespace | 1582 } // namespace |
OLD | NEW |