Diff
Modified: trunk/Source/WebCore/ChangeLog (155818 => 155819)
--- trunk/Source/WebCore/ChangeLog 2013-09-15 18:25:10 UTC (rev 155818)
+++ trunk/Source/WebCore/ChangeLog 2013-09-15 18:47:05 UTC (rev 155819)
@@ -1,5 +1,28 @@
2013-09-15 Sam Weinig <s...@webkit.org>
+ CTTE: Node subclasses should take a Document by reference in their constructor (Part 10)
+ https://bugs.webkit.org/show_bug.cgi?id=121397
+
+ Reviewed by Andreas Kling.
+
+ Convert the bindings code to pass a Document reference for named constructors.
+
+ * bindings/js/JSImageConstructor.cpp:
+ (WebCore::constructImage):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateConstructorDefinition):
+ * html/HTMLAudioElement.cpp:
+ (WebCore::HTMLAudioElement::createForJSConstructor):
+ * html/HTMLAudioElement.h:
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::createForJSConstructor):
+ * html/HTMLImageElement.h:
+ * html/HTMLOptionElement.cpp:
+ (WebCore::HTMLOptionElement::createForJSConstructor):
+ * html/HTMLOptionElement.h:
+
+2013-09-15 Sam Weinig <s...@webkit.org>
+
CTTE: Node subclasses should take a Document by reference in their constructor (Part 9)
https://bugs.webkit.org/show_bug.cgi?id=121394
Modified: trunk/Source/WebCore/bindings/js/JSImageConstructor.cpp (155818 => 155819)
--- trunk/Source/WebCore/bindings/js/JSImageConstructor.cpp 2013-09-15 18:25:10 UTC (rev 155818)
+++ trunk/Source/WebCore/bindings/js/JSImageConstructor.cpp 2013-09-15 18:47:05 UTC (rev 155819)
@@ -71,7 +71,7 @@
}
return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(),
- HTMLImageElement::createForJSConstructor(document, optionalWidth, optionalHeight))));
+ HTMLImageElement::createForJSConstructor(*document, optionalWidth, optionalHeight))));
}
ConstructType JSImageConstructor::getConstructData(JSCell*, ConstructData& constructData)
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (155818 => 155819)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2013-09-15 18:25:10 UTC (rev 155818)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2013-09-15 18:47:05 UTC (rev 155819)
@@ -4008,7 +4008,7 @@
push(@$outputArray, " return throwVMError(exec, createReferenceError(exec, \"${interfaceName} constructor associated document is unavailable\"));\n");
}
if ($generatingNamedConstructor) {
- push(@constructorArgList, "castedThis->document()");
+ push(@constructorArgList, "*castedThis->document()");
}
my $index = 0;
Modified: trunk/Source/WebCore/html/HTMLAudioElement.cpp (155818 => 155819)
--- trunk/Source/WebCore/html/HTMLAudioElement.cpp 2013-09-15 18:25:10 UTC (rev 155818)
+++ trunk/Source/WebCore/html/HTMLAudioElement.cpp 2013-09-15 18:47:05 UTC (rev 155819)
@@ -46,9 +46,9 @@
return audioElement.release();
}
-PassRefPtr<HTMLAudioElement> HTMLAudioElement::createForJSConstructor(Document* document, const String& src)
+PassRefPtr<HTMLAudioElement> HTMLAudioElement::createForJSConstructor(Document& document, const String& src)
{
- RefPtr<HTMLAudioElement> audio = adoptRef(new HTMLAudioElement(audioTag, *document, false));
+ RefPtr<HTMLAudioElement> audio = adoptRef(new HTMLAudioElement(audioTag, document, false));
audio->setPreload("auto");
if (!src.isNull()) {
audio->setSrc(src);
Modified: trunk/Source/WebCore/html/HTMLAudioElement.h (155818 => 155819)
--- trunk/Source/WebCore/html/HTMLAudioElement.h 2013-09-15 18:25:10 UTC (rev 155818)
+++ trunk/Source/WebCore/html/HTMLAudioElement.h 2013-09-15 18:47:05 UTC (rev 155819)
@@ -37,9 +37,7 @@
class HTMLAudioElement FINAL : public HTMLMediaElement {
public:
static PassRefPtr<HTMLAudioElement> create(const QualifiedName&, Document&, bool);
-
- // FIXME: Fix the bindinds to pass a Document&.
- static PassRefPtr<HTMLAudioElement> createForJSConstructor(Document*, const String& src);
+ static PassRefPtr<HTMLAudioElement> createForJSConstructor(Document&, const String& src);
private:
HTMLAudioElement(const QualifiedName&, Document&, bool);
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (155818 => 155819)
--- trunk/Source/WebCore/html/HTMLImageElement.cpp 2013-09-15 18:25:10 UTC (rev 155818)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp 2013-09-15 18:47:05 UTC (rev 155819)
@@ -72,9 +72,9 @@
m_form->removeImgElement(this);
}
-PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document* document, const int* optionalWidth, const int* optionalHeight)
+PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document& document, const int* optionalWidth, const int* optionalHeight)
{
- RefPtr<HTMLImageElement> image = adoptRef(new HTMLImageElement(imgTag, *document));
+ RefPtr<HTMLImageElement> image = adoptRef(new HTMLImageElement(imgTag, document));
if (optionalWidth)
image->setWidth(*optionalWidth);
if (optionalHeight)
Modified: trunk/Source/WebCore/html/HTMLImageElement.h (155818 => 155819)
--- trunk/Source/WebCore/html/HTMLImageElement.h 2013-09-15 18:25:10 UTC (rev 155818)
+++ trunk/Source/WebCore/html/HTMLImageElement.h 2013-09-15 18:47:05 UTC (rev 155819)
@@ -38,10 +38,8 @@
public:
static PassRefPtr<HTMLImageElement> create(Document&);
static PassRefPtr<HTMLImageElement> create(const QualifiedName&, Document&, HTMLFormElement*);
+ static PassRefPtr<HTMLImageElement> createForJSConstructor(Document&, const int* optionalWidth, const int* optionalHeight);
- // FIXME: Fix the bindinds to pass a Document&.
- static PassRefPtr<HTMLImageElement> createForJSConstructor(Document*, const int* optionalWidth, const int* optionalHeight);
-
virtual ~HTMLImageElement();
int width(bool ignorePendingStylesheets = false);
Modified: trunk/Source/WebCore/html/HTMLOptionElement.cpp (155818 => 155819)
--- trunk/Source/WebCore/html/HTMLOptionElement.cpp 2013-09-15 18:25:10 UTC (rev 155818)
+++ trunk/Source/WebCore/html/HTMLOptionElement.cpp 2013-09-15 18:47:05 UTC (rev 155819)
@@ -69,12 +69,12 @@
return adoptRef(new HTMLOptionElement(tagName, document));
}
-PassRefPtr<HTMLOptionElement> HTMLOptionElement::createForJSConstructor(Document* document, const String& data, const String& value,
+PassRefPtr<HTMLOptionElement> HTMLOptionElement::createForJSConstructor(Document& document, const String& data, const String& value,
bool defaultSelected, bool selected, ExceptionCode& ec)
{
- RefPtr<HTMLOptionElement> element = adoptRef(new HTMLOptionElement(optionTag, *document));
+ RefPtr<HTMLOptionElement> element = adoptRef(new HTMLOptionElement(optionTag, document));
- RefPtr<Text> text = Text::create(*document, data.isNull() ? "" : data);
+ RefPtr<Text> text = Text::create(document, data.isNull() ? "" : data);
ec = 0;
element->appendChild(text.release(), ec);
Modified: trunk/Source/WebCore/html/HTMLOptionElement.h (155818 => 155819)
--- trunk/Source/WebCore/html/HTMLOptionElement.h 2013-09-15 18:25:10 UTC (rev 155818)
+++ trunk/Source/WebCore/html/HTMLOptionElement.h 2013-09-15 18:47:05 UTC (rev 155819)
@@ -36,9 +36,7 @@
public:
static PassRefPtr<HTMLOptionElement> create(Document&);
static PassRefPtr<HTMLOptionElement> create(const QualifiedName&, Document&);
-
- // FIXME: Fix the bindinds to pass a Document&.
- static PassRefPtr<HTMLOptionElement> createForJSConstructor(Document*, const String& data, const String& value,
+ static PassRefPtr<HTMLOptionElement> createForJSConstructor(Document&, const String& data, const String& value,
bool defaultSelected, bool selected, ExceptionCode&);
virtual String text() const;