| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const | 378 bool HTMLSelectElement::shouldShowFocusRingOnMouseFocus() const |
| 379 { | 379 { |
| 380 return true; | 380 return true; |
| 381 } | 381 } |
| 382 | 382 |
| 383 bool HTMLSelectElement::canSelectAll() const | 383 bool HTMLSelectElement::canSelectAll() const |
| 384 { | 384 { |
| 385 return !usesMenuList(); | 385 return !usesMenuList(); |
| 386 } | 386 } |
| 387 | 387 |
| 388 RenderObject* HTMLSelectElement::createRenderer(RenderStyle*) | 388 LayoutObject* HTMLSelectElement::createRenderer(RenderStyle*) |
| 389 { | 389 { |
| 390 if (usesMenuList()) | 390 if (usesMenuList()) |
| 391 return new RenderMenuList(this); | 391 return new RenderMenuList(this); |
| 392 return new RenderListBox(this); | 392 return new RenderListBox(this); |
| 393 } | 393 } |
| 394 | 394 |
| 395 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLSelectElement::selectedOptions() | 395 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLSelectElement::selectedOptions() |
| 396 { | 396 { |
| 397 updateListItemSelectedStates(); | 397 updateListItemSelectedStates(); |
| 398 return ensureCachedCollection<HTMLCollection>(SelectedOptions); | 398 return ensureCachedCollection<HTMLCollection>(SelectedOptions); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 return; | 735 return; |
| 736 if (usesMenuList()) | 736 if (usesMenuList()) |
| 737 return; | 737 return; |
| 738 scrollToIndex(activeSelectionEndListIndex()); | 738 scrollToIndex(activeSelectionEndListIndex()); |
| 739 if (AXObjectCache* cache = document().existingAXObjectCache()) | 739 if (AXObjectCache* cache = document().existingAXObjectCache()) |
| 740 cache->selectedChildrenChanged(this); | 740 cache->selectedChildrenChanged(this); |
| 741 } | 741 } |
| 742 | 742 |
| 743 void HTMLSelectElement::setOptionsChangedOnRenderer() | 743 void HTMLSelectElement::setOptionsChangedOnRenderer() |
| 744 { | 744 { |
| 745 if (RenderObject* renderer = this->renderer()) { | 745 if (LayoutObject* renderer = this->renderer()) { |
| 746 if (usesMenuList()) | 746 if (usesMenuList()) |
| 747 toRenderMenuList(renderer)->setOptionsChanged(true); | 747 toRenderMenuList(renderer)->setOptionsChanged(true); |
| 748 } | 748 } |
| 749 } | 749 } |
| 750 | 750 |
| 751 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& HTMLSelectElement::list
Items() const | 751 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& HTMLSelectElement::list
Items() const |
| 752 { | 752 { |
| 753 if (m_shouldRecalcListItems) | 753 if (m_shouldRecalcListItems) |
| 754 recalcListItems(); | 754 recalcListItems(); |
| 755 else { | 755 else { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 | 877 |
| 878 int HTMLSelectElement::suggestedIndex() const | 878 int HTMLSelectElement::suggestedIndex() const |
| 879 { | 879 { |
| 880 return m_suggestedIndex; | 880 return m_suggestedIndex; |
| 881 } | 881 } |
| 882 | 882 |
| 883 void HTMLSelectElement::setSuggestedIndex(int suggestedIndex) | 883 void HTMLSelectElement::setSuggestedIndex(int suggestedIndex) |
| 884 { | 884 { |
| 885 m_suggestedIndex = suggestedIndex; | 885 m_suggestedIndex = suggestedIndex; |
| 886 | 886 |
| 887 if (RenderObject* renderer = this->renderer()) { | 887 if (LayoutObject* renderer = this->renderer()) { |
| 888 renderer->updateFromElement(); | 888 renderer->updateFromElement(); |
| 889 scrollToIndex(suggestedIndex); | 889 scrollToIndex(suggestedIndex); |
| 890 } | 890 } |
| 891 } | 891 } |
| 892 | 892 |
| 893 void HTMLSelectElement::scrollToIndex(int listIndex) | 893 void HTMLSelectElement::scrollToIndex(int listIndex) |
| 894 { | 894 { |
| 895 if (listIndex < 0) | 895 if (listIndex < 0) |
| 896 return; | 896 return; |
| 897 if (usesMenuList()) | 897 if (usesMenuList()) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 if (m_activeSelectionEndIndex < 0 || shouldDeselect) | 957 if (m_activeSelectionEndIndex < 0 || shouldDeselect) |
| 958 setActiveSelectionEndIndex(listIndex); | 958 setActiveSelectionEndIndex(listIndex); |
| 959 toHTMLOptionElement(*element).setSelectedState(true); | 959 toHTMLOptionElement(*element).setSelectedState(true); |
| 960 } | 960 } |
| 961 } | 961 } |
| 962 | 962 |
| 963 if (shouldDeselect) | 963 if (shouldDeselect) |
| 964 deselectItemsWithoutValidation(element); | 964 deselectItemsWithoutValidation(element); |
| 965 | 965 |
| 966 // For the menu list case, this is what makes the selected element appear. | 966 // For the menu list case, this is what makes the selected element appear. |
| 967 if (RenderObject* renderer = this->renderer()) | 967 if (LayoutObject* renderer = this->renderer()) |
| 968 renderer->updateFromElement(); | 968 renderer->updateFromElement(); |
| 969 | 969 |
| 970 scrollToSelection(); | 970 scrollToSelection(); |
| 971 setNeedsValidityCheck(); | 971 setNeedsValidityCheck(); |
| 972 | 972 |
| 973 if (usesMenuList()) { | 973 if (usesMenuList()) { |
| 974 m_isProcessingUserDrivenChange = flags & UserDriven; | 974 m_isProcessingUserDrivenChange = flags & UserDriven; |
| 975 if (flags & DispatchInputAndChangeEvent) | 975 if (flags & DispatchInputAndChangeEvent) |
| 976 dispatchInputAndChangeEventForMenuList(); | 976 dispatchInputAndChangeEventForMenuList(); |
| 977 if (RenderObject* renderer = this->renderer()) { | 977 if (LayoutObject* renderer = this->renderer()) { |
| 978 if (usesMenuList()) { | 978 if (usesMenuList()) { |
| 979 toRenderMenuList(renderer)->didSetSelectedIndex(listIndex); | 979 toRenderMenuList(renderer)->didSetSelectedIndex(listIndex); |
| 980 } else if (renderer->isListBox()) { | 980 } else if (renderer->isListBox()) { |
| 981 if (AXObjectCache* cache = document().existingAXObjectCache()) | 981 if (AXObjectCache* cache = document().existingAXObjectCache()) |
| 982 cache->selectedChildrenChanged(this); | 982 cache->selectedChildrenChanged(this); |
| 983 } | 983 } |
| 984 } | 984 } |
| 985 } | 985 } |
| 986 | 986 |
| 987 notifyFormStateChanged(); | 987 notifyFormStateChanged(); |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 int focusedIndex = activeSelectionEndListIndex(); | 1775 int focusedIndex = activeSelectionEndListIndex(); |
| 1776 if (focusedIndex < 0) | 1776 if (focusedIndex < 0) |
| 1777 focusedIndex = firstSelectableListIndex(); | 1777 focusedIndex = firstSelectableListIndex(); |
| 1778 if (focusedIndex < 0) | 1778 if (focusedIndex < 0) |
| 1779 return nullptr; | 1779 return nullptr; |
| 1780 HTMLElement* focused = listItems()[focusedIndex]; | 1780 HTMLElement* focused = listItems()[focusedIndex]; |
| 1781 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; | 1781 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; |
| 1782 } | 1782 } |
| 1783 | 1783 |
| 1784 } // namespace | 1784 } // namespace |
| OLD | NEW |