From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/html/HTMLOptionsCollection.cpp | 45 ++++++--------------------- 1 file changed, 9 insertions(+), 36 deletions(-) (limited to 'Source/WebCore/html/HTMLOptionsCollection.cpp') diff --git a/Source/WebCore/html/HTMLOptionsCollection.cpp b/Source/WebCore/html/HTMLOptionsCollection.cpp index c8f12313d..2f885de48 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.cpp +++ b/Source/WebCore/html/HTMLOptionsCollection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2011, 2012 Apple Computer, Inc. + * Copyright (C) 2006, 2011, 2012 Apple Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,56 +21,29 @@ #include "config.h" #include "HTMLOptionsCollection.h" -#include "ExceptionCode.h" -#include "HTMLOptionElement.h" - namespace WebCore { HTMLOptionsCollection::HTMLOptionsCollection(HTMLSelectElement& select) - : HTMLCollection(select, SelectOptions) + : CachedHTMLCollection::traversalType>(select, SelectOptions) { } -PassRef HTMLOptionsCollection::create(HTMLSelectElement& select, CollectionType) +Ref HTMLOptionsCollection::create(HTMLSelectElement& select, CollectionType) { return adoptRef(*new HTMLOptionsCollection(select)); } -void HTMLOptionsCollection::add(PassRefPtr element, ExceptionCode& ec) +ExceptionOr HTMLOptionsCollection::add(const OptionOrOptGroupElement& element, const std::optional& before) { - add(element, length(), ec); -} - -void HTMLOptionsCollection::add(PassRefPtr element, int index, ExceptionCode& ec) -{ - HTMLOptionElement* newOption = element.get(); - - if (!newOption) { - ec = TYPE_MISMATCH_ERR; - return; - } - - if (index < -1) { - ec = INDEX_SIZE_ERR; - return; - } - - ec = 0; - - if (index == -1 || unsigned(index) >= length()) - selectElement().add(newOption, 0, ec); - else - selectElement().add(newOption, toHTMLOptionElement(item(index)), ec); - - ASSERT(!ec); + return selectElement().add(element, before); } void HTMLOptionsCollection::remove(int index) { - selectElement().removeByIndex(index); + selectElement().remove(index); } -void HTMLOptionsCollection::remove(HTMLOptionElement* option) +void HTMLOptionsCollection::remove(HTMLOptionElement& option) { selectElement().remove(option); } @@ -85,9 +58,9 @@ void HTMLOptionsCollection::setSelectedIndex(int index) selectElement().setSelectedIndex(index); } -void HTMLOptionsCollection::setLength(unsigned length, ExceptionCode& ec) +ExceptionOr HTMLOptionsCollection::setLength(unsigned length) { - selectElement().setLength(length, ec); + return selectElement().setLength(length); } } //namespace -- cgit v1.2.1