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/HTMLOptionElement.cpp | 157 ++++++++++++------------------ 1 file changed, 60 insertions(+), 97 deletions(-) (limited to 'Source/WebCore/html/HTMLOptionElement.cpp') diff --git a/Source/WebCore/html/HTMLOptionElement.cpp b/Source/WebCore/html/HTMLOptionElement.cpp index f5049b674..8fbe51edb 100644 --- a/Source/WebCore/html/HTMLOptionElement.cpp +++ b/Source/WebCore/html/HTMLOptionElement.cpp @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) * (C) 2006 Alexey Proskuryakov (ap@nypop.com) - * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2004-2017 Apple Inc. All rights reserved. * Copyright (C) 2010 Google Inc. All rights reserved. * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. * @@ -27,9 +27,7 @@ #include "config.h" #include "HTMLOptionElement.h" -#include "Attribute.h" #include "Document.h" -#include "ExceptionCode.h" #include "HTMLDataListElement.h" #include "HTMLNames.h" #include "HTMLOptGroupElement.h" @@ -57,79 +55,62 @@ HTMLOptionElement::HTMLOptionElement(const QualifiedName& tagName, Document& doc setHasCustomStyleResolveCallbacks(); } -PassRefPtr HTMLOptionElement::create(Document& document) +Ref HTMLOptionElement::create(Document& document) { - return adoptRef(new HTMLOptionElement(optionTag, document)); + return adoptRef(*new HTMLOptionElement(optionTag, document)); } -PassRefPtr HTMLOptionElement::create(const QualifiedName& tagName, Document& document) +Ref HTMLOptionElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new HTMLOptionElement(tagName, document)); + return adoptRef(*new HTMLOptionElement(tagName, document)); } -PassRefPtr HTMLOptionElement::createForJSConstructor(Document& document, const String& data, const String& value, - bool defaultSelected, bool selected, ExceptionCode& ec) +ExceptionOr> HTMLOptionElement::createForJSConstructor(Document& document, + const String& data, const String& value, bool defaultSelected, bool selected) { - RefPtr element = adoptRef(new HTMLOptionElement(optionTag, document)); + Ref element = adoptRef(*new HTMLOptionElement(optionTag, document)); - RefPtr text = Text::create(document, data.isNull() ? "" : data); + auto text = Text::create(document, data.isNull() ? emptyString() : data); - ec = 0; - element->appendChild(text.release(), ec); - if (ec) - return 0; + auto appendResult = element->appendChild(text); + if (appendResult.hasException()) + return appendResult.releaseException(); if (!value.isNull()) element->setValue(value); if (defaultSelected) - element->setAttribute(selectedAttr, emptyAtom); + element->setAttributeWithoutSynchronization(selectedAttr, emptyAtom); element->setSelected(selected); - return element.release(); + return WTFMove(element); } -void HTMLOptionElement::didAttachRenderers() +bool HTMLOptionElement::isFocusable() const { - // If after attaching nothing called styleForRenderer() on this node we - // manually cache the value. This happens if our parent doesn't have a - // renderer like or if it doesn't allow children like