diff options
author | Steve Block <steveblock@google.com> | 2011-05-06 11:45:16 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-12 13:44:10 +0100 |
commit | cad810f21b803229eb11403f9209855525a25d57 (patch) | |
tree | 29a6fd0279be608e0fe9ffe9841f722f0f4e4269 /Source/WebCore/bindings/objc | |
parent | 121b0cf4517156d0ac5111caf9830c51b69bae8f (diff) | |
download | external_webkit-cad810f21b803229eb11403f9209855525a25d57.zip external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.gz external_webkit-cad810f21b803229eb11403f9209855525a25d57.tar.bz2 |
Merge WebKit at r75315: Initial merge by git.
Change-Id: I570314b346ce101c935ed22a626b48c2af266b84
Diffstat (limited to 'Source/WebCore/bindings/objc')
45 files changed, 7232 insertions, 0 deletions
diff --git a/Source/WebCore/bindings/objc/DOM.h b/Source/WebCore/bindings/objc/DOM.h new file mode 100644 index 0000000..a3d6201 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOM.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMCore.h> +#import <WebCore/DOMCSS.h> +#import <WebCore/DOMExtensions.h> +#import <WebCore/DOMEvents.h> +#import <WebCore/DOMHTML.h> +#import <WebCore/DOMRanges.h> +#import <WebCore/DOMStylesheets.h> +#import <WebCore/DOMTraversal.h> +#import <WebCore/DOMViews.h> +#import <WebCore/DOMXPath.h> diff --git a/Source/WebCore/bindings/objc/DOM.mm b/Source/WebCore/bindings/objc/DOM.mm new file mode 100644 index 0000000..44bd653 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOM.mm @@ -0,0 +1,566 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 James G. Speth (speth@end.com) + * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "DOMInternal.h" // import first to make the private/public trick work +#import "DOM.h" + +#import "DOMElementInternal.h" +#import "DOMHTMLCanvasElement.h" +#import "DOMNodeInternal.h" +#import "DOMPrivate.h" +#import "DOMRangeInternal.h" +#import "Frame.h" +#import "HTMLElement.h" +#import "HTMLNames.h" +#import "HTMLParserIdioms.h" +#import "Image.h" +#import "NodeFilter.h" +#import "RenderImage.h" +#import "WebScriptObjectPrivate.h" +#import <wtf/HashMap.h> + +#if ENABLE(SVG_DOM_OBJC_BINDINGS) +#import "DOMSVG.h" +#import "SVGElementInstance.h" +#import "SVGNames.h" +#endif + +using namespace JSC; +using namespace WebCore; + +// FIXME: Would be nice to break this up into separate files to match how other WebKit +// code is organized. + +//------------------------------------------------------------------------------------------ +// DOMNode + +namespace WebCore { + +typedef HashMap<const QualifiedName::QualifiedNameImpl*, Class> ObjCClassMap; +static ObjCClassMap* elementClassMap; + +static void addElementClass(const QualifiedName& tag, Class objCClass) +{ + elementClassMap->set(tag.impl(), objCClass); +} + +static void createElementClassMap() +{ + // Create the table. + elementClassMap = new ObjCClassMap; + + // FIXME: Reflect marquee once the API has been determined. + + // Populate it with HTML and SVG element classes. + addElementClass(HTMLNames::aTag, [DOMHTMLAnchorElement class]); + addElementClass(HTMLNames::appletTag, [DOMHTMLAppletElement class]); + addElementClass(HTMLNames::areaTag, [DOMHTMLAreaElement class]); + addElementClass(HTMLNames::baseTag, [DOMHTMLBaseElement class]); + addElementClass(HTMLNames::basefontTag, [DOMHTMLBaseFontElement class]); + addElementClass(HTMLNames::bodyTag, [DOMHTMLBodyElement class]); + addElementClass(HTMLNames::brTag, [DOMHTMLBRElement class]); + addElementClass(HTMLNames::buttonTag, [DOMHTMLButtonElement class]); + addElementClass(HTMLNames::canvasTag, [DOMHTMLCanvasElement class]); + addElementClass(HTMLNames::captionTag, [DOMHTMLTableCaptionElement class]); + addElementClass(HTMLNames::colTag, [DOMHTMLTableColElement class]); + addElementClass(HTMLNames::colgroupTag, [DOMHTMLTableColElement class]); + addElementClass(HTMLNames::delTag, [DOMHTMLModElement class]); + addElementClass(HTMLNames::dirTag, [DOMHTMLDirectoryElement class]); + addElementClass(HTMLNames::divTag, [DOMHTMLDivElement class]); + addElementClass(HTMLNames::dlTag, [DOMHTMLDListElement class]); + addElementClass(HTMLNames::embedTag, [DOMHTMLEmbedElement class]); + addElementClass(HTMLNames::fieldsetTag, [DOMHTMLFieldSetElement class]); + addElementClass(HTMLNames::fontTag, [DOMHTMLFontElement class]); + addElementClass(HTMLNames::formTag, [DOMHTMLFormElement class]); + addElementClass(HTMLNames::frameTag, [DOMHTMLFrameElement class]); + addElementClass(HTMLNames::framesetTag, [DOMHTMLFrameSetElement class]); + addElementClass(HTMLNames::h1Tag, [DOMHTMLHeadingElement class]); + addElementClass(HTMLNames::h2Tag, [DOMHTMLHeadingElement class]); + addElementClass(HTMLNames::h3Tag, [DOMHTMLHeadingElement class]); + addElementClass(HTMLNames::h4Tag, [DOMHTMLHeadingElement class]); + addElementClass(HTMLNames::h5Tag, [DOMHTMLHeadingElement class]); + addElementClass(HTMLNames::h6Tag, [DOMHTMLHeadingElement class]); + addElementClass(HTMLNames::headTag, [DOMHTMLHeadElement class]); + addElementClass(HTMLNames::hrTag, [DOMHTMLHRElement class]); + addElementClass(HTMLNames::htmlTag, [DOMHTMLHtmlElement class]); + addElementClass(HTMLNames::iframeTag, [DOMHTMLIFrameElement class]); + addElementClass(HTMLNames::imgTag, [DOMHTMLImageElement class]); + addElementClass(HTMLNames::inputTag, [DOMHTMLInputElement class]); + addElementClass(HTMLNames::insTag, [DOMHTMLModElement class]); + addElementClass(HTMLNames::isindexTag, [DOMHTMLIsIndexElement class]); + addElementClass(HTMLNames::labelTag, [DOMHTMLLabelElement class]); + addElementClass(HTMLNames::legendTag, [DOMHTMLLegendElement class]); + addElementClass(HTMLNames::liTag, [DOMHTMLLIElement class]); + addElementClass(HTMLNames::linkTag, [DOMHTMLLinkElement class]); + addElementClass(HTMLNames::listingTag, [DOMHTMLPreElement class]); + addElementClass(HTMLNames::mapTag, [DOMHTMLMapElement class]); + addElementClass(HTMLNames::marqueeTag, [DOMHTMLMarqueeElement class]); + addElementClass(HTMLNames::menuTag, [DOMHTMLMenuElement class]); + addElementClass(HTMLNames::metaTag, [DOMHTMLMetaElement class]); + addElementClass(HTMLNames::objectTag, [DOMHTMLObjectElement class]); + addElementClass(HTMLNames::olTag, [DOMHTMLOListElement class]); + addElementClass(HTMLNames::optgroupTag, [DOMHTMLOptGroupElement class]); + addElementClass(HTMLNames::optionTag, [DOMHTMLOptionElement class]); + addElementClass(HTMLNames::pTag, [DOMHTMLParagraphElement class]); + addElementClass(HTMLNames::paramTag, [DOMHTMLParamElement class]); + addElementClass(HTMLNames::preTag, [DOMHTMLPreElement class]); + addElementClass(HTMLNames::qTag, [DOMHTMLQuoteElement class]); + addElementClass(HTMLNames::scriptTag, [DOMHTMLScriptElement class]); + addElementClass(HTMLNames::keygenTag, [DOMHTMLSelectElement class]); + addElementClass(HTMLNames::selectTag, [DOMHTMLSelectElement class]); + addElementClass(HTMLNames::styleTag, [DOMHTMLStyleElement class]); + addElementClass(HTMLNames::tableTag, [DOMHTMLTableElement class]); + addElementClass(HTMLNames::tbodyTag, [DOMHTMLTableSectionElement class]); + addElementClass(HTMLNames::tdTag, [DOMHTMLTableCellElement class]); + addElementClass(HTMLNames::textareaTag, [DOMHTMLTextAreaElement class]); + addElementClass(HTMLNames::tfootTag, [DOMHTMLTableSectionElement class]); + addElementClass(HTMLNames::thTag, [DOMHTMLTableCellElement class]); + addElementClass(HTMLNames::theadTag, [DOMHTMLTableSectionElement class]); + addElementClass(HTMLNames::titleTag, [DOMHTMLTitleElement class]); + addElementClass(HTMLNames::trTag, [DOMHTMLTableRowElement class]); + addElementClass(HTMLNames::ulTag, [DOMHTMLUListElement class]); + addElementClass(HTMLNames::xmpTag, [DOMHTMLPreElement class]); + +#if ENABLE(SVG_DOM_OBJC_BINDINGS) + addElementClass(SVGNames::aTag, [DOMSVGAElement class]); + addElementClass(SVGNames::altGlyphTag, [DOMSVGAltGlyphElement class]); +#if ENABLE(SVG_ANIMATION) + addElementClass(SVGNames::animateTag, [DOMSVGAnimateElement class]); + addElementClass(SVGNames::animateColorTag, [DOMSVGAnimateColorElement class]); + addElementClass(SVGNames::animateTransformTag, [DOMSVGAnimateTransformElement class]); + addElementClass(SVGNames::setTag, [DOMSVGSetElement class]); +#endif + addElementClass(SVGNames::circleTag, [DOMSVGCircleElement class]); + addElementClass(SVGNames::clipPathTag, [DOMSVGClipPathElement class]); + addElementClass(SVGNames::cursorTag, [DOMSVGCursorElement class]); + addElementClass(SVGNames::defsTag, [DOMSVGDefsElement class]); + addElementClass(SVGNames::descTag, [DOMSVGDescElement class]); + addElementClass(SVGNames::ellipseTag, [DOMSVGEllipseElement class]); +#if ENABLE(FILTERS) + addElementClass(SVGNames::feBlendTag, [DOMSVGFEBlendElement class]); + addElementClass(SVGNames::feColorMatrixTag, [DOMSVGFEColorMatrixElement class]); + addElementClass(SVGNames::feComponentTransferTag, [DOMSVGFEComponentTransferElement class]); + addElementClass(SVGNames::feCompositeTag, [DOMSVGFECompositeElement class]); + addElementClass(SVGNames::feConvolveMatrixTag, [DOMSVGFEConvolveMatrixElement class]); + addElementClass(SVGNames::feDiffuseLightingTag, [DOMSVGFEDiffuseLightingElement class]); + addElementClass(SVGNames::feDisplacementMapTag, [DOMSVGFEDisplacementMapElement class]); + addElementClass(SVGNames::feDistantLightTag, [DOMSVGFEDistantLightElement class]); + addElementClass(SVGNames::feFloodTag, [DOMSVGFEFloodElement class]); + addElementClass(SVGNames::feFuncATag, [DOMSVGFEFuncAElement class]); + addElementClass(SVGNames::feFuncBTag, [DOMSVGFEFuncBElement class]); + addElementClass(SVGNames::feFuncGTag, [DOMSVGFEFuncGElement class]); + addElementClass(SVGNames::feFuncRTag, [DOMSVGFEFuncRElement class]); + addElementClass(SVGNames::feGaussianBlurTag, [DOMSVGFEGaussianBlurElement class]); + addElementClass(SVGNames::feImageTag, [DOMSVGFEImageElement class]); + addElementClass(SVGNames::feMergeTag, [DOMSVGFEMergeElement class]); + addElementClass(SVGNames::feMergeNodeTag, [DOMSVGFEMergeNodeElement class]); + addElementClass(SVGNames::feMorphologyTag, [DOMSVGFEMorphologyElement class]); + addElementClass(SVGNames::feOffsetTag, [DOMSVGFEOffsetElement class]); + addElementClass(SVGNames::fePointLightTag, [DOMSVGFEPointLightElement class]); + addElementClass(SVGNames::feSpecularLightingTag, [DOMSVGFESpecularLightingElement class]); + addElementClass(SVGNames::feSpotLightTag, [DOMSVGFESpotLightElement class]); + addElementClass(SVGNames::feTileTag, [DOMSVGFETileElement class]); + addElementClass(SVGNames::feTurbulenceTag, [DOMSVGFETurbulenceElement class]); + addElementClass(SVGNames::filterTag, [DOMSVGFilterElement class]); +#endif +#if ENABLE(SVG_FONTS) + addElementClass(SVGNames::fontTag, [DOMSVGFontElement class]); + addElementClass(SVGNames::font_faceTag, [DOMSVGFontFaceElement class]); + addElementClass(SVGNames::font_face_formatTag, [DOMSVGFontFaceFormatElement class]); + addElementClass(SVGNames::font_face_nameTag, [DOMSVGFontFaceNameElement class]); + addElementClass(SVGNames::font_face_srcTag, [DOMSVGFontFaceSrcElement class]); + addElementClass(SVGNames::font_face_uriTag, [DOMSVGFontFaceUriElement class]); + addElementClass(SVGNames::glyphTag, [DOMSVGGlyphElement class]); +#endif + addElementClass(SVGNames::gTag, [DOMSVGGElement class]); + addElementClass(SVGNames::imageTag, [DOMSVGImageElement class]); + addElementClass(SVGNames::lineTag, [DOMSVGLineElement class]); + addElementClass(SVGNames::linearGradientTag, [DOMSVGLinearGradientElement class]); + addElementClass(SVGNames::markerTag, [DOMSVGMarkerElement class]); + addElementClass(SVGNames::maskTag, [DOMSVGMaskElement class]); + addElementClass(SVGNames::metadataTag, [DOMSVGMetadataElement class]); +#if ENABLE(SVG_FONTS) + addElementClass(SVGNames::missing_glyphTag, [DOMSVGMissingGlyphElement class]); +#endif + addElementClass(SVGNames::pathTag, [DOMSVGPathElement class]); + addElementClass(SVGNames::patternTag, [DOMSVGPatternElement class]); + addElementClass(SVGNames::polygonTag, [DOMSVGPolygonElement class]); + addElementClass(SVGNames::polylineTag, [DOMSVGPolylineElement class]); + addElementClass(SVGNames::radialGradientTag, [DOMSVGRadialGradientElement class]); + addElementClass(SVGNames::rectTag, [DOMSVGRectElement class]); + addElementClass(SVGNames::scriptTag, [DOMSVGScriptElement class]); + addElementClass(SVGNames::stopTag, [DOMSVGStopElement class]); + addElementClass(SVGNames::styleTag, [DOMSVGStyleElement class]); + addElementClass(SVGNames::svgTag, [DOMSVGSVGElement class]); + addElementClass(SVGNames::switchTag, [DOMSVGSwitchElement class]); + addElementClass(SVGNames::symbolTag, [DOMSVGSymbolElement class]); + addElementClass(SVGNames::textTag, [DOMSVGTextElement class]); + addElementClass(SVGNames::titleTag, [DOMSVGTitleElement class]); + addElementClass(SVGNames::trefTag, [DOMSVGTRefElement class]); + addElementClass(SVGNames::tspanTag, [DOMSVGTSpanElement class]); + addElementClass(SVGNames::textPathTag, [DOMSVGTextPathElement class]); + addElementClass(SVGNames::useTag, [DOMSVGUseElement class]); + addElementClass(SVGNames::viewTag, [DOMSVGViewElement class]); +#endif +} + +static Class lookupElementClass(const QualifiedName& tag) +{ + // Do a special lookup to ignore element prefixes + if (tag.hasPrefix()) + return elementClassMap->get(QualifiedName(nullAtom, tag.localName(), tag.namespaceURI()).impl()); + + return elementClassMap->get(tag.impl()); +} + +static Class elementClass(const QualifiedName& tag, Class defaultClass) +{ + if (!elementClassMap) + createElementClassMap(); + Class objcClass = lookupElementClass(tag); + if (!objcClass) + objcClass = defaultClass; + return objcClass; +} + +static NSArray *kit(const Vector<IntRect>& rects) +{ + size_t size = rects.size(); + NSMutableArray *array = [NSMutableArray arrayWithCapacity:size]; + for (size_t i = 0; i < size; ++i) + [array addObject:[NSValue valueWithRect:rects[i]]]; + return array; +} + +} // namespace WebCore + +@implementation DOMNode (WebCoreInternal) + +- (NSString *)description +{ + if (!_internal) + return [NSString stringWithFormat:@"<%@: null>", [[self class] description], self]; + + NSString *value = [self nodeValue]; + if (value) + return [NSString stringWithFormat:@"<%@ [%@]: %p '%@'>", + [[self class] description], [self nodeName], _internal, value]; + + return [NSString stringWithFormat:@"<%@ [%@]: %p>", [[self class] description], [self nodeName], _internal]; +} + +- (JSC::Bindings::RootObject*)_rootObject +{ + WebCore::Frame* frame = core(self)->document()->frame(); + if (!frame) + return 0; + return frame->script()->bindingRootObject(); +} + +@end + +Class kitClass(WebCore::Node* impl) +{ + switch (impl->nodeType()) { + case WebCore::Node::ELEMENT_NODE: + if (impl->isHTMLElement()) + return WebCore::elementClass(static_cast<WebCore::HTMLElement*>(impl)->tagQName(), [DOMHTMLElement class]); +#if ENABLE(SVG_DOM_OBJC_BINDINGS) + if (impl->isSVGElement()) + return WebCore::elementClass(static_cast<WebCore::SVGElement*>(impl)->tagQName(), [DOMSVGElement class]); +#endif + return [DOMElement class]; + case WebCore::Node::ATTRIBUTE_NODE: + return [DOMAttr class]; + case WebCore::Node::TEXT_NODE: + return [DOMText class]; + case WebCore::Node::CDATA_SECTION_NODE: + return [DOMCDATASection class]; + case WebCore::Node::ENTITY_REFERENCE_NODE: + return [DOMEntityReference class]; + case WebCore::Node::ENTITY_NODE: + return [DOMEntity class]; + case WebCore::Node::PROCESSING_INSTRUCTION_NODE: + return [DOMProcessingInstruction class]; + case WebCore::Node::COMMENT_NODE: + return [DOMComment class]; + case WebCore::Node::DOCUMENT_NODE: + if (static_cast<WebCore::Document*>(impl)->isHTMLDocument()) + return [DOMHTMLDocument class]; +#if ENABLE(SVG_DOM_OBJC_BINDINGS) + if (static_cast<WebCore::Document*>(impl)->isSVGDocument()) + return [DOMSVGDocument class]; +#endif + return [DOMDocument class]; + case WebCore::Node::DOCUMENT_TYPE_NODE: + return [DOMDocumentType class]; + case WebCore::Node::DOCUMENT_FRAGMENT_NODE: + return [DOMDocumentFragment class]; + case WebCore::Node::NOTATION_NODE: + return [DOMNotation class]; + case WebCore::Node::XPATH_NAMESPACE_NODE: + // FIXME: Create an XPath objective C wrapper + // See http://bugs.webkit.org/show_bug.cgi?id=8755 + return nil; + } + ASSERT_NOT_REACHED(); + return nil; +} + +id <DOMEventTarget> kit(WebCore::EventTarget* eventTarget) +{ + if (!eventTarget) + return nil; + + if (WebCore::Node* node = eventTarget->toNode()) + return kit(node); + +#if ENABLE(SVG_DOM_OBJC_BINDINGS) + if (WebCore::SVGElementInstance* svgElementInstance = eventTarget->toSVGElementInstance()) + return kit(svgElementInstance); +#endif + + // We don't have an ObjC binding for XMLHttpRequest. + + return nil; +} + +@implementation DOMNode (DOMNodeExtensions) + +- (NSRect)boundingBox +{ + // FIXME: Could we move this function to WebCore::Node and autogenerate? + core(self)->document()->updateLayoutIgnorePendingStylesheets(); + WebCore::RenderObject* renderer = core(self)->renderer(); + if (!renderer) + return NSZeroRect; + return renderer->absoluteBoundingBoxRect(); +} + +- (NSArray *)lineBoxRects +{ + return [self textRects]; +} + +@end + +@implementation DOMNode (DOMNodeExtensionsPendingPublic) + +- (NSImage *)renderedImage +{ + // FIXME: Could we move this function to WebCore::Node and autogenerate? + WebCore::Node* node = core(self); + WebCore::Frame* frame = node->document()->frame(); + if (!frame) + return nil; + return frame->nodeImage(node).get(); +} + +- (NSArray *)textRects +{ + // FIXME: Could we move this function to WebCore::Node and autogenerate? + core(self)->document()->updateLayoutIgnorePendingStylesheets(); + if (!core(self)->renderer()) + return nil; + RefPtr<Range> range = Range::create(core(self)->document()); + WebCore::ExceptionCode ec = 0; + range->selectNodeContents(core(self), ec); + Vector<WebCore::IntRect> rects; + range->textRects(rects); + return kit(rects); +} +@end + +@implementation DOMRange (DOMRangeExtensions) + +- (NSRect)boundingBox +{ + // FIXME: The call to updateLayoutIgnorePendingStylesheets should be moved into WebCore::Range. + core(self)->ownerDocument()->updateLayoutIgnorePendingStylesheets(); + return core(self)->boundingBox(); +} + +- (NSArray *)textRects +{ + // FIXME: The call to updateLayoutIgnorePendingStylesheets should be moved into WebCore::Range. + Vector<WebCore::IntRect> rects; + core(self)->ownerDocument()->updateLayoutIgnorePendingStylesheets(); + core(self)->textRects(rects); + return kit(rects); +} + +- (NSArray *)lineBoxRects +{ + // FIXME: Remove this once all clients stop using it and we drop Leopard support. + return [self textRects]; +} + +@end + +//------------------------------------------------------------------------------------------ +// DOMElement + +@implementation DOMElement (DOMElementAppKitExtensions) + +- (NSImage*)image +{ + // FIXME: Could we move this function to WebCore::Node and autogenerate? + WebCore::RenderObject* renderer = core(self)->renderer(); + if (!renderer || !renderer->isImage()) + return nil; + WebCore::CachedImage* cachedImage = static_cast<WebCore::RenderImage*>(renderer)->cachedImage(); + if (!cachedImage || cachedImage->errorOccurred()) + return nil; + return cachedImage->image()->getNSImage(); +} + +@end + +@implementation DOMElement (WebPrivate) + +- (NSFont *)_font +{ + // FIXME: Could we move this function to WebCore::Element and autogenerate? + WebCore::RenderObject* renderer = core(self)->renderer(); + if (!renderer) + return nil; + return renderer->style()->font().primaryFont()->getNSFont(); +} + +- (NSData *)_imageTIFFRepresentation +{ + // FIXME: Could we move this function to WebCore::Element and autogenerate? + WebCore::RenderObject* renderer = core(self)->renderer(); + if (!renderer || !renderer->isImage()) + return nil; + WebCore::CachedImage* cachedImage = static_cast<WebCore::RenderImage*>(renderer)->cachedImage(); + if (!cachedImage || cachedImage->errorOccurred()) + return nil; + return (NSData *)cachedImage->image()->getTIFFRepresentation(); +} + +- (NSURL *)_getURLAttribute:(NSString *)name +{ + // FIXME: Could we move this function to WebCore::Element and autogenerate? + ASSERT(name); + WebCore::Element* element = core(self); + ASSERT(element); + return element->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(element->getAttribute(name))); +} + +- (BOOL)isFocused +{ + // FIXME: Could we move this function to WebCore::Element and autogenerate? + WebCore::Element* element = core(self); + return element->document()->focusedNode() == element; +} + +@end + +//------------------------------------------------------------------------------------------ +// DOMRange + +@implementation DOMRange (WebPrivate) + +- (NSString *)description +{ + if (!_internal) + return @"<DOMRange: null>"; + return [NSString stringWithFormat:@"<DOMRange: %@ %d %@ %d>", + [self startContainer], [self startOffset], [self endContainer], [self endOffset]]; +} + +// FIXME: This should be removed as soon as all internal Apple uses of it have been replaced with +// calls to the public method - (NSString *)text. +- (NSString *)_text +{ + return [self text]; +} + +@end + +//------------------------------------------------------------------------------------------ +// DOMRGBColor + +@implementation DOMRGBColor (WebPrivate) + +// FIXME: This should be removed as soon as all internal Apple uses of it have been replaced with +// calls to the public method - (NSColor *)color. +- (NSColor *)_color +{ + return [self color]; +} + +@end + + +//------------------------------------------------------------------------------------------ +// DOMNodeFilter + +DOMNodeFilter *kit(WebCore::NodeFilter* impl) +{ + if (!impl) + return nil; + + if (DOMNodeFilter *wrapper = getDOMWrapper(impl)) + return [[wrapper retain] autorelease]; + + DOMNodeFilter *wrapper = [[DOMNodeFilter alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(impl); + impl->ref(); + addDOMWrapper(wrapper, impl); + return [wrapper autorelease]; +} + +WebCore::NodeFilter* core(DOMNodeFilter *wrapper) +{ + return wrapper ? reinterpret_cast<WebCore::NodeFilter*>(wrapper->_internal) : 0; +} + +@implementation DOMNodeFilter + +- (void)dealloc +{ + if (_internal) + reinterpret_cast<WebCore::NodeFilter*>(_internal)->deref(); + [super dealloc]; +} + +- (void)finalize +{ + if (_internal) + reinterpret_cast<WebCore::NodeFilter*>(_internal)->deref(); + [super finalize]; +} + +- (short)acceptNode:(DOMNode *)node +{ + return core(self)->acceptNode(core(node)); +} + +@end diff --git a/Source/WebCore/bindings/objc/DOMAbstractView.mm b/Source/WebCore/bindings/objc/DOMAbstractView.mm new file mode 100644 index 0000000..0b79aa9 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMAbstractView.mm @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "DOMInternal.h" // import first to make the private/public trick work +#import "DOMAbstractViewInternal.h" + +#import "DOMDocumentInternal.h" +#import "ExceptionHandlers.h" +#import "Frame.h" +#import "ThreadCheck.h" +#import "WebScriptObjectPrivate.h" + +#define IMPL reinterpret_cast<WebCore::Frame*>(_internal) + +@implementation DOMAbstractView + +- (void)dealloc +{ + { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); } + [super dealloc]; +} + +- (DOMDocument *)document +{ + if (!_internal) + return nil; + return kit(IMPL->domWindow()->document()); +} + +@end + +@implementation DOMAbstractView (Frame) + +- (void)_disconnectFrame +{ + ASSERT(_internal); + removeDOMWrapper(_internal); + _internal = 0; +} + +@end + +WebCore::DOMWindow* core(DOMAbstractView *wrapper) +{ + if (!wrapper) + return 0; + if (!wrapper->_internal) + return 0; + return reinterpret_cast<WebCore::Frame*>(wrapper->_internal)->domWindow(); +} + +DOMAbstractView *kit(WebCore::DOMWindow* value) +{ + { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }; + + if (!value) + return nil; + WebCore::Frame* frame = value->frame(); + if (!frame) + return nil; + if (DOMAbstractView *wrapper = getDOMWrapper(frame)) + return [[wrapper retain] autorelease]; + DOMAbstractView *wrapper = [[DOMAbstractView alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(frame); + addDOMWrapper(wrapper, frame); + return [wrapper autorelease]; +} diff --git a/Source/WebCore/bindings/objc/DOMAbstractViewFrame.h b/Source/WebCore/bindings/objc/DOMAbstractViewFrame.h new file mode 100644 index 0000000..386a912 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMAbstractViewFrame.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2008 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMAbstractView.h> + +@interface DOMAbstractView (Frame) +- (void)_disconnectFrame; +@end diff --git a/Source/WebCore/bindings/objc/DOMCSS.h b/Source/WebCore/bindings/objc/DOMCSS.h new file mode 100644 index 0000000..daaa8a0 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMCSS.h @@ -0,0 +1,300 @@ +/* + * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMCore.h> +#import <WebCore/DOMDocument.h> +#import <WebCore/DOMElement.h> +#import <WebCore/DOMObject.h> +#import <WebCore/DOMStylesheets.h> + +#import <WebCore/DOMCSSCharsetRule.h> +#import <WebCore/DOMCSSFontFaceRule.h> +#import <WebCore/DOMCSSImportRule.h> +#import <WebCore/DOMCSSMediaRule.h> +#import <WebCore/DOMCSSPageRule.h> +#import <WebCore/DOMCSSPrimitiveValue.h> +#import <WebCore/DOMCSSRule.h> +#import <WebCore/DOMCSSRuleList.h> +#import <WebCore/DOMCSSStyleDeclaration.h> +#import <WebCore/DOMCSSStyleRule.h> +#import <WebCore/DOMCSSStyleSheet.h> +#import <WebCore/DOMCSSUnknownRule.h> +#import <WebCore/DOMCSSValue.h> +#import <WebCore/DOMCSSValueList.h> +#import <WebCore/DOMCounter.h> +#import <WebCore/DOMRGBColor.h> +#import <WebCore/DOMRect.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3 + +@interface DOMCSSStyleDeclaration (DOMCSS2Properties) +- (NSString *)azimuth; +- (void)setAzimuth:(NSString *)azimuth; +- (NSString *)background; +- (void)setBackground:(NSString *)background; +- (NSString *)backgroundAttachment; +- (void)setBackgroundAttachment:(NSString *)backgroundAttachment; +- (NSString *)backgroundColor; +- (void)setBackgroundColor:(NSString *)backgroundColor; +- (NSString *)backgroundImage; +- (void)setBackgroundImage:(NSString *)backgroundImage; +- (NSString *)backgroundPosition; +- (void)setBackgroundPosition:(NSString *)backgroundPosition; +- (NSString *)backgroundRepeat; +- (void)setBackgroundRepeat:(NSString *)backgroundRepeat; +- (NSString *)border; +- (void)setBorder:(NSString *)border; +- (NSString *)borderCollapse; +- (void)setBorderCollapse:(NSString *)borderCollapse; +- (NSString *)borderColor; +- (void)setBorderColor:(NSString *)borderColor; +- (NSString *)borderSpacing; +- (void)setBorderSpacing:(NSString *)borderSpacing; +- (NSString *)borderStyle; +- (void)setBorderStyle:(NSString *)borderStyle; +- (NSString *)borderTop; +- (void)setBorderTop:(NSString *)borderTop; +- (NSString *)borderRight; +- (void)setBorderRight:(NSString *)borderRight; +- (NSString *)borderBottom; +- (void)setBorderBottom:(NSString *)borderBottom; +- (NSString *)borderLeft; +- (void)setBorderLeft:(NSString *)borderLeft; +- (NSString *)borderTopColor; +- (void)setBorderTopColor:(NSString *)borderTopColor; +- (NSString *)borderRightColor; +- (void)setBorderRightColor:(NSString *)borderRightColor; +- (NSString *)borderBottomColor; +- (void)setBorderBottomColor:(NSString *)borderBottomColor; +- (NSString *)borderLeftColor; +- (void)setBorderLeftColor:(NSString *)borderLeftColor; +- (NSString *)borderTopStyle; +- (void)setBorderTopStyle:(NSString *)borderTopStyle; +- (NSString *)borderRightStyle; +- (void)setBorderRightStyle:(NSString *)borderRightStyle; +- (NSString *)borderBottomStyle; +- (void)setBorderBottomStyle:(NSString *)borderBottomStyle; +- (NSString *)borderLeftStyle; +- (void)setBorderLeftStyle:(NSString *)borderLeftStyle; +- (NSString *)borderTopWidth; +- (void)setBorderTopWidth:(NSString *)borderTopWidth; +- (NSString *)borderRightWidth; +- (void)setBorderRightWidth:(NSString *)borderRightWidth; +- (NSString *)borderBottomWidth; +- (void)setBorderBottomWidth:(NSString *)borderBottomWidth; +- (NSString *)borderLeftWidth; +- (void)setBorderLeftWidth:(NSString *)borderLeftWidth; +- (NSString *)borderWidth; +- (void)setBorderWidth:(NSString *)borderWidth; +- (NSString *)bottom; +- (void)setBottom:(NSString *)bottom; +- (NSString *)captionSide; +- (void)setCaptionSide:(NSString *)captionSide; +- (NSString *)clear; +- (void)setClear:(NSString *)clear; +- (NSString *)clip; +- (void)setClip:(NSString *)clip; +- (NSString *)color; +- (void)setColor:(NSString *)color; +- (NSString *)content; +- (void)setContent:(NSString *)content; +- (NSString *)counterIncrement; +- (void)setCounterIncrement:(NSString *)counterIncrement; +- (NSString *)counterReset; +- (void)setCounterReset:(NSString *)counterReset; +- (NSString *)cue; +- (void)setCue:(NSString *)cue; +- (NSString *)cueAfter; +- (void)setCueAfter:(NSString *)cueAfter; +- (NSString *)cueBefore; +- (void)setCueBefore:(NSString *)cueBefore; +- (NSString *)cursor; +- (void)setCursor:(NSString *)cursor; +- (NSString *)direction; +- (void)setDirection:(NSString *)direction; +- (NSString *)display; +- (void)setDisplay:(NSString *)display; +- (NSString *)elevation; +- (void)setElevation:(NSString *)elevation; +- (NSString *)emptyCells; +- (void)setEmptyCells:(NSString *)emptyCells; +- (NSString *)cssFloat; +- (void)setCssFloat:(NSString *)cssFloat; +- (NSString *)font; +- (void)setFont:(NSString *)font; +- (NSString *)fontFamily; +- (void)setFontFamily:(NSString *)fontFamily; +- (NSString *)fontSize; +- (void)setFontSize:(NSString *)fontSize; +- (NSString *)fontSizeAdjust; +- (void)setFontSizeAdjust:(NSString *)fontSizeAdjust; +- (NSString *)fontStretch; +- (void)setFontStretch:(NSString *)fontStretch; +- (NSString *)fontStyle; +- (void)setFontStyle:(NSString *)fontStyle; +- (NSString *)fontVariant; +- (void)setFontVariant:(NSString *)fontVariant; +- (NSString *)fontWeight; +- (void)setFontWeight:(NSString *)fontWeight; +- (NSString *)height; +- (void)setHeight:(NSString *)height; +- (NSString *)left; +- (void)setLeft:(NSString *)left; +- (NSString *)letterSpacing; +- (void)setLetterSpacing:(NSString *)letterSpacing; +- (NSString *)lineHeight; +- (void)setLineHeight:(NSString *)lineHeight; +- (NSString *)listStyle; +- (void)setListStyle:(NSString *)listStyle; +- (NSString *)listStyleImage; +- (void)setListStyleImage:(NSString *)listStyleImage; +- (NSString *)listStylePosition; +- (void)setListStylePosition:(NSString *)listStylePosition; +- (NSString *)listStyleType; +- (void)setListStyleType:(NSString *)listStyleType; +- (NSString *)margin; +- (void)setMargin:(NSString *)margin; +- (NSString *)marginTop; +- (void)setMarginTop:(NSString *)marginTop; +- (NSString *)marginRight; +- (void)setMarginRight:(NSString *)marginRight; +- (NSString *)marginBottom; +- (void)setMarginBottom:(NSString *)marginBottom; +- (NSString *)marginLeft; +- (void)setMarginLeft:(NSString *)marginLeft; +- (NSString *)markerOffset; +- (void)setMarkerOffset:(NSString *)markerOffset; +- (NSString *)marks; +- (void)setMarks:(NSString *)marks; +- (NSString *)maxHeight; +- (void)setMaxHeight:(NSString *)maxHeight; +- (NSString *)maxWidth; +- (void)setMaxWidth:(NSString *)maxWidth; +- (NSString *)minHeight; +- (void)setMinHeight:(NSString *)minHeight; +- (NSString *)minWidth; +- (void)setMinWidth:(NSString *)minWidth; +- (NSString *)orphans; +- (void)setOrphans:(NSString *)orphans; +- (NSString *)outline; +- (void)setOutline:(NSString *)outline; +- (NSString *)outlineColor; +- (void)setOutlineColor:(NSString *)outlineColor; +- (NSString *)outlineStyle; +- (void)setOutlineStyle:(NSString *)outlineStyle; +- (NSString *)outlineWidth; +- (void)setOutlineWidth:(NSString *)outlineWidth; +- (NSString *)overflow; +- (void)setOverflow:(NSString *)overflow; +- (NSString *)padding; +- (void)setPadding:(NSString *)padding; +- (NSString *)paddingTop; +- (void)setPaddingTop:(NSString *)paddingTop; +- (NSString *)paddingRight; +- (void)setPaddingRight:(NSString *)paddingRight; +- (NSString *)paddingBottom; +- (void)setPaddingBottom:(NSString *)paddingBottom; +- (NSString *)paddingLeft; +- (void)setPaddingLeft:(NSString *)paddingLeft; +- (NSString *)page; +- (void)setPage:(NSString *)page; +- (NSString *)pageBreakAfter; +- (void)setPageBreakAfter:(NSString *)pageBreakAfter; +- (NSString *)pageBreakBefore; +- (void)setPageBreakBefore:(NSString *)pageBreakBefore; +- (NSString *)pageBreakInside; +- (void)setPageBreakInside:(NSString *)pageBreakInside; +- (NSString *)pause; +- (void)setPause:(NSString *)pause; +- (NSString *)pauseAfter; +- (void)setPauseAfter:(NSString *)pauseAfter; +- (NSString *)pauseBefore; +- (void)setPauseBefore:(NSString *)pauseBefore; +- (NSString *)pitch; +- (void)setPitch:(NSString *)pitch; +- (NSString *)pitchRange; +- (void)setPitchRange:(NSString *)pitchRange; +- (NSString *)playDuring; +- (void)setPlayDuring:(NSString *)playDuring; +- (NSString *)position; +- (void)setPosition:(NSString *)position; +- (NSString *)quotes; +- (void)setQuotes:(NSString *)quotes; +- (NSString *)richness; +- (void)setRichness:(NSString *)richness; +- (NSString *)right; +- (void)setRight:(NSString *)right; +- (NSString *)size; +- (void)setSize:(NSString *)size; +- (NSString *)speak; +- (void)setSpeak:(NSString *)speak; +- (NSString *)speakHeader; +- (void)setSpeakHeader:(NSString *)speakHeader; +- (NSString *)speakNumeral; +- (void)setSpeakNumeral:(NSString *)speakNumeral; +- (NSString *)speakPunctuation; +- (void)setSpeakPunctuation:(NSString *)speakPunctuation; +- (NSString *)speechRate; +- (void)setSpeechRate:(NSString *)speechRate; +- (NSString *)stress; +- (void)setStress:(NSString *)stress; +- (NSString *)tableLayout; +- (void)setTableLayout:(NSString *)tableLayout; +- (NSString *)textAlign; +- (void)setTextAlign:(NSString *)textAlign; +- (NSString *)textDecoration; +- (void)setTextDecoration:(NSString *)textDecoration; +- (NSString *)textIndent; +- (void)setTextIndent:(NSString *)textIndent; +- (NSString *)textShadow; +- (void)setTextShadow:(NSString *)textShadow; +- (NSString *)textTransform; +- (void)setTextTransform:(NSString *)textTransform; +- (NSString *)top; +- (void)setTop:(NSString *)top; +- (NSString *)unicodeBidi; +- (void)setUnicodeBidi:(NSString *)unicodeBidi; +- (NSString *)verticalAlign; +- (void)setVerticalAlign:(NSString *)verticalAlign; +- (NSString *)visibility; +- (void)setVisibility:(NSString *)visibility; +- (NSString *)voiceFamily; +- (void)setVoiceFamily:(NSString *)voiceFamily; +- (NSString *)volume; +- (void)setVolume:(NSString *)volume; +- (NSString *)whiteSpace; +- (void)setWhiteSpace:(NSString *)whiteSpace; +- (NSString *)widows; +- (void)setWidows:(NSString *)widows; +- (NSString *)width; +- (void)setWidth:(NSString *)width; +- (NSString *)wordSpacing; +- (void)setWordSpacing:(NSString *)wordSpacing; +- (NSString *)zIndex; +- (void)setZIndex:(NSString *)zIndex; +@end + +#endif diff --git a/Source/WebCore/bindings/objc/DOMCSS.mm b/Source/WebCore/bindings/objc/DOMCSS.mm new file mode 100644 index 0000000..f12ee4f --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMCSS.mm @@ -0,0 +1,1357 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 James G. Speth (speth@end.com) + * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" + +#import "CSSRule.h" +#import "CSSValue.h" +#import "DOMCSSCharsetRule.h" +#import "DOMCSSFontFaceRule.h" +#import "DOMCSSImportRule.h" +#import "DOMCSSMediaRule.h" +#import "DOMCSSPageRule.h" +#import "DOMCSSPrimitiveValue.h" +#import "DOMCSSRuleInternal.h" +#import "DOMCSSStyleDeclaration.h" +#import "DOMCSSStyleRule.h" +#import "DOMCSSStyleSheet.h" +#import "DOMCSSUnknownRule.h" +#import "DOMCSSValueInternal.h" +#import "DOMCSSValueList.h" +#import "DOMInternal.h" +#import "DOMStyleSheetInternal.h" +#import "DOMWebKitCSSKeyframeRule.h" +#import "DOMWebKitCSSKeyframesRule.h" +#import "DOMWebKitCSSTransformValue.h" + +#if ENABLE(SVG_DOM_OBJC_BINDINGS) +#import "DOMSVGPaint.h" +#endif + +//------------------------------------------------------------------------------------------ +// DOMStyleSheet + +Class kitClass(WebCore::StyleSheet* impl) +{ + if (impl->isCSSStyleSheet()) + return [DOMCSSStyleSheet class]; + return [DOMStyleSheet class]; +} + +//------------------------------------------------------------------------------------------ +// DOMCSSRule + +Class kitClass(WebCore::CSSRule* impl) +{ + switch (impl->type()) { + case DOM_UNKNOWN_RULE: + return [DOMCSSUnknownRule class]; + case DOM_STYLE_RULE: + return [DOMCSSStyleRule class]; + case DOM_CHARSET_RULE: + return [DOMCSSCharsetRule class]; + case DOM_IMPORT_RULE: + return [DOMCSSImportRule class]; + case DOM_MEDIA_RULE: + return [DOMCSSMediaRule class]; + case DOM_FONT_FACE_RULE: + return [DOMCSSFontFaceRule class]; + case DOM_PAGE_RULE: + return [DOMCSSPageRule class]; + case DOM_WEBKIT_KEYFRAMES_RULE: + return [DOMWebKitCSSKeyframesRule class]; + case DOM_WEBKIT_KEYFRAME_RULE: + return [DOMWebKitCSSKeyframeRule class]; + } + ASSERT_NOT_REACHED(); + return nil; +} + +//------------------------------------------------------------------------------------------ +// DOMCSSValue + +Class kitClass(WebCore::CSSValue* impl) +{ + switch (impl->cssValueType()) { + case WebCore::CSSValue::CSS_PRIMITIVE_VALUE: + return [DOMCSSPrimitiveValue class]; + case WebCore::CSSValue::CSS_VALUE_LIST: + if (impl->isWebKitCSSTransformValue()) + return [DOMWebKitCSSTransformValue class]; + return [DOMCSSValueList class]; + case WebCore::CSSValue::CSS_INHERIT: + case WebCore::CSSValue::CSS_INITIAL: + return [DOMCSSValue class]; + case WebCore::CSSValue::CSS_CUSTOM: +#if ENABLE(SVG_DOM_OBJC_BINDINGS) + if (impl->isSVGPaint()) + return [DOMSVGPaint class]; + if (impl->isSVGColor()) + return [DOMSVGColor class]; +#endif + return [DOMCSSValue class]; + } + ASSERT_NOT_REACHED(); + return nil; +} + +//------------------------------------------------------------------------------------------ +// DOMCSSStyleDeclaration CSS2 Properties + +@implementation DOMCSSStyleDeclaration (DOMCSS2Properties) + +- (NSString *)azimuth +{ + return [self getPropertyValue:@"azimuth"]; +} + +- (void)setAzimuth:(NSString *)azimuth +{ + [self setProperty:@"azimuth" value:azimuth priority:@""]; +} + +- (NSString *)background +{ + return [self getPropertyValue:@"background"]; +} + +- (void)setBackground:(NSString *)background +{ + [self setProperty:@"background" value:background priority:@""]; +} + +- (NSString *)backgroundAttachment +{ + return [self getPropertyValue:@"background-attachment"]; +} + +- (void)setBackgroundAttachment:(NSString *)backgroundAttachment +{ + [self setProperty:@"background-attachment" value:backgroundAttachment priority:@""]; +} + +- (NSString *)backgroundColor +{ + return [self getPropertyValue:@"background-color"]; +} + +- (void)setBackgroundColor:(NSString *)backgroundColor +{ + [self setProperty:@"background-color" value:backgroundColor priority:@""]; +} + +- (NSString *)backgroundImage +{ + return [self getPropertyValue:@"background-image"]; +} + +- (void)setBackgroundImage:(NSString *)backgroundImage +{ + [self setProperty:@"background-image" value:backgroundImage priority:@""]; +} + +- (NSString *)backgroundPosition +{ + return [self getPropertyValue:@"background-position"]; +} + +- (void)setBackgroundPosition:(NSString *)backgroundPosition +{ + [self setProperty:@"background-position" value:backgroundPosition priority:@""]; +} + +- (NSString *)backgroundRepeat +{ + return [self getPropertyValue:@"background-repeat"]; +} + +- (void)setBackgroundRepeat:(NSString *)backgroundRepeat +{ + [self setProperty:@"background-repeat" value:backgroundRepeat priority:@""]; +} + +- (NSString *)border +{ + return [self getPropertyValue:@"border"]; +} + +- (void)setBorder:(NSString *)border +{ + [self setProperty:@"border" value:border priority:@""]; +} + +- (NSString *)borderCollapse +{ + return [self getPropertyValue:@"border-collapse"]; +} + +- (void)setBorderCollapse:(NSString *)borderCollapse +{ + [self setProperty:@"border-collapse" value:borderCollapse priority:@""]; +} + +- (NSString *)borderColor +{ + return [self getPropertyValue:@"border-color"]; +} + +- (void)setBorderColor:(NSString *)borderColor +{ + [self setProperty:@"border-color" value:borderColor priority:@""]; +} + +- (NSString *)borderSpacing +{ + return [self getPropertyValue:@"border-spacing"]; +} + +- (void)setBorderSpacing:(NSString *)borderSpacing +{ + [self setProperty:@"border-spacing" value:borderSpacing priority:@""]; +} + +- (NSString *)borderStyle +{ + return [self getPropertyValue:@"border-style"]; +} + +- (void)setBorderStyle:(NSString *)borderStyle +{ + [self setProperty:@"border-style" value:borderStyle priority:@""]; +} + +- (NSString *)borderTop +{ + return [self getPropertyValue:@"border-top"]; +} + +- (void)setBorderTop:(NSString *)borderTop +{ + [self setProperty:@"border-top" value:borderTop priority:@""]; +} + +- (NSString *)borderRight +{ + return [self getPropertyValue:@"border-right"]; +} + +- (void)setBorderRight:(NSString *)borderRight +{ + [self setProperty:@"border-right" value:borderRight priority:@""]; +} + +- (NSString *)borderBottom +{ + return [self getPropertyValue:@"border-bottom"]; +} + +- (void)setBorderBottom:(NSString *)borderBottom +{ + [self setProperty:@"border-bottom" value:borderBottom priority:@""]; +} + +- (NSString *)borderLeft +{ + return [self getPropertyValue:@"border-left"]; +} + +- (void)setBorderLeft:(NSString *)borderLeft +{ + [self setProperty:@"border-left" value:borderLeft priority:@""]; +} + +- (NSString *)borderTopColor +{ + return [self getPropertyValue:@"border-top-color"]; +} + +- (void)setBorderTopColor:(NSString *)borderTopColor +{ + [self setProperty:@"border-top-color" value:borderTopColor priority:@""]; +} + +- (NSString *)borderRightColor +{ + return [self getPropertyValue:@"border-right-color"]; +} + +- (void)setBorderRightColor:(NSString *)borderRightColor +{ + [self setProperty:@"border-right-color" value:borderRightColor priority:@""]; +} + +- (NSString *)borderBottomColor +{ + return [self getPropertyValue:@"border-bottom-color"]; +} + +- (void)setBorderBottomColor:(NSString *)borderBottomColor +{ + [self setProperty:@"border-bottom-color" value:borderBottomColor priority:@""]; +} + +- (NSString *)borderLeftColor +{ + return [self getPropertyValue:@"border-left-color"]; +} + +- (void)setBorderLeftColor:(NSString *)borderLeftColor +{ + [self setProperty:@"border-left-color" value:borderLeftColor priority:@""]; +} + +- (NSString *)borderTopStyle +{ + return [self getPropertyValue:@"border-top-style"]; +} + +- (void)setBorderTopStyle:(NSString *)borderTopStyle +{ + [self setProperty:@"border-top-style" value:borderTopStyle priority:@""]; +} + +- (NSString *)borderRightStyle +{ + return [self getPropertyValue:@"border-right-style"]; +} + +- (void)setBorderRightStyle:(NSString *)borderRightStyle +{ + [self setProperty:@"border-right-style" value:borderRightStyle priority:@""]; +} + +- (NSString *)borderBottomStyle +{ + return [self getPropertyValue:@"border-bottom-style"]; +} + +- (void)setBorderBottomStyle:(NSString *)borderBottomStyle +{ + [self setProperty:@"border-bottom-style" value:borderBottomStyle priority:@""]; +} + +- (NSString *)borderLeftStyle +{ + return [self getPropertyValue:@"border-left-style"]; +} + +- (void)setBorderLeftStyle:(NSString *)borderLeftStyle +{ + [self setProperty:@"border-left-style" value:borderLeftStyle priority:@""]; +} + +- (NSString *)borderTopWidth +{ + return [self getPropertyValue:@"border-top-width"]; +} + +- (void)setBorderTopWidth:(NSString *)borderTopWidth +{ + [self setProperty:@"border-top-width" value:borderTopWidth priority:@""]; +} + +- (NSString *)borderRightWidth +{ + return [self getPropertyValue:@"border-right-width"]; +} + +- (void)setBorderRightWidth:(NSString *)borderRightWidth +{ + [self setProperty:@"border-right-width" value:borderRightWidth priority:@""]; +} + +- (NSString *)borderBottomWidth +{ + return [self getPropertyValue:@"border-bottom-width"]; +} + +- (void)setBorderBottomWidth:(NSString *)borderBottomWidth +{ + [self setProperty:@"border-bottom-width" value:borderBottomWidth priority:@""]; +} + +- (NSString *)borderLeftWidth +{ + return [self getPropertyValue:@"border-left-width"]; +} + +- (void)setBorderLeftWidth:(NSString *)borderLeftWidth +{ + [self setProperty:@"border-left-width" value:borderLeftWidth priority:@""]; +} + +- (NSString *)borderWidth +{ + return [self getPropertyValue:@"border-width"]; +} + +- (void)setBorderWidth:(NSString *)borderWidth +{ + [self setProperty:@"border-width" value:borderWidth priority:@""]; +} + +- (NSString *)bottom +{ + return [self getPropertyValue:@"bottom"]; +} + +- (void)setBottom:(NSString *)bottom +{ + [self setProperty:@"bottom" value:bottom priority:@""]; +} + +- (NSString *)captionSide +{ + return [self getPropertyValue:@"caption-side"]; +} + +- (void)setCaptionSide:(NSString *)captionSide +{ + [self setProperty:@"caption-side" value:captionSide priority:@""]; +} + +- (NSString *)clear +{ + return [self getPropertyValue:@"clear"]; +} + +- (void)setClear:(NSString *)clear +{ + [self setProperty:@"clear" value:clear priority:@""]; +} + +- (NSString *)clip +{ + return [self getPropertyValue:@"clip"]; +} + +- (void)setClip:(NSString *)clip +{ + [self setProperty:@"clip" value:clip priority:@""]; +} + +- (NSString *)color +{ + return [self getPropertyValue:@"color"]; +} + +- (void)setColor:(NSString *)color +{ + [self setProperty:@"color" value:color priority:@""]; +} + +- (NSString *)content +{ + return [self getPropertyValue:@"content"]; +} + +- (void)setContent:(NSString *)content +{ + [self setProperty:@"content" value:content priority:@""]; +} + +- (NSString *)counterIncrement +{ + return [self getPropertyValue:@"counter-increment"]; +} + +- (void)setCounterIncrement:(NSString *)counterIncrement +{ + [self setProperty:@"counter-increment" value:counterIncrement priority:@""]; +} + +- (NSString *)counterReset +{ + return [self getPropertyValue:@"counter-reset"]; +} + +- (void)setCounterReset:(NSString *)counterReset +{ + [self setProperty:@"counter-reset" value:counterReset priority:@""]; +} + +- (NSString *)cue +{ + return [self getPropertyValue:@"cue"]; +} + +- (void)setCue:(NSString *)cue +{ + [self setProperty:@"cue" value:cue priority:@""]; +} + +- (NSString *)cueAfter +{ + return [self getPropertyValue:@"cue-after"]; +} + +- (void)setCueAfter:(NSString *)cueAfter +{ + [self setProperty:@"cue-after" value:cueAfter priority:@""]; +} + +- (NSString *)cueBefore +{ + return [self getPropertyValue:@"cue-before"]; +} + +- (void)setCueBefore:(NSString *)cueBefore +{ + [self setProperty:@"cue-before" value:cueBefore priority:@""]; +} + +- (NSString *)cursor +{ + return [self getPropertyValue:@"cursor"]; +} + +- (void)setCursor:(NSString *)cursor +{ + [self setProperty:@"cursor" value:cursor priority:@""]; +} + +- (NSString *)direction +{ + return [self getPropertyValue:@"direction"]; +} + +- (void)setDirection:(NSString *)direction +{ + [self setProperty:@"direction" value:direction priority:@""]; +} + +- (NSString *)display +{ + return [self getPropertyValue:@"display"]; +} + +- (void)setDisplay:(NSString *)display +{ + [self setProperty:@"display" value:display priority:@""]; +} + +- (NSString *)elevation +{ + return [self getPropertyValue:@"elevation"]; +} + +- (void)setElevation:(NSString *)elevation +{ + [self setProperty:@"elevation" value:elevation priority:@""]; +} + +- (NSString *)emptyCells +{ + return [self getPropertyValue:@"empty-cells"]; +} + +- (void)setEmptyCells:(NSString *)emptyCells +{ + [self setProperty:@"empty-cells" value:emptyCells priority:@""]; +} + +- (NSString *)cssFloat +{ + return [self getPropertyValue:@"css-float"]; +} + +- (void)setCssFloat:(NSString *)cssFloat +{ + [self setProperty:@"css-float" value:cssFloat priority:@""]; +} + +- (NSString *)font +{ + return [self getPropertyValue:@"font"]; +} + +- (void)setFont:(NSString *)font +{ + [self setProperty:@"font" value:font priority:@""]; +} + +- (NSString *)fontFamily +{ + return [self getPropertyValue:@"font-family"]; +} + +- (void)setFontFamily:(NSString *)fontFamily +{ + [self setProperty:@"font-family" value:fontFamily priority:@""]; +} + +- (NSString *)fontSize +{ + return [self getPropertyValue:@"font-size"]; +} + +- (void)setFontSize:(NSString *)fontSize +{ + [self setProperty:@"font-size" value:fontSize priority:@""]; +} + +- (NSString *)fontSizeAdjust +{ + return [self getPropertyValue:@"font-size-adjust"]; +} + +- (void)setFontSizeAdjust:(NSString *)fontSizeAdjust +{ + [self setProperty:@"font-size-adjust" value:fontSizeAdjust priority:@""]; +} + +- (NSString *)_fontSizeDelta +{ + return [self getPropertyValue:@"-webkit-font-size-delta"]; +} + +- (void)_setFontSizeDelta:(NSString *)fontSizeDelta +{ + [self setProperty:@"-webkit-font-size-delta" value:fontSizeDelta priority:@""]; +} + +- (NSString *)fontStretch +{ + return [self getPropertyValue:@"font-stretch"]; +} + +- (void)setFontStretch:(NSString *)fontStretch +{ + [self setProperty:@"font-stretch" value:fontStretch priority:@""]; +} + +- (NSString *)fontStyle +{ + return [self getPropertyValue:@"font-style"]; +} + +- (void)setFontStyle:(NSString *)fontStyle +{ + [self setProperty:@"font-style" value:fontStyle priority:@""]; +} + +- (NSString *)fontVariant +{ + return [self getPropertyValue:@"font-variant"]; +} + +- (void)setFontVariant:(NSString *)fontVariant +{ + [self setProperty:@"font-variant" value:fontVariant priority:@""]; +} + +- (NSString *)fontWeight +{ + return [self getPropertyValue:@"font-weight"]; +} + +- (void)setFontWeight:(NSString *)fontWeight +{ + [self setProperty:@"font-weight" value:fontWeight priority:@""]; +} + +- (NSString *)height +{ + return [self getPropertyValue:@"height"]; +} + +- (void)setHeight:(NSString *)height +{ + [self setProperty:@"height" value:height priority:@""]; +} + +- (NSString *)left +{ + return [self getPropertyValue:@"left"]; +} + +- (void)setLeft:(NSString *)left +{ + [self setProperty:@"left" value:left priority:@""]; +} + +- (NSString *)letterSpacing +{ + return [self getPropertyValue:@"letter-spacing"]; +} + +- (void)setLetterSpacing:(NSString *)letterSpacing +{ + [self setProperty:@"letter-spacing" value:letterSpacing priority:@""]; +} + +- (NSString *)lineHeight +{ + return [self getPropertyValue:@"line-height"]; +} + +- (void)setLineHeight:(NSString *)lineHeight +{ + [self setProperty:@"line-height" value:lineHeight priority:@""]; +} + +- (NSString *)listStyle +{ + return [self getPropertyValue:@"list-style"]; +} + +- (void)setListStyle:(NSString *)listStyle +{ + [self setProperty:@"list-style" value:listStyle priority:@""]; +} + +- (NSString *)listStyleImage +{ + return [self getPropertyValue:@"list-style-image"]; +} + +- (void)setListStyleImage:(NSString *)listStyleImage +{ + [self setProperty:@"list-style-image" value:listStyleImage priority:@""]; +} + +- (NSString *)listStylePosition +{ + return [self getPropertyValue:@"list-style-position"]; +} + +- (void)setListStylePosition:(NSString *)listStylePosition +{ + [self setProperty:@"list-style-position" value:listStylePosition priority:@""]; +} + +- (NSString *)listStyleType +{ + return [self getPropertyValue:@"list-style-type"]; +} + +- (void)setListStyleType:(NSString *)listStyleType +{ + [self setProperty:@"list-style-type" value:listStyleType priority:@""]; +} + +- (NSString *)margin +{ + return [self getPropertyValue:@"margin"]; +} + +- (void)setMargin:(NSString *)margin +{ + [self setProperty:@"margin" value:margin priority:@""]; +} + +- (NSString *)marginTop +{ + return [self getPropertyValue:@"margin-top"]; +} + +- (void)setMarginTop:(NSString *)marginTop +{ + [self setProperty:@"margin-top" value:marginTop priority:@""]; +} + +- (NSString *)marginRight +{ + return [self getPropertyValue:@"margin-right"]; +} + +- (void)setMarginRight:(NSString *)marginRight +{ + [self setProperty:@"margin-right" value:marginRight priority:@""]; +} + +- (NSString *)marginBottom +{ + return [self getPropertyValue:@"margin-bottom"]; +} + +- (void)setMarginBottom:(NSString *)marginBottom +{ + [self setProperty:@"margin-bottom" value:marginBottom priority:@""]; +} + +- (NSString *)marginLeft +{ + return [self getPropertyValue:@"margin-left"]; +} + +- (void)setMarginLeft:(NSString *)marginLeft +{ + [self setProperty:@"margin-left" value:marginLeft priority:@""]; +} + +- (NSString *)markerOffset +{ + return [self getPropertyValue:@"marker-offset"]; +} + +- (void)setMarkerOffset:(NSString *)markerOffset +{ + [self setProperty:@"marker-offset" value:markerOffset priority:@""]; +} + +- (NSString *)marks +{ + return [self getPropertyValue:@"marks"]; +} + +- (void)setMarks:(NSString *)marks +{ + [self setProperty:@"marks" value:marks priority:@""]; +} + +- (NSString *)maxHeight +{ + return [self getPropertyValue:@"max-height"]; +} + +- (void)setMaxHeight:(NSString *)maxHeight +{ + [self setProperty:@"max-height" value:maxHeight priority:@""]; +} + +- (NSString *)maxWidth +{ + return [self getPropertyValue:@"max-width"]; +} + +- (void)setMaxWidth:(NSString *)maxWidth +{ + [self setProperty:@"max-width" value:maxWidth priority:@""]; +} + +- (NSString *)minHeight +{ + return [self getPropertyValue:@"min-height"]; +} + +- (void)setMinHeight:(NSString *)minHeight +{ + [self setProperty:@"min-height" value:minHeight priority:@""]; +} + +- (NSString *)minWidth +{ + return [self getPropertyValue:@"min-width"]; +} + +- (void)setMinWidth:(NSString *)minWidth +{ + [self setProperty:@"min-width" value:minWidth priority:@""]; +} + +- (NSString *)orphans +{ + return [self getPropertyValue:@"orphans"]; +} + +- (void)setOrphans:(NSString *)orphans +{ + [self setProperty:@"orphans" value:orphans priority:@""]; +} + +- (NSString *)outline +{ + return [self getPropertyValue:@"outline"]; +} + +- (void)setOutline:(NSString *)outline +{ + [self setProperty:@"outline" value:outline priority:@""]; +} + +- (NSString *)outlineColor +{ + return [self getPropertyValue:@"outline-color"]; +} + +- (void)setOutlineColor:(NSString *)outlineColor +{ + [self setProperty:@"outline-color" value:outlineColor priority:@""]; +} + +- (NSString *)outlineStyle +{ + return [self getPropertyValue:@"outline-style"]; +} + +- (void)setOutlineStyle:(NSString *)outlineStyle +{ + [self setProperty:@"outline-style" value:outlineStyle priority:@""]; +} + +- (NSString *)outlineWidth +{ + return [self getPropertyValue:@"outline-width"]; +} + +- (void)setOutlineWidth:(NSString *)outlineWidth +{ + [self setProperty:@"outline-width" value:outlineWidth priority:@""]; +} + +- (NSString *)overflow +{ + return [self getPropertyValue:@"overflow"]; +} + +- (void)setOverflow:(NSString *)overflow +{ + [self setProperty:@"overflow" value:overflow priority:@""]; +} + +- (NSString *)padding +{ + return [self getPropertyValue:@"padding"]; +} + +- (void)setPadding:(NSString *)padding +{ + [self setProperty:@"padding" value:padding priority:@""]; +} + +- (NSString *)paddingTop +{ + return [self getPropertyValue:@"padding-top"]; +} + +- (void)setPaddingTop:(NSString *)paddingTop +{ + [self setProperty:@"padding-top" value:paddingTop priority:@""]; +} + +- (NSString *)paddingRight +{ + return [self getPropertyValue:@"padding-right"]; +} + +- (void)setPaddingRight:(NSString *)paddingRight +{ + [self setProperty:@"padding-right" value:paddingRight priority:@""]; +} + +- (NSString *)paddingBottom +{ + return [self getPropertyValue:@"padding-bottom"]; +} + +- (void)setPaddingBottom:(NSString *)paddingBottom +{ + [self setProperty:@"padding-bottom" value:paddingBottom priority:@""]; +} + +- (NSString *)paddingLeft +{ + return [self getPropertyValue:@"padding-left"]; +} + +- (void)setPaddingLeft:(NSString *)paddingLeft +{ + [self setProperty:@"padding-left" value:paddingLeft priority:@""]; +} + +- (NSString *)page +{ + return [self getPropertyValue:@"page"]; +} + +- (void)setPage:(NSString *)page +{ + [self setProperty:@"page" value:page priority:@""]; +} + +- (NSString *)pageBreakAfter +{ + return [self getPropertyValue:@"page-break-after"]; +} + +- (void)setPageBreakAfter:(NSString *)pageBreakAfter +{ + [self setProperty:@"page-break-after" value:pageBreakAfter priority:@""]; +} + +- (NSString *)pageBreakBefore +{ + return [self getPropertyValue:@"page-break-before"]; +} + +- (void)setPageBreakBefore:(NSString *)pageBreakBefore +{ + [self setProperty:@"page-break-before" value:pageBreakBefore priority:@""]; +} + +- (NSString *)pageBreakInside +{ + return [self getPropertyValue:@"page-break-inside"]; +} + +- (void)setPageBreakInside:(NSString *)pageBreakInside +{ + [self setProperty:@"page-break-inside" value:pageBreakInside priority:@""]; +} + +- (NSString *)pause +{ + return [self getPropertyValue:@"pause"]; +} + +- (void)setPause:(NSString *)pause +{ + [self setProperty:@"pause" value:pause priority:@""]; +} + +- (NSString *)pauseAfter +{ + return [self getPropertyValue:@"pause-after"]; +} + +- (void)setPauseAfter:(NSString *)pauseAfter +{ + [self setProperty:@"pause-after" value:pauseAfter priority:@""]; +} + +- (NSString *)pauseBefore +{ + return [self getPropertyValue:@"pause-before"]; +} + +- (void)setPauseBefore:(NSString *)pauseBefore +{ + [self setProperty:@"pause-before" value:pauseBefore priority:@""]; +} + +- (NSString *)pitch +{ + return [self getPropertyValue:@"pitch"]; +} + +- (void)setPitch:(NSString *)pitch +{ + [self setProperty:@"pitch" value:pitch priority:@""]; +} + +- (NSString *)pitchRange +{ + return [self getPropertyValue:@"pitch-range"]; +} + +- (void)setPitchRange:(NSString *)pitchRange +{ + [self setProperty:@"pitch-range" value:pitchRange priority:@""]; +} + +- (NSString *)playDuring +{ + return [self getPropertyValue:@"play-during"]; +} + +- (void)setPlayDuring:(NSString *)playDuring +{ + [self setProperty:@"play-during" value:playDuring priority:@""]; +} + +- (NSString *)position +{ + return [self getPropertyValue:@"position"]; +} + +- (void)setPosition:(NSString *)position +{ + [self setProperty:@"position" value:position priority:@""]; +} + +- (NSString *)quotes +{ + return [self getPropertyValue:@"quotes"]; +} + +- (void)setQuotes:(NSString *)quotes +{ + [self setProperty:@"quotes" value:quotes priority:@""]; +} + +- (NSString *)richness +{ + return [self getPropertyValue:@"richness"]; +} + +- (void)setRichness:(NSString *)richness +{ + [self setProperty:@"richness" value:richness priority:@""]; +} + +- (NSString *)right +{ + return [self getPropertyValue:@"right"]; +} + +- (void)setRight:(NSString *)right +{ + [self setProperty:@"right" value:right priority:@""]; +} + +- (NSString *)size +{ + return [self getPropertyValue:@"size"]; +} + +- (void)setSize:(NSString *)size +{ + [self setProperty:@"size" value:size priority:@""]; +} + +- (NSString *)speak +{ + return [self getPropertyValue:@"speak"]; +} + +- (void)setSpeak:(NSString *)speak +{ + [self setProperty:@"speak" value:speak priority:@""]; +} + +- (NSString *)speakHeader +{ + return [self getPropertyValue:@"speak-header"]; +} + +- (void)setSpeakHeader:(NSString *)speakHeader +{ + [self setProperty:@"speak-header" value:speakHeader priority:@""]; +} + +- (NSString *)speakNumeral +{ + return [self getPropertyValue:@"speak-numeral"]; +} + +- (void)setSpeakNumeral:(NSString *)speakNumeral +{ + [self setProperty:@"speak-numeral" value:speakNumeral priority:@""]; +} + +- (NSString *)speakPunctuation +{ + return [self getPropertyValue:@"speak-punctuation"]; +} + +- (void)setSpeakPunctuation:(NSString *)speakPunctuation +{ + [self setProperty:@"speak-punctuation" value:speakPunctuation priority:@""]; +} + +- (NSString *)speechRate +{ + return [self getPropertyValue:@"speech-rate"]; +} + +- (void)setSpeechRate:(NSString *)speechRate +{ + [self setProperty:@"speech-rate" value:speechRate priority:@""]; +} + +- (NSString *)stress +{ + return [self getPropertyValue:@"stress"]; +} + +- (void)setStress:(NSString *)stress +{ + [self setProperty:@"stress" value:stress priority:@""]; +} + +- (NSString *)tableLayout +{ + return [self getPropertyValue:@"table-layout"]; +} + +- (void)setTableLayout:(NSString *)tableLayout +{ + [self setProperty:@"table-layout" value:tableLayout priority:@""]; +} + +- (NSString *)textAlign +{ + return [self getPropertyValue:@"text-align"]; +} + +- (void)setTextAlign:(NSString *)textAlign +{ + [self setProperty:@"text-align" value:textAlign priority:@""]; +} + +- (NSString *)textDecoration +{ + return [self getPropertyValue:@"text-decoration"]; +} + +- (void)setTextDecoration:(NSString *)textDecoration +{ + [self setProperty:@"text-decoration" value:textDecoration priority:@""]; +} + +- (NSString *)textIndent +{ + return [self getPropertyValue:@"text-indent"]; +} + +- (void)setTextIndent:(NSString *)textIndent +{ + [self setProperty:@"text-indent" value:textIndent priority:@""]; +} + +- (NSString *)textShadow +{ + return [self getPropertyValue:@"text-shadow"]; +} + +- (void)setTextShadow:(NSString *)textShadow +{ + [self setProperty:@"text-shadow" value:textShadow priority:@""]; +} + +- (NSString *)textTransform +{ + return [self getPropertyValue:@"text-transform"]; +} + +- (void)setTextTransform:(NSString *)textTransform +{ + [self setProperty:@"text-transform" value:textTransform priority:@""]; +} + +- (NSString *)top +{ + return [self getPropertyValue:@"top"]; +} + +- (void)setTop:(NSString *)top +{ + [self setProperty:@"top" value:top priority:@""]; +} + +- (NSString *)unicodeBidi +{ + return [self getPropertyValue:@"unicode-bidi"]; +} + +- (void)setUnicodeBidi:(NSString *)unicodeBidi +{ + [self setProperty:@"unicode-bidi" value:unicodeBidi priority:@""]; +} + +- (NSString *)verticalAlign +{ + return [self getPropertyValue:@"vertical-align"]; +} + +- (void)setVerticalAlign:(NSString *)verticalAlign +{ + [self setProperty:@"vertical-align" value:verticalAlign priority:@""]; +} + +- (NSString *)visibility +{ + return [self getPropertyValue:@"visibility"]; +} + +- (void)setVisibility:(NSString *)visibility +{ + [self setProperty:@"visibility" value:visibility priority:@""]; +} + +- (NSString *)voiceFamily +{ + return [self getPropertyValue:@"voice-family"]; +} + +- (void)setVoiceFamily:(NSString *)voiceFamily +{ + [self setProperty:@"voice-family" value:voiceFamily priority:@""]; +} + +- (NSString *)volume +{ + return [self getPropertyValue:@"volume"]; +} + +- (void)setVolume:(NSString *)volume +{ + [self setProperty:@"volume" value:volume priority:@""]; +} + +- (NSString *)whiteSpace +{ + return [self getPropertyValue:@"white-space"]; +} + +- (void)setWhiteSpace:(NSString *)whiteSpace +{ + [self setProperty:@"white-space" value:whiteSpace priority:@""]; +} + +- (NSString *)widows +{ + return [self getPropertyValue:@"widows"]; +} + +- (void)setWidows:(NSString *)widows +{ + [self setProperty:@"widows" value:widows priority:@""]; +} + +- (NSString *)width +{ + return [self getPropertyValue:@"width"]; +} + +- (void)setWidth:(NSString *)width +{ + [self setProperty:@"width" value:width priority:@""]; +} + +- (NSString *)wordSpacing +{ + return [self getPropertyValue:@"word-spacing"]; +} + +- (void)setWordSpacing:(NSString *)wordSpacing +{ + [self setProperty:@"word-spacing" value:wordSpacing priority:@""]; +} + +- (NSString *)zIndex +{ + return [self getPropertyValue:@"z-index"]; +} + +- (void)setZIndex:(NSString *)zIndex +{ + [self setProperty:@"z-index" value:zIndex priority:@""]; +} + +@end diff --git a/Source/WebCore/bindings/objc/DOMCore.h b/Source/WebCore/bindings/objc/DOMCore.h new file mode 100644 index 0000000..afac8ed --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMCore.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMAttr.h> +#import <WebCore/DOMCDATASection.h> +#import <WebCore/DOMCharacterData.h> +#import <WebCore/DOMComment.h> +#import <WebCore/DOMDocument.h> +#import <WebCore/DOMDocumentFragment.h> +#import <WebCore/DOMDocumentType.h> +#import <WebCore/DOMElement.h> +#import <WebCore/DOMEntity.h> +#import <WebCore/DOMEntityReference.h> +#import <WebCore/DOMException.h> +#import <WebCore/DOMDOMImplementation.h> +#import <WebCore/DOMNamedNodeMap.h> +#import <WebCore/DOMNode.h> +#import <WebCore/DOMNodeList.h> +#import <WebCore/DOMNotation.h> +#import <WebCore/DOMObject.h> +#import <WebCore/DOMProcessingInstruction.h> +#import <WebCore/DOMText.h> diff --git a/Source/WebCore/bindings/objc/DOMCustomXPathNSResolver.h b/Source/WebCore/bindings/objc/DOMCustomXPathNSResolver.h new file mode 100644 index 0000000..2609e90 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMCustomXPathNSResolver.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007 Alexey Proskuryakov (ap@nypop.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DOMCustomXPathNSResolver_h +#define DOMCustomXPathNSResolver_h + +#if ENABLE(XPATH) + +#include "XPathNSResolver.h" + +#include "DOMXPathNSResolver.h" +#include <wtf/PassRefPtr.h> + +namespace WebCore { + + class Frame; + + class DOMCustomXPathNSResolver : public XPathNSResolver { + public: + static PassRefPtr<DOMCustomXPathNSResolver> create(id <DOMXPathNSResolver> customResolver) { return adoptRef(new DOMCustomXPathNSResolver(customResolver)); } + virtual ~DOMCustomXPathNSResolver(); + + virtual String lookupNamespaceURI(const String& prefix); + + private: + DOMCustomXPathNSResolver(id <DOMXPathNSResolver>); + id <DOMXPathNSResolver> m_customResolver; // DOMCustomXPathNSResolvers are always temporary, thus no need to GC protect the object. + }; + +} // namespace WebCore + +#endif // ENABLE(XPATH) + +#endif // DOMCustomXPathNSResolver_h diff --git a/Source/WebCore/bindings/objc/DOMCustomXPathNSResolver.mm b/Source/WebCore/bindings/objc/DOMCustomXPathNSResolver.mm new file mode 100644 index 0000000..670c836 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMCustomXPathNSResolver.mm @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007 Alexey Proskuryakov (ap@nypop.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DOMCustomXPathNSResolver.h" + +#if ENABLE(XPATH) + +#include "BlockExceptions.h" +#include "PlatformString.h" + +namespace WebCore { + +DOMCustomXPathNSResolver::DOMCustomXPathNSResolver(id <DOMXPathNSResolver> customResolver) + : m_customResolver(customResolver) +{ +} + +DOMCustomXPathNSResolver::~DOMCustomXPathNSResolver() +{ +} + +String DOMCustomXPathNSResolver::lookupNamespaceURI(const String& prefix) +{ + NSString *namespaceURI = nil; + + BEGIN_BLOCK_OBJC_EXCEPTIONS; + namespaceURI = [m_customResolver lookupNamespaceURI:prefix]; + END_BLOCK_OBJC_EXCEPTIONS; + + return namespaceURI; +} + +} // namespace WebCore + +#endif // ENABLE(XPATH) diff --git a/Source/WebCore/bindings/objc/DOMEventException.h b/Source/WebCore/bindings/objc/DOMEventException.h new file mode 100644 index 0000000..a485955 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMEventException.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <JavaScriptCore/WebKitAvailability.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3 + +@class NSString; + +extern NSString * const DOMEventException; + +enum DOMEventExceptionCode { + DOM_UNSPECIFIED_EVENT_TYPE_ERR = 0 +}; + +#endif diff --git a/Source/WebCore/bindings/objc/DOMEvents.h b/Source/WebCore/bindings/objc/DOMEvents.h new file mode 100644 index 0000000..ba3bd3e --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMEvents.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2004, 2006, 2008 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMDocument.h> +#import <WebCore/DOMNode.h> +#import <WebCore/DOMObject.h> +#import <WebCore/DOMViews.h> + +#import <WebCore/DOMEvent.h> +#import <WebCore/DOMEventException.h> +#import <WebCore/DOMEventListener.h> +#import <WebCore/DOMEventTarget.h> +#import <WebCore/DOMKeyboardEvent.h> +#import <WebCore/DOMMouseEvent.h> +#import <WebCore/DOMMutationEvent.h> +#import <WebCore/DOMOverflowEvent.h> +#import <WebCore/DOMUIEvent.h> +#import <WebCore/DOMWheelEvent.h> diff --git a/Source/WebCore/bindings/objc/DOMEvents.mm b/Source/WebCore/bindings/objc/DOMEvents.mm new file mode 100644 index 0000000..26dfe7b --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMEvents.mm @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Jonas Witt <jonas.witt@gmail.com> + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source ec must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "DOMEventInternal.h" + +#import "DOMBeforeLoadEvent.h" +#import "DOMKeyboardEvent.h" +#import "DOMMessageEvent.h" +#import "DOMMouseEvent.h" +#import "DOMMutationEvent.h" +#import "DOMOverflowEvent.h" +#import "DOMProgressEvent.h" +#import "DOMTextEvent.h" +#import "DOMWheelEvent.h" +#import "Event.h" + +#if ENABLE(SVG_DOM_OBJC_BINDINGS) +#import "DOMSVGZoomEvent.h" +#endif + +Class kitClass(WebCore::Event* impl) +{ + if (impl->isUIEvent()) { + if (impl->isKeyboardEvent()) + return [DOMKeyboardEvent class]; + if (impl->isTextEvent()) + return [DOMTextEvent class]; + if (impl->isMouseEvent()) + return [DOMMouseEvent class]; + if (impl->isWheelEvent()) + return [DOMWheelEvent class]; +#if ENABLE(SVG_DOM_OBJC_BINDINGS) + if (impl->isSVGZoomEvent()) + return [DOMSVGZoomEvent class]; +#endif + return [DOMUIEvent class]; + } + if (impl->isMutationEvent()) + return [DOMMutationEvent class]; + if (impl->isOverflowEvent()) + return [DOMOverflowEvent class]; + if (impl->isMessageEvent()) + return [DOMMessageEvent class]; + if (impl->isProgressEvent()) + return [DOMProgressEvent class]; + if (impl->isBeforeLoadEvent()) + return [DOMBeforeLoadEvent class]; + return [DOMEvent class]; +} diff --git a/Source/WebCore/bindings/objc/DOMException.h b/Source/WebCore/bindings/objc/DOMException.h new file mode 100644 index 0000000..64d7194 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMException.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <JavaScriptCore/WebKitAvailability.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3 + +@class NSString; + +extern NSString * const DOMException; + +enum DOMExceptionCode { + DOM_INDEX_SIZE_ERR = 1, + DOM_DOMSTRING_SIZE_ERR = 2, + DOM_HIERARCHY_REQUEST_ERR = 3, + DOM_WRONG_DOCUMENT_ERR = 4, + DOM_INVALID_CHARACTER_ERR = 5, + DOM_NO_DATA_ALLOWED_ERR = 6, + DOM_NO_MODIFICATION_ALLOWED_ERR = 7, + DOM_NOT_FOUND_ERR = 8, + DOM_NOT_SUPPORTED_ERR = 9, + DOM_INUSE_ATTRIBUTE_ERR = 10, + DOM_INVALID_STATE_ERR = 11, + DOM_SYNTAX_ERR = 12, + DOM_INVALID_MODIFICATION_ERR = 13, + DOM_NAMESPACE_ERR = 14, + DOM_INVALID_ACCESS_ERR = 15 +}; + +#endif diff --git a/Source/WebCore/bindings/objc/DOMExtensions.h b/Source/WebCore/bindings/objc/DOMExtensions.h new file mode 100644 index 0000000..7748a22 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMExtensions.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMAttr.h> +#import <WebCore/DOMCSS.h> +#import <WebCore/DOMCSSStyleDeclaration.h> +#import <WebCore/DOMDocument.h> +#import <WebCore/DOMElement.h> +#import <WebCore/DOMHTML.h> +#import <WebCore/DOMHTMLAnchorElement.h> +#import <WebCore/DOMHTMLAreaElement.h> +#import <WebCore/DOMHTMLDocument.h> +#import <WebCore/DOMHTMLElement.h> +#import <WebCore/DOMHTMLEmbedElement.h> +#import <WebCore/DOMHTMLImageElement.h> +#import <WebCore/DOMHTMLInputElement.h> +#import <WebCore/DOMHTMLLinkElement.h> +#import <WebCore/DOMHTMLObjectElement.h> +#import <WebCore/DOMNode.h> +#import <WebCore/DOMRGBColor.h> +#import <WebCore/DOMRange.h> + +@class NSArray; +@class NSImage; +@class NSURL; + +@interface DOMNode (DOMNodeExtensions) +- (NSRect)boundingBox WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER); +- (NSArray *)lineBoxRects WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER); +@end + +@interface DOMElement (DOMElementAppKitExtensions) +- (NSImage *)image WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER); +@end + +@interface DOMHTMLDocument (DOMHTMLDocumentExtensions) +- (DOMDocumentFragment *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER); +- (DOMDocumentFragment *)createDocumentFragmentWithText:(NSString *)text WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER); +@end diff --git a/Source/WebCore/bindings/objc/DOMHTML.h b/Source/WebCore/bindings/objc/DOMHTML.h new file mode 100644 index 0000000..882e397 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMHTML.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMCore.h> + +#import <WebCore/DOMBlob.h> +#import <WebCore/DOMFile.h> +#import <WebCore/DOMFileList.h> +#import <WebCore/DOMHTMLAnchorElement.h> +#import <WebCore/DOMHTMLAppletElement.h> +#import <WebCore/DOMHTMLAreaElement.h> +#import <WebCore/DOMHTMLBRElement.h> +#import <WebCore/DOMHTMLBaseElement.h> +#import <WebCore/DOMHTMLBaseFontElement.h> +#import <WebCore/DOMHTMLBodyElement.h> +#import <WebCore/DOMHTMLButtonElement.h> +#import <WebCore/DOMHTMLCollection.h> +#import <WebCore/DOMHTMLDListElement.h> +#import <WebCore/DOMHTMLDirectoryElement.h> +#import <WebCore/DOMHTMLDivElement.h> +#import <WebCore/DOMHTMLDocument.h> +#import <WebCore/DOMHTMLElement.h> +#import <WebCore/DOMHTMLEmbedElement.h> +#import <WebCore/DOMHTMLFieldSetElement.h> +#import <WebCore/DOMHTMLFontElement.h> +#import <WebCore/DOMHTMLFormElement.h> +#import <WebCore/DOMHTMLFrameElement.h> +#import <WebCore/DOMHTMLFrameSetElement.h> +#import <WebCore/DOMHTMLHRElement.h> +#import <WebCore/DOMHTMLHeadElement.h> +#import <WebCore/DOMHTMLHeadingElement.h> +#import <WebCore/DOMHTMLHtmlElement.h> +#import <WebCore/DOMHTMLIFrameElement.h> +#import <WebCore/DOMHTMLImageElement.h> +#import <WebCore/DOMHTMLInputElement.h> +#import <WebCore/DOMHTMLIsIndexElement.h> +#import <WebCore/DOMHTMLLIElement.h> +#import <WebCore/DOMHTMLLabelElement.h> +#import <WebCore/DOMHTMLLegendElement.h> +#import <WebCore/DOMHTMLLinkElement.h> +#import <WebCore/DOMHTMLMapElement.h> +#import <WebCore/DOMHTMLMarqueeElement.h> +#import <WebCore/DOMHTMLMenuElement.h> +#import <WebCore/DOMHTMLMetaElement.h> +#import <WebCore/DOMHTMLModElement.h> +#import <WebCore/DOMHTMLOListElement.h> +#import <WebCore/DOMHTMLObjectElement.h> +#import <WebCore/DOMHTMLOptGroupElement.h> +#import <WebCore/DOMHTMLOptionElement.h> +#import <WebCore/DOMHTMLOptionsCollection.h> +#import <WebCore/DOMHTMLParagraphElement.h> +#import <WebCore/DOMHTMLParamElement.h> +#import <WebCore/DOMHTMLPreElement.h> +#import <WebCore/DOMHTMLQuoteElement.h> +#import <WebCore/DOMHTMLScriptElement.h> +#import <WebCore/DOMHTMLSelectElement.h> +#import <WebCore/DOMHTMLStyleElement.h> +#import <WebCore/DOMHTMLTableCaptionElement.h> +#import <WebCore/DOMHTMLTableCellElement.h> +#import <WebCore/DOMHTMLTableColElement.h> +#import <WebCore/DOMHTMLTableElement.h> +#import <WebCore/DOMHTMLTableRowElement.h> +#import <WebCore/DOMHTMLTableSectionElement.h> +#import <WebCore/DOMHTMLTextAreaElement.h> +#import <WebCore/DOMHTMLTitleElement.h> +#import <WebCore/DOMHTMLUListElement.h> diff --git a/Source/WebCore/bindings/objc/DOMHTML.mm b/Source/WebCore/bindings/objc/DOMHTML.mm new file mode 100644 index 0000000..a2277d2 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMHTML.mm @@ -0,0 +1,206 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" + +#import "DOMDocumentFragmentInternal.h" +#import "DOMExtensions.h" +#import "DOMHTMLCollectionInternal.h" +#import "DOMHTMLDocumentInternal.h" +#import "DOMHTMLInputElementInternal.h" +#import "DOMHTMLSelectElementInternal.h" +#import "DOMHTMLTextAreaElementInternal.h" +#import "DOMNodeInternal.h" +#import "DOMPrivate.h" +#import "DocumentFragment.h" +#import "FrameView.h" +#import "HTMLCollection.h" +#import "HTMLDocument.h" +#import "HTMLInputElement.h" +#import "HTMLParserIdioms.h" +#import "HTMLSelectElement.h" +#import "HTMLTextAreaElement.h" +#import "Page.h" +#import "Range.h" +#import "RenderTextControl.h" +#import "Settings.h" +#import "markup.h" + +//------------------------------------------------------------------------------------------ +// DOMHTMLDocument + +@implementation DOMHTMLDocument (DOMHTMLDocumentExtensions) + +- (DOMDocumentFragment *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL +{ + return kit(createFragmentFromMarkup(core(self), markupString, [baseURL absoluteString]).get()); +} + +- (DOMDocumentFragment *)createDocumentFragmentWithText:(NSString *)text +{ + // FIXME: Since this is not a contextual fragment, it won't handle whitespace properly. + return kit(createFragmentFromText(core(self)->createRange().get(), text).get()); +} + +@end + +@implementation DOMHTMLDocument (WebPrivate) + +- (DOMDocumentFragment *)_createDocumentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString +{ + NSURL *baseURL = core(self)->completeURL(WebCore::stripLeadingAndTrailingHTMLSpaces(baseURLString)); + return [self createDocumentFragmentWithMarkupString:markupString baseURL:baseURL]; +} + +- (DOMDocumentFragment *)_createDocumentFragmentWithText:(NSString *)text +{ + return [self createDocumentFragmentWithText:text]; +} + +@end + +#ifdef BUILDING_ON_TIGER +@implementation DOMHTMLDocument (DOMHTMLDocumentOverrides) + +- (DOMNode *)firstChild +{ + WebCore::HTMLDocument* coreHTMLDocument = core(self); + if (!coreHTMLDocument->page() || !coreHTMLDocument->page()->settings()->needsTigerMailQuirks()) + return kit(coreHTMLDocument->firstChild()); + + WebCore::Node* child = coreHTMLDocument->firstChild(); + while (child && child->nodeType() == WebCore::Node::DOCUMENT_TYPE_NODE) + child = child->nextSibling(); + + return kit(child); +} + +@end +#endif + +@implementation DOMHTMLInputElement (FormAutoFillTransition) + +- (BOOL)_isTextField +{ + return core(self)->isTextField(); +} + +- (NSRect)_rectOnScreen +{ + // Returns bounding rect of text field, in screen coordinates. + NSRect result = [self boundingBox]; + if (!core(self)->document()->view()) + return result; + + NSView* view = core(self)->document()->view()->documentView(); + result = [view convertRect:result toView:nil]; + result.origin = [[view window] convertBaseToScreen:result.origin]; + return result; +} + +- (void)_replaceCharactersInRange:(NSRange)targetRange withString:(NSString *)replacementString selectingFromIndex:(int)index +{ + WebCore::HTMLInputElement* inputElement = core(self); + if (inputElement) { + WTF::String newValue = inputElement->value(); + newValue.replace(targetRange.location, targetRange.length, replacementString); + inputElement->setValue(newValue); + inputElement->setSelectionRange(index, newValue.length()); + } +} + +- (NSRange)_selectedRange +{ + WebCore::HTMLInputElement* inputElement = core(self); + if (inputElement) { + int start = inputElement->selectionStart(); + int end = inputElement->selectionEnd(); + return NSMakeRange(start, end - start); + } + return NSMakeRange(NSNotFound, 0); +} + +- (BOOL)_isAutofilled +{ + return core(self)->isAutofilled(); +} + +- (void)_setAutofilled:(BOOL)filled +{ + // This notifies the input element that the content has been autofilled + // This allows WebKit to obey the -webkit-autofill pseudo style, which + // changes the background color. + core(self)->setAutofilled(filled); +} + +@end + +@implementation DOMHTMLSelectElement (FormAutoFillTransition) + +- (void)_activateItemAtIndex:(int)index +{ + // Use the setSelectedIndexByUser function so a change event will be fired. <rdar://problem/6760590> + if (WebCore::HTMLSelectElement* select = core(self)) + select->setSelectedIndexByUser(index, true, true); +} + +- (void)_activateItemAtIndex:(int)index allowMultipleSelection:(BOOL)allowMultipleSelection +{ + // Use the setSelectedIndexByUser function so a change event will be fired. <rdar://problem/6760590> + // If this is a <select multiple> the allowMultipleSelection flag will allow setting multiple + // selections without clearing the other selections. + if (WebCore::HTMLSelectElement* select = core(self)) + select->setSelectedIndexByUser(index, true, true, allowMultipleSelection); +} + +@end + +@implementation DOMHTMLInputElement (FormPromptAdditions) + +- (BOOL)_isEdited +{ + WebCore::RenderObject *renderer = core(self)->renderer(); + return renderer && [self _isTextField] && static_cast<WebCore::RenderTextControl *>(renderer)->lastChangeWasUserEdit(); +} + +@end + +@implementation DOMHTMLTextAreaElement (FormPromptAdditions) + +- (BOOL)_isEdited +{ + WebCore::RenderObject* renderer = core(self)->renderer(); + return renderer && static_cast<WebCore::RenderTextControl*>(renderer)->lastChangeWasUserEdit(); +} + +@end + +Class kitClass(WebCore::HTMLCollection* collection) +{ + if (collection->type() == WebCore::SelectOptions) + return [DOMHTMLOptionsCollection class]; + return [DOMHTMLCollection class]; +} diff --git a/Source/WebCore/bindings/objc/DOMImplementationFront.cpp b/Source/WebCore/bindings/objc/DOMImplementationFront.cpp new file mode 100644 index 0000000..93db83b --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMImplementationFront.cpp @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2006, 2008 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 + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "DOMImplementationFront.h" + +#include "CSSStyleSheet.h" +#include "DocumentType.h" +#include "DOMImplementation.h" +#include "HTMLDocument.h" +#include "JSDOMImplementation.h" + +namespace WebCore { + +DOMImplementationFront* implementationFront(Document* document) +{ + return reinterpret_cast<DOMImplementationFront*>(document->implementation()); +} + +DOMImplementationFront* implementationFront(JSDOMImplementation* wrapper) +{ + return reinterpret_cast<DOMImplementationFront*>(wrapper->impl()); +} + +void DOMImplementationFront::ref() +{ + reinterpret_cast<DOMImplementation*>(this)->ref(); +} + +void DOMImplementationFront::deref() +{ + reinterpret_cast<DOMImplementation*>(this)->deref(); +} + +bool DOMImplementationFront::hasFeature(const String& feature, const String& version) const +{ + return reinterpret_cast<const DOMImplementation*>(this)->hasFeature(feature, version); +} + +PassRefPtr<DocumentType> DOMImplementationFront::createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionCode& ec) +{ + return reinterpret_cast<DOMImplementation*>(this)->createDocumentType(qualifiedName, publicId, systemId, ec); +} + +PassRefPtr<Document> DOMImplementationFront::createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType* type, ExceptionCode& ec) +{ + return reinterpret_cast<DOMImplementation*>(this)->createDocument(namespaceURI, qualifiedName, type, ec); +} + +DOMImplementationFront* DOMImplementationFront::getInterface(const String& feature) +{ + return reinterpret_cast<DOMImplementationFront*>(reinterpret_cast<DOMImplementation*>(this)->getInterface(feature)); +} + +PassRefPtr<CSSStyleSheet> DOMImplementationFront::createCSSStyleSheet(const String& title, const String& media, ExceptionCode& ec) +{ + return reinterpret_cast<DOMImplementation*>(this)->createCSSStyleSheet(title, media, ec); +} + +PassRefPtr<HTMLDocument> DOMImplementationFront::createHTMLDocument(const String& title) +{ + return reinterpret_cast<DOMImplementation*>(this)->createHTMLDocument(title); +} + +} //namespace diff --git a/Source/WebCore/bindings/objc/DOMImplementationFront.h b/Source/WebCore/bindings/objc/DOMImplementationFront.h new file mode 100644 index 0000000..dabe90c --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMImplementationFront.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef DOMImplementationFront_h +#define DOMImplementationFront_h + +// FIXME: This source file exists to work around a problem that occurs trying +// to mix DOMImplementation and WebCore::DOMImplementation in DOM.mm. +// It seems to affect only older versions of gcc. Once the buildbot is upgraded, +// we should consider increasing the minimum required version of gcc to build +// WebCore, and rolling the change that introduced this file back. + +#include <wtf/Forward.h> + +namespace WebCore { + +class CSSStyleSheet; +class Document; +class DocumentType; +class HTMLDocument; +class JSDOMImplementation; + +typedef int ExceptionCode; + +class DOMImplementationFront { +public: + void ref(); + void deref(); + bool hasFeature(const String& feature, const String& version) const; + PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionCode&); + PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionCode&); + DOMImplementationFront* getInterface(const String& feature); + PassRefPtr<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media, ExceptionCode&); + PassRefPtr<HTMLDocument> createHTMLDocument(const String& title); +}; + +DOMImplementationFront* implementationFront(Document*); +DOMImplementationFront* implementationFront(JSDOMImplementation*); + +} // namespace WebCore + +#endif // DOMImplementationFront_h diff --git a/Source/WebCore/bindings/objc/DOMInternal.h b/Source/WebCore/bindings/objc/DOMInternal.h new file mode 100644 index 0000000..6d2442b --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMInternal.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 James G. Speth (speth@end.com) + * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This is lets our internals access DOMObject's _internal field while having +// it be private for clients outside WebKit. +#define private public +#import "DOMObject.h" +#undef private + +#import "DOMNodeFilter.h" +#import "DOMXPathNSResolver.h" +#import <wtf/Forward.h> + +namespace JSC { + class JSObject; + namespace Bindings { + class RootObject; + } +} + +namespace WebCore { + class NodeFilter; +#if ENABLE(XPATH) + class XPathNSResolver; +#endif +} + +@interface DOMNodeFilter : DOMObject <DOMNodeFilter> +@end + +#if ENABLE(XPATH) +@interface DOMNativeXPathNSResolver : DOMObject <DOMXPathNSResolver> +@end +#endif // ENABLE(XPATH) + +// Helper functions for DOM wrappers and gluing to Objective-C + +// Create an NSMapTable mapping from pointers to ObjC objects held with zeroing weak references. +NSMapTable* createWrapperCache(); + +id createDOMWrapper(JSC::JSObject*, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> current); + +NSObject* getDOMWrapper(DOMObjectInternal*); +void addDOMWrapper(NSObject* wrapper, DOMObjectInternal*); +void removeDOMWrapper(DOMObjectInternal*); + +template <class Source> +inline id getDOMWrapper(Source impl) +{ + return getDOMWrapper(reinterpret_cast<DOMObjectInternal*>(impl)); +} + +template <class Source> +inline void addDOMWrapper(NSObject* wrapper, Source impl) +{ + addDOMWrapper(wrapper, reinterpret_cast<DOMObjectInternal*>(impl)); +} + +DOMNodeFilter *kit(WebCore::NodeFilter*); +WebCore::NodeFilter* core(DOMNodeFilter *); + +#if ENABLE(XPATH) +DOMNativeXPathNSResolver *kit(WebCore::XPathNSResolver*); +WebCore::XPathNSResolver* core(DOMNativeXPathNSResolver *); +#endif // ENABLE(XPATH) + +inline NSTimeInterval kit(double msSinceEpoch) +{ + return msSinceEpoch / 1000.0 - NSTimeIntervalSince1970; +} + +inline double core(NSTimeInterval sec) +{ + return sec * 1000.0 + NSTimeIntervalSince1970; +} diff --git a/Source/WebCore/bindings/objc/DOMInternal.mm b/Source/WebCore/bindings/objc/DOMInternal.mm new file mode 100644 index 0000000..590d653 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMInternal.mm @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "DOMInternal.h" + +#import "DOMNodeInternal.h" +#import "Frame.h" +#import "JSNode.h" +#import "WebScriptObjectPrivate.h" +#import "runtime_root.h" + +//------------------------------------------------------------------------------------------ +// Wrapping WebCore implementation objects + +static NSMapTable* DOMWrapperCache; + +NSMapTable* createWrapperCache() +{ +#ifdef BUILDING_ON_TIGER + return NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks, NSNonRetainedObjectMapValueCallBacks, 0); +#else + // NSMapTable with zeroing weak pointers is the recommended way to build caches like this under garbage collection. + NSPointerFunctionsOptions keyOptions = NSPointerFunctionsOpaqueMemory | NSPointerFunctionsOpaquePersonality; + NSPointerFunctionsOptions valueOptions = NSPointerFunctionsZeroingWeakMemory | NSPointerFunctionsObjectPersonality; + return [[NSMapTable alloc] initWithKeyOptions:keyOptions valueOptions:valueOptions capacity:0]; +#endif +} + +NSObject* getDOMWrapper(DOMObjectInternal* impl) +{ + if (!DOMWrapperCache) + return nil; + return static_cast<NSObject*>(NSMapGet(DOMWrapperCache, impl)); +} + +void addDOMWrapper(NSObject* wrapper, DOMObjectInternal* impl) +{ + if (!DOMWrapperCache) + DOMWrapperCache = createWrapperCache(); + NSMapInsert(DOMWrapperCache, impl, wrapper); +} + +void removeDOMWrapper(DOMObjectInternal* impl) +{ + if (!DOMWrapperCache) + return; + NSMapRemove(DOMWrapperCache, impl); +} + +//------------------------------------------------------------------------------------------ + +@implementation WebScriptObject (WebScriptObjectInternal) + +// Only called by DOMObject subclass. +- (id)_init +{ + self = [super init]; + + if (![self isKindOfClass:[DOMObject class]]) { + [NSException raise:NSGenericException format:@"+%@: _init is an internal initializer", [self class]]; + return nil; + } + + _private = [[WebScriptObjectPrivate alloc] init]; + _private->isCreatedByDOMWrapper = YES; + + return self; +} + +- (void)_initializeScriptDOMNodeImp +{ + ASSERT(_private->isCreatedByDOMWrapper); + + if (![self isKindOfClass:[DOMNode class]]) { + // DOMObject can't map back to a document, and thus an interpreter, + // so for now only create wrappers for DOMNodes. + NSLog(@"%s:%d: We don't know how to create ObjC JS wrappers from DOMObjects yet.", __FILE__, __LINE__); + return; + } + + // Extract the WebCore::Node from the ObjectiveC wrapper. + DOMNode *n = (DOMNode *)self; + WebCore::Node *nodeImpl = core(n); + + // Dig up Interpreter and ExecState. + WebCore::Frame *frame = 0; + if (WebCore::Document* document = nodeImpl->document()) + frame = document->frame(); + if (!frame) + return; + + // The global object which should own this node - FIXME: does this need to be isolated-world aware? + WebCore::JSDOMGlobalObject* globalObject = frame->script()->globalObject(WebCore::mainThreadNormalWorld()); + JSC::ExecState *exec = globalObject->globalExec(); + + // Get (or create) a cached JS object for the DOM node. + JSC::JSObject *scriptImp = asObject(WebCore::toJS(exec, globalObject, nodeImpl)); + + JSC::Bindings::RootObject* rootObject = frame->script()->bindingRootObject(); + + [self _setImp:scriptImp originRootObject:rootObject rootObject:rootObject]; +} + +@end diff --git a/Source/WebCore/bindings/objc/DOMObject.h b/Source/WebCore/bindings/objc/DOMObject.h new file mode 100644 index 0000000..c4a3f6f --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMObject.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMException.h> +#import <WebCore/WebScriptObject.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3 + +@class DOMStyleSheet; + +typedef unsigned long long DOMTimeStamp; + +typedef struct DOMObjectInternal DOMObjectInternal; + +@interface DOMObject : WebScriptObject <NSCopying> +{ +@private + DOMObjectInternal *_internal; +} +@end + +@interface DOMObject (DOMLinkStyle) +#ifndef BUILDING_ON_TIGER +@property(readonly, retain) DOMStyleSheet *sheet; +#else +- (DOMStyleSheet *)sheet; +#endif +@end + +#endif diff --git a/Source/WebCore/bindings/objc/DOMObject.mm b/Source/WebCore/bindings/objc/DOMObject.mm new file mode 100644 index 0000000..d88e86b --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMObject.mm @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2004, 2006, 2006, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 James G. Speth <speth@end.com> + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "DOMObject.h" + +#import "DOMHTMLLinkElementInternal.h" +#import "DOMHTMLStyleElementInternal.h" +#import "DOMInternal.h" +#import "DOMProcessingInstructionInternal.h" +#import "DOMStyleSheetInternal.h" +#import "HTMLLinkElement.h" +#import "HTMLStyleElement.h" +#import "ProcessingInstruction.h" +#import "StyleSheet.h" +#import "WebScriptObjectPrivate.h" +#import <wtf/UnusedParam.h> + +@implementation DOMObject + +// Prevent creation of DOM objects by clients who just "[[xxx alloc] init]". +- (id)init +{ + [NSException raise:NSGenericException format:@"+[%@ init]: should never be used", NSStringFromClass([self class])]; + [self release]; + return nil; +} + +- (void)dealloc +{ + if (_internal) + removeDOMWrapper(_internal); + [super dealloc]; +} + +- (id)copyWithZone:(NSZone *)unusedZone +{ + UNUSED_PARAM(unusedZone); + return [self retain]; +} + +@end + +@implementation DOMObject (DOMLinkStyle) + +- (DOMStyleSheet *)sheet +{ + WebCore::StyleSheet* styleSheet; + + if ([self isKindOfClass:[DOMProcessingInstruction class]]) + styleSheet = core(static_cast<DOMProcessingInstruction *>(self))->sheet(); + else if ([self isKindOfClass:[DOMHTMLLinkElement class]]) + styleSheet = core(static_cast<DOMHTMLLinkElement *>(self))->sheet(); + else if ([self isKindOfClass:[DOMHTMLStyleElement class]]) + styleSheet = core(static_cast<DOMHTMLStyleElement *>(self))->sheet(); + else + return nil; + + return kit(styleSheet); +} + +@end diff --git a/Source/WebCore/bindings/objc/DOMPrivate.h b/Source/WebCore/bindings/objc/DOMPrivate.h new file mode 100644 index 0000000..ab3b563 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMPrivate.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOM.h> + +@interface DOMNode (DOMNodeExtensionsPendingPublic) +- (NSImage *)renderedImage; +- (NSArray *)textRects; +@end + +// FIXME: this should be removed as soon as all internal Apple uses of it have been replaced with +// calls to the public method - (NSColor *)color. +@interface DOMRGBColor (WebPrivate) +- (NSColor *)_color; +@end + +// FIXME: this should be removed as soon as all internal Apple uses of it have been replaced with +// calls to the public method - (NSString *)text. +@interface DOMRange (WebPrivate) +- (NSString *)_text; +@end + +@interface DOMRange (DOMRangeExtensions) +- (NSRect)boundingBox; +- (NSArray *)lineBoxRects; // Deprecated. Use textRects instead. +- (NSArray *)textRects; +@end + +@interface DOMElement (WebPrivate) +- (NSFont *)_font; +- (NSData *)_imageTIFFRepresentation; +- (NSURL *)_getURLAttribute:(NSString *)name; +- (BOOL)isFocused; +@end + +@interface DOMCSSStyleDeclaration (WebPrivate) +- (NSString *)_fontSizeDelta; +- (void)_setFontSizeDelta:(NSString *)fontSizeDelta; +@end + +@interface DOMHTMLDocument (WebPrivate) +- (DOMDocumentFragment *)_createDocumentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString; +- (DOMDocumentFragment *)_createDocumentFragmentWithText:(NSString *)text; +@end + +// All the methods in this category are used by Safari forms autofill and should not be used for any other purpose. +// Each one should eventually be replaced by public DOM API, and when that happens Safari will switch to implementations +// using that public API, and these will be deleted. +@interface DOMHTMLInputElement (FormAutoFillTransition) +- (BOOL)_isAutofilled; +- (BOOL)_isTextField; +- (NSRect)_rectOnScreen; // bounding box of the text field, in screen coordinates +- (void)_replaceCharactersInRange:(NSRange)targetRange withString:(NSString *)replacementString selectingFromIndex:(int)index; +- (NSRange)_selectedRange; +- (void)_setAutofilled:(BOOL)filled; +@end + +// These changes are necessary to detect whether a form input was modified by a user +// or javascript +@interface DOMHTMLInputElement (FormPromptAdditions) +- (BOOL)_isEdited; +@end + +@interface DOMHTMLTextAreaElement (FormPromptAdditions) +- (BOOL)_isEdited; +@end + +// All the methods in this category are used by Safari forms autofill and should not be used for any other purpose. +// They are stopgap measures until we finish transitioning form controls to not use NSView. Each one should become +// replaceable by public DOM API, and when that happens Safari will switch to implementations using that public API, +// and these will be deleted. +@interface DOMHTMLSelectElement (FormAutoFillTransition) +- (void)_activateItemAtIndex:(int)index; +- (void)_activateItemAtIndex:(int)index allowMultipleSelection:(BOOL)allowMultipleSelection; +@end diff --git a/Source/WebCore/bindings/objc/DOMRangeException.h b/Source/WebCore/bindings/objc/DOMRangeException.h new file mode 100644 index 0000000..874a540 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMRangeException.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <JavaScriptCore/WebKitAvailability.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3 + +@class NSString; + +extern NSString * const DOMRangeException; + +enum DOMRangeExceptionCode { + DOM_BAD_BOUNDARYPOINTS_ERR = 1, + DOM_INVALID_NODE_TYPE_ERR = 2 +}; + +#endif diff --git a/Source/WebCore/bindings/objc/DOMRanges.h b/Source/WebCore/bindings/objc/DOMRanges.h new file mode 100644 index 0000000..c7e9ffc --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMRanges.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMRange.h> +#import <WebCore/DOMRangeException.h> diff --git a/Source/WebCore/bindings/objc/DOMSVG.h b/Source/WebCore/bindings/objc/DOMSVG.h new file mode 100644 index 0000000..4fc69fd --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMSVG.h @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMSVGAElement.h> +#import <WebCore/DOMSVGAltGlyphElement.h> +#import <WebCore/DOMSVGAngle.h> +#import <WebCore/DOMSVGAnimateColorElement.h> +#import <WebCore/DOMSVGAnimateElement.h> +#import <WebCore/DOMSVGAnimateTransformElement.h> +#import <WebCore/DOMSVGAnimatedAngle.h> +#import <WebCore/DOMSVGAnimatedBoolean.h> +#import <WebCore/DOMSVGAnimatedEnumeration.h> +#import <WebCore/DOMSVGAnimatedInteger.h> +#import <WebCore/DOMSVGAnimatedLength.h> +#import <WebCore/DOMSVGAnimatedLengthList.h> +#import <WebCore/DOMSVGAnimatedNumber.h> +#import <WebCore/DOMSVGAnimatedNumberList.h> +#import <WebCore/DOMSVGAnimatedPreserveAspectRatio.h> +#import <WebCore/DOMSVGAnimatedRect.h> +#import <WebCore/DOMSVGAnimatedString.h> +#import <WebCore/DOMSVGAnimatedTransformList.h> +#import <WebCore/DOMSVGAnimationElement.h> +#import <WebCore/DOMSVGCircleElement.h> +#import <WebCore/DOMSVGClipPathElement.h> +#import <WebCore/DOMSVGColor.h> +#import <WebCore/DOMSVGComponentTransferFunctionElement.h> +#import <WebCore/DOMSVGCursorElement.h> +#import <WebCore/DOMSVGDefsElement.h> +#import <WebCore/DOMSVGDescElement.h> +#import <WebCore/DOMSVGDocument.h> +#import <WebCore/DOMSVGElement.h> +#import <WebCore/DOMSVGElementInstance.h> +#import <WebCore/DOMSVGElementInstanceList.h> +#import <WebCore/DOMSVGEllipseElement.h> +#import <WebCore/DOMSVGException.h> +#import <WebCore/DOMSVGExternalResourcesRequired.h> +#import <WebCore/DOMSVGFEBlendElement.h> +#import <WebCore/DOMSVGFEColorMatrixElement.h> +#import <WebCore/DOMSVGFEComponentTransferElement.h> +#import <WebCore/DOMSVGFECompositeElement.h> +#import <WebCore/DOMSVGFEConvolveMatrixElement.h> +#import <WebCore/DOMSVGFEDiffuseLightingElement.h> +#import <WebCore/DOMSVGFEDisplacementMapElement.h> +#import <WebCore/DOMSVGFEDistantLightElement.h> +#import <WebCore/DOMSVGFEFloodElement.h> +#import <WebCore/DOMSVGFEFuncAElement.h> +#import <WebCore/DOMSVGFEFuncBElement.h> +#import <WebCore/DOMSVGFEFuncGElement.h> +#import <WebCore/DOMSVGFEFuncRElement.h> +#import <WebCore/DOMSVGFEGaussianBlurElement.h> +#import <WebCore/DOMSVGFEImageElement.h> +#import <WebCore/DOMSVGFEMergeElement.h> +#import <WebCore/DOMSVGFEMergeNodeElement.h> +#import <WebCore/DOMSVGFEMorphologyElement.h> +#import <WebCore/DOMSVGFEOffsetElement.h> +#import <WebCore/DOMSVGFEPointLightElement.h> +#import <WebCore/DOMSVGFESpecularLightingElement.h> +#import <WebCore/DOMSVGFESpotLightElement.h> +#import <WebCore/DOMSVGFETileElement.h> +#import <WebCore/DOMSVGFETurbulenceElement.h> +#import <WebCore/DOMSVGFilterElement.h> +#import <WebCore/DOMSVGFilterPrimitiveStandardAttributes.h> +#import <WebCore/DOMSVGFitToViewBox.h> +#import <WebCore/DOMSVGFontElement.h> +#import <WebCore/DOMSVGFontFaceElement.h> +#import <WebCore/DOMSVGFontFaceFormatElement.h> +#import <WebCore/DOMSVGFontFaceNameElement.h> +#import <WebCore/DOMSVGFontFaceSrcElement.h> +#import <WebCore/DOMSVGFontFaceUriElement.h> +#import <WebCore/DOMSVGForeignObjectElement.h> +#import <WebCore/DOMSVGGElement.h> +#import <WebCore/DOMSVGGlyphElement.h> +#import <WebCore/DOMSVGGradientElement.h> +#import <WebCore/DOMSVGImageElement.h> +#import <WebCore/DOMSVGLangSpace.h> +#import <WebCore/DOMSVGLength.h> +#import <WebCore/DOMSVGLengthList.h> +#import <WebCore/DOMSVGLineElement.h> +#import <WebCore/DOMSVGLinearGradientElement.h> +#import <WebCore/DOMSVGLocatable.h> +#import <WebCore/DOMSVGMarkerElement.h> +#import <WebCore/DOMSVGMaskElement.h> +#import <WebCore/DOMSVGMatrix.h> +#import <WebCore/DOMSVGMetadataElement.h> +#import <WebCore/DOMSVGMissingGlyphElement.h> +#import <WebCore/DOMSVGNumber.h> +#import <WebCore/DOMSVGNumberList.h> +#import <WebCore/DOMSVGPaint.h> +#import <WebCore/DOMSVGPathElement.h> +#import <WebCore/DOMSVGPathSeg.h> +#import <WebCore/DOMSVGPathSegArcAbs.h> +#import <WebCore/DOMSVGPathSegArcRel.h> +#import <WebCore/DOMSVGPathSegClosePath.h> +#import <WebCore/DOMSVGPathSegCurvetoCubicAbs.h> +#import <WebCore/DOMSVGPathSegCurvetoCubicRel.h> +#import <WebCore/DOMSVGPathSegCurvetoCubicSmoothAbs.h> +#import <WebCore/DOMSVGPathSegCurvetoCubicSmoothRel.h> +#import <WebCore/DOMSVGPathSegCurvetoQuadraticAbs.h> +#import <WebCore/DOMSVGPathSegCurvetoQuadraticRel.h> +#import <WebCore/DOMSVGPathSegCurvetoQuadraticSmoothAbs.h> +#import <WebCore/DOMSVGPathSegCurvetoQuadraticSmoothRel.h> +#import <WebCore/DOMSVGPathSegLinetoAbs.h> +#import <WebCore/DOMSVGPathSegLinetoHorizontalAbs.h> +#import <WebCore/DOMSVGPathSegLinetoHorizontalRel.h> +#import <WebCore/DOMSVGPathSegLinetoRel.h> +#import <WebCore/DOMSVGPathSegLinetoVerticalAbs.h> +#import <WebCore/DOMSVGPathSegLinetoVerticalRel.h> +#import <WebCore/DOMSVGPathSegList.h> +#import <WebCore/DOMSVGPathSegMovetoAbs.h> +#import <WebCore/DOMSVGPathSegMovetoRel.h> +#import <WebCore/DOMSVGPatternElement.h> +#import <WebCore/DOMSVGPoint.h> +#import <WebCore/DOMSVGPointList.h> +#import <WebCore/DOMSVGPolygonElement.h> +#import <WebCore/DOMSVGPolylineElement.h> +#import <WebCore/DOMSVGPreserveAspectRatio.h> +#import <WebCore/DOMSVGRadialGradientElement.h> +#import <WebCore/DOMSVGRect.h> +#import <WebCore/DOMSVGRectElement.h> +#import <WebCore/DOMSVGRenderingIntent.h> +#import <WebCore/DOMSVGSVGElement.h> +#import <WebCore/DOMSVGScriptElement.h> +#import <WebCore/DOMSVGSetElement.h> +#import <WebCore/DOMSVGStopElement.h> +#import <WebCore/DOMSVGStringList.h> +#import <WebCore/DOMSVGStylable.h> +#import <WebCore/DOMSVGStyleElement.h> +#import <WebCore/DOMSVGSwitchElement.h> +#import <WebCore/DOMSVGSymbolElement.h> +#import <WebCore/DOMSVGTRefElement.h> +#import <WebCore/DOMSVGTSpanElement.h> +#import <WebCore/DOMSVGTests.h> +#import <WebCore/DOMSVGTextContentElement.h> +#import <WebCore/DOMSVGTextElement.h> +#import <WebCore/DOMSVGTextPathElement.h> +#import <WebCore/DOMSVGTextPositioningElement.h> +#import <WebCore/DOMSVGTitleElement.h> +#import <WebCore/DOMSVGTransform.h> +#import <WebCore/DOMSVGTransformList.h> +#import <WebCore/DOMSVGTransformable.h> +#import <WebCore/DOMSVGURIReference.h> +#import <WebCore/DOMSVGUnitTypes.h> +#import <WebCore/DOMSVGUseElement.h> +#import <WebCore/DOMSVGViewElement.h> +#import <WebCore/DOMSVGZoomAndPan.h> +#import <WebCore/DOMSVGZoomEvent.h> diff --git a/Source/WebCore/bindings/objc/DOMSVGException.h b/Source/WebCore/bindings/objc/DOMSVGException.h new file mode 100644 index 0000000..b757978 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMSVGException.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <JavaScriptCore/WebKitAvailability.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST + +@class NSString; + +extern NSString * const DOMSVGException; + +enum DOMSVGException { + DOM_SVG_WRONG_TYPE_ERR = 0, + DOM_SVG_INVALID_VALUE_ERR = 1, + DOM_SVG_MATRIX_NOT_INVERTABLE = 2 +}; + +#endif diff --git a/Source/WebCore/bindings/objc/DOMSVGPathSegInternal.mm b/Source/WebCore/bindings/objc/DOMSVGPathSegInternal.mm new file mode 100644 index 0000000..1710f88 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMSVGPathSegInternal.mm @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" + +#if ENABLE(SVG) + +#import "DOMSVGPathSegInternal.h" + +#import "DOMSVGPathSegArcAbs.h" +#import "DOMSVGPathSegArcRel.h" +#import "DOMSVGPathSegClosePath.h" +#import "DOMSVGPathSegCurvetoCubicAbs.h" +#import "DOMSVGPathSegCurvetoCubicRel.h" +#import "DOMSVGPathSegCurvetoCubicSmoothAbs.h" +#import "DOMSVGPathSegCurvetoCubicSmoothRel.h" +#import "DOMSVGPathSegCurvetoQuadraticAbs.h" +#import "DOMSVGPathSegCurvetoQuadraticRel.h" +#import "DOMSVGPathSegCurvetoQuadraticSmoothAbs.h" +#import "DOMSVGPathSegCurvetoQuadraticSmoothRel.h" +#import "DOMSVGPathSegLinetoAbs.h" +#import "DOMSVGPathSegLinetoHorizontalAbs.h" +#import "DOMSVGPathSegLinetoHorizontalRel.h" +#import "DOMSVGPathSegLinetoRel.h" +#import "DOMSVGPathSegLinetoVerticalAbs.h" +#import "DOMSVGPathSegLinetoVerticalRel.h" +#import "DOMSVGPathSegList.h" +#import "DOMSVGPathSegMovetoAbs.h" +#import "DOMSVGPathSegMovetoRel.h" +#import "SVGPathSeg.h" + +Class kitClass(WebCore::SVGPathSeg* impl) +{ + switch (impl->pathSegType()) { + case WebCore::SVGPathSeg::PATHSEG_UNKNOWN: + return [DOMSVGPathSeg class]; + case WebCore::SVGPathSeg::PATHSEG_CLOSEPATH: + return [DOMSVGPathSegClosePath class]; + case WebCore::SVGPathSeg::PATHSEG_MOVETO_ABS: + return [DOMSVGPathSegMovetoAbs class]; + case WebCore::SVGPathSeg::PATHSEG_MOVETO_REL: + return [DOMSVGPathSegMovetoRel class]; + case WebCore::SVGPathSeg::PATHSEG_LINETO_ABS: + return [DOMSVGPathSegLinetoAbs class]; + case WebCore::SVGPathSeg::PATHSEG_LINETO_REL: + return [DOMSVGPathSegLinetoRel class]; + case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS: + return [DOMSVGPathSegCurvetoCubicAbs class]; + case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL: + return [DOMSVGPathSegCurvetoCubicRel class]; + case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS: + return [DOMSVGPathSegCurvetoQuadraticAbs class]; + case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL: + return [DOMSVGPathSegCurvetoQuadraticRel class]; + case WebCore::SVGPathSeg::PATHSEG_ARC_ABS: + return [DOMSVGPathSegArcAbs class]; + case WebCore::SVGPathSeg::PATHSEG_ARC_REL: + return [DOMSVGPathSegArcRel class]; + case WebCore::SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS: + return [DOMSVGPathSegLinetoHorizontalAbs class]; + case WebCore::SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL: + return [DOMSVGPathSegLinetoHorizontalRel class]; + case WebCore::SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS: + return [DOMSVGPathSegLinetoVerticalAbs class]; + case WebCore::SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL: + return [DOMSVGPathSegLinetoVerticalRel class]; + case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: + return [DOMSVGPathSegCurvetoCubicSmoothAbs class]; + case WebCore::SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL: + return [DOMSVGPathSegCurvetoCubicSmoothRel class]; + case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: + return [DOMSVGPathSegCurvetoQuadraticSmoothAbs class]; + case WebCore::SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: + return [DOMSVGPathSegCurvetoQuadraticSmoothRel class]; + } + ASSERT_NOT_REACHED(); + return nil; +} + +#endif // ENABLE(SVG) diff --git a/Source/WebCore/bindings/objc/DOMStylesheets.h b/Source/WebCore/bindings/objc/DOMStylesheets.h new file mode 100644 index 0000000..81b5def --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMStylesheets.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMCore.h> +#import <WebCore/DOMDocument.h> +#import <WebCore/DOMObject.h> + +#import <WebCore/DOMStyleSheet.h> +#import <WebCore/DOMStyleSheetList.h> +#import <WebCore/DOMMediaList.h> diff --git a/Source/WebCore/bindings/objc/DOMTraversal.h b/Source/WebCore/bindings/objc/DOMTraversal.h new file mode 100644 index 0000000..db9dea8 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMTraversal.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMCore.h> +#import <WebCore/DOMDocument.h> +#import <WebCore/DOMObject.h> + +#import <WebCore/DOMNodeFilter.h> +#import <WebCore/DOMNodeIterator.h> +#import <WebCore/DOMTreeWalker.h> diff --git a/Source/WebCore/bindings/objc/DOMUtility.mm b/Source/WebCore/bindings/objc/DOMUtility.mm new file mode 100644 index 0000000..2b8c474 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMUtility.mm @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 James G. Speth (speth@end.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" + +#import "DOMAbstractViewInternal.h" +#import "DOMCSSRuleInternal.h" +#import "DOMCSSRuleListInternal.h" +#import "DOMCSSStyleDeclarationInternal.h" +#import "DOMCSSValueInternal.h" +#import "DOMCounterInternal.h" +#import "DOMEventInternal.h" +#import "DOMHTMLCollectionInternal.h" +#import "DOMImplementationFront.h" +#import "DOMInternal.h" +#import "DOMMediaListInternal.h" +#import "DOMNamedNodeMapInternal.h" +#import "DOMNodeInternal.h" +#import "DOMNodeIteratorInternal.h" +#import "DOMNodeListInternal.h" +#import "DOMRGBColorInternal.h" +#import "DOMRangeInternal.h" +#import "DOMRectInternal.h" +#import "DOMStyleSheetInternal.h" +#import "DOMStyleSheetListInternal.h" +#import "DOMTreeWalkerInternal.h" +#import "JSCSSRule.h" +#import "JSCSSRuleList.h" +#import "JSCSSStyleDeclaration.h" +#import "JSCSSValue.h" +#import "JSCounter.h" +#import "JSDOMImplementation.h" +#import "JSDOMWindow.h" +#import "JSDOMWindowShell.h" +#import "JSEvent.h" +#import "JSHTMLCollection.h" +#import "JSHTMLOptionsCollection.h" +#import "JSMediaList.h" +#import "JSNamedNodeMap.h" +#import "JSNode.h" +#import "JSNodeIterator.h" +#import "JSNodeList.h" +#import "JSRGBColor.h" +#import "JSRange.h" +#import "JSRect.h" +#import "JSStyleSheet.h" +#import "JSStyleSheetList.h" +#import "JSTreeWalker.h" +#import "JSXPathExpression.h" +#import "JSXPathResult.h" +#import "WebScriptObjectPrivate.h" +#import "runtime_root.h" + +#if ENABLE(XPATH) +#import "DOMXPathExpressionInternal.h" +#import "DOMXPathResultInternal.h" +#endif + +// FIXME: Couldn't get an include of "DOMDOMImplementationInternal.h" to work here. +DOMImplementation *kit(WebCore::DOMImplementationFront*); + +// This file makes use of both the ObjC DOM API and the C++ DOM API, so we need to be careful about what +// headers are included and what namespaces we use to avoid naming conflicts. + +// FIXME: This has to be in the JSC namespace to avoid an Objective-C++ ambiguity with C++ and +// Objective-C classes of the same name (even when not in the same namespace). + +// Some day if the compiler is fixed, or if all the JS wrappers are named with a "JS" prefix, +// we could move the function out of the JSC namespace. + +namespace JSC { + +static inline id createDOMWrapper(JSC::JSObject* object) +{ + #define WRAP(className) \ + if (object->inherits(&WebCore::JS##className::s_info)) \ + return kit(static_cast<WebCore::JS##className*>(object)->impl()); + + WRAP(CSSRule) + WRAP(CSSRuleList) + WRAP(CSSStyleDeclaration) + WRAP(CSSValue) + WRAP(Counter) + WRAP(Event) + WRAP(HTMLOptionsCollection) + WRAP(MediaList) + WRAP(NamedNodeMap) + WRAP(Node) + WRAP(NodeIterator) + WRAP(NodeList) + WRAP(RGBColor) + WRAP(Range) + WRAP(Rect) + WRAP(StyleSheet) + WRAP(StyleSheetList) + WRAP(TreeWalker) +#if ENABLE(XPATH) + WRAP(XPathExpression) + WRAP(XPathResult) +#endif + + // This must be after the HTMLOptionsCollection check, because it's a subclass in the JavaScript + // binding, but not a subclass in the ObjC binding. + WRAP(HTMLCollection) + + #undef WRAP + + if (object->inherits(&WebCore::JSDOMWindowShell::s_info)) + return kit(static_cast<WebCore::JSDOMWindowShell*>(object)->impl()); + + if (object->inherits(&WebCore::JSDOMImplementation::s_info)) + return kit(implementationFront(static_cast<WebCore::JSDOMImplementation*>(object))); + + return nil; +} + +} + +id createDOMWrapper(JSC::JSObject* object, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> current) +{ + id wrapper = JSC::createDOMWrapper(object); + if (![wrapper _hasImp]) // new wrapper, not from cache + [wrapper _setImp:object originRootObject:origin rootObject:current]; + return wrapper; +} diff --git a/Source/WebCore/bindings/objc/DOMViews.h b/Source/WebCore/bindings/objc/DOMViews.h new file mode 100644 index 0000000..4b625c8 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMViews.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMCore.h> +#import <WebCore/DOMDocument.h> +#import <WebCore/DOMObject.h> + +#import <WebCore/DOMAbstractView.h> diff --git a/Source/WebCore/bindings/objc/DOMXPath.h b/Source/WebCore/bindings/objc/DOMXPath.h new file mode 100644 index 0000000..f5472c3 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMXPath.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <WebCore/DOMCore.h> +#import <WebCore/DOMDocument.h> +#import <WebCore/DOMObject.h> + +#import <WebCore/DOMXPathException.h> +#import <WebCore/DOMXPathExpression.h> +#import <WebCore/DOMXPathNSResolver.h> +#import <WebCore/DOMXPathResult.h> diff --git a/Source/WebCore/bindings/objc/DOMXPath.mm b/Source/WebCore/bindings/objc/DOMXPath.mm new file mode 100644 index 0000000..d1c07d7 --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMXPath.mm @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" + +#if ENABLE(XPATH) + +#import "DOMInternal.h" // import first to make the private/public trick work +#import "DOMXPath.h" + +#import "PlatformString.h" +#import "WebScriptObjectPrivate.h" +#import "XPathNSResolver.h" + +//------------------------------------------------------------------------------------------ +// DOMNativeXPathNSResolver + +@implementation DOMNativeXPathNSResolver + +#define IMPL reinterpret_cast<WebCore::XPathNSResolver*>(_internal) + +- (void)dealloc +{ + if (_internal) + IMPL->deref(); + [super dealloc]; +} + +- (void)finalize +{ + if (_internal) + IMPL->deref(); + [super finalize]; +} + +- (NSString *)lookupNamespaceURI:(NSString *)prefix +{ + return IMPL->lookupNamespaceURI(prefix); +} + +@end + +WebCore::XPathNSResolver* core(DOMNativeXPathNSResolver *wrapper) +{ + return wrapper ? reinterpret_cast<WebCore::XPathNSResolver*>(wrapper->_internal) : 0; +} + +DOMNativeXPathNSResolver *kit(WebCore::XPathNSResolver* impl) +{ + if (!impl) + return nil; + + if (DOMNativeXPathNSResolver *wrapper = getDOMWrapper(impl)) + return [[wrapper retain] autorelease]; + + DOMNativeXPathNSResolver *wrapper = [[DOMNativeXPathNSResolver alloc] _init]; + wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(impl); + impl->ref(); + addDOMWrapper(wrapper, impl); + return [wrapper autorelease]; +} + +#endif // ENABLE(XPATH) diff --git a/Source/WebCore/bindings/objc/DOMXPathException.h b/Source/WebCore/bindings/objc/DOMXPathException.h new file mode 100644 index 0000000..32f95fb --- /dev/null +++ b/Source/WebCore/bindings/objc/DOMXPathException.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <JavaScriptCore/WebKitAvailability.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_3_0 + +@class NSString; + +extern NSString * const DOMXPathException; + +enum DOMXPathExceptionCode { + DOM_INVALID_EXPRESSION_ERR = 51, + DOM_TYPE_ERR = 52 +}; + +#endif diff --git a/Source/WebCore/bindings/objc/ExceptionHandlers.h b/Source/WebCore/bindings/objc/ExceptionHandlers.h new file mode 100644 index 0000000..911ae2c --- /dev/null +++ b/Source/WebCore/bindings/objc/ExceptionHandlers.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ExceptionHandlers_h +#define ExceptionHandlers_h + +#include <wtf/Assertions.h> + +#if !defined(NDEBUG) && !defined(DISABLE_THREAD_CHECK) +#define DOM_ASSERT_MAIN_THREAD() do \ + if (!pthread_main_np()) { \ + WTFReportAssertionFailure(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, "DOM access on non-main thread -- you will probably crash soon!"); \ + } \ +while (0) +#else +#define DOM_ASSERT_MAIN_THREAD() ((void)0) +#endif + +namespace WebCore { + + typedef int ExceptionCode; + + class SelectionController; + class Range; + + void raiseDOMException(ExceptionCode); + + inline void raiseOnDOMError(ExceptionCode ec) + { + if (ec) + raiseDOMException(ec); + } + +} // namespace WebCore + +#endif // ExceptionHandlers_h diff --git a/Source/WebCore/bindings/objc/ExceptionHandlers.mm b/Source/WebCore/bindings/objc/ExceptionHandlers.mm new file mode 100644 index 0000000..96ba2c9 --- /dev/null +++ b/Source/WebCore/bindings/objc/ExceptionHandlers.mm @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ExceptionHandlers.h" + +#include "ExceptionCode.h" + +NSString *DOMException = @"DOMException"; +NSString *DOMRangeException = @"DOMRangeException"; +NSString *DOMEventException = @"DOMEventException"; +NSString *DOMXPathException = @"DOMXPathException"; + +#if ENABLE(SVG_DOM_OBJC_BINDINGS) +NSString *DOMSVGException = @"DOMSVGException"; +#endif + +namespace WebCore { + +void raiseDOMException(ExceptionCode ec) +{ + ASSERT(ec); + + ExceptionCodeDescription description; + getExceptionCodeDescription(ec, description); + + NSString *exceptionName; + if (strcmp(description.typeName, "DOM Range") == 0) + exceptionName = DOMRangeException; + else if (strcmp(description.typeName, "DOM Events") == 0) + exceptionName = DOMEventException; +#if ENABLE(SVG_DOM_OBJC_BINDINGS) + else if (strcmp(description.typeName, "DOM SVG") == 0) + exceptionName = DOMSVGException; +#endif + else if (strcmp(description.typeName, "DOM XPath") == 0) + exceptionName = DOMXPathException; + else + exceptionName = DOMException; + + NSString *reason; + if (description.name) + reason = [[NSString alloc] initWithFormat:@"*** %s: %@ %d", description.name, exceptionName, description.code]; + else + reason = [[NSString alloc] initWithFormat:@"*** %@ %d", exceptionName, description.code]; + + NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithInt:description.code], exceptionName, nil]; + + NSException *exception = [NSException exceptionWithName:exceptionName reason:reason userInfo:userInfo]; + + [reason release]; + [userInfo release]; + + [exception raise]; +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/objc/ObjCEventListener.h b/Source/WebCore/bindings/objc/ObjCEventListener.h new file mode 100644 index 0000000..5a2941f --- /dev/null +++ b/Source/WebCore/bindings/objc/ObjCEventListener.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2004, 2006, 2008, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ObjCEventListener_h +#define ObjCEventListener_h + +#include "EventListener.h" +#include <wtf/Forward.h> +#include <wtf/RetainPtr.h> + +@protocol DOMEventListener; + +namespace WebCore { + + class ObjCEventListener : public EventListener { + public: + typedef id<DOMEventListener> ObjCListener; + static PassRefPtr<ObjCEventListener> wrap(ObjCListener); + + static const ObjCEventListener* cast(const EventListener* listener) + { + return listener->type() == ObjCEventListenerType + ? static_cast<const ObjCEventListener*>(listener) + : 0; + } + + private: + static ObjCEventListener* find(ObjCListener); + + ObjCEventListener(ObjCListener); + virtual ~ObjCEventListener(); + virtual bool operator==(const EventListener&); + virtual void handleEvent(ScriptExecutionContext*, Event*); + + RetainPtr<ObjCListener> m_listener; + }; + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/bindings/objc/ObjCEventListener.mm b/Source/WebCore/bindings/objc/ObjCEventListener.mm new file mode 100644 index 0000000..6e2a9fa --- /dev/null +++ b/Source/WebCore/bindings/objc/ObjCEventListener.mm @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2006 James G. Speth (speth@end.com) + * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "ObjCEventListener.h" + +#import "DOMEventInternal.h" +#import "DOMEventListener.h" +#import "Event.h" +#import "EventListener.h" +#import "JSMainThreadExecState.h" +#import <wtf/HashMap.h> + +namespace WebCore { + +typedef HashMap<id, ObjCEventListener*> ListenerMap; +static ListenerMap* listenerMap; + +ObjCEventListener* ObjCEventListener::find(ObjCListener listener) +{ + ListenerMap* map = listenerMap; + if (!map) + return 0; + return map->get(listener); +} + +PassRefPtr<ObjCEventListener> ObjCEventListener::wrap(ObjCListener listener) +{ + RefPtr<ObjCEventListener> wrapper = find(listener); + if (wrapper) + return wrapper; + return adoptRef(new ObjCEventListener(listener)); +} + +ObjCEventListener::ObjCEventListener(ObjCListener listener) + : EventListener(ObjCEventListenerType) + , m_listener(listener) +{ + ListenerMap* map = listenerMap; + if (!map) { + map = new ListenerMap; + listenerMap = map; + } + map->set(listener, this); +} + +ObjCEventListener::~ObjCEventListener() +{ + listenerMap->remove(m_listener.get()); +} + +void ObjCEventListener::handleEvent(ScriptExecutionContext*, Event* event) +{ + ObjCListener listener = m_listener.get(); + [listener handleEvent:kit(event)]; +} + +bool ObjCEventListener::operator==(const EventListener& listener) +{ + if (const ObjCEventListener* objCEventListener = ObjCEventListener::cast(&listener)) + return m_listener == objCEventListener->m_listener; + return false; +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/objc/ObjCNodeFilterCondition.h b/Source/WebCore/bindings/objc/ObjCNodeFilterCondition.h new file mode 100644 index 0000000..e136bc4 --- /dev/null +++ b/Source/WebCore/bindings/objc/ObjCNodeFilterCondition.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2004, 2006, 2008 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ObjCNodeFilterCondition_h +#define ObjCNodeFilterCondition_h + +#include "NodeFilterCondition.h" + +#include <wtf/PassRefPtr.h> +#include <wtf/RetainPtr.h> + +@protocol DOMNodeFilter; + +namespace WebCore { + class Node; + + class ObjCNodeFilterCondition : public NodeFilterCondition { + public: + static PassRefPtr<ObjCNodeFilterCondition> create(id <DOMNodeFilter> filter) + { + return adoptRef(new ObjCNodeFilterCondition(filter)); + } + + virtual short acceptNode(JSC::ExecState*, Node*) const; + + private: + ObjCNodeFilterCondition(id <DOMNodeFilter> filter) + : m_filter(filter) + { + } + + RetainPtr<id <DOMNodeFilter> > m_filter; + }; + +} // namespace WebCore + +#endif diff --git a/Source/WebCore/bindings/objc/ObjCNodeFilterCondition.mm b/Source/WebCore/bindings/objc/ObjCNodeFilterCondition.mm new file mode 100644 index 0000000..825c247 --- /dev/null +++ b/Source/WebCore/bindings/objc/ObjCNodeFilterCondition.mm @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006 James G. Speth (speth@end.com) + * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" + +#import "ObjCNodeFilterCondition.h" + +#import "DOMNodeFilter.h" +#import "DOMNodeInternal.h" +#import "NodeFilter.h" + +using namespace JSC; + +namespace WebCore { + +short ObjCNodeFilterCondition::acceptNode(ExecState*, Node* node) const +{ + if (!node) + return NodeFilter::FILTER_REJECT; + return [m_filter.get() acceptNode:kit(node)]; +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/objc/PublicDOMInterfaces.h b/Source/WebCore/bindings/objc/PublicDOMInterfaces.h new file mode 100644 index 0000000..428ac4a --- /dev/null +++ b/Source/WebCore/bindings/objc/PublicDOMInterfaces.h @@ -0,0 +1,1258 @@ +// Copyright (C) 2006, 2007 Apple Inc. All rights reserved. +// Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file is used by bindings/scripts/CodeGeneratorObjC.pm to determine public API. +// All public DOM class interfaces, properties and methods need to be in this file. +// Anything not in the file will be generated into the appropriate private header file. + +#ifndef OBJC_CODE_GENERATION +#error Do not include this header, instead include the appropriate DOM header. +#endif + +@interface DOMAttr : DOMNode WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *name; +@property(readonly) BOOL specified; +@property(copy) NSString *value; +@property(readonly, retain) DOMElement *ownerElement; +@property(readonly, retain) DOMCSSStyleDeclaration *style AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMCDATASection : DOMText WEBKIT_VERSION_1_3 +@end + +@interface DOMCharacterData : DOMNode WEBKIT_VERSION_1_3 +@property(copy) NSString *data; +@property(readonly) unsigned length; +- (NSString *)substringData:(unsigned)offset :(unsigned)length; +- (NSString *)substringData:(unsigned)offset length:(unsigned)length AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)appendData:(NSString *)data; +- (void)insertData:(unsigned)offset :(NSString *)data; +- (void)deleteData:(unsigned)offset :(unsigned)length; +- (void)replaceData:(unsigned)offset :(unsigned)length :(NSString *)data; +- (void)insertData:(unsigned)offset data:(NSString *)data AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)deleteData:(unsigned)offset length:(unsigned)length AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)replaceData:(unsigned)offset length:(unsigned)length data:(NSString *)data AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMComment : DOMCharacterData WEBKIT_VERSION_1_3 +@end + +@interface DOMImplementation : DOMObject WEBKIT_VERSION_1_3 +- (BOOL)hasFeature:(NSString *)feature :(NSString *)version; +- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName :(NSString *)publicId :(NSString *)systemId; +- (DOMDocument *)createDocument:(NSString *)namespaceURI :(NSString *)qualifiedName :(DOMDocumentType *)doctype; +- (DOMCSSStyleSheet *)createCSSStyleSheet:(NSString *)title :(NSString *)media; +- (BOOL)hasFeature:(NSString *)feature version:(NSString *)version AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMDocumentType *)createDocumentType:(NSString *)qualifiedName publicId:(NSString *)publicId systemId:(NSString *)systemId AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMDocument *)createDocument:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName doctype:(DOMDocumentType *)doctype AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMCSSStyleSheet *)createCSSStyleSheet:(NSString *)title media:(NSString *)media AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMHTMLDocument *)createHTMLDocument:(NSString *)title AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMAbstractView : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMDocument *document; +@end + +@interface DOMDocument : DOMNode WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMDocumentType *doctype; +@property(readonly, retain) DOMImplementation *implementation; +@property(readonly, retain) DOMElement *documentElement; +@property(readonly, retain) DOMAbstractView *defaultView; +@property(readonly, retain) DOMStyleSheetList *styleSheets; +@property(readonly, retain) DOMHTMLCollection *images; +@property(readonly, retain) DOMHTMLCollection *applets; +@property(readonly, retain) DOMHTMLCollection *links; +@property(readonly, retain) DOMHTMLCollection *forms; +@property(readonly, retain) DOMHTMLCollection *anchors; +@property(copy) NSString *title; +@property(readonly, copy) NSString *referrer; +@property(readonly, copy) NSString *domain; +@property(readonly, copy) NSString *URL; +@property(retain) DOMHTMLElement *body; +@property(copy) NSString *cookie; +@property(readonly, copy) NSString *inputEncoding AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *xmlEncoding AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *xmlVersion AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property BOOL xmlStandalone AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *documentURI AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *charset AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *defaultCharset AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *readyState AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *characterSet AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *preferredStylesheetSet AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *selectedStylesheetSet AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *lastModified AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (DOMElement *)createElement:(NSString *)tagName; +- (DOMDocumentFragment *)createDocumentFragment; +- (DOMText *)createTextNode:(NSString *)data; +- (DOMComment *)createComment:(NSString *)data; +- (DOMCDATASection *)createCDATASection:(NSString *)data; +- (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target :(NSString *)data; +- (DOMProcessingInstruction *)createProcessingInstruction:(NSString *)target data:(NSString *)data AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMAttr *)createAttribute:(NSString *)name; +- (DOMEntityReference *)createEntityReference:(NSString *)name; +- (DOMNodeList *)getElementsByTagName:(NSString *)tagname; +- (DOMNode *)importNode:(DOMNode *)importedNode :(BOOL)deep; +- (DOMElement *)createElementNS:(NSString *)namespaceURI :(NSString *)qualifiedName; +- (DOMAttr *)createAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName; +- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName; +- (DOMNode *)importNode:(DOMNode *)importedNode deep:(BOOL)deep AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNode *)adoptNode:(DOMNode *)source AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMElement *)createElementNS:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMAttr *)createAttributeNS:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMElement *)getElementById:(NSString *)elementId; +- (DOMEvent *)createEvent:(NSString *)eventType; +- (DOMRange *)createRange; +- (DOMCSSStyleDeclaration *)createCSSStyleDeclaration AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMCSSStyleDeclaration *)getOverrideStyle:(DOMElement *)element :(NSString *)pseudoElement; +- (DOMCSSStyleDeclaration *)getOverrideStyle:(DOMElement *)element pseudoElement:(NSString *)pseudoElement AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMCSSStyleDeclaration *)getComputedStyle:(DOMElement *)element :(NSString *)pseudoElement; +- (DOMCSSStyleDeclaration *)getComputedStyle:(DOMElement *)element pseudoElement:(NSString *)pseudoElement AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)element pseudoElement:(NSString *)pseudoElement AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)element pseudoElement:(NSString *)pseudoElement authorOnly:(BOOL)authorOnly AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNodeList *)getElementsByName:(NSString *)elementName; +- (DOMNodeIterator *)createNodeIterator:(DOMNode *)root whatToShow:(unsigned)whatToShow filter:(id <DOMNodeFilter>)filter expandEntityReferences:(BOOL)expandEntityReferences AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMTreeWalker *)createTreeWalker:(DOMNode *)root whatToShow:(unsigned)whatToShow filter:(id <DOMNodeFilter>)filter expandEntityReferences:(BOOL)expandEntityReferences AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNodeIterator *)createNodeIterator:(DOMNode *)root :(unsigned)whatToShow :(id <DOMNodeFilter>)filter :(BOOL)expandEntityReferences; +- (DOMTreeWalker *)createTreeWalker:(DOMNode *)root :(unsigned)whatToShow :(id <DOMNodeFilter>)filter :(BOOL)expandEntityReferences; +#if ENABLE_XPATH +- (DOMXPathExpression *)createExpression:(NSString *)expression :(id <DOMXPathNSResolver>)resolver AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED; +- (DOMXPathExpression *)createExpression:(NSString *)expression resolver:(id <DOMXPathNSResolver>)resolver AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (id <DOMXPathNSResolver>)createNSResolver:(DOMNode *)nodeResolver AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMXPathResult *)evaluate:(NSString *)expression :(DOMNode *)contextNode :(id <DOMXPathNSResolver>)resolver :(unsigned short)type :(DOMXPathResult *)inResult AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED; +- (DOMXPathResult *)evaluate:(NSString *)expression contextNode:(DOMNode *)contextNode resolver:(id <DOMXPathNSResolver>)resolver type:(unsigned short)type inResult:(DOMXPathResult *)inResult AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +#endif +- (BOOL)execCommand:(NSString *)command userInterface:(BOOL)userInterface value:(NSString *)value AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)execCommand:(NSString *)command userInterface:(BOOL)userInterface AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)execCommand:(NSString *)command AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)queryCommandEnabled:(NSString *)command AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)queryCommandIndeterm:(NSString *)command AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)queryCommandState:(NSString *)command AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)queryCommandSupported:(NSString *)command AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (NSString *)queryCommandValue:(NSString *)command AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMElement *)elementFromPoint:(int)x y:(int)y AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNodeList *)getElementsByClassName:(NSString *)tagname AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (DOMElement *)querySelector:(NSString *)selectors AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (DOMNodeList *)querySelectorAll:(NSString *)selectors AVAILABLE_IN_WEBKIT_VERSION_4_0; +#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API +- (void)webkitCancelFullScreen AVAILABLE_IN_WEBKIT_VERSION_4_0; +#endif +@end + +@interface DOMDocumentFragment : DOMNode WEBKIT_VERSION_1_3 +@end + +@interface DOMDocumentType : DOMNode WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *name; +@property(readonly, retain) DOMNamedNodeMap *entities; +@property(readonly, retain) DOMNamedNodeMap *notations; +@property(readonly, copy) NSString *publicId; +@property(readonly, copy) NSString *systemId; +@property(readonly, copy) NSString *internalSubset; +@end + +@interface DOMElement : DOMNode WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *tagName; +@property(readonly, retain) DOMCSSStyleDeclaration *style; +@property(readonly) int offsetLeft; +@property(readonly) int offsetTop; +@property(readonly) int offsetWidth; +@property(readonly) int offsetHeight; +@property(readonly, retain) DOMElement *offsetParent; +@property(readonly) int clientWidth; +@property(readonly) int clientHeight; +@property int scrollLeft; +@property int scrollTop; +@property(readonly) int scrollWidth; +@property(readonly) int scrollHeight; +@property(readonly) int clientLeft AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int clientTop AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *innerText AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, retain) DOMElement *firstElementChild AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(readonly, retain) DOMElement *lastElementChild AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(readonly, retain) DOMElement *previousElementSibling AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(readonly, retain) DOMElement *nextElementSibling AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(readonly) unsigned childElementCount AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (NSString *)getAttribute:(NSString *)name; +- (void)setAttribute:(NSString *)name :(NSString *)value; +- (void)setAttribute:(NSString *)name value:(NSString *)value AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)removeAttribute:(NSString *)name; +- (DOMAttr *)getAttributeNode:(NSString *)name; +- (DOMAttr *)setAttributeNode:(DOMAttr *)newAttr; +- (DOMAttr *)removeAttributeNode:(DOMAttr *)oldAttr; +- (DOMNodeList *)getElementsByTagName:(NSString *)name; +- (NSString *)getAttributeNS:(NSString *)namespaceURI :(NSString *)localName; +- (void)setAttributeNS:(NSString *)namespaceURI :(NSString *)qualifiedName :(NSString *)value; +- (void)removeAttributeNS:(NSString *)namespaceURI :(NSString *)localName; +- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI :(NSString *)localName; +- (DOMAttr *)getAttributeNodeNS:(NSString *)namespaceURI :(NSString *)localName; +- (NSString *)getAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)setAttributeNS:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName value:(NSString *)value AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)removeAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNodeList *)getElementsByTagNameNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMAttr *)getAttributeNodeNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMAttr *)setAttributeNodeNS:(DOMAttr *)newAttr; +- (BOOL)hasAttribute:(NSString *)name; +- (BOOL)hasAttributeNS:(NSString *)namespaceURI :(NSString *)localName; +- (BOOL)hasAttributeNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)scrollIntoView:(BOOL)alignWithTop AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)scrollIntoViewIfNeeded:(BOOL)centerIfNeeded AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)contains:(DOMElement *)element AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)scrollByLines:(int)lines AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)scrollByPages:(int)pages AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)focus AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (void)blur AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (DOMNodeList *)getElementsByClassName:(NSString *)name AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (DOMElement *)querySelector:(NSString *)selectors AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (DOMNodeList *)querySelectorAll:(NSString *)selectors AVAILABLE_IN_WEBKIT_VERSION_4_0; +#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API +- (void)webkitRequestFullScreen:(unsigned short)flags AVAILABLE_IN_WEBKIT_VERSION_4_0; +#endif +@end + +@interface DOMEntity : DOMNode WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *publicId; +@property(readonly, copy) NSString *systemId; +@property(readonly, copy) NSString *notationName; +@end + +@interface DOMEntityReference : DOMNode WEBKIT_VERSION_1_3 +@end + +@interface DOMBlob : DOMObject WEBKIT_VERSION_4_0 +@property(readonly) unsigned long long size; +@end + +@interface DOMFile : DOMBlob WEBKIT_VERSION_4_0 +@property(readonly, copy) NSString *name; + +// FIXME: obsolete properties. To be removed. +@property(readonly, copy) NSString *fileName; +@property(readonly) unsigned long long fileSize; +@end + +@interface DOMFileList : DOMObject WEBKIT_VERSION_4_0 +@property(readonly) unsigned length; +- (DOMFile *)item:(unsigned)index; +@end + +@interface DOMNamedNodeMap : DOMObject WEBKIT_VERSION_1_3 +@property(readonly) unsigned length; +- (DOMNode *)getNamedItem:(NSString *)name; +- (DOMNode *)setNamedItem:(DOMNode *)node; +- (DOMNode *)removeNamedItem:(NSString *)name; +- (DOMNode *)item:(unsigned)index; +- (DOMNode *)getNamedItemNS:(NSString *)namespaceURI :(NSString *)localName; +- (DOMNode *)getNamedItemNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNode *)setNamedItemNS:(DOMNode *)node; +- (DOMNode *)removeNamedItemNS:(NSString *)namespaceURI :(NSString *)localName; +- (DOMNode *)removeNamedItemNS:(NSString *)namespaceURI localName:(NSString *)localName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMNode : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *nodeName; +@property(copy) NSString *nodeValue; +@property(readonly) unsigned short nodeType; +@property(readonly, retain) DOMNode *parentNode; +@property(readonly, retain) DOMNodeList *childNodes; +@property(readonly, retain) DOMNode *firstChild; +@property(readonly, retain) DOMNode *lastChild; +@property(readonly, retain) DOMNode *previousSibling; +@property(readonly, retain) DOMNode *nextSibling; +@property(readonly, retain) DOMNamedNodeMap *attributes; +@property(readonly, retain) DOMDocument *ownerDocument; +@property(readonly, copy) NSString *namespaceURI; +@property(copy) NSString *prefix; +@property(readonly, copy) NSString *localName; +@property(copy) NSString *textContent AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *baseURI AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, retain) DOMElement *parentElement AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) BOOL isContentEditable AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNode *)insertBefore:(DOMNode *)newChild :(DOMNode *)refChild; +- (DOMNode *)insertBefore:(DOMNode *)newChild refChild:(DOMNode *)refChild AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNode *)replaceChild:(DOMNode *)newChild :(DOMNode *)oldChild; +- (DOMNode *)replaceChild:(DOMNode *)newChild oldChild:(DOMNode *)oldChild AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNode *)removeChild:(DOMNode *)oldChild; +- (DOMNode *)appendChild:(DOMNode *)newChild; +- (BOOL)hasChildNodes; +- (DOMNode *)cloneNode:(BOOL)deep; +- (void)normalize; +- (BOOL)isSupported:(NSString *)feature :(NSString *)version; +- (BOOL)isSupported:(NSString *)feature version:(NSString *)version AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)hasAttributes; +- (BOOL)isSameNode:(DOMNode *)other AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)isEqualNode:(DOMNode *)other AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (NSString *)lookupPrefix:(NSString *)namespaceURI AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)isDefaultNamespace:(NSString *)namespaceURI AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (NSString *)lookupNamespaceURI:(NSString *)prefix AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (unsigned short)compareDocumentPosition:(DOMNode *)other AVAILABLE_IN_WEBKIT_VERSION_4_0; +@end + +@interface DOMNodeList : DOMObject WEBKIT_VERSION_1_3 +@property(readonly) unsigned length; +- (DOMNode *)item:(unsigned)index; +@end + +@interface DOMNotation : DOMNode WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *publicId; +@property(readonly, copy) NSString *systemId; +@end + +@interface DOMProcessingInstruction : DOMNode WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *target; +@property(copy) NSString *data; +@property(readonly, retain) DOMStyleSheet *sheet AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMText : DOMCharacterData WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *wholeText AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (DOMText *)splitText:(unsigned)offset; +- (DOMText *)replaceWholeText:(NSString *)content AVAILABLE_IN_WEBKIT_VERSION_4_0; +@end + +@interface DOMHTMLAnchorElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *accessKey; +@property(copy) NSString *charset; +@property(copy) NSString *coords; +@property(copy) NSString *href; +@property(copy) NSString *hreflang; +@property(copy) NSString *name; +@property(copy) NSString *rel; +@property(copy) NSString *rev; +@property(copy) NSString *shape; +@property(copy) NSString *target; +@property(copy) NSString *type; +@property(readonly, copy) NSURL *absoluteLinkURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *hashName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *host AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *hostname AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *pathname AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *port AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *protocol AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *search AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *text AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLAppletElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@property(copy) NSString *alt; +@property(copy) NSString *archive; +@property(copy) NSString *code; +@property(copy) NSString *codeBase; +@property(copy) NSString *height; +@property int hspace; +@property(copy) NSString *name; +@property(copy) NSString *object; +@property int vspace; +@property(copy) NSString *width; +@end + +@interface DOMHTMLAreaElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *accessKey; +@property(copy) NSString *alt; +@property(copy) NSString *coords; +@property(copy) NSString *href; +@property BOOL noHref; +@property(copy) NSString *shape; +@property(copy) NSString *target; +@property(readonly, copy) NSURL *absoluteLinkURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *hashName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *host AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *hostname AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *pathname AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *port AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *protocol AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSString *search AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLBRElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *clear; +@end + +@interface DOMHTMLBaseElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *href; +@property(copy) NSString *target; +@end + +@interface DOMHTMLBaseFontElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *color; +@property(copy) NSString *face; +@property(copy) NSString *size; +@end + +@interface DOMHTMLBodyElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *aLink; +@property(copy) NSString *background; +@property(copy) NSString *bgColor; +@property(copy) NSString *link; +@property(copy) NSString *text; +@property(copy) NSString *vLink; +@end + +@interface DOMHTMLButtonElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLFormElement *form; +@property(copy) NSString *accessKey; +@property BOOL disabled; +@property(copy) NSString *name; +@property(readonly, copy) NSString *type; +@property(copy) NSString *value; +@property BOOL autofocus AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(readonly) BOOL willValidate AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (void)click AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLCanvasElement : DOMHTMLElement WEBKIT_VERSION_3_0 +@property int height; +@property int width; +@end + +@interface DOMHTMLCollection : DOMObject WEBKIT_VERSION_1_3 +@property(readonly) unsigned length; +- (DOMNode *)item:(unsigned)index; +- (DOMNode *)namedItem:(NSString *)name; +- (DOMNodeList *)tags:(NSString *)name AVAILABLE_IN_WEBKIT_VERSION_4_0; +@end + +@interface DOMHTMLDListElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property BOOL compact; +@end + +@interface DOMHTMLDirectoryElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property BOOL compact; +@end + +@interface DOMHTMLDivElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@end + +@interface DOMHTMLDocument : DOMDocument WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLCollection *embeds AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, retain) DOMHTMLCollection *plugins AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, retain) DOMHTMLCollection *scripts AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int width AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int height AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *dir AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *designMode AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *bgColor AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *fgColor AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *alinkColor AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *linkColor AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *vlinkColor AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, retain) DOMElement *activeElement AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(readonly, copy) NSString *compatMode AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (void)captureEvents AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)releaseEvents AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)clear AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (BOOL)hasFocus AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (void)open; +- (void)close; +- (void)write:(NSString *)text; +- (void)writeln:(NSString *)text; +@end + +@interface DOMHTMLElement : DOMElement WEBKIT_VERSION_1_3 +@property(copy) NSString *title; +@property(copy) NSString *idName; +@property(copy) NSString *lang; +@property(copy) NSString *dir; +@property(copy) NSString *className; +@property(copy) NSString *innerHTML; +@property(copy) NSString *innerText; +@property(copy) NSString *outerHTML; +@property(copy) NSString *outerText; +@property(readonly, retain) DOMHTMLCollection *children; +@property(copy) NSString *contentEditable; +@property(readonly) BOOL isContentEditable; +@property(readonly, copy) NSString *titleDisplayString AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property int tabIndex; +@end + +@interface DOMHTMLEmbedElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@property int height; +@property(copy) NSString *name; +@property(copy) NSString *src; +@property(copy) NSString *type; +@property int width; +@end + +@interface DOMHTMLFieldSetElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLFormElement *form; +@end + +@interface DOMHTMLFontElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *color; +@property(copy) NSString *face; +@property(copy) NSString *size; +@end + +@interface DOMHTMLFormElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLCollection *elements; +@property(readonly) int length; +@property(copy) NSString *name; +@property(copy) NSString *acceptCharset; +@property(copy) NSString *action; +@property(copy) NSString *enctype; +@property(copy) NSString *method; +@property(copy) NSString *target; +@property(copy) NSString *encoding AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)submit; +- (void)reset; +@end + +@interface DOMHTMLFrameElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *frameBorder; +@property(copy) NSString *longDesc; +@property(copy) NSString *marginHeight; +@property(copy) NSString *marginWidth; +@property(copy) NSString *name; +@property BOOL noResize; +@property(copy) NSString *scrolling; +@property(copy) NSString *src; +@property(readonly, retain) DOMDocument *contentDocument; +@property(readonly, retain) DOMAbstractView *contentWindow AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *location AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int width AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int height AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLFrameSetElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *cols; +@property(copy) NSString *rows; +@end + +@interface DOMHTMLHRElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@property BOOL noShade; +@property(copy) NSString *size; +@property(copy) NSString *width; +@end + +@interface DOMHTMLHeadElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *profile; +@end + +@interface DOMHTMLHeadingElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@end + +@interface DOMHTMLHtmlElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *version; +@end + +@interface DOMHTMLIFrameElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@property(copy) NSString *frameBorder; +@property(copy) NSString *height; +@property(copy) NSString *longDesc; +@property(copy) NSString *marginHeight; +@property(copy) NSString *marginWidth; +@property(copy) NSString *name; +@property(copy) NSString *scrolling; +@property(copy) NSString *src; +@property(copy) NSString *width; +@property(readonly, retain) DOMDocument *contentDocument; +@property(readonly, retain) DOMAbstractView *contentWindow AVAILABLE_IN_WEBKIT_VERSION_4_0; +@end + +@interface DOMHTMLImageElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *name; +@property(copy) NSString *align; +@property(copy) NSString *alt; +@property(copy) NSString *border; +@property int height; +@property int hspace; +@property BOOL isMap; +@property(copy) NSString *longDesc; +@property(copy) NSString *src; +@property(copy) NSString *useMap; +@property int vspace; +@property int width; +@property(readonly, copy) NSString *altDisplayString AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSURL *absoluteImageURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) BOOL complete AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(copy) NSString *lowsrc AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int naturalHeight AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int naturalWidth AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int x AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int y AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLInputElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *defaultValue; +@property BOOL defaultChecked; +@property(readonly, retain) DOMHTMLFormElement *form; +@property(copy) NSString *accept; +@property(copy) NSString *accessKey; +@property(copy) NSString *align; +@property(copy) NSString *alt; +@property BOOL checked; +@property BOOL disabled; +@property int maxLength; +@property(copy) NSString *name; +@property BOOL readOnly; +@property(copy) NSString *size; +@property(copy) NSString *src; +@property(copy) NSString *type; +@property(copy) NSString *useMap; +@property(copy) NSString *value; +@property(readonly, copy) NSString *altDisplayString AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, copy) NSURL *absoluteImageURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property BOOL indeterminate AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property int selectionStart AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property int selectionEnd AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property BOOL autofocus AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property BOOL multiple AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(readonly) BOOL willValidate AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(readonly, retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (void)select; +- (void)click; +- (void)setSelectionRange:(int)start end:(int)end AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLIsIndexElement : DOMHTMLInputElement WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLFormElement *form; +@property(copy) NSString *prompt; +@end + +@interface DOMHTMLLIElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *type; +@property int value; +@end + +@interface DOMHTMLLabelElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLFormElement *form; +@property(copy) NSString *accessKey; +@property(copy) NSString *htmlFor; +@end + +@interface DOMHTMLLegendElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLFormElement *form; +@property(copy) NSString *accessKey; +@property(copy) NSString *align; +@end + +@interface DOMHTMLLinkElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property BOOL disabled; +@property(copy) NSString *charset; +@property(copy) NSString *href; +@property(copy) NSString *hreflang; +@property(copy) NSString *media; +@property(copy) NSString *rel; +@property(copy) NSString *rev; +@property(copy) NSString *target; +@property(copy) NSString *type; +@property(readonly, copy) NSURL *absoluteLinkURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, retain) DOMStyleSheet *sheet AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLMapElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLCollection *areas; +@property(copy) NSString *name; +@end + +@interface DOMHTMLMarqueeElement : DOMHTMLElement WEBKIT_VERSION_3_0 +- (void)start; +- (void)stop; +@end + +@interface DOMHTMLMenuElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property BOOL compact; +@end + +@interface DOMHTMLMetaElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *content; +@property(copy) NSString *httpEquiv; +@property(copy) NSString *name; +@property(copy) NSString *scheme; +@end + +@interface DOMHTMLModElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *cite; +@property(copy) NSString *dateTime; +@end + +@interface DOMHTMLOListElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property BOOL compact; +@property int start; +@property(copy) NSString *type; +@end + +@interface DOMHTMLObjectElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLFormElement *form; +@property(copy) NSString *code; +@property(copy) NSString *align; +@property(copy) NSString *archive; +@property(copy) NSString *border; +@property(copy) NSString *codeBase; +@property(copy) NSString *codeType; +@property(copy) NSString *data; +@property BOOL declare; +@property(copy) NSString *height; +@property int hspace; +@property(copy) NSString *name; +@property(copy) NSString *standby; +@property(copy) NSString *type; +@property(copy) NSString *useMap; +@property int vspace; +@property(copy) NSString *width; +@property(readonly, retain) DOMDocument *contentDocument; +@property(readonly, copy) NSURL *absoluteImageURL AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLOptGroupElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property BOOL disabled; +@property(copy) NSString *label; +@end + +@interface DOMHTMLOptionElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMHTMLFormElement *form; +@property BOOL defaultSelected; +@property(readonly, copy) NSString *text; +@property(readonly) int index; +@property BOOL disabled; +@property(copy) NSString *label; +@property BOOL selected; +@property(copy) NSString *value; +@end + +@interface DOMHTMLOptionsCollection : DOMObject WEBKIT_VERSION_1_3 +@property unsigned length; +@property int selectedIndex AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNode *)item:(unsigned)index; +- (DOMNode *)namedItem:(NSString *)name; +- (void)add:(DOMHTMLOptionElement *)option index:(unsigned)index AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)remove:(unsigned)index AVAILABLE_IN_WEBKIT_VERSION_4_0; +@end + +@interface DOMHTMLParagraphElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@end + +@interface DOMHTMLParamElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *name; +@property(copy) NSString *type; +@property(copy) NSString *value; +@property(copy) NSString *valueType; +@end + +@interface DOMHTMLPreElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property int width; +@property BOOL wrap AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLQuoteElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *cite; +@end + +@interface DOMHTMLScriptElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *text; +@property(copy) NSString *htmlFor; +@property(copy) NSString *event; +@property(copy) NSString *charset; +@property BOOL defer; +@property(copy) NSString *src; +@property(copy) NSString *type; +@end + +@interface DOMHTMLSelectElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *type; +@property int selectedIndex; +@property(copy) NSString *value; +@property(readonly) int length; +@property(readonly, retain) DOMHTMLFormElement *form; +@property(readonly, retain) DOMHTMLOptionsCollection *options; +@property BOOL disabled; +@property BOOL multiple; +@property(copy) NSString *name; +@property int size; +@property(readonly) BOOL willValidate AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property BOOL autofocus AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (void)add:(DOMHTMLElement *)element :(DOMHTMLElement *)before; +- (void)add:(DOMHTMLElement *)element before:(DOMHTMLElement *)before AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)remove:(int)index; +- (DOMNode *)item:(unsigned)index AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (DOMNode *)namedItem:(NSString *)name AVAILABLE_IN_WEBKIT_VERSION_4_0; +@end + +@interface DOMHTMLStyleElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property BOOL disabled; +@property(copy) NSString *media; +@property(copy) NSString *type; +@property(readonly, retain) DOMStyleSheet *sheet AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLTableCaptionElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@end + +@interface DOMHTMLTableCellElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly) int cellIndex; +@property(copy) NSString *abbr; +@property(copy) NSString *align; +@property(copy) NSString *axis; +@property(copy) NSString *bgColor; +@property(copy) NSString *ch; +@property(copy) NSString *chOff; +@property int colSpan; +@property(copy) NSString *headers; +@property(copy) NSString *height; +@property BOOL noWrap; +@property int rowSpan; +@property(copy) NSString *scope; +@property(copy) NSString *vAlign; +@property(copy) NSString *width; +@end + +@interface DOMHTMLTableColElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@property(copy) NSString *ch; +@property(copy) NSString *chOff; +@property int span; +@property(copy) NSString *vAlign; +@property(copy) NSString *width; +@end + +@interface DOMHTMLTableElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(retain) DOMHTMLTableCaptionElement *caption; +@property(retain) DOMHTMLTableSectionElement *tHead; +@property(retain) DOMHTMLTableSectionElement *tFoot; +@property(readonly, retain) DOMHTMLCollection *rows; +@property(readonly, retain) DOMHTMLCollection *tBodies; +@property(copy) NSString *align; +@property(copy) NSString *bgColor; +@property(copy) NSString *border; +@property(copy) NSString *cellPadding; +@property(copy) NSString *cellSpacing; +@property(copy) NSString *frameBorders; +@property(copy) NSString *rules; +@property(copy) NSString *summary; +@property(copy) NSString *width; +- (DOMHTMLElement *)createTHead; +- (void)deleteTHead; +- (DOMHTMLElement *)createTFoot; +- (void)deleteTFoot; +- (DOMHTMLElement *)createCaption; +- (void)deleteCaption; +- (DOMHTMLElement *)insertRow:(int)index; +- (void)deleteRow:(int)index; +@end + +@interface DOMHTMLTableRowElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(readonly) int rowIndex; +@property(readonly) int sectionRowIndex; +@property(readonly, retain) DOMHTMLCollection *cells; +@property(copy) NSString *align; +@property(copy) NSString *bgColor; +@property(copy) NSString *ch; +@property(copy) NSString *chOff; +@property(copy) NSString *vAlign; +- (DOMHTMLElement *)insertCell:(int)index; +- (void)deleteCell:(int)index; +@end + +@interface DOMHTMLTableSectionElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *align; +@property(copy) NSString *ch; +@property(copy) NSString *chOff; +@property(copy) NSString *vAlign; +@property(readonly, retain) DOMHTMLCollection *rows; +- (DOMHTMLElement *)insertRow:(int)index; +- (void)deleteRow:(int)index; +@end + +@interface DOMHTMLTextAreaElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *defaultValue; +@property(readonly, retain) DOMHTMLFormElement *form; +@property(copy) NSString *accessKey; +@property int cols; +@property BOOL disabled; +@property(copy) NSString *name; +@property BOOL readOnly; +@property int rows; +@property(readonly, copy) NSString *type; +@property(copy) NSString *value; +@property int selectionStart AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property int selectionEnd AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property BOOL autofocus AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property(readonly) BOOL willValidate AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (void)select; +- (void)setSelectionRange:(int)start end:(int)end AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMHTMLTitleElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property(copy) NSString *text; +@end + +@interface DOMHTMLUListElement : DOMHTMLElement WEBKIT_VERSION_1_3 +@property BOOL compact; +@property(copy) NSString *type; +@end + +@interface DOMStyleSheetList : DOMObject WEBKIT_VERSION_1_3 +@property(readonly) unsigned length; +- (DOMStyleSheet *)item:(unsigned)index; +@end + +@interface DOMCSSCharsetRule : DOMCSSRule WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *encoding; +@end + +@interface DOMCSSFontFaceRule : DOMCSSRule WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMCSSStyleDeclaration *style; +@end + +@interface DOMCSSImportRule : DOMCSSRule WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *href; +@property(readonly, retain) DOMMediaList *media; +@property(readonly, retain) DOMCSSStyleSheet *styleSheet; +@end + +@interface DOMCSSMediaRule : DOMCSSRule WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMMediaList *media; +@property(readonly, retain) DOMCSSRuleList *cssRules; +- (unsigned)insertRule:(NSString *)rule :(unsigned)index; +- (unsigned)insertRule:(NSString *)rule index:(unsigned)index AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)deleteRule:(unsigned)index; +@end + +@interface DOMCSSPageRule : DOMCSSRule WEBKIT_VERSION_1_3 +@property(copy) NSString *selectorText; +@property(readonly, retain) DOMCSSStyleDeclaration *style; +@end + +@interface DOMCSSPrimitiveValue : DOMCSSValue WEBKIT_VERSION_1_3 +@property(readonly) unsigned short primitiveType; +- (void)setFloatValue:(unsigned short)unitType :(float)floatValue; +- (void)setFloatValue:(unsigned short)unitType floatValue:(float)floatValue AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (float)getFloatValue:(unsigned short)unitType; +- (void)setStringValue:(unsigned short)stringType :(NSString *)stringValue; +- (void)setStringValue:(unsigned short)stringType stringValue:(NSString *)stringValue AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (NSString *)getStringValue; +- (DOMCounter *)getCounterValue; +- (DOMRect *)getRectValue; +- (DOMRGBColor *)getRGBColorValue; +@end + +@interface DOMRGBColor : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMCSSPrimitiveValue *red; +@property(readonly, retain) DOMCSSPrimitiveValue *green; +@property(readonly, retain) DOMCSSPrimitiveValue *blue; +@property(readonly, retain) DOMCSSPrimitiveValue *alpha; +@property(readonly, copy) NSColor *color AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMCSSRule : DOMObject WEBKIT_VERSION_1_3 +@property(readonly) unsigned short type; +@property(copy) NSString *cssText; +@property(readonly, retain) DOMCSSStyleSheet *parentStyleSheet; +@property(readonly, retain) DOMCSSRule *parentRule; +@end + +@interface DOMCSSRuleList : DOMObject WEBKIT_VERSION_1_3 +@property(readonly) unsigned length; +- (DOMCSSRule *)item:(unsigned)index; +@end + +@interface DOMCSSStyleDeclaration : DOMObject WEBKIT_VERSION_1_3 +@property(copy) NSString *cssText; +@property(readonly) unsigned length; +@property(readonly, retain) DOMCSSRule *parentRule; +- (NSString *)getPropertyValue:(NSString *)propertyName; +- (DOMCSSValue *)getPropertyCSSValue:(NSString *)propertyName; +- (NSString *)removeProperty:(NSString *)propertyName; +- (NSString *)getPropertyPriority:(NSString *)propertyName; +- (void)setProperty:(NSString *)propertyName :(NSString *)value :(NSString *)priority; +- (void)setProperty:(NSString *)propertyName value:(NSString *)value priority:(NSString *)priority AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (NSString *)item:(unsigned)index; +- (NSString *)getPropertyShorthand:(NSString *)propertyName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)isPropertyImplicit:(NSString *)propertyName AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMCSSStyleRule : DOMCSSRule WEBKIT_VERSION_1_3 +@property(copy) NSString *selectorText; +@property(readonly, retain) DOMCSSStyleDeclaration *style; +@end + +@interface DOMStyleSheet : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *type; +@property BOOL disabled; +@property(readonly, retain) DOMNode *ownerNode; +@property(readonly, retain) DOMStyleSheet *parentStyleSheet; +@property(readonly, copy) NSString *href; +@property(readonly, copy) NSString *title; +@property(readonly, retain) DOMMediaList *media; +@end + +@interface DOMCSSStyleSheet : DOMStyleSheet WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMCSSRule *ownerRule; +@property(readonly, retain) DOMCSSRuleList *cssRules; +@property(readonly, retain) DOMCSSRuleList *rules AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (unsigned)insertRule:(NSString *)rule :(unsigned)index; +- (unsigned)insertRule:(NSString *)rule index:(unsigned)index AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)deleteRule:(unsigned)index; +- (int)addRule:(NSString *)selector style:(NSString *)style index:(unsigned)index AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (void)removeRule:(unsigned)index AVAILABLE_IN_WEBKIT_VERSION_4_0; +@end + +@interface DOMCSSValue : DOMObject WEBKIT_VERSION_1_3 +@property(copy) NSString *cssText; +@property(readonly) unsigned short cssValueType; +@end + +@interface DOMCSSValueList : DOMCSSValue WEBKIT_VERSION_1_3 +@property(readonly) unsigned length; +- (DOMCSSValue *)item:(unsigned)index; +@end + +@interface DOMCSSUnknownRule : DOMCSSRule WEBKIT_VERSION_1_3 +@end + +@interface DOMCounter : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *identifier; +@property(readonly, copy) NSString *listStyle; +@property(readonly, copy) NSString *separator; +@end + +@interface DOMRect : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMCSSPrimitiveValue *top; +@property(readonly, retain) DOMCSSPrimitiveValue *right; +@property(readonly, retain) DOMCSSPrimitiveValue *bottom; +@property(readonly, retain) DOMCSSPrimitiveValue *left; +@end + +@interface DOMEvent : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, copy) NSString *type; +@property(readonly, retain) id <DOMEventTarget> target; +@property(readonly, retain) id <DOMEventTarget> currentTarget; +@property(readonly) unsigned short eventPhase; +@property(readonly) BOOL bubbles; +@property(readonly) BOOL cancelable; +@property(readonly) DOMTimeStamp timeStamp; +@property(readonly, retain) id <DOMEventTarget> srcElement AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property BOOL returnValue AVAILABLE_IN_WEBKIT_VERSION_4_0; +@property BOOL cancelBubble AVAILABLE_IN_WEBKIT_VERSION_4_0; +- (void)stopPropagation; +- (void)preventDefault; +- (void)initEvent:(NSString *)eventTypeArg canBubbleArg:(BOOL)canBubbleArg cancelableArg:(BOOL)cancelableArg AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)initEvent:(NSString *)eventTypeArg :(BOOL)canBubbleArg :(BOOL)cancelableArg; +@end + +@interface DOMUIEvent : DOMEvent WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMAbstractView *view; +@property(readonly) int detail; +@property(readonly) int keyCode AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int charCode AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int layerX AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int layerY AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int pageX AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int pageY AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int which AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)initUIEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view detail:(int)detail AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)initUIEvent:(NSString *)type :(BOOL)canBubble :(BOOL)cancelable :(DOMAbstractView *)view :(int)detail; +@end + +@interface DOMMutationEvent : DOMEvent WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMNode *relatedNode; +@property(readonly, copy) NSString *prevValue; +@property(readonly, copy) NSString *newValue; +@property(readonly, copy) NSString *attrName; +@property(readonly) unsigned short attrChange; +- (void)initMutationEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable relatedNode:(DOMNode *)relatedNode prevValue:(NSString *)prevValue newValue:(NSString *)newValue attrName:(NSString *)attrName attrChange:(unsigned short)attrChange AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)initMutationEvent:(NSString *)type :(BOOL)canBubble :(BOOL)cancelable :(DOMNode *)relatedNode :(NSString *)prevValue :(NSString *)newValue :(NSString *)attrName :(unsigned short)attrChange; +@end + +@interface DOMOverflowEvent : DOMEvent WEBKIT_VERSION_3_0 +@property(readonly) unsigned short orient; +@property(readonly) BOOL horizontalOverflow; +@property(readonly) BOOL verticalOverflow; +- (void)initOverflowEvent:(unsigned short)orient horizontalOverflow:(BOOL)horizontalOverflow verticalOverflow:(BOOL)verticalOverflow; +@end + +@interface DOMWheelEvent : DOMUIEvent WEBKIT_VERSION_3_0 +@property(readonly) int screenX; +@property(readonly) int screenY; +@property(readonly) int clientX; +@property(readonly) int clientY; +@property(readonly) BOOL ctrlKey; +@property(readonly) BOOL shiftKey; +@property(readonly) BOOL altKey; +@property(readonly) BOOL metaKey; +@property(readonly) BOOL isHorizontal; +@property(readonly) int wheelDelta; +@property(readonly) int wheelDeltaX AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int wheelDeltaY AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int offsetX AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int offsetY AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int x AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int y AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)initWheelEvent:(int)wheelDeltaX wheelDeltaY:(int)wheelDeltaY view:(DOMAbstractView *)view screenX:(int)screenX screenY:(int)screenY clientX:(int)clientX clientY:(int)clientY ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMKeyboardEvent : DOMUIEvent WEBKIT_VERSION_3_0 +@property(readonly, copy) NSString *keyIdentifier; +@property(readonly) unsigned keyLocation; +@property(readonly) BOOL ctrlKey; +@property(readonly) BOOL shiftKey; +@property(readonly) BOOL altKey; +@property(readonly) BOOL metaKey; +@property(readonly) int keyCode; +@property(readonly) int charCode; +@property(readonly) BOOL altGraphKey AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)getModifierState:(NSString *)keyIdentifierArg; +- (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)keyIdentifier keyLocation:(unsigned)keyLocation ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey altGraphKey:(BOOL)altGraphKey AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)initKeyboardEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view keyIdentifier:(NSString *)keyIdentifier keyLocation:(unsigned)keyLocation ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMMouseEvent : DOMUIEvent WEBKIT_VERSION_1_3 +@property(readonly) int screenX; +@property(readonly) int screenY; +@property(readonly) int clientX; +@property(readonly) int clientY; +@property(readonly) BOOL ctrlKey; +@property(readonly) BOOL shiftKey; +@property(readonly) BOOL altKey; +@property(readonly) BOOL metaKey; +@property(readonly) unsigned short button; +@property(readonly, retain) id <DOMEventTarget> relatedTarget; +@property(readonly) int offsetX AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int offsetY AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int x AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) int y AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, retain) DOMNode *fromElement AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly, retain) DOMNode *toElement AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)initMouseEvent:(NSString *)type canBubble:(BOOL)canBubble cancelable:(BOOL)cancelable view:(DOMAbstractView *)view detail:(int)detail screenX:(int)screenX screenY:(int)screenY clientX:(int)clientX clientY:(int)clientY ctrlKey:(BOOL)ctrlKey altKey:(BOOL)altKey shiftKey:(BOOL)shiftKey metaKey:(BOOL)metaKey button:(unsigned short)button relatedTarget:(id <DOMEventTarget>)relatedTarget AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)initMouseEvent:(NSString *)type :(BOOL)canBubble :(BOOL)cancelable :(DOMAbstractView *)view :(int)detail :(int)screenX :(int)screenY :(int)clientX :(int)clientY :(BOOL)ctrlKey :(BOOL)altKey :(BOOL)shiftKey :(BOOL)metaKey :(unsigned short)button :(id <DOMEventTarget>)relatedTarget; +@end + +@interface DOMRange : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMNode *startContainer; +@property(readonly) int startOffset; +@property(readonly, retain) DOMNode *endContainer; +@property(readonly) int endOffset; +@property(readonly) BOOL collapsed; +@property(readonly, retain) DOMNode *commonAncestorContainer; +@property(readonly, copy) NSString *text AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)setStart:(DOMNode *)refNode offset:(int)offset AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)setStart:(DOMNode *)refNode :(int)offset; +- (void)setEnd:(DOMNode *)refNode offset:(int)offset AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)setEnd:(DOMNode *)refNode :(int)offset; +- (void)setStartBefore:(DOMNode *)refNode; +- (void)setStartAfter:(DOMNode *)refNode; +- (void)setEndBefore:(DOMNode *)refNode; +- (void)setEndAfter:(DOMNode *)refNode; +- (void)collapse:(BOOL)toStart; +- (void)selectNode:(DOMNode *)refNode; +- (void)selectNodeContents:(DOMNode *)refNode; +- (short)compareBoundaryPoints:(unsigned short)how sourceRange:(DOMRange *)sourceRange AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (short)compareBoundaryPoints:(unsigned short)how :(DOMRange *)sourceRange; +- (void)deleteContents; +- (DOMDocumentFragment *)extractContents; +- (DOMDocumentFragment *)cloneContents; +- (void)insertNode:(DOMNode *)newNode; +- (void)surroundContents:(DOMNode *)newParent; +- (DOMRange *)cloneRange; +- (NSString *)toString; +- (void)detach; +- (DOMDocumentFragment *)createContextualFragment:(NSString *)html AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)intersectsNode:(DOMNode *)refNode AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (short)compareNode:(DOMNode *)refNode AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (short)comparePoint:(DOMNode *)refNode offset:(int)offset AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)isPointInRange:(DOMNode *)refNode offset:(int)offset AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@end + +@interface DOMNodeIterator : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMNode *root; +@property(readonly) unsigned whatToShow; +@property(readonly, retain) id <DOMNodeFilter> filter; +@property(readonly) BOOL expandEntityReferences; +@property(readonly, retain) DOMNode *referenceNode AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +@property(readonly) BOOL pointerBeforeReferenceNode AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMNode *)nextNode; +- (DOMNode *)previousNode; +- (void)detach; +@end + +@interface DOMMediaList : DOMObject WEBKIT_VERSION_1_3 +@property(copy) NSString *mediaText; +@property(readonly) unsigned length; +- (NSString *)item:(unsigned)index; +- (void)deleteMedium:(NSString *)oldMedium; +- (void)appendMedium:(NSString *)newMedium; +@end + +@interface DOMTreeWalker : DOMObject WEBKIT_VERSION_1_3 +@property(readonly, retain) DOMNode *root; +@property(readonly) unsigned whatToShow; +@property(readonly, retain) id <DOMNodeFilter> filter; +@property(readonly) BOOL expandEntityReferences; +@property(retain) DOMNode *currentNode; +- (DOMNode *)parentNode; +- (DOMNode *)firstChild; +- (DOMNode *)lastChild; +- (DOMNode *)previousSibling; +- (DOMNode *)nextSibling; +- (DOMNode *)previousNode; +- (DOMNode *)nextNode; +@end + +@interface DOMXPathResult : DOMObject WEBKIT_VERSION_3_0 +@property(readonly) unsigned short resultType; +@property(readonly) double numberValue; +@property(readonly, copy) NSString *stringValue; +@property(readonly) BOOL booleanValue; +@property(readonly, retain) DOMNode *singleNodeValue; +@property(readonly) BOOL invalidIteratorState; +@property(readonly) unsigned snapshotLength; +- (DOMNode *)iterateNext; +- (DOMNode *)snapshotItem:(unsigned)index; +@end + +@interface DOMXPathExpression : DOMObject WEBKIT_VERSION_3_0 +- (DOMXPathResult *)evaluate:(DOMNode *)contextNode type:(unsigned short)type inResult:(DOMXPathResult *)inResult AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (DOMXPathResult *)evaluate:(DOMNode *)contextNode :(unsigned short)type :(DOMXPathResult *)inResult AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER_BUT_DEPRECATED; +@end + +// Protocols + +@protocol DOMEventListener <NSObject> WEBKIT_VERSION_1_3 +- (void)handleEvent:(DOMEvent *)evt; +@end + +@protocol DOMEventTarget <NSObject, NSCopying> WEBKIT_VERSION_1_3 +- (void)addEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture; +- (void)removeEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture; +- (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (void)removeEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER; +- (BOOL)dispatchEvent:(DOMEvent *)event; +@end + +@protocol DOMNodeFilter <NSObject> WEBKIT_VERSION_1_3 +- (short)acceptNode:(DOMNode *)n; +@end + +@protocol DOMXPathNSResolver <NSObject> WEBKIT_VERSION_3_0 +- (NSString *)lookupNamespaceURI:(NSString *)prefix; +@end diff --git a/Source/WebCore/bindings/objc/WebScriptObject.h b/Source/WebCore/bindings/objc/WebScriptObject.h new file mode 100644 index 0000000..f75f458 --- /dev/null +++ b/Source/WebCore/bindings/objc/WebScriptObject.h @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> +#import <JavaScriptCore/JSBase.h> +#import <JavaScriptCore/WebKitAvailability.h> + +#if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_1_3 + +// NSObject (WebScripting) ----------------------------------------------------- + +/* + Classes may implement one or more methods in WebScripting to export interfaces + to WebKit's JavaScript environment. + + By default, no properties or functions are exported. A class must implement + +isKeyExcludedFromWebScript: and/or +isSelectorExcludedFromWebScript: to + expose selected properties and methods, respectively, to JavaScript. + + Access to exported properties is done using KVC -- specifically, the following + KVC methods: + + - (void)setValue:(id)value forKey:(NSString *)key + - (id)valueForKey:(NSString *)key + + Clients may also intercept property set/get operations that are made by the + scripting environment for properties that are not exported. This is done using + the KVC methods: + + - (void)setValue:(id)value forUndefinedKey:(NSString *)key + - (id)valueForUndefinedKey:(NSString *)key + + Similarly, clients may intercept method invocations that are made by the + scripting environment for methods that are not exported. This is done using + the method: + + - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args; + + If clients need to raise an exception in the script environment + they can call [WebScriptObject throwException:]. Note that throwing an + exception using this method will only succeed if the method that throws the exception + is being called within the scope of a script invocation. + + Not all methods are exposed. Only those methods whose parameters and return + type meets the export criteria are exposed. Valid types are Objective-C instances + and scalars. Other types are not allowed. + + Types will be converted automatically between JavaScript and Objective-C in + the following manner: + + JavaScript ObjC + ---------- ---------- + null => nil + undefined => WebUndefined + number => NSNumber + boolean => CFBoolean + string => NSString + object => id + + The object => id conversion occurs as follows: if the object wraps an underlying + Objective-C object (i.e., if it was created by a previous ObjC => JavaScript conversion), + then the underlying Objective-C object is returned. Otherwise, a new WebScriptObject + is created and returned. + + The above conversions occur only if the declared ObjC type is an object type. + For primitive types like int and char, a numeric cast is performed. + + ObjC JavaScript + ---- ---------- + NSNull => null + nil => undefined + WebUndefined => undefined + CFBoolean => boolean + NSNumber => number + NSString => string + NSArray => array object + WebScriptObject => object + + The above conversions occur only if the declared ObjC type is an object type. + For primitive type like int and char, a numeric cast is performed. +*/ +@interface NSObject (WebScripting) + +/*! + @method webScriptNameForSelector: + @param selector The selector that will be exposed to the script environment. + @discussion Use the returned string as the exported name for the selector + in the script environment. It is the responsibility of the class to ensure + uniqueness of the returned name. If nil is returned or this + method is not implemented the default name for the selector will + be used. The default name concatenates the components of the + Objective-C selector name and replaces ':' with '_'. '_' characters + are escaped with an additional '$', i.e. '_' becomes "$_". '$' are + also escaped, i.e. + Objective-C name Default script name + moveTo:: move__ + moveTo_ moveTo$_ + moveTo$_ moveTo$$$_ + @result Returns the name to be used to represent the specified selector in the + scripting environment. +*/ ++ (NSString *)webScriptNameForSelector:(SEL)selector; + +/*! + @method isSelectorExcludedFromWebScript: + @param selector The selector the will be exposed to the script environment. + @discussion Return NO to export the selector to the script environment. + Return YES to prevent the selector from being exported to the script environment. + If this method is not implemented on the class no selectors will be exported. + @result Returns YES to hide the selector, NO to export the selector. +*/ ++ (BOOL)isSelectorExcludedFromWebScript:(SEL)selector; + +/*! + @method webScriptNameForKey: + @param name The name of the instance variable that will be exposed to the + script environment. Only instance variables that meet the export criteria will + be exposed. + @discussion Provide an alternate name for a property. + @result Returns the name to be used to represent the specified property in the + scripting environment. +*/ ++ (NSString *)webScriptNameForKey:(const char *)name; + +/*! + @method isKeyExcludedFromWebScript: + @param name The name of the instance variable that will be exposed to the + script environment. + @discussion Return NO to export the property to the script environment. + Return YES to prevent the property from being exported to the script environment. + @result Returns YES to hide the property, NO to export the property. +*/ ++ (BOOL)isKeyExcludedFromWebScript:(const char *)name; + +/*! + @method invokeUndefinedMethodFromWebScript:withArguments: + @param name The name of the method to invoke. + @param arguments The arguments to pass the method. + @discussion If a script attempts to invoke a method that is not exported, + invokeUndefinedMethodFromWebScript:withArguments: will be called. + @result The return value of the invocation. The value will be converted as appropriate + for the script environment. +*/ +- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)arguments; + +/*! + @method invokeDefaultMethodWithArguments: + @param arguments The arguments to pass the method. + @discussion If a script attempts to call an exposed object as a function, + this method will be called. + @result The return value of the call. The value will be converted as appropriate + for the script environment. +*/ +- (id)invokeDefaultMethodWithArguments:(NSArray *)arguments; + +/*! + @method finalizeForWebScript + @discussion finalizeForScript is called on objects exposed to the script + environment just before the script environment garbage collects the object. + Subsequently, any references to WebScriptObjects made by the exposed object will + be invalid and have undefined consequences. +*/ +- (void)finalizeForWebScript; + +@end + + +// WebScriptObject -------------------------------------------------- + +@class WebScriptObjectPrivate; +@class WebFrame; + +/*! + @class WebScriptObject + @discussion WebScriptObjects are used to wrap script objects passed from + script environments to Objective-C. WebScriptObjects cannot be created + directly. In normal uses of WebKit, you gain access to the script + environment using the "windowScriptObject" method on WebView. + + The following KVC methods are commonly used to access properties of the + WebScriptObject: + + - (void)setValue:(id)value forKey:(NSString *)key + - (id)valueForKey:(NSString *)key + + As it possible to remove attributes from web script objects, the following + additional method augments the basic KVC methods: + + - (void)removeWebScriptKey:(NSString *)name; + + Also, since the sparse array access allowed in script objects doesn't map well + to NSArray, the following methods can be used to access index based properties: + + - (id)webScriptValueAtIndex:(unsigned)index; + - (void)setWebScriptValueAtIndex:(unsigned)index value:(id)value; +*/ +@interface WebScriptObject : NSObject +{ + WebScriptObjectPrivate *_private; +} + +/*! + @method throwException: + @discussion Throws an exception in the current script execution context. + @result Either NO if an exception could not be raised, YES otherwise. +*/ ++ (BOOL)throwException:(NSString *)exceptionMessage; + +/*! + @method JSObject + @result The equivalent JSObjectRef for this WebScriptObject. + @discussion Use this method to bridge between the WebScriptObject and + JavaScriptCore APIs. +*/ +- (JSObjectRef)JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER); + +/*! + @method callWebScriptMethod:withArguments: + @param name The name of the method to call in the script environment. + @param arguments The arguments to pass to the script environment. + @discussion Calls the specified method in the script environment using the + specified arguments. + @result Returns the result of calling the script method. + Returns WebUndefined when an exception is thrown in the script environment. +*/ +- (id)callWebScriptMethod:(NSString *)name withArguments:(NSArray *)arguments; + +/*! + @method evaluateWebScript: + @param script The script to execute in the target script environment. + @discussion The script will be executed in the target script environment. The format + of the script is dependent of the target script environment. + @result Returns the result of evaluating the script in the script environment. + Returns WebUndefined when an exception is thrown in the script environment. +*/ +- (id)evaluateWebScript:(NSString *)script; + +/*! + @method removeWebScriptKey: + @param name The name of the property to remove. + @discussion Removes the property from the object in the script environment. +*/ +- (void)removeWebScriptKey:(NSString *)name; + +/*! + @method stringRepresentation + @discussion Converts the target object to a string representation. The coercion + of non string objects type is dependent on the script environment. + @result Returns the string representation of the object. +*/ +- (NSString *)stringRepresentation; + +/*! + @method webScriptValueAtIndex: + @param index The index of the property to return. + @discussion Gets the value of the property at the specified index. + @result The value of the property. Returns WebUndefined when an exception is + thrown in the script environment. +*/ +- (id)webScriptValueAtIndex:(unsigned)index; + +/*! + @method setWebScriptValueAtIndex:value: + @param index The index of the property to set. + @param value The value of the property to set. + @discussion Sets the property value at the specified index. +*/ +- (void)setWebScriptValueAtIndex:(unsigned)index value:(id)value; + +/*! + @method setException: + @param description The description of the exception. + @discussion Raises an exception in the script environment in the context of the + current object. +*/ +- (void)setException:(NSString *)description; + +@end + + +// WebUndefined -------------------------------------------------------------- + +/*! + @class WebUndefined +*/ +@interface WebUndefined : NSObject <NSCoding, NSCopying> + +/*! + @method undefined + @result The WebUndefined shared instance. +*/ ++ (WebUndefined *)undefined; + +@end + +#endif diff --git a/Source/WebCore/bindings/objc/WebScriptObject.mm b/Source/WebCore/bindings/objc/WebScriptObject.mm new file mode 100644 index 0000000..6bf7afe --- /dev/null +++ b/Source/WebCore/bindings/objc/WebScriptObject.mm @@ -0,0 +1,678 @@ +/* + * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" +#import "WebScriptObjectPrivate.h" + +#import "Bridge.h" +#import "Console.h" +#import "DOMInternal.h" +#import "DOMWindow.h" +#import "Frame.h" +#import "JSDOMWindow.h" +#import "JSDOMWindowCustom.h" +#import "JSHTMLElement.h" +#import "JSMainThreadExecState.h" +#import "JSPluginElementFunctions.h" +#import "ObjCRuntimeObject.h" +#import "PlatformString.h" +#import "StringSourceProvider.h" +#import "WebCoreObjCExtras.h" +#import "objc_instance.h" +#import "runtime_object.h" +#import "runtime_root.h" +#import <JavaScriptCore/APICast.h> +#import <interpreter/CallFrame.h> +#import <runtime/InitializeThreading.h> +#import <runtime/JSGlobalObject.h> +#import <runtime/JSLock.h> +#import <runtime/Completion.h> +#import <runtime/Completion.h> +#import <wtf/Threading.h> + +#ifdef BUILDING_ON_TIGER +typedef unsigned NSUInteger; +#endif + +using namespace JSC; +using namespace JSC::Bindings; +using namespace WebCore; + +namespace WebCore { + +static NSMapTable* JSWrapperCache; + +NSObject* getJSWrapper(JSObject* impl) +{ + if (!JSWrapperCache) + return nil; + return static_cast<NSObject*>(NSMapGet(JSWrapperCache, impl)); +} + +void addJSWrapper(NSObject* wrapper, JSObject* impl) +{ + if (!JSWrapperCache) + JSWrapperCache = createWrapperCache(); + NSMapInsert(JSWrapperCache, impl, wrapper); +} + +void removeJSWrapper(JSObject* impl) +{ + if (!JSWrapperCache) + return; + NSMapRemove(JSWrapperCache, impl); +} + +id createJSWrapper(JSC::JSObject* object, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> root) +{ + if (id wrapper = getJSWrapper(object)) + return [[wrapper retain] autorelease]; + return [[[WebScriptObject alloc] _initWithJSObject:object originRootObject:origin rootObject:root] autorelease]; +} + +static void addExceptionToConsole(ExecState* exec) +{ + JSDOMWindow* window = asJSDOMWindow(exec->dynamicGlobalObject()); + if (!window || !exec->hadException()) + return; + reportCurrentException(exec); +} + +} // namespace WebCore + +@implementation WebScriptObjectPrivate + +@end + +@implementation WebScriptObject + ++ (void)initialize +{ + JSC::initializeThreading(); + WTF::initializeMainThreadToProcessMainThread(); +#ifndef BUILDING_ON_TIGER + WebCoreObjCFinalizeOnMainThread(self); +#endif +} + ++ (id)scriptObjectForJSObject:(JSObjectRef)jsObject originRootObject:(RootObject*)originRootObject rootObject:(RootObject*)rootObject +{ + if (id domWrapper = createDOMWrapper(toJS(jsObject), originRootObject, rootObject)) + return domWrapper; + + return WebCore::createJSWrapper(toJS(jsObject), originRootObject, rootObject); +} + +static void _didExecute(WebScriptObject *obj) +{ + ASSERT(JSLock::lockCount() > 0); + + RootObject* root = [obj _rootObject]; + if (!root) + return; + + ExecState* exec = root->globalObject()->globalExec(); + KJSDidExecuteFunctionPtr func = Instance::didExecuteFunction(); + if (func) + func(exec, root->globalObject()); +} + +- (void)_setImp:(JSObject*)imp originRootObject:(PassRefPtr<RootObject>)originRootObject rootObject:(PassRefPtr<RootObject>)rootObject +{ + // This function should only be called once, as a (possibly lazy) initializer. + ASSERT(!_private->imp); + ASSERT(!_private->rootObject); + ASSERT(!_private->originRootObject); + ASSERT(imp); + + _private->imp = imp; + _private->rootObject = rootObject.releaseRef(); + _private->originRootObject = originRootObject.releaseRef(); + + WebCore::addJSWrapper(self, imp); + + if (_private->rootObject) + _private->rootObject->gcProtect(imp); +} + +- (void)_setOriginRootObject:(PassRefPtr<RootObject>)originRootObject andRootObject:(PassRefPtr<RootObject>)rootObject +{ + ASSERT(_private->imp); + + if (rootObject) + rootObject->gcProtect(_private->imp); + + if (_private->rootObject && _private->rootObject->isValid()) + _private->rootObject->gcUnprotect(_private->imp); + + if (_private->rootObject) + _private->rootObject->deref(); + + if (_private->originRootObject) + _private->originRootObject->deref(); + + _private->rootObject = rootObject.releaseRef(); + _private->originRootObject = originRootObject.releaseRef(); +} + +- (id)_initWithJSObject:(JSC::JSObject*)imp originRootObject:(PassRefPtr<JSC::Bindings::RootObject>)originRootObject rootObject:(PassRefPtr<JSC::Bindings::RootObject>)rootObject +{ + ASSERT(imp); + + self = [super init]; + _private = [[WebScriptObjectPrivate alloc] init]; + [self _setImp:imp originRootObject:originRootObject rootObject:rootObject]; + + return self; +} + +- (JSObject*)_imp +{ + // Associate the WebScriptObject with the JS wrapper for the ObjC DOM wrapper. + // This is done on lazily, on demand. + if (!_private->imp && _private->isCreatedByDOMWrapper) + [self _initializeScriptDOMNodeImp]; + return [self _rootObject] ? _private->imp : 0; +} + +- (BOOL)_hasImp +{ + return _private->imp != nil; +} + +// Node that DOMNode overrides this method. So you should almost always +// use this method call instead of _private->rootObject directly. +- (RootObject*)_rootObject +{ + return _private->rootObject && _private->rootObject->isValid() ? _private->rootObject : 0; +} + +- (RootObject *)_originRootObject +{ + return _private->originRootObject && _private->originRootObject->isValid() ? _private->originRootObject : 0; +} + +- (BOOL)_isSafeScript +{ + RootObject *root = [self _rootObject]; + if (!root) + return false; + + if (!_private->originRootObject) + return true; + + if (!_private->originRootObject->isValid()) + return false; + + return root->globalObject()->allowsAccessFrom(_private->originRootObject->globalObject()); +} + +- (void)dealloc +{ + if (WebCoreObjCScheduleDeallocateOnMainThread([WebScriptObject class], self)) + return; + + if (_private->imp) + WebCore::removeJSWrapper(_private->imp); + + if (_private->rootObject && _private->rootObject->isValid()) + _private->rootObject->gcUnprotect(_private->imp); + + if (_private->rootObject) + _private->rootObject->deref(); + + if (_private->originRootObject) + _private->originRootObject->deref(); + + [_private release]; + + [super dealloc]; +} + +- (void)finalize +{ + if (_private->rootObject && _private->rootObject->isValid()) + _private->rootObject->gcUnprotect(_private->imp); + + if (_private->rootObject) + _private->rootObject->deref(); + + if (_private->originRootObject) + _private->originRootObject->deref(); + + [super finalize]; +} + ++ (BOOL)throwException:(NSString *)exceptionMessage +{ + ObjcInstance::setGlobalException(exceptionMessage); + return YES; +} + +static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* rootObject, MarkedArgumentBuffer& aList) +{ + int i, numObjects = array ? [array count] : 0; + + for (i = 0; i < numObjects; i++) { + id anObject = [array objectAtIndex:i]; + aList.append(convertObjcValueToValue(exec, &anObject, ObjcObjectType, rootObject)); + } +} + +- (id)callWebScriptMethod:(NSString *)name withArguments:(NSArray *)args +{ + if (![self _isSafeScript]) + return nil; + + JSLock lock(SilenceAssertionsOnly); + + // Look up the function object. + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + ASSERT(!exec->hadException()); + + JSValue function = [self _imp]->get(exec, Identifier(exec, stringToUString(String(name)))); + CallData callData; + CallType callType = getCallData(function, callData); + if (callType == CallTypeNone) + return nil; + + MarkedArgumentBuffer argList; + getListFromNSArray(exec, args, [self _rootObject], argList); + + if (![self _isSafeScript]) + return nil; + + [self _rootObject]->globalObject()->globalData().timeoutChecker.start(); + JSValue result = JSMainThreadExecState::call(exec, function, callType, callData, [self _imp], argList); + [self _rootObject]->globalObject()->globalData().timeoutChecker.stop(); + + if (exec->hadException()) { + addExceptionToConsole(exec); + result = jsUndefined(); + exec->clearException(); + } + + // Convert and return the result of the function call. + id resultObj = [WebScriptObject _convertValueToObjcValue:result originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; + + _didExecute(self); + + return resultObj; +} + +- (id)evaluateWebScript:(NSString *)script +{ + if (![self _isSafeScript]) + return nil; + + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + ASSERT(!exec->hadException()); + + JSValue result; + JSLock lock(SilenceAssertionsOnly); + + [self _rootObject]->globalObject()->globalData().timeoutChecker.start(); + Completion completion = JSMainThreadExecState::evaluate([self _rootObject]->globalObject()->globalExec(), [self _rootObject]->globalObject()->globalScopeChain(), makeSource(String(script)), JSC::JSValue()); + [self _rootObject]->globalObject()->globalData().timeoutChecker.stop(); + ComplType type = completion.complType(); + + if (type == Normal) { + result = completion.value(); + if (!result) + result = jsUndefined(); + } else + result = jsUndefined(); + + if (exec->hadException()) { + addExceptionToConsole(exec); + result = jsUndefined(); + exec->clearException(); + } + + id resultObj = [WebScriptObject _convertValueToObjcValue:result originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; + + _didExecute(self); + + return resultObj; +} + +- (void)setValue:(id)value forKey:(NSString *)key +{ + if (![self _isSafeScript]) + return; + + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + ASSERT(!exec->hadException()); + + JSLock lock(SilenceAssertionsOnly); + + PutPropertySlot slot; + [self _imp]->put(exec, Identifier(exec, stringToUString(String(key))), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), slot); + + if (exec->hadException()) { + addExceptionToConsole(exec); + exec->clearException(); + } + + _didExecute(self); +} + +- (id)valueForKey:(NSString *)key +{ + if (![self _isSafeScript]) + return nil; + + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + ASSERT(!exec->hadException()); + + id resultObj; + { + // Need to scope this lock to ensure that we release the lock before calling + // [super valueForKey:key] which might throw an exception and bypass the JSLock destructor, + // leaving the lock permanently held + JSLock lock(SilenceAssertionsOnly); + + JSValue result = [self _imp]->get(exec, Identifier(exec, stringToUString(String(key)))); + + if (exec->hadException()) { + addExceptionToConsole(exec); + result = jsUndefined(); + exec->clearException(); + } + + resultObj = [WebScriptObject _convertValueToObjcValue:result originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; + } + + if ([resultObj isKindOfClass:[WebUndefined class]]) + resultObj = [super valueForKey:key]; // defaults to throwing an exception + + JSLock lock(SilenceAssertionsOnly); + _didExecute(self); + + return resultObj; +} + +- (void)removeWebScriptKey:(NSString *)key +{ + if (![self _isSafeScript]) + return; + + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + ASSERT(!exec->hadException()); + + JSLock lock(SilenceAssertionsOnly); + [self _imp]->deleteProperty(exec, Identifier(exec, stringToUString(String(key)))); + + if (exec->hadException()) { + addExceptionToConsole(exec); + exec->clearException(); + } + + _didExecute(self); +} + +- (BOOL)hasWebScriptKey:(NSString *)key +{ + if (![self _isSafeScript]) + return NO; + + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + ASSERT(!exec->hadException()); + + JSLock lock(SilenceAssertionsOnly); + BOOL result = [self _imp]->hasProperty(exec, Identifier(exec, stringToUString(String(key)))); + + if (exec->hadException()) { + addExceptionToConsole(exec); + exec->clearException(); + } + + _didExecute(self); + + return result; +} + +- (NSString *)stringRepresentation +{ + if (![self _isSafeScript]) { + // This is a workaround for a gcc 3.3 internal compiler error. + return @"Undefined"; + } + + JSLock lock(SilenceAssertionsOnly); + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + + id result = convertValueToObjcValue(exec, [self _imp], ObjcObjectType).objectValue; + + NSString *description = [result description]; + + _didExecute(self); + + return description; +} + +- (id)webScriptValueAtIndex:(unsigned)index +{ + if (![self _isSafeScript]) + return nil; + + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + ASSERT(!exec->hadException()); + + JSLock lock(SilenceAssertionsOnly); + JSValue result = [self _imp]->get(exec, index); + + if (exec->hadException()) { + addExceptionToConsole(exec); + result = jsUndefined(); + exec->clearException(); + } + + id resultObj = [WebScriptObject _convertValueToObjcValue:result originRootObject:[self _originRootObject] rootObject:[self _rootObject]]; + + _didExecute(self); + + return resultObj; +} + +- (void)setWebScriptValueAtIndex:(unsigned)index value:(id)value +{ + if (![self _isSafeScript]) + return; + + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + ASSERT(!exec->hadException()); + + JSLock lock(SilenceAssertionsOnly); + [self _imp]->put(exec, index, convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject])); + + if (exec->hadException()) { + addExceptionToConsole(exec); + exec->clearException(); + } + + _didExecute(self); +} + +- (void)setException:(NSString *)description +{ + if (![self _rootObject]) + return; + ObjcInstance::setGlobalException(description, [self _rootObject]->globalObject()); +} + +- (JSObjectRef)JSObject +{ + if (![self _isSafeScript]) + return NULL; + + return toRef([self _imp]); +} + ++ (id)_convertValueToObjcValue:(JSValue)value originRootObject:(RootObject*)originRootObject rootObject:(RootObject*)rootObject +{ + if (value.isObject()) { + JSObject* object = asObject(value); + JSLock lock(SilenceAssertionsOnly); + + if (object->inherits(&JSHTMLElement::s_info)) { + // Plugin elements cache the instance internally. + HTMLElement* el = static_cast<JSHTMLElement*>(object)->impl(); + ObjcInstance* instance = static_cast<ObjcInstance*>(pluginInstance(el)); + if (instance) + return instance->getObject(); + } else if (object->inherits(&ObjCRuntimeObject::s_info)) { + ObjCRuntimeObject* runtimeObject = static_cast<ObjCRuntimeObject*>(object); + ObjcInstance* instance = runtimeObject->getInternalObjCInstance(); + if (instance) + return instance->getObject(); + return nil; + } + + return [WebScriptObject scriptObjectForJSObject:toRef(object) originRootObject:originRootObject rootObject:rootObject]; + } + + if (value.isString()) { + ExecState* exec = rootObject->globalObject()->globalExec(); + const UString& u = asString(value)->value(exec); + return [NSString stringWithCharacters:u.characters() length:u.length()]; + } + + if (value.isNumber()) + return [NSNumber numberWithDouble:value.uncheckedGetNumber()]; + + if (value.isBoolean()) + return [NSNumber numberWithBool:value.getBoolean()]; + + if (value.isUndefined()) + return [WebUndefined undefined]; + + // jsNull is not returned as NSNull because existing applications do not expect + // that return value. Return as nil for compatibility. <rdar://problem/4651318> <rdar://problem/4701626> + // Other types (e.g., UnspecifiedType) also return as nil. + return nil; +} + +@end + +@interface WebScriptObject (WebKitCocoaBindings) + +- (id)objectAtIndex:(unsigned)index; + +@end + +@implementation WebScriptObject (WebKitCocoaBindings) + +#if 0 + +// FIXME: We'd like to add this, but we can't do that until this issue is resolved: +// http://bugs.webkit.org/show_bug.cgi?id=13129: presence of 'count' method on +// WebScriptObject breaks Democracy player. + +- (unsigned)count +{ + id length = [self valueForKey:@"length"]; + if (![length respondsToSelector:@selector(intValue)]) + return 0; + return [length intValue]; +} + +#endif + +- (id)objectAtIndex:(unsigned)index +{ + return [self webScriptValueAtIndex:index]; +} + +@end + +@implementation WebUndefined + ++ (id)allocWithZone:(NSZone *)unusedZone +{ + UNUSED_PARAM(unusedZone); + + static WebUndefined *sharedUndefined = 0; + if (!sharedUndefined) + sharedUndefined = [super allocWithZone:NULL]; + return sharedUndefined; +} + +- (NSString *)description +{ + return @"undefined"; +} + +- (id)initWithCoder:(NSCoder *)unusedCoder +{ + UNUSED_PARAM(unusedCoder); + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)unusedCoder +{ + UNUSED_PARAM(unusedCoder); +} + +- (id)copyWithZone:(NSZone *)unusedZone +{ + UNUSED_PARAM(unusedZone); + + return self; +} + +- (id)retain +{ + return self; +} + +- (void)release +{ +} + +- (NSUInteger)retainCount +{ + return UINT_MAX; +} + +- (id)autorelease +{ + return self; +} + +- (void)dealloc +{ + ASSERT(false); + return; + [super dealloc]; // make -Wdealloc-check happy +} + ++ (WebUndefined *)undefined +{ + return [WebUndefined allocWithZone:NULL]; +} + +@end diff --git a/Source/WebCore/bindings/objc/WebScriptObjectPrivate.h b/Source/WebCore/bindings/objc/WebScriptObjectPrivate.h new file mode 100644 index 0000000..5da1dde --- /dev/null +++ b/Source/WebCore/bindings/objc/WebScriptObjectPrivate.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _WEB_SCRIPT_OBJECT_PRIVATE_H_ +#define _WEB_SCRIPT_OBJECT_PRIVATE_H_ + +#import "WebScriptObject.h" +#import <runtime/JSValue.h> +#import <wtf/PassRefPtr.h> + +namespace JSC { + + class JSObject; + + namespace Bindings { + class RootObject; + } +} +namespace WebCore { + NSObject* getJSWrapper(JSC::JSObject*); + void addJSWrapper(NSObject* wrapper, JSC::JSObject*); + void removeJSWrapper(JSC::JSObject*); + id createJSWrapper(JSC::JSObject*, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> root); +} + +@interface WebScriptObject (Private) ++ (id)_convertValueToObjcValue:(JSC::JSValue)value originRootObject:(JSC::Bindings::RootObject*)originRootObject rootObject:(JSC::Bindings::RootObject*)rootObject; ++ (id)scriptObjectForJSObject:(JSObjectRef)jsObject originRootObject:(JSC::Bindings::RootObject*)originRootObject rootObject:(JSC::Bindings::RootObject*)rootObject; +- (id)_init; +- (id)_initWithJSObject:(JSC::JSObject*)imp originRootObject:(PassRefPtr<JSC::Bindings::RootObject>)originRootObject rootObject:(PassRefPtr<JSC::Bindings::RootObject>)rootObject; +- (void)_setImp:(JSC::JSObject*)imp originRootObject:(PassRefPtr<JSC::Bindings::RootObject>)originRootObject rootObject:(PassRefPtr<JSC::Bindings::RootObject>)rootObject; +- (void)_setOriginRootObject:(PassRefPtr<JSC::Bindings::RootObject>)originRootObject andRootObject:(PassRefPtr<JSC::Bindings::RootObject>)rootObject; +- (void)_initializeScriptDOMNodeImp; +- (JSC::JSObject *)_imp; +- (BOOL)_hasImp; +- (JSC::Bindings::RootObject*)_rootObject; +- (JSC::Bindings::RootObject*)_originRootObject; +@end + +@interface WebScriptObject (StagedForPublic) +/*! + @method hasWebScriptKey: + @param name The name of the property to check for. + @discussion Checks for the existence of the property on the object in the script environment. + @result Returns YES if the property exists, NO otherwise. + */ +- (BOOL)hasWebScriptKey:(NSString *)name; +@end + +@interface WebScriptObjectPrivate : NSObject +{ +@public + JSC::JSObject *imp; + JSC::Bindings::RootObject* rootObject; + JSC::Bindings::RootObject* originRootObject; + BOOL isCreatedByDOMWrapper; +} +@end + + +#endif |