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

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

Issue 1292653003: [bindings] Avoid using custom binding for HTMLOptionsCollection.length attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missed to fix the test case! Created 5 years, 4 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 | « Source/core/html/HTMLOptionsCollection.idl ('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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (!exceptionState.hadException()) { 479 if (!exceptionState.hadException()) {
480 add(element, before, exceptionState); 480 add(element, before, exceptionState);
481 if (diff >= 0 && option->selected()) 481 if (diff >= 0 && option->selected())
482 optionSelectionStateChanged(option, true); 482 optionSelectionStateChanged(option, true);
483 } 483 }
484 } 484 }
485 485
486 void HTMLSelectElement::setLength(unsigned newLen, ExceptionState& exceptionStat e) 486 void HTMLSelectElement::setLength(unsigned newLen, ExceptionState& exceptionStat e)
487 { 487 {
488 if (newLen > maxSelectItems) 488 if (newLen > maxSelectItems)
489 newLen = maxSelectItems; 489 return;
490 int diff = length() - newLen; 490 int diff = length() - newLen;
491 491
492 if (diff < 0) { // Add dummy elements. 492 if (diff < 0) { // Add dummy elements.
493 do { 493 do {
494 appendChild(document().createElement(optionTag, false), exceptionSta te); 494 appendChild(document().createElement(optionTag, false), exceptionSta te);
495 if (exceptionState.hadException()) 495 if (exceptionState.hadException())
496 break; 496 break;
497 } while (++diff); 497 } while (++diff);
498 } else { 498 } else {
499 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& items = listIte ms(); 499 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& items = listIte ms();
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 int focusedIndex = activeSelectionEndListIndex(); 1780 int focusedIndex = activeSelectionEndListIndex();
1781 if (focusedIndex < 0) 1781 if (focusedIndex < 0)
1782 focusedIndex = firstSelectableListIndex(); 1782 focusedIndex = firstSelectableListIndex();
1783 if (focusedIndex < 0) 1783 if (focusedIndex < 0)
1784 return nullptr; 1784 return nullptr;
1785 HTMLElement* focused = listItems()[focusedIndex]; 1785 HTMLElement* focused = listItems()[focusedIndex];
1786 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr ; 1786 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr ;
1787 } 1787 }
1788 1788
1789 } // namespace 1789 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLOptionsCollection.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698