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/HTMLProgressElement.cpp | 61 ++++++++++++----------------- 1 file changed, 24 insertions(+), 37 deletions(-) (limited to 'Source/WebCore/html/HTMLProgressElement.cpp') diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp index c877fbe05..8b40e1dc2 100644 --- a/Source/WebCore/html/HTMLProgressElement.cpp +++ b/Source/WebCore/html/HTMLProgressElement.cpp @@ -19,13 +19,9 @@ */ #include "config.h" -#if ENABLE(PROGRESS_ELEMENT) #include "HTMLProgressElement.h" -#include "Attribute.h" #include "ElementIterator.h" -#include "EventNames.h" -#include "ExceptionCode.h" #include "HTMLNames.h" #include "HTMLParserIdioms.h" #include "ProgressShadowElement.h" @@ -51,19 +47,19 @@ HTMLProgressElement::~HTMLProgressElement() { } -PassRefPtr HTMLProgressElement::create(const QualifiedName& tagName, Document& document) +Ref HTMLProgressElement::create(const QualifiedName& tagName, Document& document) { - RefPtr progress = adoptRef(new HTMLProgressElement(tagName, document)); + Ref progress = adoptRef(*new HTMLProgressElement(tagName, document)); progress->ensureUserAgentShadowRoot(); - return progress.release(); + return progress; } -RenderPtr HTMLProgressElement::createElementRenderer(PassRef style) +RenderPtr HTMLProgressElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) { - if (!style.get().hasAppearance() || hasAuthorShadowRoot()) - return RenderElement::createFor(*this, std::move(style)); + if (!style.hasAppearance()) + return RenderElement::createFor(*this, WTFMove(style)); - return createRenderer(*this, std::move(style)); + return createRenderer(*this, WTFMove(style)); } bool HTMLProgressElement::childShouldCreateRenderer(const Node& child) const @@ -73,9 +69,9 @@ bool HTMLProgressElement::childShouldCreateRenderer(const Node& child) const RenderProgress* HTMLProgressElement::renderProgress() const { - if (renderer() && renderer()->isProgress()) - return toRenderProgress(renderer()); - return toRenderProgress(descendantsOfType(*userAgentShadowRoot()).first()->renderer()); + if (is(renderer())) + return downcast(renderer()); + return downcast(descendantsOfType(*userAgentShadowRoot()).first()->renderer()); } void HTMLProgressElement::parseAttribute(const QualifiedName& name, const AtomicString& value) @@ -96,32 +92,24 @@ void HTMLProgressElement::didAttachRenderers() double HTMLProgressElement::value() const { - double value = parseToDoubleForNumberType(fastGetAttribute(valueAttr)); + double value = parseToDoubleForNumberType(attributeWithoutSynchronization(valueAttr)); return !std::isfinite(value) || value < 0 ? 0 : std::min(value, max()); } -void HTMLProgressElement::setValue(double value, ExceptionCode& ec) +void HTMLProgressElement::setValue(double value) { - if (!std::isfinite(value)) { - ec = NOT_SUPPORTED_ERR; - return; - } - setAttribute(valueAttr, AtomicString::number(value >= 0 ? value : 0)); + setAttributeWithoutSynchronization(valueAttr, AtomicString::number(value >= 0 ? value : 0)); } double HTMLProgressElement::max() const { - double max = parseToDoubleForNumberType(getAttribute(maxAttr)); + double max = parseToDoubleForNumberType(attributeWithoutSynchronization(maxAttr)); return !std::isfinite(max) || max <= 0 ? 1 : max; } -void HTMLProgressElement::setMax(double max, ExceptionCode& ec) +void HTMLProgressElement::setMax(double max) { - if (!std::isfinite(max)) { - ec = NOT_SUPPORTED_ERR; - return; - } - setAttribute(maxAttr, AtomicString::number(max > 0 ? max : 1)); + setAttributeWithoutSynchronization(maxAttr, AtomicString::number(max > 0 ? max : 1)); } double HTMLProgressElement::position() const @@ -133,7 +121,7 @@ double HTMLProgressElement::position() const bool HTMLProgressElement::isDeterminate() const { - return fastHasAttribute(valueAttr); + return hasAttributeWithoutSynchronization(valueAttr); } void HTMLProgressElement::didElementStateChange() @@ -143,7 +131,7 @@ void HTMLProgressElement::didElementStateChange() bool wasDeterminate = render->isDeterminate(); render->updateFromElement(); if (wasDeterminate != isDeterminate()) - didAffectSelector(AffectedSelectorIndeterminate); + invalidateStyleForSubtree(); } } @@ -151,16 +139,16 @@ void HTMLProgressElement::didAddUserAgentShadowRoot(ShadowRoot* root) { ASSERT(!m_value); - RefPtr inner = ProgressInnerElement::create(document()); + auto inner = ProgressInnerElement::create(document()); root->appendChild(inner); - RefPtr bar = ProgressBarElement::create(document()); - RefPtr value = ProgressValueElement::create(document()); - m_value = value.get(); + auto bar = ProgressBarElement::create(document()); + auto value = ProgressValueElement::create(document()); + m_value = value.ptr(); m_value->setWidthPercentage(HTMLProgressElement::IndeterminatePosition * 100); - bar->appendChild(m_value, ASSERT_NO_EXCEPTION); + bar->appendChild(value); - inner->appendChild(bar, ASSERT_NO_EXCEPTION); + inner->appendChild(bar); } bool HTMLProgressElement::shouldAppearIndeterminate() const @@ -169,4 +157,3 @@ bool HTMLProgressElement::shouldAppearIndeterminate() const } } // namespace -#endif -- cgit v1.2.1