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

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

Issue 2109993003: Remove redundant calls to HTMLSelectElement::setRecalcListItems(). (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
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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 HTMLCollection* HTMLSelectElement::selectedOptions() 413 HTMLCollection* HTMLSelectElement::selectedOptions()
414 { 414 {
415 return ensureCachedCollection<HTMLCollection>(SelectedOptions); 415 return ensureCachedCollection<HTMLCollection>(SelectedOptions);
416 } 416 }
417 417
418 HTMLOptionsCollection* HTMLSelectElement::options() 418 HTMLOptionsCollection* HTMLSelectElement::options()
419 { 419 {
420 return ensureCachedCollection<HTMLOptionsCollection>(SelectOptions); 420 return ensureCachedCollection<HTMLOptionsCollection>(SelectOptions);
421 } 421 }
422 422
423 void HTMLSelectElement::childrenChanged(const ChildrenChange& change)
424 {
425 setRecalcListItems();
426 setNeedsValidityCheck();
427 m_lastOnChangeSelection.clear();
428
429 HTMLFormControlElementWithState::childrenChanged(change);
430 }
431
432 void HTMLSelectElement::optionElementChildrenChanged(const HTMLOptionElement& op tion) 423 void HTMLSelectElement::optionElementChildrenChanged(const HTMLOptionElement& op tion)
433 { 424 {
434 setNeedsValidityCheck(); 425 setNeedsValidityCheck();
435 426
436 if (layoutObject()) { 427 if (layoutObject()) {
437 if (option.selected() && usesMenuList()) 428 if (option.selected() && usesMenuList())
438 layoutObject()->updateFromElement(); 429 layoutObject()->updateFromElement();
439 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che()) 430 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa che())
440 cache->childrenChanged(this); 431 cache->childrenChanged(this);
441 } 432 }
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 { 969 {
979 ASSERT(option.ownerSelectElement() == this); 970 ASSERT(option.ownerSelectElement() == this);
980 setRecalcListItems(); 971 setRecalcListItems();
981 if (optionIsSelected) { 972 if (optionIsSelected) {
982 selectOption(&option); 973 selectOption(&option);
983 } else { 974 } else {
984 // No need to reset if we already have a selected option. 975 // No need to reset if we already have a selected option.
985 if (!m_lastOnChangeOption) 976 if (!m_lastOnChangeOption)
986 resetToDefaultSelection(); 977 resetToDefaultSelection();
987 } 978 }
979 setNeedsValidityCheck();
980 m_lastOnChangeSelection.clear();
988 } 981 }
989 982
990 void HTMLSelectElement::optionRemoved(const HTMLOptionElement& option) 983 void HTMLSelectElement::optionRemoved(const HTMLOptionElement& option)
991 { 984 {
992 setRecalcListItems(); 985 setRecalcListItems();
993 if (option.selected()) 986 if (option.selected())
994 resetToDefaultSelection(ResetReasonSelectedOptionRemoved); 987 resetToDefaultSelection(ResetReasonSelectedOptionRemoved);
995 else if (!m_lastOnChangeOption) 988 else if (!m_lastOnChangeOption)
996 resetToDefaultSelection(); 989 resetToDefaultSelection();
997 if (m_lastOnChangeOption == &option) 990 if (m_lastOnChangeOption == &option)
998 m_lastOnChangeOption.clear(); 991 m_lastOnChangeOption.clear();
999 if (m_optionToScrollTo == &option) 992 if (m_optionToScrollTo == &option)
1000 m_optionToScrollTo.clear(); 993 m_optionToScrollTo.clear();
1001 if (m_activeSelectionAnchor == &option) 994 if (m_activeSelectionAnchor == &option)
1002 m_activeSelectionAnchor.clear(); 995 m_activeSelectionAnchor.clear();
1003 if (m_activeSelectionEnd == &option) 996 if (m_activeSelectionEnd == &option)
1004 m_activeSelectionEnd.clear(); 997 m_activeSelectionEnd.clear();
1005 if (option.selected()) 998 if (option.selected())
1006 setAutofilled(false); 999 setAutofilled(false);
1000 setNeedsValidityCheck();
1001 m_lastOnChangeSelection.clear();
1002 }
1003
1004 void HTMLSelectElement::optGroupInsertedOrRemoved(const HTMLOptGroupElement&)
1005 {
1006 setRecalcListItems();
1007 setNeedsValidityCheck();
1008 m_lastOnChangeSelection.clear();
1009 }
1010
1011 void HTMLSelectElement::hrInsertedOrRemoved(const HTMLHRElement&)
1012 {
1013 setRecalcListItems();
1014 m_lastOnChangeSelection.clear();
1007 } 1015 }
1008 1016
1009 void HTMLSelectElement::selectOption(int optionIndex, SelectOptionFlags flags) 1017 void HTMLSelectElement::selectOption(int optionIndex, SelectOptionFlags flags)
1010 { 1018 {
1011 selectOption(optionIndex < 0 ? nullptr : item(optionIndex), flags); 1019 selectOption(optionIndex < 0 ? nullptr : item(optionIndex), flags);
1012 } 1020 }
1013 1021
1014 void HTMLSelectElement::selectOption(HTMLOptionElement* option, SelectOptionFlag s flags) 1022 void HTMLSelectElement::selectOption(HTMLOptionElement* option, SelectOptionFlag s flags)
1015 { 1023 {
1016 selectOption(option, option ? option->index() : -1, flags); 1024 selectOption(option, option ? option->index() : -1, flags);
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
2078 } 2086 }
2079 2087
2080 void HTMLSelectElement::didMutateSubtree() 2088 void HTMLSelectElement::didMutateSubtree()
2081 { 2089 {
2082 DCHECK(popupIsVisible()); 2090 DCHECK(popupIsVisible());
2083 DCHECK(m_popup); 2091 DCHECK(m_popup);
2084 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2092 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2085 } 2093 }
2086 2094
2087 } // namespace blink 2095 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698