Commit cf9dd0fa authored by darin@apple.com's avatar darin@apple.com

Make DOM classes start with a reference count of 1, like all other RefCounted

        
Patch by Darin Adler <darin@apple.com> on 2009-08-22
Reviewed by Oliver Hunt.

Next step: Element, HTMLElement, HTMLAnchorElement, HTMLAppletElement,
HTMLAreaElement, HTMLEmbedElement, HTMLFrameElement, HTMLIFrameElement,
HTMLObjectElement, HTMLPlugInElement, HTMLPlugInImageElement.

* DerivedSources.make: Fix error seen every time we build by escaping the $
in the build rule, since you have to use $$ for that in make.

* WebCore.base.exp: Updated.

* bindings/objc/DOM.mm:
Added now-needed include of SVGNames.h.

* dom/Document.cpp: Added now-needed include of SVGNames.h.
(WebCore::Document::createElement): Use create instead of new.

* dom/Element.cpp:
(WebCore::Element::Element): Added ConstructionType argument so the caller
can determine whether this starts with a reference count of either 0 or 1.
Later we will remove this again once they are all 1.
(WebCore::Element::create): Added.

* dom/Element.h: Added create and made constructor protected.

* dom/StyledElement.cpp:
(WebCore::StyledElement::StyledElement): Added ConstructionType argument.
* dom/StyledElement.h: Made many functions protected or private, including
the constructor.

* dom/make_names.pl: Use create to create the base elements HTMLElement,
SVGElement, and WMLElement.

* editing/CreateLinkCommand.cpp:
(WebCore::CreateLinkCommand::doApply): Use create instead of new.
* editing/UnlinkCommand.cpp:
(WebCore::UnlinkCommand::doApply): Ditto.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::create): Added.
* html/HTMLAnchorElement.h: Made constructor protected and added create.
Also made m_rootEditableElementForSelectionOnMouseDown a RefPtr.

* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::create): Added.
* html/HTMLAppletElement.h: Made constructor private and added create.

* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::create): Added.
* html/HTMLAreaElement.h: Made constructor private and added create.

* html/HTMLElement.cpp:
(WebCore::HTMLElement::create): Added.
* html/HTMLElement.h: Made constructor protected and added create.
Made other functions protected and private. Also added inline
definition of constructor.

* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::create): Added.
* html/HTMLEmbedElement.h: Made constructor private and added create.
Made other functions private.

* html/HTMLFrameElement.cpp:
(WebCore::HTMLFrameElement::create): Added.
(WebCore::HTMLFrameElement::parseMappedAttribute):
* html/HTMLFrameElement.h: Made constructor private and added create.
Made other functions private.

* html/HTMLFrameElementBase.h: Made functions protected and private.

* html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement): Pass
CreateElement so reference count starts at 1.

* html/HTMLFrameOwnerElement.h: Made functions protected and private.

* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::create): Added.
* html/HTMLIFrameElement.h: Made constructor private and added create.
Made other functions private.

* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::create): Added.
(WebCore::HTMLObjectElement::containsJavaApplet): Changed while loop
into a for loop and tweaked formatting.

* html/HTMLObjectElement.h: Made constructor private and added create.
Made other functions private.

* html/HTMLPlugInElement.h: Made constructor protected.
Made other functions protected and private.

* html/HTMLPlugInImageElement.h: Made constructor and another function
protected.

* html/HTMLTagNames.in: Removed createWithNew from all classes that
now have create functions. Moved conditional noscript to a separate
paragraph.

* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::addSpanWithClassName): Use create.
(WebCore::HTMLViewSourceDocument::addLink): Ditto.
* page/DragController.cpp:
(WebCore::documentFragmentFromDragData): Ditto.

* svg/SVGElement.cpp:
(WebCore::SVGElement::SVGElement): Pass CreateElementZeroRefCount
so reference count still starts at 0. Will change this class later.
(WebCore::SVGElement::create): Added.
* svg/SVGElement.h: Added create, made constructor protected, and
made other functions protected and private. Removed unneeded
SVGNames.h include.

* svg/SVGExternalResourcesRequired.h: Added now-needed SVGNames.h
include.

* svg/SVGStopElement.h: Added now-needed SVGNames.h include.
Made functions private.

* wml/WMLElement.cpp:
(WebCore::WMLElement::WMLElement): Pass CreateElementZeroRefCount
so reference count still starts at 0. Will change this class later.
(WebCore::WMLElement::create): Added.
* wml/WMLElement.h: Added create and made constructor protected.

* wml/WMLTagNames.in: Removed createWithNew from WMLElement.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47688 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 382487e9
2009-08-22 Darin Adler <darin@apple.com>
Reviewed by Oliver Hunt.
Make DOM classes start with a reference count of 1, like all other RefCounted
Next step: Element, HTMLElement, HTMLAnchorElement, HTMLAppletElement,
HTMLAreaElement, HTMLEmbedElement, HTMLFrameElement, HTMLIFrameElement,
HTMLObjectElement, HTMLPlugInElement, HTMLPlugInImageElement.
* DerivedSources.make: Fix error seen every time we build by escaping the $
in the build rule, since you have to use $$ for that in make.
* WebCore.base.exp: Updated.
* bindings/objc/DOM.mm:
Added now-needed include of SVGNames.h.
* dom/Document.cpp: Added now-needed include of SVGNames.h.
(WebCore::Document::createElement): Use create instead of new.
* dom/Element.cpp:
(WebCore::Element::Element): Added ConstructionType argument so the caller
can determine whether this starts with a reference count of either 0 or 1.
Later we will remove this again once they are all 1.
(WebCore::Element::create): Added.
* dom/Element.h: Added create and made constructor protected.
* dom/StyledElement.cpp:
(WebCore::StyledElement::StyledElement): Added ConstructionType argument.
* dom/StyledElement.h: Made many functions protected or private, including
the constructor.
* dom/make_names.pl: Use create to create the base elements HTMLElement,
SVGElement, and WMLElement.
* editing/CreateLinkCommand.cpp:
(WebCore::CreateLinkCommand::doApply): Use create instead of new.
* editing/UnlinkCommand.cpp:
(WebCore::UnlinkCommand::doApply): Ditto.
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::create): Added.
* html/HTMLAnchorElement.h: Made constructor protected and added create.
Also made m_rootEditableElementForSelectionOnMouseDown a RefPtr.
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::create): Added.
* html/HTMLAppletElement.h: Made constructor private and added create.
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::create): Added.
* html/HTMLAreaElement.h: Made constructor private and added create.
* html/HTMLElement.cpp:
(WebCore::HTMLElement::create): Added.
* html/HTMLElement.h: Made constructor protected and added create.
Made other functions protected and private. Also added inline
definition of constructor.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::create): Added.
* html/HTMLEmbedElement.h: Made constructor private and added create.
Made other functions private.
* html/HTMLFrameElement.cpp:
(WebCore::HTMLFrameElement::create): Added.
(WebCore::HTMLFrameElement::parseMappedAttribute):
* html/HTMLFrameElement.h: Made constructor private and added create.
Made other functions private.
* html/HTMLFrameElementBase.h: Made functions protected and private.
* html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement): Pass
CreateElement so reference count starts at 1.
* html/HTMLFrameOwnerElement.h: Made functions protected and private.
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::create): Added.
* html/HTMLIFrameElement.h: Made constructor private and added create.
Made other functions private.
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::create): Added.
(WebCore::HTMLObjectElement::containsJavaApplet): Changed while loop
into a for loop and tweaked formatting.
* html/HTMLObjectElement.h: Made constructor private and added create.
Made other functions private.
* html/HTMLPlugInElement.h: Made constructor protected.
Made other functions protected and private.
* html/HTMLPlugInImageElement.h: Made constructor and another function
protected.
* html/HTMLTagNames.in: Removed createWithNew from all classes that
now have create functions. Moved conditional noscript to a separate
paragraph.
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::addSpanWithClassName): Use create.
(WebCore::HTMLViewSourceDocument::addLink): Ditto.
* page/DragController.cpp:
(WebCore::documentFragmentFromDragData): Ditto.
* svg/SVGElement.cpp:
(WebCore::SVGElement::SVGElement): Pass CreateElementZeroRefCount
so reference count still starts at 0. Will change this class later.
(WebCore::SVGElement::create): Added.
* svg/SVGElement.h: Added create, made constructor protected, and
made other functions protected and private. Removed unneeded
SVGNames.h include.
* svg/SVGExternalResourcesRequired.h: Added now-needed SVGNames.h
include.
* svg/SVGStopElement.h: Added now-needed SVGNames.h include.
Made functions private.
* wml/WMLElement.cpp:
(WebCore::WMLElement::WMLElement): Pass CreateElementZeroRefCount
so reference count still starts at 0. Will change this class later.
(WebCore::WMLElement::create): Added.
* wml/WMLElement.h: Added create and made constructor protected.
* wml/WMLTagNames.in: Removed createWithNew from WMLElement.
2009-08-22 Adele Peterson <adele@apple.com>
Reviewed by Anders Carlsson.
......@@ -463,14 +463,14 @@ endif
# 2. Lines containing only whitespace
# These two types of lines will be ignored by make{prop,values}.pl.
CSSPropertyNames.h : $(WEBCORE_CSS_PROPERTY_NAMES) css/makeprop.pl
if sort $(WEBCORE_CSS_PROPERTY_NAMES) | uniq -d | grep -E -v '(^#)|(^[[:space:]]*$)'; then echo 'Duplicate value!'; exit 1; fi
if sort $(WEBCORE_CSS_PROPERTY_NAMES) | uniq -d | grep -E -v '(^#)|(^[[:space:]]*$$)'; then echo 'Duplicate value!'; exit 1; fi
cat $(WEBCORE_CSS_PROPERTY_NAMES) > CSSPropertyNames.in
perl "$(WebCore)/css/makeprop.pl"
CSSValueKeywords.h : $(WEBCORE_CSS_VALUE_KEYWORDS) css/makevalues.pl
# Lower case all the values, as CSS values are case-insensitive
perl -ne 'print lc' $(WEBCORE_CSS_VALUE_KEYWORDS) > CSSValueKeywords.in
if sort CSSValueKeywords.in | uniq -d | grep -E -v '(^#)|(^[[:space:]]*$)'; then echo 'Duplicate value!'; exit 1; fi
if sort CSSValueKeywords.in | uniq -d | grep -E -v '(^#)|(^[[:space:]]*$$)'; then echo 'Duplicate value!'; exit 1; fi
perl "$(WebCore)/css/makevalues.pl"
# --------
......
......@@ -399,6 +399,7 @@ __ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionE
__ZN7WebCore16threadGlobalDataEv
__ZN7WebCore17DOMImplementation14isTextMIMETypeERKNS_6StringE
__ZN7WebCore17GlyphPageTreeNode18treeGlyphPageCountEv
__ZN7WebCore17HTMLPlugInElement11getNPObjectEv
__ZN7WebCore17equalIgnoringCaseEPNS_10StringImplES1_
__ZN7WebCore18deprecatedParseURLERKNS_6StringE
__ZN7WebCore18isStartOfParagraphERKNS_15VisiblePositionE
......
......@@ -44,6 +44,7 @@
#if ENABLE(SVG_DOM_OBJC_BINDINGS)
#import "DOMSVG.h"
#import "SVGElementInstance.h"
#import "SVGNames.h"
#endif
using namespace JSC;
......
......@@ -101,6 +101,7 @@
#include "RenderTextControl.h"
#include "RenderView.h"
#include "RenderWidget.h"
#include "SVGNames.h"
#include "ScriptController.h"
#include "ScriptElement.h"
#include "ScriptEventListener.h"
......@@ -795,7 +796,7 @@ PassRefPtr<Element> Document::createElement(const QualifiedName& qName, bool cre
#endif
if (!e)
e = new Element(qName, document());
e = Element::create(qName, document());
// <image> uses imgTag so we need a special rule.
#if ENABLE(WML)
......
......@@ -57,12 +57,17 @@ namespace WebCore {
using namespace HTMLNames;
using namespace XMLNames;
Element::Element(const QualifiedName& tagName, Document* document)
: ContainerNode(document, CreateElementZeroRefCount)
Element::Element(const QualifiedName& tagName, Document* document, ConstructionType type)
: ContainerNode(document, type)
, m_tagName(tagName)
{
}
PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new Element(tagName, document, CreateElement));
}
Element::~Element()
{
if (namedAttrMap)
......
......@@ -41,7 +41,7 @@ class IntSize;
class Element : public ContainerNode {
public:
Element(const QualifiedName&, Document*);
static PassRefPtr<Element> create(const QualifiedName&, Document*);
virtual ~Element();
const AtomicString& getIDAttribute() const;
......@@ -208,6 +208,8 @@ public:
virtual void dispatchFormControlChangeEvent() { }
protected:
Element(const QualifiedName&, Document*, ConstructionType);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
......
......@@ -111,8 +111,8 @@ void StyledElement::updateStyleAttribute() const
m_synchronizingStyleAttribute = false;
}
StyledElement::StyledElement(const QualifiedName& name, Document *doc)
: Element(name, doc)
StyledElement::StyledElement(const QualifiedName& name, Document* document, ConstructionType type)
: Element(name, document, type)
{
}
......
......@@ -3,7 +3,7 @@
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Peter Kelly (pmk@post.com)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -38,13 +38,11 @@ class MappedAttribute;
class StyledElement : public Element {
public:
StyledElement(const QualifiedName&, Document*);
virtual ~StyledElement();
virtual bool isStyledElement() const { return true; }
NamedMappedAttrMap* mappedAttributes() { return static_cast<NamedMappedAttrMap*>(namedAttrMap.get()); }
const NamedMappedAttrMap* mappedAttributes() const { return static_cast<NamedMappedAttrMap*>(namedAttrMap.get()); }
bool hasMappedAttributes() const { return namedAttrMap && mappedAttributes()->hasMappedAttributes(); }
bool isMappedAttribute(const QualifiedName& name) const { MappedAttributeEntry res = eNone; mapToEntry(name, res); return res != eNone; }
......@@ -53,38 +51,36 @@ public:
void addCSSProperty(MappedAttribute*, int id, int value);
void addCSSImageProperty(MappedAttribute*, int propertyID, const String& url);
void addCSSColor(MappedAttribute*, int id, const String& color);
void createMappedDecl(MappedAttribute*);
static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value);
static void setMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration*);
static void removeMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value);
static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*);
static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*);
CSSMutableStyleDeclaration* inlineStyleDecl() const { return m_inlineStyleDecl.get(); }
virtual bool canHaveAdditionalAttributeStyleDecls() const { return false; }
virtual void additionalAttributeStyleDecls(Vector<CSSMutableStyleDeclaration*>&) {};
CSSMutableStyleDeclaration* getInlineStyleDecl();
CSSStyleDeclaration* style();
void createInlineStyleDecl();
void destroyInlineStyleDecl();
void invalidateStyleAttribute();
virtual void updateStyleAttribute() const;
const ClassNames& classNames() const { ASSERT(hasClass()); ASSERT(mappedAttributes()); return mappedAttributes()->classNames(); }
virtual void attributeChanged(Attribute*, bool preserveDecls = false);
virtual void parseMappedAttribute(MappedAttribute*);
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
virtual void createAttributeMap() const;
virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value);
protected:
StyledElement(const QualifiedName&, Document*, ConstructionType);
virtual void attributeChanged(Attribute*, bool preserveDecls = false);
virtual void parseMappedAttribute(MappedAttribute*);
virtual void copyNonAttributeProperties(const Element*);
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
protected:
// classAttributeChanged() exists to share code between
// parseMappedAttribute (called via setAttribute()) and
// svgAttributeChanged (called when element.className.baseValue is set)
......@@ -92,6 +88,17 @@ protected:
virtual void didMoveToNewOwnerDocument();
private:
virtual bool isStyledElement() const { return true; }
void createMappedDecl(MappedAttribute*);
void createInlineStyleDecl();
void destroyInlineStyleDecl();
virtual void updateStyleAttribute() const;
virtual void createAttributeMap() const;
RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl;
};
......
......@@ -282,7 +282,7 @@ sub printConstructorInterior
if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) {
print F <<END
if (!MediaPlayer::isAvailable())
return new HTMLElement($constructorTagName, document);
return HTMLElement::create($constructorTagName, document);
END
;
}
......@@ -756,7 +756,7 @@ if ($parameters{namespace} eq "HTML") {
print F " return function(qName, document, createdByParser);\n";
}
print F " return new $parameters{namespace}Element(qName, document);\n";
print F " return $parameters{namespace}Element::create(qName, document);\n";
if ($parameters{guardFactoryWith}) {
......
......@@ -43,7 +43,7 @@ void CreateLinkCommand::doApply()
if (endingSelection().isNone())
return;
RefPtr<HTMLAnchorElement> anchorElement = new HTMLAnchorElement(document());
RefPtr<HTMLAnchorElement> anchorElement = HTMLAnchorElement::create(document());
anchorElement->setHref(m_url);
if (endingSelection().isRange()) {
......
......@@ -37,14 +37,13 @@ UnlinkCommand::UnlinkCommand(Document* document)
void UnlinkCommand::doApply()
{
// FIXME: If a caret is inside a link, remove it.
// FIXME: If a caret is inside a link, we should remove it, but currently we don't.
if (!endingSelection().isRange())
return;
pushPartiallySelectedAnchorElementsDown();
HTMLAnchorElement* anchorElement = new HTMLAnchorElement(document());
removeStyledElement(anchorElement);
removeStyledElement(HTMLAnchorElement::create(document()));
}
}
......@@ -40,18 +40,20 @@ namespace WebCore {
using namespace HTMLNames;
HTMLAnchorElement::HTMLAnchorElement(Document* document)
: HTMLElement(aTag, document)
, m_rootEditableElementForSelectionOnMouseDown(0)
HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document, CreateElement)
, m_wasShiftKeyDownOnMouseDown(false)
{
}
HTMLAnchorElement::HTMLAnchorElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document)
, m_rootEditableElementForSelectionOnMouseDown(0)
, m_wasShiftKeyDownOnMouseDown(false)
PassRefPtr<HTMLAnchorElement> HTMLAnchorElement::create(Document* document)
{
return adoptRef(new HTMLAnchorElement(aTag, document));
}
PassRefPtr<HTMLAnchorElement> HTMLAnchorElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLAnchorElement(tagName, document));
}
bool HTMLAnchorElement::supportsFocus() const
......
......@@ -30,8 +30,8 @@ namespace WebCore {
class HTMLAnchorElement : public HTMLElement {
public:
HTMLAnchorElement(Document*);
HTMLAnchorElement(const QualifiedName&, Document*);
static PassRefPtr<HTMLAnchorElement> create(Document*);
static PassRefPtr<HTMLAnchorElement> create(const QualifiedName&, Document*);
KURL href() const;
void setHref(const AtomicString&);
......@@ -52,6 +52,8 @@ public:
bool isLiveLink() const;
protected:
HTMLAnchorElement(const QualifiedName&, Document*);
virtual void parseMappedAttribute(MappedAttribute*);
private:
......@@ -70,7 +72,7 @@ private:
virtual short tabIndex() const;
virtual bool draggable() const;
Element* m_rootEditableElementForSelectionOnMouseDown;
RefPtr<Element> m_rootEditableElementForSelectionOnMouseDown;
bool m_wasShiftKeyDownOnMouseDown;
};
......
......@@ -34,12 +34,17 @@ namespace WebCore {
using namespace HTMLNames;
HTMLAppletElement::HTMLAppletElement(const QualifiedName& tagName, Document* doc)
: HTMLPlugInElement(tagName, doc)
inline HTMLAppletElement::HTMLAppletElement(const QualifiedName& tagName, Document* document)
: HTMLPlugInElement(tagName, document)
{
ASSERT(hasTagName(appletTag));
}
PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLAppletElement(tagName, document));
}
void HTMLAppletElement::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name() == altAttr ||
......
......@@ -29,7 +29,7 @@ namespace WebCore {
class HTMLAppletElement : public HTMLPlugInElement {
public:
HTMLAppletElement(const QualifiedName&, Document*);
static PassRefPtr<HTMLAppletElement> create(const QualifiedName&, Document*);
String hspace() const;
void setHspace(const String&);
......@@ -38,6 +38,8 @@ public:
void setVspace(const String&);
private:
HTMLAppletElement(const QualifiedName&, Document*);
virtual int tagPriority() const { return 1; }
virtual void parseMappedAttribute(MappedAttribute*);
......
......@@ -34,7 +34,7 @@ namespace WebCore {
using namespace HTMLNames;
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)
......@@ -43,8 +43,9 @@ HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document* documen
ASSERT(hasTagName(areaTag));
}
HTMLAreaElement::~HTMLAreaElement()
PassRefPtr<HTMLAreaElement> HTMLAreaElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLAreaElement(tagName, document));
}
void HTMLAreaElement::parseMappedAttribute(MappedAttribute* attr)
......
......@@ -34,8 +34,7 @@ class Path;
class HTMLAreaElement : public HTMLAnchorElement {
public:
HTMLAreaElement(const QualifiedName&, Document*);
virtual ~HTMLAreaElement();
static PassRefPtr<HTMLAreaElement> create(const QualifiedName&, Document*);
bool isDefault() const { return m_shape == Default; }
......@@ -49,6 +48,8 @@ public:
void setNoHref(bool);
private:
HTMLAreaElement(const QualifiedName&, Document*);
virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
virtual int tagPriority() const { return 0; }
virtual void parseMappedAttribute(MappedAttribute*);
......
......@@ -56,13 +56,9 @@ using namespace HTMLNames;
using std::min;
using std::max;
HTMLElement::HTMLElement(const QualifiedName& tagName, Document *doc)
: StyledElement(tagName, doc)
{
}
HTMLElement::~HTMLElement()
PassRefPtr<HTMLElement> HTMLElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLElement(tagName, document, CreateElement));
}
String HTMLElement::nodeName() const
......
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -35,19 +35,12 @@ enum HTMLTagStatus { TagStatusOptional, TagStatusRequired, TagStatusForbidden };
class HTMLElement : public StyledElement {
public:
HTMLElement(const QualifiedName& tagName, Document*);
virtual ~HTMLElement();
virtual bool isHTMLElement() const { return true; }
virtual String nodeName() const;
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttribute*);
static PassRefPtr<HTMLElement> create(const QualifiedName& tagName, Document*);
PassRefPtr<HTMLCollection> children();
virtual String title() const;
virtual short tabIndex() const;
void setTabIndex(int);
......@@ -63,12 +56,11 @@ public:
void insertAdjacentHTML(const String& where, const String& html, ExceptionCode&);
void insertAdjacentText(const String& where, const String& text, ExceptionCode&);
virtual bool isFocusable() const;
virtual bool isContentEditable() const;
virtual bool isContentRichlyEditable() const;
virtual String contentEditable() const;
virtual void setContentEditable(MappedAttribute*);
virtual void setContentEditable(const String&);
String contentEditable() const;
void setContentEditable(const String&);
virtual bool draggable() const;
void setDraggable(bool);
......@@ -79,31 +71,53 @@ public:
virtual HTMLTagStatus endTagRequirement() const;
virtual int tagPriority() const;
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
HTMLFormElement* form() const { return virtualForm(); }
static void addHTMLAlignmentToStyledElement(StyledElement*, MappedAttribute*);
protected:
HTMLElement(const QualifiedName& tagName, Document*, ConstructionType = CreateElementZeroRefCount);
void addHTMLAlignment(MappedAttribute*);
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttribute*);
virtual bool isFocusable() const;
virtual bool childAllowed(Node* newChild); // Error-checking during parsing that checks the DTD
// Helper function to check the DTD for a given child node.
virtual bool checkDTD(const Node*);
static bool inEitherTagList(const Node*);
static bool inInlineTagList(const Node*);
static bool inBlockTagList(const Node*);
static bool isRecognizedTagName(const QualifiedName&);
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
HTMLFormElement* form() const { return virtualForm(); }
HTMLFormElement* findFormAncestor() const;
static void addHTMLAlignmentToStyledElement(StyledElement*, MappedAttribute*);
private:
virtual bool isHTMLElement() const { return true; }
protected:
void addHTMLAlignment(MappedAttribute*);
virtual String nodeName() const;
void setContentEditable(MappedAttribute*);
private:
virtual HTMLFormElement* virtualForm() const;
Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&);
};
inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document* document, ConstructionType type)
: StyledElement(tagName, document, type)
{
}
} // namespace WebCore
#endif // HTMLElement_h
......@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Stefan Schimanski (1Stein@gmx.de)
* Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
......@@ -42,13 +42,18 @@ namespace WebCore {
using namespace HTMLNames;
HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document* doc)
: HTMLPlugInImageElement(tagName, doc)
inline HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document* document)
: HTMLPlugInImageElement(tagName, document)
, m_needWidgetUpdate(false)
{
ASSERT(hasTagName(embedTag));
}
PassRefPtr<HTMLEmbedElement> HTMLEmbedElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLEmbedElement(tagName, document));
}
static inline RenderWidget* findWidgetRenderer(const Node* n)
{
if (!n->renderer())
......
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -29,6 +29,11 @@ namespace WebCore {