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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 using namespace std; | 55 using namespace std; |
56 using namespace WTF::Unicode; | 56 using namespace WTF::Unicode; |
57 | 57 |
58 namespace WebCore { | 58 namespace WebCore { |
59 | 59 |
60 using namespace HTMLNames; | 60 using namespace HTMLNames; |
61 | 61 |
62 // Upper limit agreed upon with representatives of Opera and Mozilla. | 62 // Upper limit agreed upon with representatives of Opera and Mozilla. |
63 static const unsigned maxSelectItems = 10000; | 63 static const unsigned maxSelectItems = 10000; |
64 | 64 |
65 HTMLSelectElement::HTMLSelectElement(Document& document, HTMLFormElement* form,
bool createdByParser) | 65 HTMLSelectElement::HTMLSelectElement(Document& document, HTMLFormElement* form) |
66 : HTMLFormControlElementWithState(selectTag, document, form) | 66 : HTMLFormControlElementWithState(selectTag, document, form) |
67 , m_typeAhead(this) | 67 , m_typeAhead(this) |
68 , m_size(0) | 68 , m_size(0) |
69 , m_lastOnChangeIndex(-1) | 69 , m_lastOnChangeIndex(-1) |
70 , m_activeSelectionAnchorIndex(-1) | 70 , m_activeSelectionAnchorIndex(-1) |
71 , m_activeSelectionEndIndex(-1) | 71 , m_activeSelectionEndIndex(-1) |
72 , m_isProcessingUserDrivenChange(false) | 72 , m_isProcessingUserDrivenChange(false) |
73 , m_multiple(false) | 73 , m_multiple(false) |
74 , m_activeSelectionState(false) | 74 , m_activeSelectionState(false) |
75 , m_shouldRecalcListItems(false) | 75 , m_shouldRecalcListItems(false) |
76 , m_isParsingInProgress(createdByParser) | |
77 { | 76 { |
78 ScriptWrappable::init(this); | 77 ScriptWrappable::init(this); |
79 } | 78 } |
80 | 79 |
81 PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document) | 80 PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document) |
82 { | 81 { |
83 return adoptRef(new HTMLSelectElement(document, 0, false)); | 82 return adoptRef(new HTMLSelectElement(document, 0)); |
84 } | 83 } |
85 | 84 |
86 PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document, HTML
FormElement* form, bool createdByParser) | 85 PassRefPtr<HTMLSelectElement> HTMLSelectElement::create(Document& document, HTML
FormElement* form) |
87 { | 86 { |
88 return adoptRef(new HTMLSelectElement(document, form, createdByParser)); | 87 return adoptRef(new HTMLSelectElement(document, form)); |
89 } | 88 } |
90 | 89 |
91 const AtomicString& HTMLSelectElement::formControlType() const | 90 const AtomicString& HTMLSelectElement::formControlType() const |
92 { | 91 { |
93 DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple",
AtomicString::ConstructFromLiteral)); | 92 DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple",
AtomicString::ConstructFromLiteral)); |
94 DEFINE_STATIC_LOCAL(const AtomicString, selectOne, ("select-one", AtomicStri
ng::ConstructFromLiteral)); | 93 DEFINE_STATIC_LOCAL(const AtomicString, selectOne, ("select-one", AtomicStri
ng::ConstructFromLiteral)); |
95 return m_multiple ? selectMultiple : selectOne; | 94 return m_multiple ? selectMultiple : selectOne; |
96 } | 95 } |
97 | 96 |
98 void HTMLSelectElement::optionSelectedByUser(int optionIndex, bool fireOnChangeN
ow, bool allowMultipleSelection) | 97 void HTMLSelectElement::optionSelectedByUser(int optionIndex, bool fireOnChangeN
ow, bool allowMultipleSelection) |
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 if (items[i]->hasTagName(optionTag)) | 1536 if (items[i]->hasTagName(optionTag)) |
1538 ++options; | 1537 ++options; |
1539 } | 1538 } |
1540 | 1539 |
1541 return options; | 1540 return options; |
1542 } | 1541 } |
1543 | 1542 |
1544 void HTMLSelectElement::finishParsingChildren() | 1543 void HTMLSelectElement::finishParsingChildren() |
1545 { | 1544 { |
1546 HTMLFormControlElementWithState::finishParsingChildren(); | 1545 HTMLFormControlElementWithState::finishParsingChildren(); |
1547 m_isParsingInProgress = false; | |
1548 updateListItemSelectedStates(); | 1546 updateListItemSelectedStates(); |
1549 } | 1547 } |
1550 | 1548 |
1551 bool HTMLSelectElement::anonymousIndexedSetter(unsigned index, PassRefPtr<HTMLOp
tionElement> value, ExceptionState& exceptionState) | 1549 bool HTMLSelectElement::anonymousIndexedSetter(unsigned index, PassRefPtr<HTMLOp
tionElement> value, ExceptionState& exceptionState) |
1552 { | 1550 { |
1553 if (!value) { // undefined or null | 1551 if (!value) { // undefined or null |
1554 remove(index); | 1552 remove(index); |
1555 return true; | 1553 return true; |
1556 } | 1554 } |
1557 setOption(index, value.get(), exceptionState); | 1555 setOption(index, value.get(), exceptionState); |
1558 return true; | 1556 return true; |
1559 } | 1557 } |
1560 | 1558 |
1561 bool HTMLSelectElement::isInteractiveContent() const | 1559 bool HTMLSelectElement::isInteractiveContent() const |
1562 { | 1560 { |
1563 return true; | 1561 return true; |
1564 } | 1562 } |
1565 | 1563 |
1566 bool HTMLSelectElement::supportsAutofocus() const | 1564 bool HTMLSelectElement::supportsAutofocus() const |
1567 { | 1565 { |
1568 return true; | 1566 return true; |
1569 } | 1567 } |
1570 | 1568 |
1571 } // namespace | 1569 } // namespace |
OLD | NEW |