Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSelectElement.cpp

Issue 2118743002: Merge "Improve performance of SELECT element by optimizing Vector." to M52 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 // Cache the selection state so we can restore the old selection as the new 647 // Cache the selection state so we can restore the old selection as the new
648 // selection pivots around this anchor index. 648 // selection pivots around this anchor index.
649 // Example: 649 // Example:
650 // 1. Press the mouse button on the second OPTION 650 // 1. Press the mouse button on the second OPTION
651 // m_activeSelectionAnchorIndex = 1 651 // m_activeSelectionAnchorIndex = 1
652 // 2. Drag the mouse pointer onto the fifth OPTION 652 // 2. Drag the mouse pointer onto the fifth OPTION
653 // m_activeSelectionEndIndex = 4, options at 1-4 indices are selected. 653 // m_activeSelectionEndIndex = 4, options at 1-4 indices are selected.
654 // 3. Drag the mouse pointer onto the fourth OPTION 654 // 3. Drag the mouse pointer onto the fourth OPTION
655 // m_activeSelectionEndIndex = 3, options at 1-3 indices are selected. 655 // m_activeSelectionEndIndex = 3, options at 1-3 indices are selected.
656 // updateListBoxSelection needs to clear selection of the fifth OPTION. 656 // updateListBoxSelection needs to clear selection of the fifth OPTION.
657 m_cachedStateForActiveSelection.clear(); 657 m_cachedStateForActiveSelection.resize(0);
658 for (auto& element : listItems()) { 658 for (auto& element : listItems()) {
659 m_cachedStateForActiveSelection.append(isHTMLOptionElement(*element) && toHTMLOptionElement(element)->selected()); 659 m_cachedStateForActiveSelection.append(isHTMLOptionElement(*element) && toHTMLOptionElement(element)->selected());
660 } 660 }
661 } 661 }
662 662
663 void HTMLSelectElement::setActiveSelectionEnd(HTMLOptionElement* option) 663 void HTMLSelectElement::setActiveSelectionEnd(HTMLOptionElement* option)
664 { 664 {
665 m_activeSelectionEnd = option; 665 m_activeSelectionEnd = option;
666 } 666 }
667 667
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 796
797 if (layoutObject()) { 797 if (layoutObject()) {
798 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che()) 798 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che())
799 cache->childrenChanged(this); 799 cache->childrenChanged(this);
800 } 800 }
801 } 801 }
802 802
803 void HTMLSelectElement::recalcListItems() const 803 void HTMLSelectElement::recalcListItems() const
804 { 804 {
805 TRACE_EVENT0("blink", "HTMLSelectElement::recalcListItems"); 805 TRACE_EVENT0("blink", "HTMLSelectElement::recalcListItems");
806 m_listItems.clear(); 806 m_listItems.resize(0);
807 807
808 m_shouldRecalcListItems = false; 808 m_shouldRecalcListItems = false;
809 809
810 for (Element* currentElement = ElementTraversal::firstWithin(*this); current Element && m_listItems.size() < maxListItems; ) { 810 for (Element* currentElement = ElementTraversal::firstWithin(*this); current Element && m_listItems.size() < maxListItems; ) {
811 if (!currentElement->isHTMLElement()) { 811 if (!currentElement->isHTMLElement()) {
812 currentElement = ElementTraversal::nextSkippingChildren(*currentElem ent, this); 812 currentElement = ElementTraversal::nextSkippingChildren(*currentElem ent, this);
813 continue; 813 continue;
814 } 814 }
815 HTMLElement& current = toHTMLElement(*currentElement); 815 HTMLElement& current = toHTMLElement(*currentElement);
816 816
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 } 2083 }
2084 2084
2085 void HTMLSelectElement::didMutateSubtree() 2085 void HTMLSelectElement::didMutateSubtree()
2086 { 2086 {
2087 DCHECK(popupIsVisible()); 2087 DCHECK(popupIsVisible());
2088 DCHECK(m_popup); 2088 DCHECK(m_popup);
2089 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2089 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2090 } 2090 }
2091 2091
2092 } // namespace blink 2092 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698