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

Unified Diff: Source/core/html/HTMLSelectElement.cpp

Issue 761463002: Fix listbox selections with only disabled options. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated patch Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/html/crash-on-invalid-selection-index-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLSelectElement.cpp
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp
index 82da0779b342a0275c7bf979e95f88268c8f16bc..e148cea7b8c7c1b185eb3658ac8862c853a83099 100644
--- a/Source/core/html/HTMLSelectElement.cpp
+++ b/Source/core/html/HTMLSelectElement.cpp
@@ -660,20 +660,19 @@ void HTMLSelectElement::setActiveSelectionEndIndex(int index)
void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions, bool scroll)
{
ASSERT(renderer() && (renderer()->isListBox() || m_multiple));
- ASSERT(!listItems().size() || m_activeSelectionAnchorIndex >= 0);
- unsigned start = std::min(m_activeSelectionAnchorIndex, m_activeSelectionEndIndex);
- unsigned end = std::max(m_activeSelectionAnchorIndex, m_activeSelectionEndIndex);
+ int start = std::min(m_activeSelectionAnchorIndex, m_activeSelectionEndIndex);
+ int end = std::max(m_activeSelectionAnchorIndex, m_activeSelectionEndIndex);
const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& items = listItems();
- for (unsigned i = 0; i < items.size(); ++i) {
+ for (int i = 0; i < static_cast<int>(items.size()); ++i) {
HTMLElement* element = items[i];
if (!isHTMLOptionElement(*element) || toHTMLOptionElement(element)->isDisabledFormControl() || !toHTMLOptionElement(element)->renderer())
continue;
if (i >= start && i <= end)
toHTMLOptionElement(element)->setSelectedState(m_activeSelectionState);
- else if (deselectOtherOptions || i >= m_cachedStateForActiveSelection.size())
+ else if (deselectOtherOptions || i >= static_cast<int>(m_cachedStateForActiveSelection.size()))
toHTMLOptionElement(element)->setSelectedState(false);
else
toHTMLOptionElement(element)->setSelectedState(m_cachedStateForActiveSelection[i]);
« no previous file with comments | « LayoutTests/fast/html/crash-on-invalid-selection-index-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698