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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 , m_activeSelectionState(false) | 83 , m_activeSelectionState(false) |
84 , m_shouldRecalcListItems(false) | 84 , m_shouldRecalcListItems(false) |
85 , m_suggestedIndex(-1) | 85 , m_suggestedIndex(-1) |
86 , m_isAutofilledByPreview(false) | 86 , m_isAutofilledByPreview(false) |
87 { | 87 { |
88 } | 88 } |
89 | 89 |
90 PassRefPtrWillBeRawPtr<HTMLSelectElement> HTMLSelectElement::create(Document& do
cument) | 90 PassRefPtrWillBeRawPtr<HTMLSelectElement> HTMLSelectElement::create(Document& do
cument) |
91 { | 91 { |
92 RefPtrWillBeRawPtr<HTMLSelectElement> select = adoptRefWillBeNoop(new HTMLSe
lectElement(document, 0)); | 92 RefPtrWillBeRawPtr<HTMLSelectElement> select = adoptRefWillBeNoop(new HTMLSe
lectElement(document, 0)); |
93 select->ensureUserAgentShadowRoot(); | 93 select->ensureClosedShadowRoot(); |
94 return select.release(); | 94 return select.release(); |
95 } | 95 } |
96 | 96 |
97 PassRefPtrWillBeRawPtr<HTMLSelectElement> HTMLSelectElement::create(Document& do
cument, HTMLFormElement* form) | 97 PassRefPtrWillBeRawPtr<HTMLSelectElement> HTMLSelectElement::create(Document& do
cument, HTMLFormElement* form) |
98 { | 98 { |
99 RefPtrWillBeRawPtr<HTMLSelectElement> select = adoptRefWillBeNoop(new HTMLSe
lectElement(document, form)); | 99 RefPtrWillBeRawPtr<HTMLSelectElement> select = adoptRefWillBeNoop(new HTMLSe
lectElement(document, form)); |
100 select->ensureUserAgentShadowRoot(); | 100 select->ensureClosedShadowRoot(); |
101 return select.release(); | 101 return select.release(); |
102 } | 102 } |
103 | 103 |
104 const AtomicString& HTMLSelectElement::formControlType() const | 104 const AtomicString& HTMLSelectElement::formControlType() const |
105 { | 105 { |
106 DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple",
AtomicString::ConstructFromLiteral)); | 106 DEFINE_STATIC_LOCAL(const AtomicString, selectMultiple, ("select-multiple",
AtomicString::ConstructFromLiteral)); |
107 DEFINE_STATIC_LOCAL(const AtomicString, selectOne, ("select-one", AtomicStri
ng::ConstructFromLiteral)); | 107 DEFINE_STATIC_LOCAL(const AtomicString, selectOne, ("select-one", AtomicStri
ng::ConstructFromLiteral)); |
108 return m_multiple ? selectMultiple : selectOne; | 108 return m_multiple ? selectMultiple : selectOne; |
109 } | 109 } |
110 | 110 |
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 } | 1747 } |
1748 | 1748 |
1749 DEFINE_TRACE(HTMLSelectElement) | 1749 DEFINE_TRACE(HTMLSelectElement) |
1750 { | 1750 { |
1751 #if ENABLE(OILPAN) | 1751 #if ENABLE(OILPAN) |
1752 visitor->trace(m_listItems); | 1752 visitor->trace(m_listItems); |
1753 #endif | 1753 #endif |
1754 HTMLFormControlElementWithState::trace(visitor); | 1754 HTMLFormControlElementWithState::trace(visitor); |
1755 } | 1755 } |
1756 | 1756 |
1757 void HTMLSelectElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 1757 void HTMLSelectElement::didAddClosedShadowRoot(ShadowRoot& root) |
1758 { | 1758 { |
1759 RefPtrWillBeRawPtr<HTMLContentElement> content = HTMLContentElement::create(
document()); | 1759 RefPtrWillBeRawPtr<HTMLContentElement> content = HTMLContentElement::create(
document()); |
1760 content->setAttribute(selectAttr, "option,optgroup,hr"); | 1760 content->setAttribute(selectAttr, "option,optgroup,hr"); |
1761 root.appendChild(content); | 1761 root.appendChild(content); |
1762 } | 1762 } |
1763 | 1763 |
1764 HTMLOptionElement* HTMLSelectElement::spatialNavigationFocusedOption() | 1764 HTMLOptionElement* HTMLSelectElement::spatialNavigationFocusedOption() |
1765 { | 1765 { |
1766 if (!isSpatialNavigationEnabled(document().frame())) | 1766 if (!isSpatialNavigationEnabled(document().frame())) |
1767 return nullptr; | 1767 return nullptr; |
1768 int focusedIndex = activeSelectionEndListIndex(); | 1768 int focusedIndex = activeSelectionEndListIndex(); |
1769 if (focusedIndex < 0) | 1769 if (focusedIndex < 0) |
1770 focusedIndex = firstSelectableListIndex(); | 1770 focusedIndex = firstSelectableListIndex(); |
1771 if (focusedIndex < 0) | 1771 if (focusedIndex < 0) |
1772 return nullptr; | 1772 return nullptr; |
1773 HTMLElement* focused = listItems()[focusedIndex]; | 1773 HTMLElement* focused = listItems()[focusedIndex]; |
1774 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; | 1774 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; |
1775 } | 1775 } |
1776 | 1776 |
1777 } // namespace | 1777 } // namespace |
OLD | NEW |