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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 HTMLElement* element = items[i]; | 639 HTMLElement* element = items[i]; |
640 m_cachedStateForActiveSelection.append(isHTMLOptionElement(*element) &&
toHTMLOptionElement(element)->selected()); | 640 m_cachedStateForActiveSelection.append(isHTMLOptionElement(*element) &&
toHTMLOptionElement(element)->selected()); |
641 } | 641 } |
642 } | 642 } |
643 | 643 |
644 void HTMLSelectElement::setActiveSelectionEndIndex(int index) | 644 void HTMLSelectElement::setActiveSelectionEndIndex(int index) |
645 { | 645 { |
646 if (index == m_activeSelectionEndIndex) | 646 if (index == m_activeSelectionEndIndex) |
647 return; | 647 return; |
648 m_activeSelectionEndIndex = index; | 648 m_activeSelectionEndIndex = index; |
649 setNeedsStyleRecalc(SubtreeStyleChange); | 649 setNeedsStyleRecalc(StyleChangeReasonForTracing::Control, SubtreeStyleChange
); |
650 } | 650 } |
651 | 651 |
652 void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions) | 652 void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions) |
653 { | 653 { |
654 ASSERT(renderer() && (renderer()->isListBox() || m_multiple)); | 654 ASSERT(renderer() && (renderer()->isListBox() || m_multiple)); |
655 ASSERT(!listItems().size() || m_activeSelectionAnchorIndex >= 0); | 655 ASSERT(!listItems().size() || m_activeSelectionAnchorIndex >= 0); |
656 | 656 |
657 unsigned start = std::min(m_activeSelectionAnchorIndex, m_activeSelectionEnd
Index); | 657 unsigned start = std::min(m_activeSelectionAnchorIndex, m_activeSelectionEnd
Index); |
658 unsigned end = std::max(m_activeSelectionAnchorIndex, m_activeSelectionEndIn
dex); | 658 unsigned end = std::max(m_activeSelectionAnchorIndex, m_activeSelectionEndIn
dex); |
659 | 659 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 | 763 |
764 void HTMLSelectElement::setRecalcListItems() | 764 void HTMLSelectElement::setRecalcListItems() |
765 { | 765 { |
766 // FIXME: This function does a bunch of confusing things depending on if it | 766 // FIXME: This function does a bunch of confusing things depending on if it |
767 // is in the document or not. | 767 // is in the document or not. |
768 | 768 |
769 m_shouldRecalcListItems = true; | 769 m_shouldRecalcListItems = true; |
770 // Manual selection anchor is reset when manipulating the select programmati
cally. | 770 // Manual selection anchor is reset when manipulating the select programmati
cally. |
771 m_activeSelectionAnchorIndex = -1; | 771 m_activeSelectionAnchorIndex = -1; |
772 setOptionsChangedOnRenderer(); | 772 setOptionsChangedOnRenderer(); |
773 setNeedsStyleRecalc(SubtreeStyleChange); | 773 setNeedsStyleRecalc(StyleChangeReasonForTracing::ControlValue, SubtreeStyleC
hange); |
774 if (!inDocument()) { | 774 if (!inDocument()) { |
775 if (HTMLOptionsCollection* collection = cachedCollection<HTMLOptionsColl
ection>(SelectOptions)) | 775 if (HTMLOptionsCollection* collection = cachedCollection<HTMLOptionsColl
ection>(SelectOptions)) |
776 collection->invalidateCache(); | 776 collection->invalidateCache(); |
777 } | 777 } |
778 if (!inDocument()) | 778 if (!inDocument()) |
779 invalidateSelectedItems(); | 779 invalidateSelectedItems(); |
780 | 780 |
781 if (renderer()) { | 781 if (renderer()) { |
782 if (AXObjectCache* cache = renderer()->document().existingAXObjectCache(
)) | 782 if (AXObjectCache* cache = renderer()->document().existingAXObjectCache(
)) |
783 cache->childrenChanged(this); | 783 cache->childrenChanged(this); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 toHTMLOptionElement(element)->setSelectedState(false); | 1145 toHTMLOptionElement(element)->setSelectedState(false); |
1146 | 1146 |
1147 if (!firstOption) | 1147 if (!firstOption) |
1148 firstOption = toHTMLOptionElement(element); | 1148 firstOption = toHTMLOptionElement(element); |
1149 } | 1149 } |
1150 | 1150 |
1151 if (!selectedOption && firstOption && !m_multiple && m_size <= 1) | 1151 if (!selectedOption && firstOption && !m_multiple && m_size <= 1) |
1152 firstOption->setSelectedState(true); | 1152 firstOption->setSelectedState(true); |
1153 | 1153 |
1154 setOptionsChangedOnRenderer(); | 1154 setOptionsChangedOnRenderer(); |
1155 setNeedsStyleRecalc(SubtreeStyleChange); | 1155 setNeedsStyleRecalc(StyleChangeReasonForTracing::ControlValue, SubtreeStyleC
hange); |
1156 setNeedsValidityCheck(); | 1156 setNeedsValidityCheck(); |
1157 } | 1157 } |
1158 | 1158 |
1159 void HTMLSelectElement::handlePopupOpenKeyboardEvent(Event* event) | 1159 void HTMLSelectElement::handlePopupOpenKeyboardEvent(Event* event) |
1160 { | 1160 { |
1161 focus(); | 1161 focus(); |
1162 // Calling focus() may cause us to lose our renderer. Return true so | 1162 // Calling focus() may cause us to lose our renderer. Return true so |
1163 // that our caller doesn't process the event further, but don't set | 1163 // that our caller doesn't process the event further, but don't set |
1164 // the event as handled. | 1164 // the event as handled. |
1165 if (!renderer() || !renderer()->isMenuList() || isDisabledFormControl()) | 1165 if (!renderer() || !renderer()->isMenuList() || isDisabledFormControl()) |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 int focusedIndex = activeSelectionEndListIndex(); | 1739 int focusedIndex = activeSelectionEndListIndex(); |
1740 if (focusedIndex < 0) | 1740 if (focusedIndex < 0) |
1741 focusedIndex = firstSelectableListIndex(); | 1741 focusedIndex = firstSelectableListIndex(); |
1742 if (focusedIndex < 0) | 1742 if (focusedIndex < 0) |
1743 return nullptr; | 1743 return nullptr; |
1744 HTMLElement* focused = listItems()[focusedIndex]; | 1744 HTMLElement* focused = listItems()[focusedIndex]; |
1745 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; | 1745 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; |
1746 } | 1746 } |
1747 | 1747 |
1748 } // namespace | 1748 } // namespace |
OLD | NEW |