2
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3
* Copyright (C) 2006 James G. Speth (speth@end.com)
4
* Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
15
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
#import "DOMInternal.h" // import first to make the private/public trick work
32
#import "DOMElementInternal.h"
33
#import "DOMHTMLCanvasElement.h"
34
#import "DOMNodeInternal.h"
35
#import "DOMPrivate.h"
36
#import "DOMRangeInternal.h"
39
#import "HTMLElement.h"
41
#import "HTMLParserIdioms.h"
43
#import "NodeFilter.h"
44
#import "RenderImage.h"
45
#import "WebScriptObjectPrivate.h"
46
#import <wtf/HashMap.h>
48
#if ENABLE(SVG_DOM_OBJC_BINDINGS)
50
#import "SVGElementInstance.h"
55
using namespace WebCore;
57
// FIXME: Would be nice to break this up into separate files to match how other WebKit
60
//------------------------------------------------------------------------------------------
65
typedef HashMap<const QualifiedName::QualifiedNameImpl*, Class> ObjCClassMap;
66
static ObjCClassMap* elementClassMap;
68
static void addElementClass(const QualifiedName& tag, Class objCClass)
70
elementClassMap->set(tag.impl(), objCClass);
73
static void createElementClassMap()
76
elementClassMap = new ObjCClassMap;
78
// FIXME: Reflect marquee once the API has been determined.
80
// Populate it with HTML and SVG element classes.
81
addElementClass(HTMLNames::aTag, [DOMHTMLAnchorElement class]);
82
addElementClass(HTMLNames::appletTag, [DOMHTMLAppletElement class]);
83
addElementClass(HTMLNames::areaTag, [DOMHTMLAreaElement class]);
84
addElementClass(HTMLNames::baseTag, [DOMHTMLBaseElement class]);
85
addElementClass(HTMLNames::basefontTag, [DOMHTMLBaseFontElement class]);
86
addElementClass(HTMLNames::bodyTag, [DOMHTMLBodyElement class]);
87
addElementClass(HTMLNames::brTag, [DOMHTMLBRElement class]);
88
addElementClass(HTMLNames::buttonTag, [DOMHTMLButtonElement class]);
89
addElementClass(HTMLNames::canvasTag, [DOMHTMLCanvasElement class]);
90
addElementClass(HTMLNames::captionTag, [DOMHTMLTableCaptionElement class]);
91
addElementClass(HTMLNames::colTag, [DOMHTMLTableColElement class]);
92
addElementClass(HTMLNames::colgroupTag, [DOMHTMLTableColElement class]);
93
addElementClass(HTMLNames::delTag, [DOMHTMLModElement class]);
94
addElementClass(HTMLNames::dirTag, [DOMHTMLDirectoryElement class]);
95
addElementClass(HTMLNames::divTag, [DOMHTMLDivElement class]);
96
addElementClass(HTMLNames::dlTag, [DOMHTMLDListElement class]);
97
addElementClass(HTMLNames::embedTag, [DOMHTMLEmbedElement class]);
98
addElementClass(HTMLNames::fieldsetTag, [DOMHTMLFieldSetElement class]);
99
addElementClass(HTMLNames::fontTag, [DOMHTMLFontElement class]);
100
addElementClass(HTMLNames::formTag, [DOMHTMLFormElement class]);
101
addElementClass(HTMLNames::frameTag, [DOMHTMLFrameElement class]);
102
addElementClass(HTMLNames::framesetTag, [DOMHTMLFrameSetElement class]);
103
addElementClass(HTMLNames::h1Tag, [DOMHTMLHeadingElement class]);
104
addElementClass(HTMLNames::h2Tag, [DOMHTMLHeadingElement class]);
105
addElementClass(HTMLNames::h3Tag, [DOMHTMLHeadingElement class]);
106
addElementClass(HTMLNames::h4Tag, [DOMHTMLHeadingElement class]);
107
addElementClass(HTMLNames::h5Tag, [DOMHTMLHeadingElement class]);
108
addElementClass(HTMLNames::h6Tag, [DOMHTMLHeadingElement class]);
109
addElementClass(HTMLNames::headTag, [DOMHTMLHeadElement class]);
110
addElementClass(HTMLNames::hrTag, [DOMHTMLHRElement class]);
111
addElementClass(HTMLNames::htmlTag, [DOMHTMLHtmlElement class]);
112
addElementClass(HTMLNames::iframeTag, [DOMHTMLIFrameElement class]);
113
addElementClass(HTMLNames::imgTag, [DOMHTMLImageElement class]);
114
addElementClass(HTMLNames::inputTag, [DOMHTMLInputElement class]);
115
addElementClass(HTMLNames::insTag, [DOMHTMLModElement class]);
116
addElementClass(HTMLNames::labelTag, [DOMHTMLLabelElement class]);
117
addElementClass(HTMLNames::legendTag, [DOMHTMLLegendElement class]);
118
addElementClass(HTMLNames::liTag, [DOMHTMLLIElement class]);
119
addElementClass(HTMLNames::linkTag, [DOMHTMLLinkElement class]);
120
addElementClass(HTMLNames::listingTag, [DOMHTMLPreElement class]);
121
addElementClass(HTMLNames::mapTag, [DOMHTMLMapElement class]);
122
addElementClass(HTMLNames::marqueeTag, [DOMHTMLMarqueeElement class]);
123
addElementClass(HTMLNames::menuTag, [DOMHTMLMenuElement class]);
124
addElementClass(HTMLNames::metaTag, [DOMHTMLMetaElement class]);
125
addElementClass(HTMLNames::objectTag, [DOMHTMLObjectElement class]);
126
addElementClass(HTMLNames::olTag, [DOMHTMLOListElement class]);
127
addElementClass(HTMLNames::optgroupTag, [DOMHTMLOptGroupElement class]);
128
addElementClass(HTMLNames::optionTag, [DOMHTMLOptionElement class]);
129
addElementClass(HTMLNames::pTag, [DOMHTMLParagraphElement class]);
130
addElementClass(HTMLNames::paramTag, [DOMHTMLParamElement class]);
131
addElementClass(HTMLNames::preTag, [DOMHTMLPreElement class]);
132
addElementClass(HTMLNames::qTag, [DOMHTMLQuoteElement class]);
133
addElementClass(HTMLNames::scriptTag, [DOMHTMLScriptElement class]);
134
addElementClass(HTMLNames::selectTag, [DOMHTMLSelectElement class]);
135
addElementClass(HTMLNames::styleTag, [DOMHTMLStyleElement class]);
136
addElementClass(HTMLNames::tableTag, [DOMHTMLTableElement class]);
137
addElementClass(HTMLNames::tbodyTag, [DOMHTMLTableSectionElement class]);
138
addElementClass(HTMLNames::tdTag, [DOMHTMLTableCellElement class]);
139
addElementClass(HTMLNames::textareaTag, [DOMHTMLTextAreaElement class]);
140
addElementClass(HTMLNames::tfootTag, [DOMHTMLTableSectionElement class]);
141
addElementClass(HTMLNames::thTag, [DOMHTMLTableCellElement class]);
142
addElementClass(HTMLNames::theadTag, [DOMHTMLTableSectionElement class]);
143
addElementClass(HTMLNames::titleTag, [DOMHTMLTitleElement class]);
144
addElementClass(HTMLNames::trTag, [DOMHTMLTableRowElement class]);
145
addElementClass(HTMLNames::ulTag, [DOMHTMLUListElement class]);
146
addElementClass(HTMLNames::xmpTag, [DOMHTMLPreElement class]);
148
#if ENABLE(SVG_DOM_OBJC_BINDINGS)
149
addElementClass(SVGNames::aTag, [DOMSVGAElement class]);
150
addElementClass(SVGNames::altGlyphDefTag, [DOMSVGAltGlyphDefElement class]);
151
addElementClass(SVGNames::altGlyphTag, [DOMSVGAltGlyphElement class]);
152
addElementClass(SVGNames::altGlyphItemTag, [DOMSVGAltGlyphItemElement class]);
153
addElementClass(SVGNames::animateTag, [DOMSVGAnimateElement class]);
154
addElementClass(SVGNames::animateColorTag, [DOMSVGAnimateColorElement class]);
155
addElementClass(SVGNames::animateTransformTag, [DOMSVGAnimateTransformElement class]);
156
addElementClass(SVGNames::setTag, [DOMSVGSetElement class]);
157
addElementClass(SVGNames::circleTag, [DOMSVGCircleElement class]);
158
addElementClass(SVGNames::clipPathTag, [DOMSVGClipPathElement class]);
159
addElementClass(SVGNames::cursorTag, [DOMSVGCursorElement class]);
160
addElementClass(SVGNames::defsTag, [DOMSVGDefsElement class]);
161
addElementClass(SVGNames::descTag, [DOMSVGDescElement class]);
162
addElementClass(SVGNames::ellipseTag, [DOMSVGEllipseElement class]);
164
addElementClass(SVGNames::feBlendTag, [DOMSVGFEBlendElement class]);
165
addElementClass(SVGNames::feColorMatrixTag, [DOMSVGFEColorMatrixElement class]);
166
addElementClass(SVGNames::feComponentTransferTag, [DOMSVGFEComponentTransferElement class]);
167
addElementClass(SVGNames::feCompositeTag, [DOMSVGFECompositeElement class]);
168
addElementClass(SVGNames::feConvolveMatrixTag, [DOMSVGFEConvolveMatrixElement class]);
169
addElementClass(SVGNames::feDiffuseLightingTag, [DOMSVGFEDiffuseLightingElement class]);
170
addElementClass(SVGNames::feDisplacementMapTag, [DOMSVGFEDisplacementMapElement class]);
171
addElementClass(SVGNames::feDistantLightTag, [DOMSVGFEDistantLightElement class]);
172
addElementClass(SVGNames::feDropShadowTag, [DOMSVGFEDropShadowElement class]);
173
addElementClass(SVGNames::feFloodTag, [DOMSVGFEFloodElement class]);
174
addElementClass(SVGNames::feFuncATag, [DOMSVGFEFuncAElement class]);
175
addElementClass(SVGNames::feFuncBTag, [DOMSVGFEFuncBElement class]);
176
addElementClass(SVGNames::feFuncGTag, [DOMSVGFEFuncGElement class]);
177
addElementClass(SVGNames::feFuncRTag, [DOMSVGFEFuncRElement class]);
178
addElementClass(SVGNames::feGaussianBlurTag, [DOMSVGFEGaussianBlurElement class]);
179
addElementClass(SVGNames::feImageTag, [DOMSVGFEImageElement class]);
180
addElementClass(SVGNames::feMergeTag, [DOMSVGFEMergeElement class]);
181
addElementClass(SVGNames::feMergeNodeTag, [DOMSVGFEMergeNodeElement class]);
182
addElementClass(SVGNames::feMorphologyTag, [DOMSVGFEMorphologyElement class]);
183
addElementClass(SVGNames::feOffsetTag, [DOMSVGFEOffsetElement class]);
184
addElementClass(SVGNames::fePointLightTag, [DOMSVGFEPointLightElement class]);
185
addElementClass(SVGNames::feSpecularLightingTag, [DOMSVGFESpecularLightingElement class]);
186
addElementClass(SVGNames::feSpotLightTag, [DOMSVGFESpotLightElement class]);
187
addElementClass(SVGNames::feTileTag, [DOMSVGFETileElement class]);
188
addElementClass(SVGNames::feTurbulenceTag, [DOMSVGFETurbulenceElement class]);
189
addElementClass(SVGNames::filterTag, [DOMSVGFilterElement class]);
191
#if ENABLE(SVG_FONTS)
192
addElementClass(SVGNames::fontTag, [DOMSVGFontElement class]);
193
addElementClass(SVGNames::font_faceTag, [DOMSVGFontFaceElement class]);
194
addElementClass(SVGNames::font_face_formatTag, [DOMSVGFontFaceFormatElement class]);
195
addElementClass(SVGNames::font_face_nameTag, [DOMSVGFontFaceNameElement class]);
196
addElementClass(SVGNames::font_face_srcTag, [DOMSVGFontFaceSrcElement class]);
197
addElementClass(SVGNames::font_face_uriTag, [DOMSVGFontFaceUriElement class]);
198
addElementClass(SVGNames::glyphTag, [DOMSVGGlyphElement class]);
199
addElementClass(SVGNames::glyphRefTag, [DOMSVGGlyphRefElement class]);
201
addElementClass(SVGNames::gTag, [DOMSVGGElement class]);
202
addElementClass(SVGNames::imageTag, [DOMSVGImageElement class]);
203
addElementClass(SVGNames::lineTag, [DOMSVGLineElement class]);
204
addElementClass(SVGNames::linearGradientTag, [DOMSVGLinearGradientElement class]);
205
addElementClass(SVGNames::markerTag, [DOMSVGMarkerElement class]);
206
addElementClass(SVGNames::maskTag, [DOMSVGMaskElement class]);
207
addElementClass(SVGNames::metadataTag, [DOMSVGMetadataElement class]);
208
#if ENABLE(SVG_FONTS)
209
addElementClass(SVGNames::missing_glyphTag, [DOMSVGMissingGlyphElement class]);
211
addElementClass(SVGNames::pathTag, [DOMSVGPathElement class]);
212
addElementClass(SVGNames::patternTag, [DOMSVGPatternElement class]);
213
addElementClass(SVGNames::polygonTag, [DOMSVGPolygonElement class]);
214
addElementClass(SVGNames::polylineTag, [DOMSVGPolylineElement class]);
215
addElementClass(SVGNames::radialGradientTag, [DOMSVGRadialGradientElement class]);
216
addElementClass(SVGNames::rectTag, [DOMSVGRectElement class]);
217
addElementClass(SVGNames::scriptTag, [DOMSVGScriptElement class]);
218
addElementClass(SVGNames::stopTag, [DOMSVGStopElement class]);
219
addElementClass(SVGNames::styleTag, [DOMSVGStyleElement class]);
220
addElementClass(SVGNames::svgTag, [DOMSVGSVGElement class]);
221
addElementClass(SVGNames::switchTag, [DOMSVGSwitchElement class]);
222
addElementClass(SVGNames::symbolTag, [DOMSVGSymbolElement class]);
223
addElementClass(SVGNames::textTag, [DOMSVGTextElement class]);
224
addElementClass(SVGNames::titleTag, [DOMSVGTitleElement class]);
225
addElementClass(SVGNames::trefTag, [DOMSVGTRefElement class]);
226
addElementClass(SVGNames::tspanTag, [DOMSVGTSpanElement class]);
227
addElementClass(SVGNames::textPathTag, [DOMSVGTextPathElement class]);
228
addElementClass(SVGNames::useTag, [DOMSVGUseElement class]);
229
addElementClass(SVGNames::viewTag, [DOMSVGViewElement class]);
233
static Class lookupElementClass(const QualifiedName& tag)
235
// Do a special lookup to ignore element prefixes
237
return elementClassMap->get(QualifiedName(nullAtom, tag.localName(), tag.namespaceURI()).impl());
239
return elementClassMap->get(tag.impl());
242
static Class elementClass(const QualifiedName& tag, Class defaultClass)
244
if (!elementClassMap)
245
createElementClassMap();
246
Class objcClass = lookupElementClass(tag);
248
objcClass = defaultClass;
252
static NSArray *kit(const Vector<IntRect>& rects)
254
size_t size = rects.size();
255
NSMutableArray *array = [NSMutableArray arrayWithCapacity:size];
256
for (size_t i = 0; i < size; ++i)
257
[array addObject:[NSValue valueWithRect:rects[i]]];
261
} // namespace WebCore
263
@implementation DOMNode (WebCoreInternal)
265
- (NSString *)description
268
return [NSString stringWithFormat:@"<%@: null>", [[self class] description]];
270
NSString *value = [self nodeValue];
272
return [NSString stringWithFormat:@"<%@ [%@]: %p '%@'>",
273
[[self class] description], [self nodeName], _internal, value];
275
return [NSString stringWithFormat:@"<%@ [%@]: %p>", [[self class] description], [self nodeName], _internal];
278
- (JSC::Bindings::RootObject*)_rootObject
280
WebCore::Frame* frame = core(self)->document()->frame();
283
return frame->script()->bindingRootObject();
288
Class kitClass(WebCore::Node* impl)
290
switch (impl->nodeType()) {
291
case WebCore::Node::ELEMENT_NODE:
292
if (impl->isHTMLElement())
293
return WebCore::elementClass(static_cast<WebCore::HTMLElement*>(impl)->tagQName(), [DOMHTMLElement class]);
294
#if ENABLE(SVG_DOM_OBJC_BINDINGS)
295
if (impl->isSVGElement())
296
return WebCore::elementClass(static_cast<WebCore::SVGElement*>(impl)->tagQName(), [DOMSVGElement class]);
298
return [DOMElement class];
299
case WebCore::Node::ATTRIBUTE_NODE:
300
return [DOMAttr class];
301
case WebCore::Node::TEXT_NODE:
302
return [DOMText class];
303
case WebCore::Node::CDATA_SECTION_NODE:
304
return [DOMCDATASection class];
305
case WebCore::Node::ENTITY_REFERENCE_NODE:
306
return [DOMEntityReference class];
307
case WebCore::Node::ENTITY_NODE:
308
return [DOMEntity class];
309
case WebCore::Node::PROCESSING_INSTRUCTION_NODE:
310
return [DOMProcessingInstruction class];
311
case WebCore::Node::COMMENT_NODE:
312
return [DOMComment class];
313
case WebCore::Node::DOCUMENT_NODE:
314
if (static_cast<WebCore::Document*>(impl)->isHTMLDocument())
315
return [DOMHTMLDocument class];
316
#if ENABLE(SVG_DOM_OBJC_BINDINGS)
317
if (static_cast<WebCore::Document*>(impl)->isSVGDocument())
318
return [DOMSVGDocument class];
320
return [DOMDocument class];
321
case WebCore::Node::DOCUMENT_TYPE_NODE:
322
return [DOMDocumentType class];
323
case WebCore::Node::DOCUMENT_FRAGMENT_NODE:
324
return [DOMDocumentFragment class];
325
case WebCore::Node::NOTATION_NODE:
326
return [DOMNotation class];
327
case WebCore::Node::XPATH_NAMESPACE_NODE:
328
// FIXME: Create an XPath objective C wrapper
329
// See http://bugs.webkit.org/show_bug.cgi?id=8755
332
ASSERT_NOT_REACHED();
336
id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget)
341
if (WebCore::Node* node = eventTarget->toNode())
344
// We don't have an ObjC binding for XMLHttpRequest.
349
@implementation DOMNode (DOMNodeExtensions)
351
- (NSRect)boundingBox
353
// FIXME: Could we move this function to WebCore::Node and autogenerate?
354
core(self)->document()->updateLayoutIgnorePendingStylesheets();
355
WebCore::RenderObject* renderer = core(self)->renderer();
358
return renderer->absoluteBoundingBoxRect();
361
- (NSArray *)lineBoxRects
363
return [self textRects];
368
@implementation DOMNode (DOMNodeExtensionsPendingPublic)
370
- (NSImage *)renderedImage
372
// FIXME: Could we move this function to WebCore::Node and autogenerate?
373
WebCore::Node* node = core(self);
374
WebCore::Frame* frame = node->document()->frame();
377
return frame->nodeImage(node).get();
380
- (NSArray *)textRects
382
core(self)->document()->updateLayoutIgnorePendingStylesheets();
383
if (!core(self)->renderer())
385
Vector<WebCore::IntRect> rects;
386
core(self)->textRects(rects);
392
@implementation DOMRange (DOMRangeExtensions)
394
- (NSRect)boundingBox
396
// FIXME: The call to updateLayoutIgnorePendingStylesheets should be moved into WebCore::Range.
397
core(self)->ownerDocument()->updateLayoutIgnorePendingStylesheets();
398
return core(self)->boundingBox();
401
- (NSImage *)renderedImageForcingBlackText:(BOOL)forceBlackText
403
WebCore::Range* range = core(self);
404
WebCore::Frame* frame = range->ownerDocument()->frame();
408
return frame->rangeImage(range, forceBlackText);
411
- (NSArray *)textRects
413
// FIXME: The call to updateLayoutIgnorePendingStylesheets should be moved into WebCore::Range.
414
Vector<WebCore::IntRect> rects;
415
core(self)->ownerDocument()->updateLayoutIgnorePendingStylesheets();
416
core(self)->textRects(rects);
420
- (NSArray *)lineBoxRects
422
// FIXME: Remove this once all clients stop using it and we drop Leopard support.
423
return [self textRects];
428
//------------------------------------------------------------------------------------------
431
@implementation DOMElement (DOMElementAppKitExtensions)
435
// FIXME: Could we move this function to WebCore::Node and autogenerate?
436
WebCore::RenderObject* renderer = core(self)->renderer();
437
if (!renderer || !renderer->isImage())
439
WebCore::CachedImage* cachedImage = static_cast<WebCore::RenderImage*>(renderer)->cachedImage();
440
if (!cachedImage || cachedImage->errorOccurred())
442
return cachedImage->imageForRenderer(renderer)->getNSImage();
447
@implementation DOMElement (WebPrivate)
451
// FIXME: Could we move this function to WebCore::Element and autogenerate?
452
WebCore::RenderObject* renderer = core(self)->renderer();
455
return renderer->style()->font().primaryFont()->getNSFont();
458
- (NSData *)_imageTIFFRepresentation
460
// FIXME: Could we move this function to WebCore::Element and autogenerate?
461
WebCore::RenderObject* renderer = core(self)->renderer();
462
if (!renderer || !renderer->isImage())
464
WebCore::CachedImage* cachedImage = static_cast<WebCore::RenderImage*>(renderer)->cachedImage();
465
if (!cachedImage || cachedImage->errorOccurred())
467
return (NSData *)cachedImage->imageForRenderer(renderer)->getTIFFRepresentation();
470
- (NSURL *)_getURLAttribute:(NSString *)name
472
// FIXME: Could we move this function to WebCore::Element and autogenerate?
474
WebCore::Element* element = core(self);
476
return element->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(element->getAttribute(name)));
481
// FIXME: Could we move this function to WebCore::Element and autogenerate?
482
WebCore::Element* element = core(self);
483
return element->document()->focusedNode() == element;
488
//------------------------------------------------------------------------------------------
491
@implementation DOMRange (WebPrivate)
493
- (NSString *)description
496
return @"<DOMRange: null>";
497
return [NSString stringWithFormat:@"<DOMRange: %@ %d %@ %d>",
498
[self startContainer], [self startOffset], [self endContainer], [self endOffset]];
501
// FIXME: This should be removed as soon as all internal Apple uses of it have been replaced with
502
// calls to the public method - (NSString *)text.
510
//------------------------------------------------------------------------------------------
513
@implementation DOMRGBColor (WebPrivate)
515
// FIXME: This should be removed as soon as all internal Apple uses of it have been replaced with
516
// calls to the public method - (NSColor *)color.
525
//------------------------------------------------------------------------------------------
528
DOMNodeFilter *kit(WebCore::NodeFilter* impl)
533
if (DOMNodeFilter *wrapper = getDOMWrapper(impl))
534
return [[wrapper retain] autorelease];
536
DOMNodeFilter *wrapper = [[DOMNodeFilter alloc] _init];
537
wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(impl);
539
addDOMWrapper(wrapper, impl);
540
return [wrapper autorelease];
543
WebCore::NodeFilter* core(DOMNodeFilter *wrapper)
545
return wrapper ? reinterpret_cast<WebCore::NodeFilter*>(wrapper->_internal) : 0;
548
@implementation DOMNodeFilter
553
reinterpret_cast<WebCore::NodeFilter*>(_internal)->deref();
560
reinterpret_cast<WebCore::NodeFilter*>(_internal)->deref();
564
- (short)acceptNode:(DOMNode *)node
566
return core(self)->acceptNode(core(node));