| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights |
| 7 * reserved. | 7 * reserved. |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2010 Google Inc. All rights reserved. | 9 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 10 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 namespace blink { | 79 namespace blink { |
| 80 | 80 |
| 81 using namespace HTMLNames; | 81 using namespace HTMLNames; |
| 82 | 82 |
| 83 // Upper limit of m_listItems. According to the HTML standard, options larger | 83 // Upper limit of m_listItems. According to the HTML standard, options larger |
| 84 // than this limit doesn't work well because |selectedIndex| IDL attribute is | 84 // than this limit doesn't work well because |selectedIndex| IDL attribute is |
| 85 // signed. | 85 // signed. |
| 86 static const unsigned maxListItems = INT_MAX; | 86 static const unsigned maxListItems = INT_MAX; |
| 87 | 87 |
| 88 HTMLSelectElement::HTMLSelectElement(Document& document, HTMLFormElement* form) | 88 HTMLSelectElement::HTMLSelectElement(Document& document) |
| 89 : HTMLFormControlElementWithState(selectTag, document, form), | 89 : HTMLFormControlElementWithState(selectTag, document), |
| 90 m_typeAhead(this), | 90 m_typeAhead(this), |
| 91 m_size(0), | 91 m_size(0), |
| 92 m_lastOnChangeOption(nullptr), | 92 m_lastOnChangeOption(nullptr), |
| 93 m_isMultiple(false), | 93 m_isMultiple(false), |
| 94 m_activeSelectionState(false), | 94 m_activeSelectionState(false), |
| 95 m_shouldRecalcListItems(false), | 95 m_shouldRecalcListItems(false), |
| 96 m_isAutofilledByPreview(false), | 96 m_isAutofilledByPreview(false), |
| 97 m_indexToSelectOnCancel(-1), | 97 m_indexToSelectOnCancel(-1), |
| 98 m_popupIsVisible(false) { | 98 m_popupIsVisible(false) { |
| 99 setHasCustomStyleCallbacks(); | 99 setHasCustomStyleCallbacks(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 HTMLSelectElement* HTMLSelectElement::create(Document& document) { | 102 HTMLSelectElement* HTMLSelectElement::create(Document& document) { |
| 103 HTMLSelectElement* select = new HTMLSelectElement(document, 0); | 103 HTMLSelectElement* select = new HTMLSelectElement(document); |
| 104 select->ensureUserAgentShadowRoot(); | 104 select->ensureUserAgentShadowRoot(); |
| 105 return select; | 105 return select; |
| 106 } | 106 } |
| 107 | |
| 108 HTMLSelectElement* HTMLSelectElement::create(Document& document, | |
| 109 HTMLFormElement* form) { | |
| 110 HTMLSelectElement* select = new HTMLSelectElement(document, form); | |
| 111 select->ensureUserAgentShadowRoot(); | |
| 112 return select; | |
| 113 } | |
| 114 | 107 |
| 115 HTMLSelectElement::~HTMLSelectElement() {} | 108 HTMLSelectElement::~HTMLSelectElement() {} |
| 116 | 109 |
| 117 const AtomicString& HTMLSelectElement::formControlType() const { | 110 const AtomicString& HTMLSelectElement::formControlType() const { |
| 118 DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple")); | 111 DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple")); |
| 119 DEFINE_STATIC_LOCAL(const AtomicString, selectOne, ("select-one")); | 112 DEFINE_STATIC_LOCAL(const AtomicString, selectOne, ("select-one")); |
| 120 return m_isMultiple ? selectMultiple : selectOne; | 113 return m_isMultiple ? selectMultiple : selectOne; |
| 121 } | 114 } |
| 122 | 115 |
| 123 bool HTMLSelectElement::hasPlaceholderLabelOption() const { | 116 bool HTMLSelectElement::hasPlaceholderLabelOption() const { |
| (...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 m_popupUpdater = nullptr; | 2021 m_popupUpdater = nullptr; |
| 2029 } | 2022 } |
| 2030 | 2023 |
| 2031 void HTMLSelectElement::didMutateSubtree() { | 2024 void HTMLSelectElement::didMutateSubtree() { |
| 2032 DCHECK(popupIsVisible()); | 2025 DCHECK(popupIsVisible()); |
| 2033 DCHECK(m_popup); | 2026 DCHECK(m_popup); |
| 2034 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2027 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2035 } | 2028 } |
| 2036 | 2029 |
| 2037 } // namespace blink | 2030 } // namespace blink |
| OLD | NEW |