Commit 3a3edd48 authored by darin@apple.com's avatar darin@apple.com

More work on making DOM classes start with reference count of 1

https://bugs.webkit.org/show_bug.cgi?id=28068

Patch by Darin Adler <darin@apple.com> on 2009-08-18
Reviewed by Sam Weinig.

Some related clean-up and preparation steps so the subsequent
patches will be as small as possible.

* WebCore.base.exp: Sorted this file.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityDescription):
Use nameAttr instead of the name function.

* bindings/js/JSHTMLFrameElementCustom.cpp:
(WebCore::JSHTMLFrameElement::setSrc):
Use srcAttr instead of the src function.

* bindings/js/JSHTMLIFrameElementCustom.cpp:
(WebCore::JSHTMLIFrameElement::setSrc):
Use srcAttr instead of the src function.

* bindings/objc/DOM.mm: Sorted includes.
* dom/Document.cpp: Ditto.

* dom/StyledElement.cpp: Made invalidateStyleAttribute inline.
* dom/StyledElement.h: Ditto.

* dom/make_names.pl: Changed default of createWithNew to 0.
Eventually all elements will be created with create instead of new.

* html/HTMLTagNames.in:
* svg/svgtags.in:
* wml/WMLTagNames.in:
Added createWithNew for every tag. We'll remove it as we convert
element classes to use create.

* html/HTMLAppletElement.h: Removed unneeded forward declarations.
* html/HTMLFrameElement.h: Ditto.

* html/HTMLEmbedElement.cpp: Removed many attribute get and
set functions.
* html/HTMLEmbedElement.h: Ditto.
* html/HTMLIFrameElement.cpp: Ditto.
* html/HTMLIFrameElement.h: Ditto.
* html/HTMLObjectElement.cpp: Ditto.
* html/HTMLObjectElement.h: Ditto.
* html/HTMLPlugInElement.cpp: Ditto.
* html/HTMLPlugInElement.h: Ditto.

* html/HTMLFrameElementBase.cpp: Removed many attribute get and
set functions.
(WebCore::HTMLFrameElementBase::location): Changed to use
srcAttr instead of src.
* html/HTMLFrameElementBase.h: Removed many attribute get and set
functions.

* loader/MediaDocument.cpp:
(WebCore::MediaDocument::replaceMediaElementTimerFired):
Use srcAttr and typeAttr instead of setSrc and setType.
* loader/PluginDocument.cpp:
(WebCore::PluginTokenizer::createDocumentStructure): Ditto.

* rendering/RenderPartObject.cpp:
(WebCore::RenderPartObject::updateWidget): Use nameAttr instead
of name -- this avoids an extra AtomicString round trip and a little
ref count churn too.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47469 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4f4d58b2
2009-08-18 Darin Adler <darin@apple.com>
Reviewed by Sam Weinig.
More work on making DOM classes start with reference count of 1
https://bugs.webkit.org/show_bug.cgi?id=28068
Some related clean-up and preparation steps so the subsequent
patches will be as small as possible.
* WebCore.base.exp: Sorted this file.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityDescription):
Use nameAttr instead of the name function.
* bindings/js/JSHTMLFrameElementCustom.cpp:
(WebCore::JSHTMLFrameElement::setSrc):
Use srcAttr instead of the src function.
* bindings/js/JSHTMLIFrameElementCustom.cpp:
(WebCore::JSHTMLIFrameElement::setSrc):
Use srcAttr instead of the src function.
* bindings/objc/DOM.mm: Sorted includes.
* dom/Document.cpp: Ditto.
* dom/StyledElement.cpp: Made invalidateStyleAttribute inline.
* dom/StyledElement.h: Ditto.
* dom/make_names.pl: Changed default of createWithNew to 0.
Eventually all elements will be created with create instead of new.
* html/HTMLTagNames.in:
* svg/svgtags.in:
* wml/WMLTagNames.in:
Added createWithNew for every tag. We'll remove it as we convert
element classes to use create.
* html/HTMLAppletElement.h: Removed unneeded forward declarations.
* html/HTMLFrameElement.h: Ditto.
* html/HTMLEmbedElement.cpp: Removed many attribute get and
set functions.
* html/HTMLEmbedElement.h: Ditto.
* html/HTMLIFrameElement.cpp: Ditto.
* html/HTMLIFrameElement.h: Ditto.
* html/HTMLObjectElement.cpp: Ditto.
* html/HTMLObjectElement.h: Ditto.
* html/HTMLPlugInElement.cpp: Ditto.
* html/HTMLPlugInElement.h: Ditto.
* html/HTMLFrameElementBase.cpp: Removed many attribute get and
set functions.
(WebCore::HTMLFrameElementBase::location): Changed to use
srcAttr instead of src.
* html/HTMLFrameElementBase.h: Removed many attribute get and set
functions.
* loader/MediaDocument.cpp:
(WebCore::MediaDocument::replaceMediaElementTimerFired):
Use srcAttr and typeAttr instead of setSrc and setType.
* loader/PluginDocument.cpp:
(WebCore::PluginTokenizer::createDocumentStructure): Ditto.
* rendering/RenderPartObject.cpp:
(WebCore::RenderPartObject::updateWidget): Use nameAttr instead
of name -- this avoids an extra AtomicString round trip and a little
ref count churn too.
2009-08-18 Drew Wilson <atwilson@google.com>
Reviewed by David Levin.
......@@ -444,8 +444,8 @@ __ZN7WebCore22applicationIsAppleMailEv
__ZN7WebCore22createFragmentFromTextEPNS_5RangeERKNS_6StringE
__ZN7WebCore22externalRepresentationEPNS_12RenderObjectE
__ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx
__ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE
__ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_20ApplicationCacheHostE
__ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE
__ZN7WebCore23ApplicationCacheStorage18vacuumDatabaseFileEv
__ZN7WebCore23ApplicationCacheStorage5emptyEv
__ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbbbbNS_10EditActionE
......@@ -698,9 +698,9 @@ __ZN7WebCore9FrameView16adjustPageHeightEPffff
__ZN7WebCore9FrameView18updateControlTintsEv
__ZN7WebCore9FrameView22setBaseBackgroundColorENS_5ColorE
__ZN7WebCore9FrameView23layoutIfNeededRecursiveEv
__ZN7WebCore9FrameView29syncCompositingStateRecursiveEv
__ZN7WebCore9FrameView29forceLayoutWithPageWidthRangeEffb
__ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
__ZN7WebCore9FrameView29syncCompositingStateRecursiveEv
__ZN7WebCore9FrameView6createEPNS_5FrameE
__ZN7WebCore9FrameView6createEPNS_5FrameERKNS_7IntSizeE
__ZN7WebCore9HTMLNames10listingTagE
......
......@@ -1018,7 +1018,7 @@ String AccessibilityRenderObject::accessibilityDescription() const
const AtomicString& title = static_cast<HTMLFrameElementBase*>(owner)->getAttribute(titleAttr);
if (!title.isEmpty())
return title;
return static_cast<HTMLFrameElementBase*>(owner)->name();
return static_cast<HTMLFrameElementBase*>(owner)->getAttribute(nameAttr);
}
if (owner->isHTMLElement())
return static_cast<HTMLElement*>(owner)->getAttribute(nameAttr);
......
......@@ -32,12 +32,15 @@
#include "CSSHelper.h"
#include "Document.h"
#include "HTMLFrameElement.h"
#include "HTMLNames.h"
#include "JSDOMBinding.h"
using namespace JSC;
namespace WebCore {
using namespace HTMLNames;
static inline bool allowSettingJavascriptURL(ExecState* exec, HTMLFrameElement* imp, const String& value)
{
if (protocolIsJavaScript(deprecatedParseURL(value))) {
......@@ -55,8 +58,7 @@ void JSHTMLFrameElement::setSrc(ExecState* exec, JSValue value)
if (!allowSettingJavascriptURL(exec, imp, srcValue))
return;
imp->setSrc(srcValue);
return;
imp->setAttribute(srcAttr, srcValue);
}
void JSHTMLFrameElement::setLocation(ExecState* exec, JSValue value)
......@@ -68,7 +70,6 @@ void JSHTMLFrameElement::setLocation(ExecState* exec, JSValue value)
return;
imp->setLocation(locationValue);
return;
}
} // namespace WebCore
......@@ -32,12 +32,15 @@
#include "CSSHelper.h"
#include "Document.h"
#include "HTMLIFrameElement.h"
#include "HTMLNames.h"
#include "JSDOMBinding.h"
using namespace JSC;
namespace WebCore {
using namespace HTMLNames;
void JSHTMLIFrameElement::setSrc(ExecState* exec, JSValue value)
{
HTMLIFrameElement* imp = static_cast<HTMLIFrameElement*>(impl());
......@@ -49,7 +52,7 @@ void JSHTMLIFrameElement::setSrc(ExecState* exec, JSValue value)
return;
}
imp->setSrc(srcValue);
imp->setAttribute(srcAttr, srcValue);
}
} // namespace WebCore
......@@ -29,15 +29,15 @@
#import "DOMInternal.h" // import first to make the private/public trick work
#import "DOM.h"
#import "DOMRangeInternal.h"
#import "DOMElementInternal.h"
#import "DOMNodeInternal.h"
#import "DOMHTMLCanvasElement.h"
#import "DOMNodeInternal.h"
#import "DOMRangeInternal.h"
#import "Frame.h"
#import "HTMLNames.h"
#import "HTMLElement.h"
#import "RenderImage.h"
#import "HTMLNames.h"
#import "NodeFilter.h"
#import "RenderImage.h"
#import "WebScriptObjectPrivate.h"
#import <wtf/HashMap.h>
......
......@@ -80,7 +80,6 @@
#include "HitTestResult.h"
#include "ImageLoader.h"
#include "InspectorController.h"
#include "ScriptEventListener.h"
#include "KeyboardEvent.h"
#include "Logging.h"
#include "MappedAttribute.h"
......@@ -104,6 +103,7 @@
#include "RenderWidget.h"
#include "ScriptController.h"
#include "ScriptElement.h"
#include "ScriptEventListener.h"
#include "SecurityOrigin.h"
#include "SegmentedString.h"
#include "SelectionController.h"
......
......@@ -101,11 +101,6 @@ void StyledElement::removeMappedAttributeDecl(MappedAttributeEntry entryType, co
mappedAttributeDecls->remove(MappedAttributeKey(entryType, attrName.localName().impl(), attrValue.impl()));
}
void StyledElement::invalidateStyleAttribute()
{
m_isStyleAttributeValid = false;
}
void StyledElement::updateStyleAttribute() const
{
ASSERT(!m_isStyleAttributeValid);
......@@ -292,12 +287,6 @@ void StyledElement::addCSSProperty(MappedAttribute* attr, int id, int value)
attr->decl()->setProperty(id, value, false);
}
void StyledElement::addCSSStringProperty(MappedAttribute* attr, int id, const String &value, CSSPrimitiveValue::UnitTypes type)
{
if (!attr->decl()) createMappedDecl(attr);
attr->decl()->setStringProperty(id, value, type, false);
}
void StyledElement::addCSSImageProperty(MappedAttribute* attr, int id, const String& url)
{
if (!attr->decl()) createMappedDecl(attr);
......
......@@ -48,17 +48,16 @@ public:
bool hasMappedAttributes() const { return namedAttrMap && mappedAttributes()->hasMappedAttributes(); }
bool isMappedAttribute(const QualifiedName& name) const { MappedAttributeEntry res = eNone; mapToEntry(name, res); return res != eNone; }
void addCSSLength(MappedAttribute* attr, int id, const String &value);
void addCSSProperty(MappedAttribute* attr, int id, const String &value);
void addCSSProperty(MappedAttribute* attr, int id, int value);
void addCSSStringProperty(MappedAttribute* attr, int id, const String &value, CSSPrimitiveValue::UnitTypes = CSSPrimitiveValue::CSS_STRING);
void addCSSLength(MappedAttribute*, int id, const String& value);
void addCSSProperty(MappedAttribute*, int id, const String& value);
void addCSSProperty(MappedAttribute*, int id, int value);
void addCSSImageProperty(MappedAttribute*, int propertyID, const String& url);
void addCSSColor(MappedAttribute* attr, int id, const String &c);
void createMappedDecl(MappedAttribute* attr);
void addCSSColor(MappedAttribute*, int id, const String& color);
void createMappedDecl(MappedAttribute*);
static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value);
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 type, const QualifiedName& name, const AtomicString& value);
static void removeMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value);
static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*);
static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*);
......@@ -96,6 +95,11 @@ protected:
RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl;
};
inline void StyledElement::invalidateStyleAttribute()
{
m_isStyleAttributeValid = false;
}
} //namespace
#endif
......@@ -93,7 +93,7 @@ sub defaultTagPropertyHash
return (
'constructorNeedsCreatedByParser' => 0,
'constructorNeedsFormElement' => 0,
'createWithNew' => 1,
'createWithNew' => 0,
'exportString' => 0,
'interfaceName' => defaultInterfaceName($_[0]),
# By default, the JSInterfaceName is the same as the interfaceName.
......
......@@ -27,9 +27,6 @@
namespace WebCore {
class HTMLFormElement;
class HTMLImageLoader;
class HTMLAppletElement : public HTMLPlugInElement {
public:
HTMLAppletElement(const QualifiedName&, Document*);
......
......@@ -49,10 +49,6 @@ HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document* doc)
ASSERT(hasTagName(embedTag));
}
HTMLEmbedElement::~HTMLEmbedElement()
{
}
static inline RenderWidget* findWidgetRenderer(const Node* n)
{
if (!n->renderer())
......@@ -238,31 +234,11 @@ const QualifiedName& HTMLEmbedElement::imageSourceAttributeName() const
return srcAttr;
}
String HTMLEmbedElement::src() const
{
return getAttribute(srcAttr);
}
void HTMLEmbedElement::setSrc(const String& value)
{
setAttribute(srcAttr, value);
}
String HTMLEmbedElement::type() const
{
return getAttribute(typeAttr);
}
void HTMLEmbedElement::setType(const String& value)
{
setAttribute(typeAttr, value);
}
void HTMLEmbedElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
HTMLPlugInImageElement::addSubresourceAttributeURLs(urls);
addSubresourceURL(urls, document()->completeURL(src()));
addSubresourceURL(urls, document()->completeURL(getAttribute(srcAttr)));
}
}
......@@ -30,7 +30,6 @@ namespace WebCore {
class HTMLEmbedElement : public HTMLPlugInImageElement {
public:
HTMLEmbedElement(const QualifiedName&, Document*);
~HTMLEmbedElement();
virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
virtual int tagPriority() const { return 0; }
......@@ -54,12 +53,6 @@ public:
virtual RenderWidget* renderWidgetForJSBindings() const;
String src() const;
void setSrc(const String&);
String type() const;
void setType(const String&);
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
private:
......
......@@ -28,11 +28,6 @@
namespace WebCore {
class Document;
class RenderObject;
class RenderArena;
class RenderStyle;
class HTMLFrameElement : public HTMLFrameElementBase {
public:
HTMLFrameElement(const QualifiedName&, Document*);
......
......@@ -197,7 +197,7 @@ void HTMLFrameElementBase::attach()
KURL HTMLFrameElementBase::location() const
{
return src();
return document()->completeURL(getAttribute(srcAttr));
}
void HTMLFrameElementBase::setLocation(const String& str)
......@@ -229,76 +229,6 @@ bool HTMLFrameElementBase::isURLAttribute(Attribute *attr) const
return attr->name() == srcAttr;
}
String HTMLFrameElementBase::frameBorder() const
{
return getAttribute(frameborderAttr);
}
void HTMLFrameElementBase::setFrameBorder(const String &value)
{
setAttribute(frameborderAttr, value);
}
String HTMLFrameElementBase::longDesc() const
{
return getAttribute(longdescAttr);
}
void HTMLFrameElementBase::setLongDesc(const String &value)
{
setAttribute(longdescAttr, value);
}
String HTMLFrameElementBase::marginHeight() const
{
return getAttribute(marginheightAttr);
}
void HTMLFrameElementBase::setMarginHeight(const String &value)
{
setAttribute(marginheightAttr, value);
}
String HTMLFrameElementBase::marginWidth() const
{
return getAttribute(marginwidthAttr);
}
void HTMLFrameElementBase::setMarginWidth(const String &value)
{
setAttribute(marginwidthAttr, value);
}
String HTMLFrameElementBase::name() const
{
return getAttribute(nameAttr);
}
void HTMLFrameElementBase::setName(const String &value)
{
setAttribute(nameAttr, value);
}
String HTMLFrameElementBase::scrolling() const
{
return getAttribute(scrollingAttr);
}
void HTMLFrameElementBase::setScrolling(const String &value)
{
setAttribute(scrollingAttr, value);
}
KURL HTMLFrameElementBase::src() const
{
return document()->completeURL(getAttribute(srcAttr));
}
void HTMLFrameElementBase::setSrc(const String &value)
{
setAttribute(srcAttr, value);
}
int HTMLFrameElementBase::width() const
{
if (!renderer())
......
......@@ -52,27 +52,6 @@ public:
int getMarginWidth() const { return m_marginWidth; }
int getMarginHeight() const { return m_marginHeight; }
String frameBorder() const;
void setFrameBorder(const String&);
String longDesc() const;
void setLongDesc(const String&);
String marginHeight() const;
void setMarginHeight(const String&);
String marginWidth() const;
void setMarginWidth(const String&);
String name() const;
void setName(const String&);
String scrolling() const;
void setScrolling(const String&);
KURL src() const;
void setSrc(const String&);
int width() const;
int height() const;
......
......@@ -126,34 +126,4 @@ bool HTMLIFrameElement::isURLAttribute(Attribute* attr) const
return attr->name() == srcAttr;
}
String HTMLIFrameElement::align() const
{
return getAttribute(alignAttr);
}
void HTMLIFrameElement::setAlign(const String &value)
{
setAttribute(alignAttr, value);
}
String HTMLIFrameElement::height() const
{
return getAttribute(heightAttr);
}
void HTMLIFrameElement::setHeight(const String &value)
{
setAttribute(heightAttr, value);
}
String HTMLIFrameElement::width() const
{
return getAttribute(widthAttr);
}
void HTMLIFrameElement::setWidth(const String &value)
{
setAttribute(widthAttr, value);
}
}
......@@ -48,15 +48,6 @@ public:
virtual bool isURLAttribute(Attribute*) const;
String align() const;
void setAlign(const String&);
String height() const;
void setHeight(const String&);
String width() const;
void setWidth(const String&);
private:
AtomicString m_name;
};
......
......@@ -54,10 +54,6 @@ HTMLObjectElement::HTMLObjectElement(const QualifiedName& tagName, Document* doc
ASSERT(hasTagName(objectTag));
}
HTMLObjectElement::~HTMLObjectElement()
{
}
RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const
{
RenderWidget* renderWidget = (renderer() && renderer()->isWidget()) ? toRenderWidget(renderer()) : 0;
......@@ -297,66 +293,6 @@ void HTMLObjectElement::updateDocNamedItem()
m_docNamedItem = isNamedItem;
}
String HTMLObjectElement::code() const
{
return getAttribute(codeAttr);
}
void HTMLObjectElement::setCode(const String& value)
{
setAttribute(codeAttr, value);
}
String HTMLObjectElement::archive() const
{
return getAttribute(archiveAttr);
}
void HTMLObjectElement::setArchive(const String& value)
{
setAttribute(archiveAttr, value);
}
String HTMLObjectElement::border() const
{
return getAttribute(borderAttr);
}
void HTMLObjectElement::setBorder(const String& value)
{
setAttribute(borderAttr, value);
}
String HTMLObjectElement::codeBase() const
{
return getAttribute(codebaseAttr);
}
void HTMLObjectElement::setCodeBase(const String& value)
{
setAttribute(codebaseAttr, value);
}
String HTMLObjectElement::codeType() const
{
return getAttribute(codetypeAttr);
}
void HTMLObjectElement::setCodeType(const String& value)
{
setAttribute(codetypeAttr, value);
}
KURL HTMLObjectElement::data() const
{
return document()->completeURL(getAttribute(dataAttr));
}
void HTMLObjectElement::setData(const String& value)
{
setAttribute(dataAttr, value);
}
bool HTMLObjectElement::declare() const
{
return !getAttribute(declareAttr).isNull();
......@@ -377,36 +313,6 @@ void HTMLObjectElement::setHspace(int value)
setAttribute(hspaceAttr, String::number(value));
}
String HTMLObjectElement::standby() const
{
return getAttribute(standbyAttr);
}
void HTMLObjectElement::setStandby(const String& value)
{
setAttribute(standbyAttr, value);
}
String HTMLObjectElement::type() const
{
return getAttribute(typeAttr);
}
void HTMLObjectElement::setType(const String& value)
{
setAttribute(typeAttr, value);
}
String HTMLObjectElement::useMap() const
{
return getAttribute(usemapAttr);
}
void HTMLObjectElement::setUseMap(const String& value)
{
setAttribute(usemapAttr, value);