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

Side by Side 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: 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 unified diff | 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 »
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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 return; 607 return;
608 608
609 // Save the selection so it can be compared to the new selectAll selection 609 // Save the selection so it can be compared to the new selectAll selection
610 // when dispatching change events. 610 // when dispatching change events.
611 saveLastSelection(); 611 saveLastSelection();
612 612
613 m_activeSelectionState = true; 613 m_activeSelectionState = true;
614 setActiveSelectionAnchorIndex(nextSelectableListIndex(-1)); 614 setActiveSelectionAnchorIndex(nextSelectableListIndex(-1));
615 setActiveSelectionEndIndex(previousSelectableListIndex(-1)); 615 setActiveSelectionEndIndex(previousSelectableListIndex(-1));
616 616
617 if (m_activeSelectionAnchorIndex < 0)
keishi 2014/12/02 02:40:13 I think updateListBoxSelection should just be able
618 return;
619
617 updateListBoxSelection(false, false); 620 updateListBoxSelection(false, false);
618 listBoxOnChange(); 621 listBoxOnChange();
619 setNeedsValidityCheck(); 622 setNeedsValidityCheck();
620 } 623 }
621 624
622 void HTMLSelectElement::saveLastSelection() 625 void HTMLSelectElement::saveLastSelection()
623 { 626 {
624 if (usesMenuList()) { 627 if (usesMenuList()) {
625 m_lastOnChangeIndex = selectedIndex(); 628 m_lastOnChangeIndex = selectedIndex();
626 return; 629 return;
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 int focusedIndex = activeSelectionEndListIndex(); 1777 int focusedIndex = activeSelectionEndListIndex();
1775 if (focusedIndex < 0) 1778 if (focusedIndex < 0)
1776 focusedIndex = firstSelectableListIndex(); 1779 focusedIndex = firstSelectableListIndex();
1777 if (focusedIndex < 0) 1780 if (focusedIndex < 0)
1778 return nullptr; 1781 return nullptr;
1779 HTMLElement* focused = listItems()[focusedIndex]; 1782 HTMLElement* focused = listItems()[focusedIndex];
1780 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr ; 1783 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr ;
1781 } 1784 }
1782 1785
1783 } // namespace 1786 } // namespace
OLDNEW
« 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