InputType should return input renderers wrapped in RenderPtr.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Dec 2013 03:02:25 +0000 (03:02 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Dec 2013 03:02:25 +0000 (03:02 +0000)
<https://webkit.org/b/126307>

Rename InputType::createRenderer() to createInputRenderer() and
make it return RenderPtr<RenderElement>. Also made it non-const.

Reviewed by Anders Carlsson.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161167 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/html/BaseButtonInputType.cpp
Source/WebCore/html/BaseButtonInputType.h
Source/WebCore/html/FileInputType.cpp
Source/WebCore/html/FileInputType.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HiddenInputType.cpp
Source/WebCore/html/HiddenInputType.h
Source/WebCore/html/ImageInputType.cpp
Source/WebCore/html/ImageInputType.h
Source/WebCore/html/InputType.cpp
Source/WebCore/html/InputType.h
Source/WebCore/html/RangeInputType.cpp
Source/WebCore/html/RangeInputType.h
Source/WebCore/html/SearchInputType.cpp
Source/WebCore/html/SearchInputType.h
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/html/TextFieldInputType.h

index 03016f8d91faa562ac9ba472fd86c72d29407db9..bf7f3896e5071bf19d18ec02c46a8bdfc6fecc5a 100644 (file)
@@ -1,3 +1,13 @@
+2013-12-30  Andreas Kling  <akling@apple.com>
+
+        InputType should return input renderers wrapped in RenderPtr.
+        <https://webkit.org/b/126307>
+
+        Rename InputType::createRenderer() to createInputRenderer() and
+        make it return RenderPtr<RenderElement>. Also made it non-const.
+
+        Reviewed by Anders Carlsson.
+
 2013-12-30  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         Cleanup static_cast<HTMLFormElement*> by using toHTMLFormElement()
 2013-12-30  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         Cleanup static_cast<HTMLFormElement*> by using toHTMLFormElement()
index 547d651c695a266a697907d9244b14ffdbe2215f..0b18b4f0705834e4cff30ea23ac1fcf1efed1481 100644 (file)
@@ -52,9 +52,9 @@ bool BaseButtonInputType::appendFormData(FormDataList&, bool) const
     return false;
 }
 
     return false;
 }
 
-RenderElement* BaseButtonInputType::createRenderer(PassRef<RenderStyle> style) const
+RenderPtr<RenderElement> BaseButtonInputType::createInputRenderer(PassRef<RenderStyle> style)
 {
 {
-    return new RenderButton(element(), std::move(style));
+    return createRenderer<RenderButton>(element(), std::move(style));
 }
 
 bool BaseButtonInputType::storesValueSeparateFromAttribute()
 }
 
 bool BaseButtonInputType::storesValueSeparateFromAttribute()
index 1d78f097fb40e58a4239b58c3f918db7ba8ce140..01cb2325fc862153ec16ecfa89ad227a744602be 100644 (file)
@@ -43,7 +43,7 @@ protected:
 private:
     virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE;
     virtual bool appendFormData(FormDataList&, bool) const OVERRIDE;
 private:
     virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE;
     virtual bool appendFormData(FormDataList&, bool) const OVERRIDE;
-    virtual RenderElement* createRenderer(PassRef<RenderStyle>) const OVERRIDE;
+    virtual RenderPtr<RenderElement> createInputRenderer(PassRef<RenderStyle>) OVERRIDE;
     virtual bool storesValueSeparateFromAttribute() OVERRIDE;
     virtual void setValue(const String&, bool, TextFieldEventBehavior) OVERRIDE;
 };
     virtual bool storesValueSeparateFromAttribute() OVERRIDE;
     virtual void setValue(const String&, bool, TextFieldEventBehavior) OVERRIDE;
 };
index c07afb89e5a9655b061dd67eb3e322ca16656a1c..9e2c527beade0842f2deb08280eec141ab547474 100644 (file)
@@ -208,9 +208,9 @@ void FileInputType::handleDOMActivateEvent(Event* event)
     event->setDefaultHandled();
 }
 
     event->setDefaultHandled();
 }
 
-RenderElement* FileInputType::createRenderer(PassRef<RenderStyle> style) const
+RenderPtr<RenderElement> FileInputType::createInputRenderer(PassRef<RenderStyle> style)
 {
 {
-    return new RenderFileUploadControl(element(), std::move(style));
+    return createRenderer<RenderFileUploadControl>(element(), std::move(style));
 }
 
 bool FileInputType::canSetStringValue() const
 }
 
 bool FileInputType::canSetStringValue() const
index de9712eda8ad33fee85ddac1e3bab1677056f106..06503060e33f5131b030754fdaf9cc57a02a354d 100644 (file)
@@ -58,7 +58,7 @@ private:
     virtual bool valueMissing(const String&) const OVERRIDE;
     virtual String valueMissingText() const OVERRIDE;
     virtual void handleDOMActivateEvent(Event*) OVERRIDE;
     virtual bool valueMissing(const String&) const OVERRIDE;
     virtual String valueMissingText() const OVERRIDE;
     virtual void handleDOMActivateEvent(Event*) OVERRIDE;
-    virtual RenderElement* createRenderer(PassRef<RenderStyle>) const OVERRIDE;
+    virtual RenderPtr<RenderElement> createInputRenderer(PassRef<RenderStyle>) OVERRIDE;
     virtual bool canSetStringValue() const OVERRIDE;
     virtual bool canChangeFromAnotherType() const OVERRIDE;
     virtual FileList* files() OVERRIDE;
     virtual bool canSetStringValue() const OVERRIDE;
     virtual bool canChangeFromAnotherType() const OVERRIDE;
     virtual FileList* files() OVERRIDE;
index 0cf2cc658ce6bef8260dd97e6d6712c2250bd9fd..30e25f5841e328c810a145e601ba3ee5341df9bb 100644 (file)
@@ -782,7 +782,7 @@ bool HTMLInputElement::rendererIsNeeded(const RenderStyle& style)
 
 RenderElement* HTMLInputElement::createRenderer(PassRef<RenderStyle> style)
 {
 
 RenderElement* HTMLInputElement::createRenderer(PassRef<RenderStyle> style)
 {
-    return m_inputType->createRenderer(std::move(style));
+    return m_inputType->createInputRenderer(std::move(style)).leakPtr();
 }
 
 void HTMLInputElement::willAttachRenderers()
 }
 
 void HTMLInputElement::willAttachRenderers()
index 71f7c1cd759cae04dbaa2d0bfee8430b93640265..15eac5d51ca1ca9f8f5bc4c6400e67361400fb15 100644 (file)
@@ -37,6 +37,7 @@
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include "InputTypeNames.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include "InputTypeNames.h"
+#include "RenderElement.h"
 
 namespace WebCore {
 
 
 namespace WebCore {
 
@@ -66,10 +67,10 @@ bool HiddenInputType::supportsValidation() const
     return false;
 }
 
     return false;
 }
 
-RenderElement* HiddenInputType::createRenderer(PassRef<RenderStyle>) const
+RenderPtr<RenderElement> HiddenInputType::createInputRenderer(PassRef<RenderStyle>)
 {
     ASSERT_NOT_REACHED();
 {
     ASSERT_NOT_REACHED();
-    return 0;
+    return nullptr;
 }
 
 void HiddenInputType::accessKeyAction(bool)
 }
 
 void HiddenInputType::accessKeyAction(bool)
index f7087c07d2cc4aac989139cc2934611b5babcad4..0f897652423eef217d588e0cc22e37e001f02331 100644 (file)
@@ -44,7 +44,7 @@ private:
     virtual FormControlState saveFormControlState() const OVERRIDE;
     virtual void restoreFormControlState(const FormControlState&) OVERRIDE;
     virtual bool supportsValidation() const OVERRIDE;
     virtual FormControlState saveFormControlState() const OVERRIDE;
     virtual void restoreFormControlState(const FormControlState&) OVERRIDE;
     virtual bool supportsValidation() const OVERRIDE;
-    virtual RenderElement* createRenderer(PassRef<RenderStyle>) const OVERRIDE;
+    virtual RenderPtr<RenderElement> createInputRenderer(PassRef<RenderStyle>) OVERRIDE;
     virtual void accessKeyAction(bool sendMouseEvents) OVERRIDE;
     virtual bool rendererIsNeeded() OVERRIDE;
     virtual bool storesValueSeparateFromAttribute() OVERRIDE;
     virtual void accessKeyAction(bool sendMouseEvents) OVERRIDE;
     virtual bool rendererIsNeeded() OVERRIDE;
     virtual bool storesValueSeparateFromAttribute() OVERRIDE;
index 88c24ea11dec5ce86fd9b9219ae65be315adb00f..28fe7505f34bd16c6ba031d498637012ad2ab309 100644 (file)
@@ -101,11 +101,11 @@ void ImageInputType::handleDOMActivateEvent(Event* event)
     event->setDefaultHandled();
 }
 
     event->setDefaultHandled();
 }
 
-RenderElement* ImageInputType::createRenderer(PassRef<RenderStyle> style) const
+RenderPtr<RenderElement> ImageInputType::createInputRenderer(PassRef<RenderStyle> style)
 {
 {
-    RenderImage* image = new RenderImage(element(), std::move(style));
+    auto image = createRenderer<RenderImage>(element(), std::move(style));
     image->setImageResource(RenderImageResource::create());
     image->setImageResource(RenderImageResource::create());
-    return image;
+    return std::move(image);
 }
 
 void ImageInputType::altAttributeChanged()
 }
 
 void ImageInputType::altAttributeChanged()
index b1116210c73b21f9d45970a36e65c76caac4ca60..c2db54b43fd7cbc87db3ea748918c58c9823ed0a 100644 (file)
@@ -47,7 +47,7 @@ private:
     virtual bool isFormDataAppendable() const OVERRIDE;
     virtual bool appendFormData(FormDataList&, bool) const OVERRIDE;
     virtual bool supportsValidation() const OVERRIDE;
     virtual bool isFormDataAppendable() const OVERRIDE;
     virtual bool appendFormData(FormDataList&, bool) const OVERRIDE;
     virtual bool supportsValidation() const OVERRIDE;
-    virtual RenderElement* createRenderer(PassRef<RenderStyle>) const OVERRIDE;
+    virtual RenderPtr<RenderElement> createInputRenderer(PassRef<RenderStyle>) OVERRIDE;
     virtual void handleDOMActivateEvent(Event*) OVERRIDE;
     virtual void altAttributeChanged() OVERRIDE;
     virtual void srcAttributeChanged() OVERRIDE;
     virtual void handleDOMActivateEvent(Event*) OVERRIDE;
     virtual void altAttributeChanged() OVERRIDE;
     virtual void srcAttributeChanged() OVERRIDE;
index cfbd1e32be2c45a16465261e7993d9e2146fe81d..6ee059051c43ee39cbaf25dfca914b4a1001153e 100644 (file)
@@ -479,9 +479,9 @@ PassRefPtr<HTMLFormElement> InputType::formForSubmission() const
     return element().form();
 }
 
     return element().form();
 }
 
-RenderElement* InputType::createRenderer(PassRef<RenderStyle> style) const
+RenderPtr<RenderElement> InputType::createInputRenderer(PassRef<RenderStyle> style)
 {
 {
-    return RenderElement::createFor(element(), std::move(style));
+    return RenderPtr<RenderElement>(RenderElement::createFor(element(), std::move(style)));
 }
 
 void InputType::blur()
 }
 
 void InputType::blur()
index d0dc504fbb58526fec502f656ce3b6490fce1161..a5d606df9c9b835e4b920cb87267e71133a00a06 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "FeatureObserver.h"
 #include "HTMLTextFormControlElement.h"
 
 #include "FeatureObserver.h"
 #include "HTMLTextFormControlElement.h"
+#include "RenderPtr.h"
 #include "StepRange.h"
 #include <wtf/FastMalloc.h>
 #include <wtf/Forward.h>
 #include "StepRange.h"
 #include <wtf/FastMalloc.h>
 #include <wtf/Forward.h>
@@ -236,7 +237,7 @@ public:
     // Miscellaneous functions
 
     virtual bool rendererIsNeeded();
     // Miscellaneous functions
 
     virtual bool rendererIsNeeded();
-    virtual RenderElement* createRenderer(PassRef<RenderStyle>) const;
+    virtual RenderPtr<RenderElement> createInputRenderer(PassRef<RenderStyle>);
     virtual void addSearchResult();
     virtual void attach();
     virtual void detach();
     virtual void addSearchResult();
     virtual void attach();
     virtual void detach();
index 4b16a005d3393d61ecfc37959e0cbb3e1c5c2392..1c58576035e4f789969d77bdf75435768ba6cf10 100644 (file)
@@ -289,9 +289,9 @@ HTMLElement* RangeInputType::sliderThumbElement() const
     return &typedSliderThumbElement();
 }
 
     return &typedSliderThumbElement();
 }
 
-RenderElement* RangeInputType::createRenderer(PassRef<RenderStyle> style) const
+RenderPtr<RenderElement> RangeInputType::createInputRenderer(PassRef<RenderStyle> style)
 {
 {
-    return new RenderSlider(element(), std::move(style));
+    return createRenderer<RenderSlider>(element(), std::move(style));
 }
 
 Decimal RangeInputType::parseToNumber(const String& src, const Decimal& defaultValue) const
 }
 
 Decimal RangeInputType::parseToNumber(const String& src, const Decimal& defaultValue) const
index ac01e24edb4efd70baf514919484b76f87ce6394..59670217751c5c13744f7635ceb50c9b784b237b 100644 (file)
@@ -55,7 +55,7 @@ private:
     virtual void handleMouseDownEvent(MouseEvent*) OVERRIDE;
 #endif
     virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE;
     virtual void handleMouseDownEvent(MouseEvent*) OVERRIDE;
 #endif
     virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE;
-    virtual RenderElement* createRenderer(PassRef<RenderStyle>) const OVERRIDE;
+    virtual RenderPtr<RenderElement> createInputRenderer(PassRef<RenderStyle>) OVERRIDE;
     virtual void createShadowSubtree() OVERRIDE;
     virtual Decimal parseToNumber(const String&, const Decimal&) const OVERRIDE;
     virtual String serialize(const Decimal&) const OVERRIDE;
     virtual void createShadowSubtree() OVERRIDE;
     virtual Decimal parseToNumber(const String&, const Decimal&) const OVERRIDE;
     virtual String serialize(const Decimal&) const OVERRIDE;
index 3ddae972d32bbc256b0a9eae7bcd09554d6b5263..7a9e4cadea52633a4fee4cd5d491d1d7d6073361 100644 (file)
@@ -65,9 +65,9 @@ void SearchInputType::addSearchResult()
 #endif
 }
 
 #endif
 }
 
-RenderElement* SearchInputType::createRenderer(PassRef<RenderStyle> style) const
+RenderPtr<RenderElement> SearchInputType::createInputRenderer(PassRef<RenderStyle> style)
 {
 {
-    return new RenderSearchField(element(), std::move(style));
+    return createRenderer<RenderSearchField>(element(), std::move(style));
 }
 
 const AtomicString& SearchInputType::formControlType() const
 }
 
 const AtomicString& SearchInputType::formControlType() const
index 890319ed542d6b5bc07ccc8f06218e042cf588d3..29d03e3cbd459cfdbb82a04cb6426eee57ee9d9a 100644 (file)
@@ -48,7 +48,7 @@ public:
 private:
     virtual void attach() OVERRIDE;
     virtual void addSearchResult() OVERRIDE;
 private:
     virtual void attach() OVERRIDE;
     virtual void addSearchResult() OVERRIDE;
-    virtual RenderElement* createRenderer(PassRef<RenderStyle>) const OVERRIDE;
+    virtual RenderPtr<RenderElement> createInputRenderer(PassRef<RenderStyle>) OVERRIDE;
     virtual const AtomicString& formControlType() const OVERRIDE;
     virtual bool shouldRespectSpeechAttribute() OVERRIDE;
     virtual bool isSearchField() const OVERRIDE;
     virtual const AtomicString& formControlType() const OVERRIDE;
     virtual bool shouldRespectSpeechAttribute() OVERRIDE;
     virtual bool isSearchField() const OVERRIDE;
index 1948f8fdd3983cb7b690903188991086544cfdc7..9381d99cbc5a5a318b7a4dca8acadcb3f57afffc 100644 (file)
@@ -205,9 +205,9 @@ bool TextFieldInputType::shouldSubmitImplicitly(Event* event)
     return (event->type() == eventNames().textInputEvent && event->eventInterface() == TextEventInterfaceType && static_cast<TextEvent*>(event)->data() == "\n") || InputType::shouldSubmitImplicitly(event);
 }
 
     return (event->type() == eventNames().textInputEvent && event->eventInterface() == TextEventInterfaceType && static_cast<TextEvent*>(event)->data() == "\n") || InputType::shouldSubmitImplicitly(event);
 }
 
-RenderElement* TextFieldInputType::createRenderer(PassRef<RenderStyle> style) const
+RenderPtr<RenderElement> TextFieldInputType::createInputRenderer(PassRef<RenderStyle> style)
 {
 {
-    return new RenderTextControlSingleLine(element(), std::move(style));
+    return createRenderer<RenderTextControlSingleLine>(element(), std::move(style));
 }
 
 bool TextFieldInputType::needsContainer() const
 }
 
 bool TextFieldInputType::needsContainer() const
index dcfde9086f7469862411e7653470b917d84d1a0f..759966ad18263ac805d888a205f8476cd0ba5980 100644 (file)
@@ -88,7 +88,7 @@ private:
     virtual void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) OVERRIDE;
     virtual void forwardEvent(Event*) OVERRIDE;
     virtual bool shouldSubmitImplicitly(Event*) OVERRIDE;
     virtual void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) OVERRIDE;
     virtual void forwardEvent(Event*) OVERRIDE;
     virtual bool shouldSubmitImplicitly(Event*) OVERRIDE;
-    virtual RenderElement* createRenderer(PassRef<RenderStyle>) const OVERRIDE;
+    virtual RenderPtr<RenderElement> createInputRenderer(PassRef<RenderStyle>) OVERRIDE;
     virtual bool shouldUseInputMethod() const OVERRIDE;
 #if !PLATFORM(IOS)
     virtual String sanitizeValue(const String&) const OVERRIDE;
     virtual bool shouldUseInputMethod() const OVERRIDE;
 #if !PLATFORM(IOS)
     virtual String sanitizeValue(const String&) const OVERRIDE;