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

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

Issue 2151763002: SELECT element: Fix a DCHECK failure in optionToBeShown(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SELECT element: Fix a DCHECK failure in optionToBeShown(). 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 | third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp » ('j') | 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 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 1138
1139 void HTMLSelectElement::restoreFormControlState(const FormControlState& state) 1139 void HTMLSelectElement::restoreFormControlState(const FormControlState& state)
1140 { 1140 {
1141 recalcListItems(); 1141 recalcListItems();
1142 1142
1143 const ListItems& items = listItems(); 1143 const ListItems& items = listItems();
1144 size_t itemsSize = items.size(); 1144 size_t itemsSize = items.size();
1145 if (itemsSize == 0) 1145 if (itemsSize == 0)
1146 return; 1146 return;
1147 1147
1148 for (auto& item : items) { 1148 selectOption(nullptr, DeselectOtherOptions);
1149 if (isHTMLOptionElement(item))
1150 toHTMLOptionElement(item)->setSelectedState(false);
1151 }
1152 1149
1153 // The saved state should have at least one value and an index. 1150 // The saved state should have at least one value and an index.
1154 ASSERT(state.valueSize() >= 2); 1151 ASSERT(state.valueSize() >= 2);
1155 if (!multiple()) { 1152 if (!multiple()) {
1156 size_t index = state[1].toUInt(); 1153 size_t index = state[1].toUInt();
1157 if (index < itemsSize && isHTMLOptionElement(items[index]) && toHTMLOpti onElement(items[index])->value() == state[0]) { 1154 if (index < itemsSize && isHTMLOptionElement(items[index]) && toHTMLOpti onElement(items[index])->value() == state[0]) {
1158 toHTMLOptionElement(items[index])->setSelectedState(true); 1155 toHTMLOptionElement(items[index])->setSelectedState(true);
1159 toHTMLOptionElement(items[index])->setDirty(true); 1156 toHTMLOptionElement(items[index])->setDirty(true);
1160 m_lastOnChangeOption = toHTMLOptionElement(items[index]); 1157 m_lastOnChangeOption = toHTMLOptionElement(items[index]);
1161 } else { 1158 } else {
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 } 2055 }
2059 2056
2060 void HTMLSelectElement::didMutateSubtree() 2057 void HTMLSelectElement::didMutateSubtree()
2061 { 2058 {
2062 DCHECK(popupIsVisible()); 2059 DCHECK(popupIsVisible());
2063 DCHECK(m_popup); 2060 DCHECK(m_popup);
2064 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2061 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2065 } 2062 }
2066 2063
2067 } // namespace blink 2064 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698