Chromium Code Reviews| 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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 // Cache the selection state so we can restore the old selection as the new | 644 // Cache the selection state so we can restore the old selection as the new |
| 645 // selection pivots around this anchor index. | 645 // selection pivots around this anchor index. |
| 646 // Example: | 646 // Example: |
| 647 // 1. Press the mouse button on the second OPTION | 647 // 1. Press the mouse button on the second OPTION |
| 648 // m_activeSelectionAnchorIndex = 1 | 648 // m_activeSelectionAnchorIndex = 1 |
| 649 // 2. Drag the mouse pointer onto the fifth OPTION | 649 // 2. Drag the mouse pointer onto the fifth OPTION |
| 650 // m_activeSelectionEndIndex = 4, options at 1-4 indices are selected. | 650 // m_activeSelectionEndIndex = 4, options at 1-4 indices are selected. |
| 651 // 3. Drag the mouse pointer onto the fourth OPTION | 651 // 3. Drag the mouse pointer onto the fourth OPTION |
| 652 // m_activeSelectionEndIndex = 3, options at 1-3 indices are selected. | 652 // m_activeSelectionEndIndex = 3, options at 1-3 indices are selected. |
| 653 // updateListBoxSelection needs to clear selection of the fifth OPTION. | 653 // updateListBoxSelection needs to clear selection of the fifth OPTION. |
| 654 m_cachedStateForActiveSelection.clear(); | 654 m_cachedStateForActiveSelection.resize(0); |
| 655 for (auto& element : listItems()) { | 655 for (auto& element : listItems()) { |
| 656 m_cachedStateForActiveSelection.append(isHTMLOptionElement(*element) && toHTMLOptionElement(element)->selected()); | 656 m_cachedStateForActiveSelection.append(isHTMLOptionElement(*element) && toHTMLOptionElement(element)->selected()); |
| 657 } | 657 } |
| 658 } | 658 } |
| 659 | 659 |
| 660 void HTMLSelectElement::setActiveSelectionEnd(HTMLOptionElement* option) | 660 void HTMLSelectElement::setActiveSelectionEnd(HTMLOptionElement* option) |
| 661 { | 661 { |
| 662 m_activeSelectionEnd = option; | 662 m_activeSelectionEnd = option; |
| 663 } | 663 } |
| 664 | 664 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 793 | 793 |
| 794 if (layoutObject()) { | 794 if (layoutObject()) { |
| 795 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che()) | 795 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che()) |
| 796 cache->childrenChanged(this); | 796 cache->childrenChanged(this); |
| 797 } | 797 } |
| 798 } | 798 } |
| 799 | 799 |
| 800 void HTMLSelectElement::recalcListItems() const | 800 void HTMLSelectElement::recalcListItems() const |
| 801 { | 801 { |
| 802 TRACE_EVENT0("blink", "HTMLSelectElement::recalcListItems"); | 802 TRACE_EVENT0("blink", "HTMLSelectElement::recalcListItems"); |
| 803 m_listItems.clear(); | 803 m_listItems.resize(0); |
|
sof
2016/06/29 05:43:24
Isn't there a risk of m_listItem's backing store n
tkent
2016/06/29 06:07:46
There is.
But I guess such scenario is not common.
| |
| 804 | 804 |
| 805 m_shouldRecalcListItems = false; | 805 m_shouldRecalcListItems = false; |
| 806 | 806 |
| 807 for (Element* currentElement = ElementTraversal::firstWithin(*this); current Element && m_listItems.size() < maxListItems; ) { | 807 for (Element* currentElement = ElementTraversal::firstWithin(*this); current Element && m_listItems.size() < maxListItems; ) { |
| 808 if (!currentElement->isHTMLElement()) { | 808 if (!currentElement->isHTMLElement()) { |
| 809 currentElement = ElementTraversal::nextSkippingChildren(*currentElem ent, this); | 809 currentElement = ElementTraversal::nextSkippingChildren(*currentElem ent, this); |
| 810 continue; | 810 continue; |
| 811 } | 811 } |
| 812 HTMLElement& current = toHTMLElement(*currentElement); | 812 HTMLElement& current = toHTMLElement(*currentElement); |
| 813 | 813 |
| (...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2072 } | 2072 } |
| 2073 | 2073 |
| 2074 void HTMLSelectElement::didMutateSubtree() | 2074 void HTMLSelectElement::didMutateSubtree() |
| 2075 { | 2075 { |
| 2076 DCHECK(popupIsVisible()); | 2076 DCHECK(popupIsVisible()); |
| 2077 DCHECK(m_popup); | 2077 DCHECK(m_popup); |
| 2078 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2078 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2079 } | 2079 } |
| 2080 | 2080 |
| 2081 } // namespace blink | 2081 } // namespace blink |
| OLD | NEW |