Replace WTF::move with WTFMove
[WebKit-https.git] / Source / WebCore / html / HTMLMeterElement.cpp
index 4ca3f64..36d27a7 100644 (file)
@@ -23,7 +23,7 @@
 #include "HTMLMeterElement.h"
 
 #include "Attribute.h"
-#include "ElementTraversal.h"
+#include "ElementIterator.h"
 #include "EventNames.h"
 #include "ExceptionCode.h"
 #include "FormDataList.h"
@@ -50,22 +50,22 @@ HTMLMeterElement::~HTMLMeterElement()
 {
 }
 
-PassRefPtr<HTMLMeterElement> HTMLMeterElement::create(const QualifiedName& tagName, Document& document)
+Ref<HTMLMeterElement> HTMLMeterElement::create(const QualifiedName& tagName, Document& document)
 {
-    RefPtr<HTMLMeterElement> meter = adoptRef(new HTMLMeterElement(tagName, document));
+    Ref<HTMLMeterElement> meter = adoptRef(*new HTMLMeterElement(tagName, document));
     meter->ensureUserAgentShadowRoot();
     return meter;
 }
 
-RenderElement* HTMLMeterElement::createRenderer(RenderArena& arena, RenderStyle& style)
+RenderPtr<RenderElement> HTMLMeterElement::createElementRenderer(Ref<RenderStyle>&& style, const RenderTreePosition&)
 {
-    if (hasAuthorShadowRoot() || !document().page()->theme()->supportsMeter(style.appearance()))
-        return RenderElement::createFor(*this, style);
+    if (!document().page()->theme().supportsMeter(style.get().appearance()))
+        return RenderElement::createFor(*this, WTFMove(style));
 
-    return new (arena) RenderMeter(*this);
+    return createRenderer<RenderMeter>(*this, WTFMove(style));
 }
 
-bool HTMLMeterElement::childShouldCreateRenderer(const Node* child) const
+bool HTMLMeterElement::childShouldCreateRenderer(const Node& child) const
 {
     return hasShadowRootParent(child) && HTMLElement::childShouldCreateRenderer(child);
 }
@@ -220,25 +220,25 @@ void HTMLMeterElement::didElementStateChange()
 
 RenderMeter* HTMLMeterElement::renderMeter() const
 {
-    if (renderer() && renderer()->isMeter())
-        return toRenderMeter(renderer());
-    return toRenderMeter(ElementTraversal::firstWithin(userAgentShadowRoot())->renderer());
+    if (is<RenderMeter>(renderer()))
+        return downcast<RenderMeter>(renderer());
+    return downcast<RenderMeter>(descendantsOfType<Element>(*userAgentShadowRoot()).first()->renderer());
 }
 
 void HTMLMeterElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 {
     ASSERT(!m_value);
 
-    RefPtr<MeterInnerElement> inner = MeterInnerElement::create(document());
-    root->appendChild(inner);
+    Ref<MeterInnerElement> inner = MeterInnerElement::create(document());
+    root->appendChild(inner.copyRef());
 
-    RefPtr<MeterBarElement> bar = MeterBarElement::create(document());
+    Ref<MeterBarElement> bar = MeterBarElement::create(document());
     m_value = MeterValueElement::create(document());
     m_value->setWidthPercentage(0);
     m_value->updatePseudo();
-    bar->appendChild(m_value, ASSERT_NO_EXCEPTION);
+    bar->appendChild(*m_value, ASSERT_NO_EXCEPTION);
 
-    inner->appendChild(bar, ASSERT_NO_EXCEPTION);
+    inner->appendChild(WTFMove(bar), ASSERT_NO_EXCEPTION);
 }
 
 } // namespace