| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 , m_lastOnChangeIndex(-1) | 78 , m_lastOnChangeIndex(-1) |
| 79 , m_activeSelectionAnchorIndex(-1) | 79 , m_activeSelectionAnchorIndex(-1) |
| 80 , m_activeSelectionEndIndex(-1) | 80 , m_activeSelectionEndIndex(-1) |
| 81 , m_isProcessingUserDrivenChange(false) | 81 , m_isProcessingUserDrivenChange(false) |
| 82 , m_multiple(false) | 82 , m_multiple(false) |
| 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 setHasCustomStyleCallbacks(); |
| 88 } | 89 } |
| 89 | 90 |
| 90 PassRefPtrWillBeRawPtr<HTMLSelectElement> HTMLSelectElement::create(Document& do
cument) | 91 PassRefPtrWillBeRawPtr<HTMLSelectElement> HTMLSelectElement::create(Document& do
cument) |
| 91 { | 92 { |
| 92 RefPtrWillBeRawPtr<HTMLSelectElement> select = adoptRefWillBeNoop(new HTMLSe
lectElement(document, 0)); | 93 RefPtrWillBeRawPtr<HTMLSelectElement> select = adoptRefWillBeNoop(new HTMLSe
lectElement(document, 0)); |
| 93 select->ensureUserAgentShadowRoot(); | 94 select->ensureUserAgentShadowRoot(); |
| 94 return select.release(); | 95 return select.release(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 PassRefPtrWillBeRawPtr<HTMLSelectElement> HTMLSelectElement::create(Document& do
cument, HTMLFormElement* form) | 98 PassRefPtrWillBeRawPtr<HTMLSelectElement> HTMLSelectElement::create(Document& do
cument, HTMLFormElement* form) |
| (...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 } | 1745 } |
| 1745 | 1746 |
| 1746 DEFINE_TRACE(HTMLSelectElement) | 1747 DEFINE_TRACE(HTMLSelectElement) |
| 1747 { | 1748 { |
| 1748 #if ENABLE(OILPAN) | 1749 #if ENABLE(OILPAN) |
| 1749 visitor->trace(m_listItems); | 1750 visitor->trace(m_listItems); |
| 1750 #endif | 1751 #endif |
| 1751 HTMLFormControlElementWithState::trace(visitor); | 1752 HTMLFormControlElementWithState::trace(visitor); |
| 1752 } | 1753 } |
| 1753 | 1754 |
| 1755 void HTMLSelectElement::willRecalcStyle(StyleRecalcChange change) |
| 1756 { |
| 1757 // recalcListItems will update the selected state of the <option> elements |
| 1758 // in this <select> so we need to do it before we recalc their style so they |
| 1759 // match the right selectors (ex. :checked). |
| 1760 // TODO(esprehn): Find a way to avoid needing a willRecalcStyle callback. |
| 1761 if (m_shouldRecalcListItems) |
| 1762 recalcListItems(); |
| 1763 } |
| 1764 |
| 1754 void HTMLSelectElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 1765 void HTMLSelectElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| 1755 { | 1766 { |
| 1756 RefPtrWillBeRawPtr<HTMLContentElement> content = HTMLContentElement::create(
document()); | 1767 RefPtrWillBeRawPtr<HTMLContentElement> content = HTMLContentElement::create(
document()); |
| 1757 content->setAttribute(selectAttr, "option,optgroup,hr"); | 1768 content->setAttribute(selectAttr, "option,optgroup,hr"); |
| 1758 root.appendChild(content); | 1769 root.appendChild(content); |
| 1759 } | 1770 } |
| 1760 | 1771 |
| 1761 HTMLOptionElement* HTMLSelectElement::spatialNavigationFocusedOption() | 1772 HTMLOptionElement* HTMLSelectElement::spatialNavigationFocusedOption() |
| 1762 { | 1773 { |
| 1763 if (!isSpatialNavigationEnabled(document().frame())) | 1774 if (!isSpatialNavigationEnabled(document().frame())) |
| 1764 return nullptr; | 1775 return nullptr; |
| 1765 int focusedIndex = activeSelectionEndListIndex(); | 1776 int focusedIndex = activeSelectionEndListIndex(); |
| 1766 if (focusedIndex < 0) | 1777 if (focusedIndex < 0) |
| 1767 focusedIndex = firstSelectableListIndex(); | 1778 focusedIndex = firstSelectableListIndex(); |
| 1768 if (focusedIndex < 0) | 1779 if (focusedIndex < 0) |
| 1769 return nullptr; | 1780 return nullptr; |
| 1770 HTMLElement* focused = listItems()[focusedIndex]; | 1781 HTMLElement* focused = listItems()[focusedIndex]; |
| 1771 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; | 1782 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; |
| 1772 } | 1783 } |
| 1773 | 1784 |
| 1774 } // namespace | 1785 } // namespace |
| OLD | NEW |