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

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

Issue 2123863002: Improve performance of HTMLSelectElement::deselectItemsWithoutValidation(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 // change events for list boxes whenever the selection change is actually 1185 // change events for list boxes whenever the selection change is actually
1186 // made. This matches other browsers' behavior. 1186 // made. This matches other browsers' behavior.
1187 if (usesMenuList()) 1187 if (usesMenuList())
1188 dispatchInputAndChangeEventForMenuList(); 1188 dispatchInputAndChangeEventForMenuList();
1189 m_lastOnChangeSelection.clear(); 1189 m_lastOnChangeSelection.clear();
1190 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement, type, sourceCapabilities); 1190 HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement, type, sourceCapabilities);
1191 } 1191 }
1192 1192
1193 void HTMLSelectElement::deselectItemsWithoutValidation(HTMLElement* excludeEleme nt) 1193 void HTMLSelectElement::deselectItemsWithoutValidation(HTMLElement* excludeEleme nt)
1194 { 1194 {
1195 if (!multiple() && usesMenuList() && m_lastOnChangeOption && m_lastOnChangeO ption != excludeElement) {
1196 m_lastOnChangeOption->setSelectedState(false);
1197 return;
1198 }
1195 for (auto& element : listItems()) { 1199 for (auto& element : listItems()) {
1196 if (element != excludeElement && isHTMLOptionElement(*element)) 1200 if (element != excludeElement && isHTMLOptionElement(*element))
1197 toHTMLOptionElement(element)->setSelectedState(false); 1201 toHTMLOptionElement(element)->setSelectedState(false);
1198 } 1202 }
1199 } 1203 }
1200 1204
1201 FormControlState HTMLSelectElement::saveFormControlState() const 1205 FormControlState HTMLSelectElement::saveFormControlState() const
1202 { 1206 {
1203 const ListItems& items = listItems(); 1207 const ListItems& items = listItems();
1204 size_t length = items.size(); 1208 size_t length = items.size();
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 } 2140 }
2137 2141
2138 void HTMLSelectElement::didMutateSubtree() 2142 void HTMLSelectElement::didMutateSubtree()
2139 { 2143 {
2140 DCHECK(popupIsVisible()); 2144 DCHECK(popupIsVisible());
2141 DCHECK(m_popup); 2145 DCHECK(m_popup);
2142 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2146 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2143 } 2147 }
2144 2148
2145 } // namespace blink 2149 } // 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