[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:37:40 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 71c3d824cae6d491be367cc0bf4f75263d26b26c
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Apr 28 22:49:49 2004 +0000
Reviewed by Chris.
- another step of refinement on the reinterpret_cast stuff; now it's a compile-time
error if you do it wrong
- fixed a couple of storage leaks
* kwq/DOMInternal.h: Added new DOM_cast template function. Like reinterpret_cast, but a
compile-time error if you use it with the wrong parameters. Also added type-safe versions
of the wrapper functions that do the DOM_cast automatically.
* kwq/DOMInternal.mm:
(getDOMWrapperImpl): Changed name and parameter type as part of above change.
(addDOMWrapperImpl): Ditto.
(removeDOMWrapper): Ditto.
* kwq/DOM.mm: Use the new DOM_cast instead of reinterpret_cast, and the new
DOM wrapper calls that do the cast automatically.
* kwq/DOM-CSS.mm: More of the same.
(-[DOMCSSStyleSheet dealloc]): Added override to deref, fixes leak.
* kwq/DOMHTML.mm: More of the same.
(-[DOMHTMLCollection dealloc]): Added override to deref, fixes leak.
(-[DOMHTMLOptionsCollection dealloc]): Added override to deref, fixes theoretical leak.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6512 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 9303d60..f01dbfe 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -2,6 +2,30 @@
Reviewed by Chris.
+ - another step of refinement on the reinterpret_cast stuff; now it's a compile-time
+ error if you do it wrong
+ - fixed a couple of storage leaks
+
+ * kwq/DOMInternal.h: Added new DOM_cast template function. Like reinterpret_cast, but a
+ compile-time error if you use it with the wrong parameters. Also added type-safe versions
+ of the wrapper functions that do the DOM_cast automatically.
+ * kwq/DOMInternal.mm:
+ (getDOMWrapperImpl): Changed name and parameter type as part of above change.
+ (addDOMWrapperImpl): Ditto.
+ (removeDOMWrapper): Ditto.
+
+ * kwq/DOM.mm: Use the new DOM_cast instead of reinterpret_cast, and the new
+ DOM wrapper calls that do the cast automatically.
+ * kwq/DOM-CSS.mm: More of the same.
+ (-[DOMCSSStyleSheet dealloc]): Added override to deref, fixes leak.
+ * kwq/DOMHTML.mm: More of the same.
+ (-[DOMHTMLCollection dealloc]): Added override to deref, fixes leak.
+ (-[DOMHTMLOptionsCollection dealloc]): Added override to deref, fixes theoretical leak.
+
+2004-04-28 Darin Adler <darin at apple.com>
+
+ Reviewed by Chris.
+
- fixed reinterpret_cast mistakes and some style issues in DOM implementation
* kwq/DOM-CSS.mm:
diff --git a/WebCore/kwq/DOM-CSS.mm b/WebCore/kwq/DOM-CSS.mm
index 56cc2e9..c5d8a89 100644
--- a/WebCore/kwq/DOM-CSS.mm
+++ b/WebCore/kwq/DOM-CSS.mm
@@ -106,14 +106,14 @@ static inline int getPropertyID(NSString *string)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<StyleSheetImpl *>(_internal)->deref();
+ DOM_cast<StyleSheetImpl *>(_internal)->deref();
}
[super dealloc];
}
- (StyleSheetImpl *)_DOMStyleSheetImpl
{
- return reinterpret_cast<StyleSheetImpl *>(_internal);
+ return DOM_cast<StyleSheetImpl *>(_internal);
}
- (NSString *)type
@@ -163,9 +163,9 @@ static inline int getPropertyID(NSString *string)
- (id)_initWithDOMStyleSheetImpl:(StyleSheetImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -175,7 +175,7 @@ static inline int getPropertyID(NSString *string)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -192,14 +192,14 @@ static inline int getPropertyID(NSString *string)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<StyleSheetListImpl *>(_internal)->deref();
+ DOM_cast<StyleSheetListImpl *>(_internal)->deref();
}
[super dealloc];
}
- (StyleSheetListImpl *)_styleSheetListImpl
{
- return reinterpret_cast<StyleSheetListImpl *>(_internal);
+ return DOM_cast<StyleSheetListImpl *>(_internal);
}
- (unsigned long)length
@@ -219,9 +219,9 @@ static inline int getPropertyID(NSString *string)
- (id)_initWithStyleSheetListImpl:(StyleSheetListImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -231,7 +231,7 @@ static inline int getPropertyID(NSString *string)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -245,9 +245,17 @@ static inline int getPropertyID(NSString *string)
@implementation DOMCSSStyleSheet
+- (void)dealloc
+{
+ if (_internal) {
+ DOM_cast<CSSStyleSheetImpl *>(_internal)->deref();
+ }
+ [super dealloc];
+}
+
- (CSSStyleSheetImpl *)_CSSStyleSheetImpl
{
- return reinterpret_cast<CSSStyleSheetImpl *>(_internal);
+ return DOM_cast<CSSStyleSheetImpl *>(_internal);
}
- (DOMCSSRule *)ownerRule
@@ -282,9 +290,9 @@ static inline int getPropertyID(NSString *string)
- (id)_initWithCSSStyleSheetImpl:(CSSStyleSheetImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -294,7 +302,7 @@ static inline int getPropertyID(NSString *string)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -311,14 +319,14 @@ static inline int getPropertyID(NSString *string)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<MediaListImpl *>(_internal)->deref();
+ DOM_cast<MediaListImpl *>(_internal)->deref();
}
[super dealloc];
}
- (MediaListImpl *)_mediaListImpl
{
- return reinterpret_cast<MediaListImpl *>(_internal);
+ return DOM_cast<MediaListImpl *>(_internal);
}
- (NSString *)mediaText
@@ -358,9 +366,9 @@ static inline int getPropertyID(NSString *string)
- (id)_initWithMediaListImpl:(MediaListImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -370,7 +378,7 @@ static inline int getPropertyID(NSString *string)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -387,14 +395,14 @@ static inline int getPropertyID(NSString *string)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<CSSRuleListImpl *>(_internal)->deref();
+ DOM_cast<CSSRuleListImpl *>(_internal)->deref();
}
[super dealloc];
}
- (CSSRuleListImpl *)_ruleListImpl
{
- return reinterpret_cast<CSSRuleListImpl *>(_internal);
+ return DOM_cast<CSSRuleListImpl *>(_internal);
}
- (unsigned long)length
@@ -414,9 +422,9 @@ static inline int getPropertyID(NSString *string)
- (id)_initWithRuleListImpl:(CSSRuleListImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -426,7 +434,7 @@ static inline int getPropertyID(NSString *string)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -443,14 +451,14 @@ static inline int getPropertyID(NSString *string)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<CSSRuleImpl *>(_internal)->deref();
+ DOM_cast<CSSRuleImpl *>(_internal)->deref();
}
[super dealloc];
}
- (CSSRuleImpl *)_ruleImpl
{
- return reinterpret_cast<CSSRuleImpl *>(_internal);
+ return DOM_cast<CSSRuleImpl *>(_internal);
}
- (unsigned short)type
@@ -485,9 +493,9 @@ static inline int getPropertyID(NSString *string)
- (id)_initWithRuleImpl:(CSSRuleImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -497,7 +505,7 @@ static inline int getPropertyID(NSString *string)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -537,7 +545,7 @@ static inline int getPropertyID(NSString *string)
- (CSSStyleRuleImpl *)_styleRuleImpl
{
- return static_cast<CSSStyleRuleImpl *>(reinterpret_cast<CSSRuleImpl *>(_internal));
+ return static_cast<CSSStyleRuleImpl *>(DOM_cast<CSSRuleImpl *>(_internal));
}
- (NSString *)selectorText
@@ -564,7 +572,7 @@ static inline int getPropertyID(NSString *string)
- (CSSMediaRuleImpl *)_mediaRuleImpl
{
- return static_cast<CSSMediaRuleImpl *>(reinterpret_cast<CSSRuleImpl *>(_internal));
+ return static_cast<CSSMediaRuleImpl *>(DOM_cast<CSSRuleImpl *>(_internal));
}
- (DOMMediaList *)media
@@ -596,7 +604,7 @@ static inline int getPropertyID(NSString *string)
- (CSSFontFaceRuleImpl *)_fontFaceRuleImpl
{
- return static_cast<CSSFontFaceRuleImpl *>(reinterpret_cast<CSSRuleImpl *>(_internal));
+ return static_cast<CSSFontFaceRuleImpl *>(DOM_cast<CSSRuleImpl *>(_internal));
}
- (DOMCSSStyleDeclaration *)style
@@ -613,7 +621,7 @@ static inline int getPropertyID(NSString *string)
- (CSSPageRuleImpl *)_pageRuleImpl
{
- return static_cast<CSSPageRuleImpl *>(reinterpret_cast<CSSRuleImpl *>(_internal));
+ return static_cast<CSSPageRuleImpl *>(DOM_cast<CSSRuleImpl *>(_internal));
}
- (NSString *)selectorText
@@ -640,7 +648,7 @@ static inline int getPropertyID(NSString *string)
- (CSSImportRuleImpl *)_importRuleImpl
{
- return static_cast<CSSImportRuleImpl *>(reinterpret_cast<CSSRuleImpl *>(_internal));
+ return static_cast<CSSImportRuleImpl *>(DOM_cast<CSSRuleImpl *>(_internal));
}
- (DOMMediaList *)media
@@ -667,7 +675,7 @@ static inline int getPropertyID(NSString *string)
- (CSSCharsetRuleImpl *)_importRuleImpl
{
- return static_cast<CSSCharsetRuleImpl *>(reinterpret_cast<CSSRuleImpl *>(_internal));
+ return static_cast<CSSCharsetRuleImpl *>(DOM_cast<CSSRuleImpl *>(_internal));
}
- (NSString *)encoding
@@ -692,7 +700,7 @@ static inline int getPropertyID(NSString *string)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<CSSStyleDeclarationImpl *>(_internal)->deref();
+ DOM_cast<CSSStyleDeclarationImpl *>(_internal)->deref();
}
[super dealloc];
}
@@ -772,9 +780,9 @@ static inline int getPropertyID(NSString *string)
- (id)_initWithStyleDeclarationImpl:(CSSStyleDeclarationImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -784,7 +792,7 @@ static inline int getPropertyID(NSString *string)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -793,7 +801,7 @@ static inline int getPropertyID(NSString *string)
- (CSSStyleDeclarationImpl *)_styleDeclarationImpl
{
- return reinterpret_cast<CSSStyleDeclarationImpl *>(_internal);
+ return DOM_cast<CSSStyleDeclarationImpl *>(_internal);
}
@end
@@ -806,14 +814,14 @@ static inline int getPropertyID(NSString *string)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<CSSValueImpl *>(_internal)->deref();
+ DOM_cast<CSSValueImpl *>(_internal)->deref();
}
[super dealloc];
}
- (CSSValueImpl *)_valueImpl
{
- return reinterpret_cast<CSSValueImpl *>(_internal);
+ return DOM_cast<CSSValueImpl *>(_internal);
}
- (NSString *)cssText
@@ -838,9 +846,9 @@ static inline int getPropertyID(NSString *string)
- (id)_initWithValueImpl:(CSSValueImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -850,7 +858,7 @@ static inline int getPropertyID(NSString *string)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -881,7 +889,7 @@ static inline int getPropertyID(NSString *string)
- (CSSPrimitiveValueImpl *)_primitiveValueImpl
{
- return static_cast<CSSPrimitiveValueImpl *>(reinterpret_cast<CSSValueImpl *>(_internal));
+ return static_cast<CSSPrimitiveValueImpl *>(DOM_cast<CSSValueImpl *>(_internal));
}
- (unsigned short)primitiveType
@@ -938,7 +946,7 @@ static inline int getPropertyID(NSString *string)
- (CSSValueListImpl *)_valueListImpl
{
- return static_cast<CSSValueListImpl *>(reinterpret_cast<CSSValueImpl *>(_internal));
+ return static_cast<CSSValueListImpl *>(DOM_cast<CSSValueImpl *>(_internal));
}
- (unsigned long)length
@@ -1048,14 +1056,14 @@ void removeWrapperForRGB(QRgb value)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<RectImpl *>(_internal)->deref();
+ DOM_cast<RectImpl *>(_internal)->deref();
}
[super dealloc];
}
- (RectImpl *)_rectImpl
{
- return reinterpret_cast<RectImpl *>(_internal);
+ return DOM_cast<RectImpl *>(_internal);
}
- (DOMCSSPrimitiveValue *)top
@@ -1090,9 +1098,9 @@ void removeWrapperForRGB(QRgb value)
- (id)_initWithRectImpl:(RectImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -1102,7 +1110,7 @@ void removeWrapperForRGB(QRgb value)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -1119,14 +1127,14 @@ void removeWrapperForRGB(QRgb value)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<CounterImpl *>(_internal)->deref();
+ DOM_cast<CounterImpl *>(_internal)->deref();
}
[super dealloc];
}
- (CounterImpl *)_counterImpl
{
- return reinterpret_cast<CounterImpl *>(_internal);
+ return DOM_cast<CounterImpl *>(_internal);
}
- (NSString *)identifier
@@ -1156,9 +1164,9 @@ void removeWrapperForRGB(QRgb value)
- (id)_initWithCounterImpl:(CounterImpl *)impl
{
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -1168,7 +1176,7 @@ void removeWrapperForRGB(QRgb value)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
diff --git a/WebCore/kwq/DOM.mm b/WebCore/kwq/DOM.mm
index 313cf5f..a3b0dfc 100644
--- a/WebCore/kwq/DOM.mm
+++ b/WebCore/kwq/DOM.mm
@@ -139,7 +139,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (void)dealloc
{
if (_internal) {
- removeDOMWrapperForImpl(_internal);
+ removeDOMWrapper(_internal);
}
[super dealloc];
}
@@ -168,7 +168,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<NodeImpl *>(_internal)->deref();
+ DOM_cast<NodeImpl *>(_internal)->deref();
}
[super dealloc];
}
@@ -347,9 +347,9 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
ASSERT(impl);
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -359,7 +359,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -562,7 +562,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (NodeImpl *)_nodeImpl
{
- return reinterpret_cast<NodeImpl *>(_internal);
+ return DOM_cast<NodeImpl *>(_internal);
}
- (BOOL)isContentEditable
@@ -580,14 +580,14 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<NamedNodeMapImpl *>(_internal)->deref();
+ DOM_cast<NamedNodeMapImpl *>(_internal)->deref();
}
[super dealloc];
}
- (NamedNodeMapImpl *)_namedNodeMapImpl
{
- return reinterpret_cast<NamedNodeMapImpl *>(_internal);
+ return DOM_cast<NamedNodeMapImpl *>(_internal);
}
- (DOMNode *)getNamedItem:(NSString *)name
@@ -696,9 +696,9 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
ASSERT(impl);
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -708,7 +708,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -725,14 +725,14 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<NodeListImpl *>(_internal)->deref();
+ DOM_cast<NodeListImpl *>(_internal)->deref();
}
[super dealloc];
}
- (NodeListImpl *)_nodeListImpl
{
- return reinterpret_cast<NodeListImpl *>(_internal);
+ return DOM_cast<NodeListImpl *>(_internal);
}
- (DOMNode *)item:(unsigned long)index
@@ -754,9 +754,9 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
ASSERT(impl);
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -766,7 +766,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -783,7 +783,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<DOMImplementationImpl *>(_internal)->deref();
+ DOM_cast<DOMImplementationImpl *>(_internal)->deref();
}
[super dealloc];
}
@@ -846,9 +846,9 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
ASSERT(impl);
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -858,7 +858,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -867,7 +867,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (DOMImplementationImpl *)_DOMImplementationImpl
{
- return reinterpret_cast<DOMImplementationImpl *>(_internal);
+ return DOM_cast<DOMImplementationImpl *>(_internal);
}
@end
@@ -1092,7 +1092,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (DocumentImpl *)_documentImpl
{
- return static_cast<DocumentImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<DocumentImpl *>(DOM_cast<NodeImpl *>(_internal));
}
@end
@@ -1104,7 +1104,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (CharacterDataImpl *)_characterDataImpl
{
- return static_cast<CharacterDataImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<CharacterDataImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)data
@@ -1217,7 +1217,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (AttrImpl *)_attrImpl
{
- return static_cast<AttrImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<AttrImpl *>(DOM_cast<NodeImpl *>(_internal));
}
@end
@@ -1441,7 +1441,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (ElementImpl *)_elementImpl
{
- return static_cast<ElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<ElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
@end
@@ -1453,7 +1453,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (TextImpl *)_textImpl
{
- return static_cast<TextImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<TextImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMText *)splitText:(unsigned long)offset
@@ -1487,7 +1487,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (DocumentTypeImpl *)_documentTypeImpl
{
- return static_cast<DocumentTypeImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<DocumentTypeImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)name
@@ -1529,7 +1529,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (NotationImpl *)_notationImpl
{
- return static_cast<NotationImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<NotationImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)publicId
@@ -1551,7 +1551,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (EntityImpl *)_entityImpl
{
- return static_cast<EntityImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<EntityImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)publicId
@@ -1585,7 +1585,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (ProcessingInstructionImpl *)_processingInstructionImpl
{
- return static_cast<ProcessingInstructionImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<ProcessingInstructionImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)target
@@ -1617,7 +1617,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (void)dealloc
{
if (_internal) {
- reinterpret_cast<RangeImpl *>(_internal)->deref();
+ DOM_cast<RangeImpl *>(_internal)->deref();
}
[super dealloc];
}
@@ -1810,9 +1810,9 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
ASSERT(impl);
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -1822,7 +1822,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -1831,7 +1831,7 @@ inline Document DocumentImpl::createInstance(DocumentImpl *impl)
- (RangeImpl *)_rangeImpl
{
- return reinterpret_cast<RangeImpl *>(_internal);
+ return DOM_cast<RangeImpl *>(_internal);
}
@end
diff --git a/WebCore/kwq/DOMHTML.mm b/WebCore/kwq/DOMHTML.mm
index 0aa989b..9ca897a 100644
--- a/WebCore/kwq/DOMHTML.mm
+++ b/WebCore/kwq/DOMHTML.mm
@@ -149,9 +149,17 @@ using DOM::NodeImpl;
@implementation DOMHTMLCollection
+- (void)dealloc
+{
+ if (_internal) {
+ DOM_cast<HTMLCollectionImpl *>(_internal)->deref();
+ }
+ [super dealloc];
+}
+
- (HTMLCollectionImpl *)_collectionImpl
{
- return reinterpret_cast<HTMLCollectionImpl *>(_internal);
+ return DOM_cast<HTMLCollectionImpl *>(_internal);
}
- (unsigned long)length
@@ -178,9 +186,9 @@ using DOM::NodeImpl;
ASSERT(impl);
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -190,7 +198,7 @@ using DOM::NodeImpl;
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -202,17 +210,27 @@ using DOM::NodeImpl;
@implementation DOMHTMLOptionsCollection
#if 0
+
//
// We need to implement a KHTML element to back this object
//
+
+- (void)dealloc
+{
+ if (_internal) {
+ DOM_cast<HTMLOptionsCollectionImpl *>(_internal)->deref();
+ }
+ [super dealloc];
+}
+
- (id)_initWithOptionsCollectionImpl:(HTMLOptionsCollectionImpl *)impl
{
ASSERT(impl);
[super _init];
- _internal = reinterpret_cast<DOMObjectInternal *>(impl);
+ _internal = DOM_cast<DOMObjectInternal *>(impl);
impl->ref();
- setDOMWrapperForImpl(self, impl);
+ addDOMWrapper(self, impl);
return self;
}
@@ -222,7 +240,7 @@ using DOM::NodeImpl;
return nil;
id cachedInstance;
- cachedInstance = getDOMWrapperForImpl(impl);
+ cachedInstance = getDOMWrapper(impl);
if (cachedInstance)
return [[cachedInstance retain] autorelease];
@@ -231,7 +249,7 @@ using DOM::NodeImpl;
- (HTMLOptionsCollectionImpl *)_optionsCollectionImpl
{
- return reinterpret_cast<HTMLOptionsCollectionImpl *>(_internal);
+ return DOM_cast<HTMLOptionsCollectionImpl *>(_internal);
}
#endif
@@ -327,7 +345,7 @@ using DOM::NodeImpl;
- (HTMLElementImpl *)_HTMLElementImpl
{
- return static_cast<HTMLElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
@end
@@ -336,7 +354,7 @@ using DOM::NodeImpl;
- (HTMLDocumentImpl *)_HTMLDocumentImpl
{
- return static_cast<HTMLDocumentImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLDocumentImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)title
@@ -453,7 +471,7 @@ using DOM::NodeImpl;
- (HTMLHtmlElementImpl *)_HTMLHtmlElementImpl
{
- return static_cast<HTMLHtmlElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLHtmlElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)version
@@ -472,7 +490,7 @@ using DOM::NodeImpl;
- (HTMLHeadElementImpl *)_headElementImpl
{
- return static_cast<HTMLHeadElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLHeadElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)profile
@@ -491,7 +509,7 @@ using DOM::NodeImpl;
- (HTMLLinkElementImpl *)_linkElementImpl
{
- return static_cast<HTMLLinkElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLLinkElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (BOOL)disabled
@@ -596,7 +614,7 @@ using DOM::NodeImpl;
- (HTMLTitleElementImpl *)_titleElementImpl
{
- return static_cast<HTMLTitleElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLTitleElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)text
@@ -615,7 +633,7 @@ using DOM::NodeImpl;
- (HTMLMetaElementImpl *)_metaElementImpl
{
- return static_cast<HTMLMetaElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLMetaElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)content
@@ -664,7 +682,7 @@ using DOM::NodeImpl;
- (HTMLBaseElementImpl *)_baseElementImpl
{
- return static_cast<HTMLBaseElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLBaseElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)href
@@ -698,7 +716,7 @@ using DOM::NodeImpl;
- (HTMLStyleElementImpl *)_styleElementImpl
{
- return static_cast<HTMLStyleElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLStyleElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (BOOL)disabled
@@ -737,7 +755,7 @@ using DOM::NodeImpl;
- (HTMLBodyElementImpl *)_bodyElementImpl
{
- return static_cast<HTMLBodyElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLBodyElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)aLink
@@ -806,7 +824,7 @@ using DOM::NodeImpl;
- (HTMLFormElementImpl *)_formElementImpl
{
- return static_cast<HTMLFormElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLFormElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMHTMLCollection *)elements
@@ -905,7 +923,7 @@ using DOM::NodeImpl;
- (HTMLIsIndexElementImpl *)_isIndexElementImpl
{
- return static_cast<HTMLIsIndexElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLIsIndexElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMHTMLFormElement *)form
@@ -929,7 +947,7 @@ using DOM::NodeImpl;
- (HTMLSelectElementImpl *)_selectElementImpl
{
- return static_cast<HTMLSelectElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLSelectElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)type
@@ -1057,7 +1075,7 @@ using DOM::NodeImpl;
- (HTMLOptGroupElementImpl *)_optGroupElementImpl
{
- return static_cast<HTMLOptGroupElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLOptGroupElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (BOOL)disabled
@@ -1086,7 +1104,7 @@ using DOM::NodeImpl;
- (HTMLOptionElementImpl *)_optionElementImpl
{
- return static_cast<HTMLOptionElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLOptionElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMHTMLFormElement *)form
@@ -1161,7 +1179,7 @@ using DOM::NodeImpl;
- (HTMLInputElementImpl *)_inputElementImpl
{
- return static_cast<HTMLInputElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLInputElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)defaultValue
@@ -1371,7 +1389,7 @@ using DOM::NodeImpl;
- (HTMLTextAreaElementImpl *)_textAreaElementImpl
{
- return static_cast<HTMLTextAreaElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLTextAreaElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)defaultValue
@@ -1502,7 +1520,7 @@ using DOM::NodeImpl;
- (HTMLButtonElementImpl *)_buttonElementImpl
{
- return static_cast<HTMLButtonElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLButtonElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMHTMLFormElement *)form
@@ -1571,7 +1589,7 @@ using DOM::NodeImpl;
- (HTMLLabelElementImpl *)_labelElementImpl
{
- return static_cast<HTMLLabelElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLLabelElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMHTMLFormElement *)form
@@ -1608,7 +1626,7 @@ using DOM::NodeImpl;
- (HTMLFieldSetElementImpl *)_fieldSetElementImpl
{
- return static_cast<HTMLFieldSetElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLFieldSetElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMHTMLFormElement *)form
@@ -1622,7 +1640,7 @@ using DOM::NodeImpl;
- (HTMLLegendElementImpl *)_legendElementImpl
{
- return static_cast<HTMLLegendElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLLegendElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMHTMLFormElement *)form
@@ -1656,7 +1674,7 @@ using DOM::NodeImpl;
- (HTMLUListElementImpl *)_uListElementImpl
{
- return static_cast<HTMLUListElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLUListElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (BOOL)compact
@@ -1685,7 +1703,7 @@ using DOM::NodeImpl;
- (HTMLOListElementImpl *)_oListElementImpl
{
- return static_cast<HTMLOListElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLOListElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (BOOL)compact
@@ -1725,7 +1743,7 @@ using DOM::NodeImpl;
- (HTMLDListElementImpl *)_dListElementImpl
{
- return static_cast<HTMLDListElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLDListElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (BOOL)compact
@@ -1744,7 +1762,7 @@ using DOM::NodeImpl;
- (HTMLDirectoryElementImpl *)_directoryListElementImpl
{
- return static_cast<HTMLDirectoryElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLDirectoryElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (BOOL)compact
@@ -1763,7 +1781,7 @@ using DOM::NodeImpl;
- (HTMLMenuElementImpl *)_menuListElementImpl
{
- return static_cast<HTMLMenuElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLMenuElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (BOOL)compact
@@ -1782,7 +1800,7 @@ using DOM::NodeImpl;
- (HTMLLIElementImpl *)_liElementImpl
{
- return static_cast<HTMLLIElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLLIElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)type
@@ -1812,7 +1830,7 @@ using DOM::NodeImpl;
- (HTMLGenericElementImpl *)_quoteElementImpl
{
- return static_cast<HTMLGenericElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLGenericElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)cite
@@ -1831,7 +1849,7 @@ using DOM::NodeImpl;
- (HTMLDivElementImpl *)_divElementImpl
{
- return static_cast<HTMLDivElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLDivElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)align
@@ -1850,7 +1868,7 @@ using DOM::NodeImpl;
- (HTMLParagraphElementImpl *)_paragraphElementImpl
{
- return static_cast<HTMLParagraphElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLParagraphElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)align
@@ -1869,7 +1887,7 @@ using DOM::NodeImpl;
- (HTMLHeadingElementImpl *)_headingElementImpl
{
- return static_cast<HTMLHeadingElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLHeadingElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)align
@@ -1888,7 +1906,7 @@ using DOM::NodeImpl;
- (HTMLPreElementImpl *)_preElementImpl
{
- return static_cast<HTMLPreElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLPreElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (long)width
@@ -1908,7 +1926,7 @@ using DOM::NodeImpl;
- (HTMLBRElementImpl *)_BRElementImpl
{
- return static_cast<HTMLBRElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLBRElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)clear
@@ -1927,7 +1945,7 @@ using DOM::NodeImpl;
- (HTMLBaseFontElementImpl *)_baseFontElementImpl
{
- return static_cast<HTMLBaseFontElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLBaseFontElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)color
@@ -1966,7 +1984,7 @@ using DOM::NodeImpl;
- (HTMLFontElementImpl *)_fontElementImpl
{
- return static_cast<HTMLFontElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLFontElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)color
@@ -2005,7 +2023,7 @@ using DOM::NodeImpl;
- (HTMLHRElementImpl *)_HRElementImpl
{
- return static_cast<HTMLHRElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLHRElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)align
@@ -2054,7 +2072,7 @@ using DOM::NodeImpl;
- (HTMLElementImpl *)_modElementImpl
{
- return static_cast<HTMLElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)cite
@@ -2083,7 +2101,7 @@ using DOM::NodeImpl;
- (HTMLAnchorElementImpl *)_anchorElementImpl
{
- return static_cast<HTMLAnchorElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLAnchorElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)accessKey
@@ -2231,7 +2249,7 @@ using DOM::NodeImpl;
- (HTMLImageElementImpl *)_imageElementImpl
{
- return static_cast<HTMLImageElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLImageElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)name
@@ -2369,7 +2387,7 @@ using DOM::NodeImpl;
- (HTMLObjectElementImpl *)_objectElementImpl
{
- return static_cast<HTMLObjectElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLObjectElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMHTMLFormElement *)form
@@ -2561,7 +2579,7 @@ using DOM::NodeImpl;
- (HTMLParamElementImpl *)_paramElementImpl
{
- return static_cast<HTMLParamElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLParamElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)name
@@ -2610,7 +2628,7 @@ using DOM::NodeImpl;
- (HTMLAppletElementImpl *)_appletElementImpl
{
- return static_cast<HTMLAppletElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLAppletElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)align
@@ -2731,7 +2749,7 @@ using DOM::NodeImpl;
- (HTMLMapElementImpl *)_mapElementImpl
{
- return static_cast<HTMLMapElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLMapElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (DOMHTMLCollection *)areas
@@ -2756,7 +2774,7 @@ using DOM::NodeImpl;
- (HTMLAreaElementImpl *)_areaElementImpl
{
- return static_cast<HTMLAreaElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLAreaElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)accessKey
@@ -2851,7 +2869,7 @@ using DOM::NodeImpl;
- (HTMLScriptElementImpl *)_scriptElementImpl
{
- return static_cast<HTMLScriptElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLScriptElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)text
@@ -2951,7 +2969,7 @@ using DOM::NodeImpl;
- (HTMLTableCaptionElementImpl *)_tableCaptionElementImpl
{
- return static_cast<HTMLTableCaptionElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLTableCaptionElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
@end
@@ -3030,7 +3048,7 @@ using DOM::NodeImpl;
- (HTMLTableSectionElementImpl *)_tableSectionElementImpl
{
- return static_cast<HTMLTableSectionElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLTableSectionElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
@end
@@ -3228,7 +3246,7 @@ using DOM::NodeImpl;
- (HTMLTableElementImpl *)_tableElementImpl
{
- return static_cast<HTMLTableElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLTableElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
@end
@@ -3237,7 +3255,7 @@ using DOM::NodeImpl;
- (HTMLTableColElementImpl *)_tableColElementImpl
{
- return static_cast<HTMLTableColElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLTableColElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)align
@@ -3307,7 +3325,7 @@ using DOM::NodeImpl;
- (HTMLTableRowElementImpl *)_tableRowElementImpl
{
- return static_cast<HTMLTableRowElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLTableRowElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (long)rowIndex
@@ -3553,7 +3571,7 @@ using DOM::NodeImpl;
- (HTMLTableCellElementImpl *)_tableCellElementImpl
{
- return static_cast<HTMLTableCellElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLTableCellElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
@end
@@ -3562,7 +3580,7 @@ using DOM::NodeImpl;
- (HTMLFrameSetElementImpl *)_frameSetElementImpl
{
- return static_cast<HTMLFrameSetElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLFrameSetElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)rows
@@ -3591,7 +3609,7 @@ using DOM::NodeImpl;
- (HTMLFrameElementImpl *)_frameElementImpl
{
- return static_cast<HTMLFrameElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLFrameElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)frameBorder
@@ -3685,7 +3703,7 @@ using DOM::NodeImpl;
- (HTMLIFrameElementImpl *)_IFrameElementImpl
{
- return static_cast<HTMLIFrameElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLIFrameElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)align
@@ -3811,7 +3829,7 @@ using DOM::NodeImpl;
- (HTMLEmbedElementImpl *)_embedElementImpl
{
- return static_cast<HTMLEmbedElementImpl *>(reinterpret_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLEmbedElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)align
diff --git a/WebCore/kwq/DOMInternal.h b/WebCore/kwq/DOMInternal.h
index 9c3f37c..c1e4bdf 100644
--- a/WebCore/kwq/DOMInternal.h
+++ b/WebCore/kwq/DOMInternal.h
@@ -79,9 +79,18 @@ namespace DOM {
// Helper functions for DOM wrappers and gluing to Objective-C
-id getDOMWrapperForImpl(const void *impl);
-void setDOMWrapperForImpl(id wrapper, const void *impl);
-void removeDOMWrapperForImpl(const void *impl);
+// Like reinterpret_cast, but a compiler error if you use it on the wrong type.
+template <class Target, class Source> Target DOM_cast(Source) { failToCompile(); }
+
+// Type safe DOM wrapper access.
+
+id getDOMWrapperImpl(DOMObjectInternal *impl);
+void addDOMWrapperImpl(id wrapper, DOMObjectInternal *impl);
+
+template <class Source> inline id getDOMWrapper(Source impl) { return getDOMWrapperImpl(DOM_cast<DOMObjectInternal *>(impl)); }
+template <class Source> inline void addDOMWrapper(id wrapper, Source impl) { addDOMWrapperImpl(wrapper, DOM_cast<DOMObjectInternal *>(impl)); }
+void removeDOMWrapper(DOMObjectInternal *impl);
+
void raiseDOMException(int code);
inline void raiseOnDOMError(int code)
@@ -89,3 +98,31 @@ inline void raiseOnDOMError(int code)
if (code)
raiseDOMException(code);
}
+
+// Implementation details for the above.
+
+#define ALLOW_DOM_CAST(type) \
+ namespace DOM { class type; } \
+ template <> inline DOMObjectInternal *DOM_cast<DOMObjectInternal *, DOM::type *>(DOM::type *p) \
+ { return reinterpret_cast<DOMObjectInternal *>(p); } \
+ template <> inline DOM::type *DOM_cast<DOM::type *, DOMObjectInternal *>(DOMObjectInternal *p) \
+ { return reinterpret_cast<DOM::type *>(p); }
+
+// No class should appear in this list if it's base class is already here.
+ALLOW_DOM_CAST(CounterImpl)
+ALLOW_DOM_CAST(CSSRuleImpl)
+ALLOW_DOM_CAST(CSSRuleListImpl)
+ALLOW_DOM_CAST(CSSStyleDeclarationImpl)
+ALLOW_DOM_CAST(CSSStyleSheetImpl)
+ALLOW_DOM_CAST(CSSValueImpl)
+ALLOW_DOM_CAST(DOMImplementationImpl)
+ALLOW_DOM_CAST(HTMLCollectionImpl)
+ALLOW_DOM_CAST(HTMLOptionsCollectionImpl)
+ALLOW_DOM_CAST(MediaListImpl)
+ALLOW_DOM_CAST(NamedNodeMapImpl)
+ALLOW_DOM_CAST(NodeImpl)
+ALLOW_DOM_CAST(NodeListImpl)
+ALLOW_DOM_CAST(RangeImpl)
+ALLOW_DOM_CAST(RectImpl)
+ALLOW_DOM_CAST(StyleSheetImpl)
+ALLOW_DOM_CAST(StyleSheetListImpl)
diff --git a/WebCore/kwq/DOMInternal.mm b/WebCore/kwq/DOMInternal.mm
index 5e06948..968e7cf 100644
--- a/WebCore/kwq/DOMInternal.mm
+++ b/WebCore/kwq/DOMInternal.mm
@@ -41,14 +41,14 @@ using DOM::RangeException;
static CFMutableDictionaryRef wrapperCache = NULL;
-id getDOMWrapperForImpl(const void *impl)
+id getDOMWrapperImpl(DOMObjectInternal *impl)
{
if (!wrapperCache)
return nil;
return (id)CFDictionaryGetValue(wrapperCache, impl);
}
-void setDOMWrapperForImpl(id wrapper, const void *impl)
+void addDOMWrapperImpl(id wrapper, DOMObjectInternal *impl)
{
if (!wrapperCache) {
// No need to retain/free either impl key, or id value. Items will be removed
@@ -58,7 +58,7 @@ void setDOMWrapperForImpl(id wrapper, const void *impl)
CFDictionarySetValue(wrapperCache, impl, wrapper);
}
-void removeDOMWrapperForImpl(const void *impl)
+void removeDOMWrapper(DOMObjectInternal *impl)
{
if (!wrapperCache)
return;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list