Commit c1d18d0d authored by weinig@apple.com's avatar weinig@apple.com

[CTTE] Node subclasses should take a Document by reference in their

constructor (HTMLAnchorElement, HTMLAppletElement, HTMLAreaElement, HTMLAudioElement)
https://bugs.webkit.org/show_bug.cgi?id=121365

Reviewed by Andreas Kling.

* editing/CreateLinkCommand.cpp:
(WebCore::CreateLinkCommand::doApply):
* editing/UnlinkCommand.cpp:
(WebCore::UnlinkCommand::doApply):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::HTMLAnchorElement):
(WebCore::HTMLAnchorElement::create):
* html/HTMLAnchorElement.h:
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::HTMLAppletElement):
(WebCore::HTMLAppletElement::create):
* html/HTMLAppletElement.h:
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::HTMLAreaElement):
(WebCore::HTMLAreaElement::create):
* html/HTMLAreaElement.h:
* html/HTMLAudioElement.cpp:
(WebCore::HTMLAudioElement::HTMLAudioElement):
(WebCore::HTMLAudioElement::create):
(WebCore::HTMLAudioElement::createForJSConstructor):
* html/HTMLAudioElement.h:
* html/HTMLTagNames.in:
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::addLink):
* page/DragController.cpp:
(WebCore::documentFragmentFromDragData):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155780 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 017192a9
2013-09-14 Sam Weinig <sam@webkit.org>
[CTTE] Node subclasses should take a Document by reference in their
constructor (HTMLAnchorElement, HTMLAppletElement, HTMLAreaElement, HTMLAudioElement)
https://bugs.webkit.org/show_bug.cgi?id=121365
Reviewed by Andreas Kling.
* editing/CreateLinkCommand.cpp:
(WebCore::CreateLinkCommand::doApply):
* editing/UnlinkCommand.cpp:
(WebCore::UnlinkCommand::doApply):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::HTMLAnchorElement):
(WebCore::HTMLAnchorElement::create):
* html/HTMLAnchorElement.h:
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::HTMLAppletElement):
(WebCore::HTMLAppletElement::create):
* html/HTMLAppletElement.h:
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::HTMLAreaElement):
(WebCore::HTMLAreaElement::create):
* html/HTMLAreaElement.h:
* html/HTMLAudioElement.cpp:
(WebCore::HTMLAudioElement::HTMLAudioElement):
(WebCore::HTMLAudioElement::create):
(WebCore::HTMLAudioElement::createForJSConstructor):
* html/HTMLAudioElement.h:
* html/HTMLTagNames.in:
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::addLink):
* page/DragController.cpp:
(WebCore::documentFragmentFromDragData):
2013-09-14 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org>
Get INPUT_SPEECH compiling for Nix, EFL and GTK
......@@ -43,7 +43,7 @@ void CreateLinkCommand::doApply()
if (endingSelection().isNone())
return;
RefPtr<HTMLAnchorElement> anchorElement = HTMLAnchorElement::create(&document());
RefPtr<HTMLAnchorElement> anchorElement = HTMLAnchorElement::create(document());
anchorElement->setHref(m_url);
if (endingSelection().isRange())
......
......@@ -41,7 +41,7 @@ void UnlinkCommand::doApply()
if (!endingSelection().isNonOrphanedRange())
return;
removeStyledElement(HTMLAnchorElement::create(&document()));
removeStyledElement(HTMLAnchorElement::create(document()));
}
}
......@@ -52,8 +52,8 @@ namespace WebCore {
using namespace HTMLNames;
HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document)
HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document& document)
: HTMLElement(tagName, &document)
, m_hasRootEditableElementForSelectionOnMouseDown(false)
, m_wasShiftKeyDownOnMouseDown(false)
, m_linkRelations(0)
......@@ -61,12 +61,12 @@ HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document* doc
{
}
PassRefPtr<HTMLAnchorElement> HTMLAnchorElement::create(Document* document)
PassRefPtr<HTMLAnchorElement> HTMLAnchorElement::create(Document& document)
{
return adoptRef(new HTMLAnchorElement(aTag, document));
}
PassRefPtr<HTMLAnchorElement> HTMLAnchorElement::create(const QualifiedName& tagName, Document* document)
PassRefPtr<HTMLAnchorElement> HTMLAnchorElement::create(const QualifiedName& tagName, Document& document)
{
return adoptRef(new HTMLAnchorElement(tagName, document));
}
......
......@@ -55,8 +55,8 @@ enum {
class HTMLAnchorElement : public HTMLElement {
public:
static PassRefPtr<HTMLAnchorElement> create(Document*);
static PassRefPtr<HTMLAnchorElement> create(const QualifiedName&, Document*);
static PassRefPtr<HTMLAnchorElement> create(Document&);
static PassRefPtr<HTMLAnchorElement> create(const QualifiedName&, Document&);
virtual ~HTMLAnchorElement();
......@@ -103,7 +103,7 @@ public:
void invalidateCachedVisitedLinkHash() { m_cachedVisitedLinkHash = 0; }
protected:
HTMLAnchorElement(const QualifiedName&, Document*);
HTMLAnchorElement(const QualifiedName&, Document&);
virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
......
......@@ -40,15 +40,15 @@ namespace WebCore {
using namespace HTMLNames;
HTMLAppletElement::HTMLAppletElement(const QualifiedName& tagName, Document* document, bool createdByParser)
: HTMLPlugInImageElement(tagName, document, createdByParser, ShouldNotPreferPlugInsForImages)
HTMLAppletElement::HTMLAppletElement(const QualifiedName& tagName, Document& document, bool createdByParser)
: HTMLPlugInImageElement(tagName, &document, createdByParser, ShouldNotPreferPlugInsForImages)
{
ASSERT(hasTagName(appletTag));
m_serviceType = "application/x-java-applet";
}
PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)
PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document& document, bool createdByParser)
{
return adoptRef(new HTMLAppletElement(tagName, document, createdByParser));
}
......
......@@ -29,10 +29,10 @@ namespace WebCore {
class HTMLAppletElement FINAL : public HTMLPlugInImageElement {
public:
static PassRefPtr<HTMLAppletElement> create(const QualifiedName&, Document*, bool createdByParser);
static PassRefPtr<HTMLAppletElement> create(const QualifiedName&, Document&, bool createdByParser);
private:
HTMLAppletElement(const QualifiedName&, Document*, bool createdByParser);
HTMLAppletElement(const QualifiedName&, Document&, bool createdByParser);
virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
......
......@@ -39,7 +39,7 @@ namespace WebCore {
using namespace HTMLNames;
inline HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document* document)
inline HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document& document)
: HTMLAnchorElement(tagName, document)
, m_coordsLen(0)
, m_lastSize(-1, -1)
......@@ -48,7 +48,7 @@ inline HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document*
ASSERT(hasTagName(areaTag));
}
PassRefPtr<HTMLAreaElement> HTMLAreaElement::create(const QualifiedName& tagName, Document* document)
PassRefPtr<HTMLAreaElement> HTMLAreaElement::create(const QualifiedName& tagName, Document& document)
{
return adoptRef(new HTMLAreaElement(tagName, document));
}
......
......@@ -35,7 +35,7 @@ class Path;
class HTMLAreaElement FINAL : public HTMLAnchorElement {
public:
static PassRefPtr<HTMLAreaElement> create(const QualifiedName&, Document*);
static PassRefPtr<HTMLAreaElement> create(const QualifiedName&, Document&);
bool isDefault() const { return m_shape == Default; }
......@@ -48,7 +48,7 @@ public:
HTMLImageElement* imageElement() const;
private:
HTMLAreaElement(const QualifiedName&, Document*);
HTMLAreaElement(const QualifiedName&, Document&);
virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
virtual bool supportsFocus() const OVERRIDE;
......
......@@ -33,13 +33,13 @@ namespace WebCore {
using namespace HTMLNames;
HTMLAudioElement::HTMLAudioElement(const QualifiedName& tagName, Document* document, bool createdByParser)
: HTMLMediaElement(tagName, document, createdByParser)
HTMLAudioElement::HTMLAudioElement(const QualifiedName& tagName, Document& document, bool createdByParser)
: HTMLMediaElement(tagName, &document, createdByParser)
{
ASSERT(hasTagName(audioTag));
}
PassRefPtr<HTMLAudioElement> HTMLAudioElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)
PassRefPtr<HTMLAudioElement> HTMLAudioElement::create(const QualifiedName& tagName, Document& document, bool createdByParser)
{
RefPtr<HTMLAudioElement> audioElement(adoptRef(new HTMLAudioElement(tagName, document, createdByParser)));
audioElement->suspendIfNeeded();
......@@ -48,7 +48,7 @@ PassRefPtr<HTMLAudioElement> HTMLAudioElement::create(const QualifiedName& tagNa
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);
......
......@@ -36,11 +36,13 @@ class Document;
class HTMLAudioElement FINAL : public HTMLMediaElement {
public:
static PassRefPtr<HTMLAudioElement> create(const QualifiedName&, Document*, bool);
static PassRefPtr<HTMLAudioElement> create(const QualifiedName&, Document&, bool);
// FIXME: Fix the bindinds to pass a Document&.
static PassRefPtr<HTMLAudioElement> createForJSConstructor(Document*, const String& src);
private:
HTMLAudioElement(const QualifiedName&, Document*, bool);
HTMLAudioElement(const QualifiedName&, Document&, bool);
};
ELEMENT_TYPE_CASTS(HTMLAudioElement)
......
......@@ -3,15 +3,15 @@ namespacePrefix="xhtml"
namespaceURI="http://www.w3.org/1999/xhtml"
fallbackInterfaceName="HTMLUnknownElement"
a interfaceName=HTMLAnchorElement, generateTypeHelpers
a interfaceName=HTMLAnchorElement, generateTypeHelpers, constructorTakesDocumentReference
abbr interfaceName=HTMLElement
acronym interfaceName=HTMLElement
address interfaceName=HTMLElement
applet constructorNeedsCreatedByParser, generateTypeHelpers
area generateTypeHelpers
applet constructorNeedsCreatedByParser, generateTypeHelpers, constructorTakesDocumentReference
area generateTypeHelpers, constructorTakesDocumentReference
article interfaceName=HTMLElement
aside interfaceName=HTMLElement
audio wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser, generateTypeHelpers
audio wrapperOnlyIfMediaIsAvailable, conditional=VIDEO, constructorNeedsCreatedByParser, generateTypeHelpers, constructorTakesDocumentReference
b interfaceName=HTMLElement
base generateTypeHelpers
basefont interfaceName=HTMLBaseFontElement
......
......@@ -293,7 +293,7 @@ PassRefPtr<Element> HTMLViewSourceDocument::addLink(const AtomicString& url, boo
addLine("webkit-html-tag");
// Now create a link for the attribute value instead of a span.
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(this);
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(*this);
const char* classValue;
if (isAnchor)
classValue = "webkit-html-attribute-value webkit-html-external-link";
......
......@@ -131,7 +131,7 @@ static PassRefPtr<DocumentFragment> documentFragmentFromDragData(DragData* dragD
String title;
String url = dragData->asURL(frame, DragData::DoNotConvertFilenames, &title);
if (!url.isEmpty()) {
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(&document);
RefPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(document);
anchor->setHref(url);
if (title.isEmpty()) {
// Try the plain text first because the url might be normalized or escaped.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment