Commit 460f0156 authored by weinig's avatar weinig
Browse files

Reviewed by Tim H.

        Patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=11038
        Auto-generate DOMSVGElement for the Objective-C bindings

        - Auto-generates DOMSVGElement.

        - Make SVGExceptions work like all the other ExceptionCode
          extensions (Range, XPath, etc.) by adding SVGExceptionOffset
          and SVGExceptionMax.

        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/kjs_binding.cpp:
        (KJS::):
        (KJS::setDOMException):
        * bindings/objc/DOMInternal.h:
        * bindings/objc/DOMInternal.mm:
        (raiseDOMException):
        * bindings/objc/DOMSVG.h:
        * bindings/objc/DOMSVGExecption.h: Added.
        * ksvg2/ksvg.h:
        * ksvg2/svg/SVGElement.cpp:
        (WebCore::SVGElement::setId):
        (WebCore::SVGElement::setXmlbase):
        * ksvg2/svg/SVGElement.h:
        * ksvg2/svg/SVGElement.idl:
        * ksvg2/svg/SVGException.h: Added.
        (WebCore::):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3e0a19d2
2006-09-26 Sam Weinig <sam.weinig@gmail.com>
Reviewed by Tim H.
Patch for http://bugzilla.opendarwin.org/show_bug.cgi?id=11038
Auto-generate DOMSVGElement for the Objective-C bindings
- Auto-generates DOMSVGElement.
- Make SVGExceptions work like all the other ExceptionCode
extensions (Range, XPath, etc.) by adding SVGExceptionOffset
and SVGExceptionMax.
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/kjs_binding.cpp:
(KJS::):
(KJS::setDOMException):
* bindings/objc/DOMInternal.h:
* bindings/objc/DOMInternal.mm:
(raiseDOMException):
* bindings/objc/DOMSVG.h:
* bindings/objc/DOMSVGExecption.h: Added.
* ksvg2/ksvg.h:
* ksvg2/svg/SVGElement.cpp:
(WebCore::SVGElement::setId):
(WebCore::SVGElement::setXmlbase):
* ksvg2/svg/SVGElement.h:
* ksvg2/svg/SVGElement.idl:
* ksvg2/svg/SVGException.h: Added.
(WebCore::):
2006-09-26 Eric Seidel <eric@eseidel.com>
 
Reviewed by Tim H.
......@@ -139,6 +139,7 @@ all : \
DOMStyleSheet.h \
DOMStyleSheetList.h \
DOMSVGAngle.h \
DOMSVGElement.h \
DOMSVGLength.h \
DOMSVGLengthList.h \
DOMSVGMatrix.h \
......
......@@ -495,6 +495,11 @@
8541639C0AC718680001E01B /* DOMSVGLengthListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 854163940AC718680001E01B /* DOMSVGLengthListInternal.h */; };
8541639D0AC718680001E01B /* DOMSVGLengthInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 854163950AC718680001E01B /* DOMSVGLengthInternal.h */; };
8541639E0AC718680001E01B /* DOMSVGAngleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 854163960AC718680001E01B /* DOMSVGAngleInternal.h */; };
854949120AC858D8008AB035 /* DOMSVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 854949100AC858D8008AB035 /* DOMSVGElement.h */; };
854949130AC858D8008AB035 /* DOMSVGElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 854949110AC858D8008AB035 /* DOMSVGElement.mm */; };
854949170AC85950008AB035 /* DOMSVGElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 854949160AC85950008AB035 /* DOMSVGElementInternal.h */; };
8549492F0AC85A32008AB035 /* DOMSVGExecption.h in Headers */ = {isa = PBXBuildFile; fileRef = 8549492E0AC85A32008AB035 /* DOMSVGExecption.h */; };
854949690AC87613008AB035 /* SVGException.h in Headers */ = {isa = PBXBuildFile; fileRef = 854949680AC87613008AB035 /* SVGException.h */; };
854FE7300A2297BE0058D7AD /* NodeFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 854FE7260A2297BE0058D7AD /* NodeFilter.cpp */; };
854FE7310A2297BE0058D7AD /* NodeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 854FE7270A2297BE0058D7AD /* NodeFilter.h */; };
854FE7320A2297BE0058D7AD /* NodeFilterCondition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 854FE7280A2297BE0058D7AD /* NodeFilterCondition.cpp */; };
......@@ -2970,6 +2975,11 @@
854163940AC718680001E01B /* DOMSVGLengthListInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGLengthListInternal.h; sourceTree = "<group>"; };
854163950AC718680001E01B /* DOMSVGLengthInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGLengthInternal.h; sourceTree = "<group>"; };
854163960AC718680001E01B /* DOMSVGAngleInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGAngleInternal.h; sourceTree = "<group>"; };
854949100AC858D8008AB035 /* DOMSVGElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGElement.h; sourceTree = "<group>"; };
854949110AC858D8008AB035 /* DOMSVGElement.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMSVGElement.mm; sourceTree = "<group>"; };
854949160AC85950008AB035 /* DOMSVGElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGElementInternal.h; sourceTree = "<group>"; };
8549492E0AC85A32008AB035 /* DOMSVGExecption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGExecption.h; sourceTree = "<group>"; };
854949680AC87613008AB035 /* SVGException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGException.h; sourceTree = "<group>"; };
854FE7260A2297BE0058D7AD /* NodeFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = NodeFilter.cpp; sourceTree = "<group>"; };
854FE7270A2297BE0058D7AD /* NodeFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NodeFilter.h; sourceTree = "<group>"; };
854FE7280A2297BE0058D7AD /* NodeFilterCondition.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = NodeFilterCondition.cpp; sourceTree = "<group>"; };
......@@ -5645,6 +5655,14 @@
name = Range;
sourceTree = "<group>";
};
8549492D0AC85A0A008AB035 /* SVG */ = {
isa = PBXGroup;
children = (
8549492E0AC85A32008AB035 /* DOMSVGExecption.h */,
);
name = SVG;
sourceTree = "<group>";
};
854F12AC0A8EBC18000940B5 /* Core */ = {
isa = PBXGroup;
children = (
......@@ -5796,6 +5814,8 @@
children = (
854163690AC7180B0001E01B /* DOMSVGAngle.h */,
854163680AC7180B0001E01B /* DOMSVGAngle.mm */,
854949100AC858D8008AB035 /* DOMSVGElement.h */,
854949110AC858D8008AB035 /* DOMSVGElement.mm */,
854163670AC7180B0001E01B /* DOMSVGLength.h */,
854163660AC7180B0001E01B /* DOMSVGLength.mm */,
854163650AC7180B0001E01B /* DOMSVGLengthList.h */,
......@@ -6073,6 +6093,7 @@
85E711870AC5D5350053270F /* DOMRectInternal.h */,
85E711880AC5D5350053270F /* DOMStyleSheetListInternal.h */,
854163960AC718680001E01B /* DOMSVGAngleInternal.h */,
854949160AC85950008AB035 /* DOMSVGElementInternal.h */,
854163950AC718680001E01B /* DOMSVGLengthInternal.h */,
854163940AC718680001E01B /* DOMSVGLengthListInternal.h */,
854163930AC718680001E01B /* DOMSVGMatrixInternal.h */,
......@@ -6899,6 +6920,7 @@
A8C0F8EA089701F400BA5114 /* SVGViewElement.h */,
A8C0F8EB089701F400BA5114 /* SVGZoomAndPan.cpp */,
A8C0F8EC089701F400BA5114 /* SVGZoomAndPan.h */,
854949680AC87613008AB035 /* SVGException.h */,
);
path = svg;
sourceTree = "<group>";
......@@ -7091,6 +7113,7 @@
85C7F4430AAF7686004014DD /* Events */,
85992FC20AA5DD4600AC0785 /* HTML */,
851EE8230ABCA58A00A6AA33 /* Range */,
8549492D0AC85A0A008AB035 /* SVG */,
859FA5F20AB0BEE2004FAEE9 /* Traversal */,
851EE8060ABCA25200A6AA33 /* Views */,
858015CC0ABCA7410080588D /* XPath */,
......@@ -8877,6 +8900,10 @@
8541639C0AC718680001E01B /* DOMSVGLengthListInternal.h in Headers */,
8541639D0AC718680001E01B /* DOMSVGLengthInternal.h in Headers */,
8541639E0AC718680001E01B /* DOMSVGAngleInternal.h in Headers */,
854949120AC858D8008AB035 /* DOMSVGElement.h in Headers */,
854949170AC85950008AB035 /* DOMSVGElementInternal.h in Headers */,
8549492F0AC85A32008AB035 /* DOMSVGExecption.h in Headers */,
854949690AC87613008AB035 /* SVGException.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -9977,6 +10004,7 @@
854163740AC7180B0001E01B /* DOMSVGLengthList.mm in Sources */,
854163760AC7180B0001E01B /* DOMSVGLength.mm in Sources */,
854163780AC7180B0001E01B /* DOMSVGAngle.mm in Sources */,
854949130AC858D8008AB035 /* DOMSVGElement.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -33,12 +33,19 @@
#include "Range.h"
#include "RangeException.h"
#include "xmlhttprequest.h"
#include "XPathEvaluator.h"
#include "kjs_dom.h"
#include "kjs_window.h"
#include <kjs/collector.h>
#include <wtf/HashMap.h>
#ifdef SVG_SUPPORT
#include "SVGException.h"
#endif
#ifdef XPATH_SUPPORT
#include "XPathEvaluator.h"
#endif
using namespace WebCore;
using namespace EventNames;
......@@ -324,6 +331,14 @@ static const char * const xpathExceptionNames[] = {
};
#endif
#ifdef SVG_SUPPORT
static const char * const svgExceptionNames[] = {
"SVG_WRONG_TYPE_ERR",
"SVG_INVALID_VALUE_ERR",
"SVG_MATRIX_NOT_INVERTABLE"
};
#endif
void setDOMException(ExecState* exec, ExceptionCode ec)
{
if (ec == 0 || exec->hadException())
......@@ -365,6 +380,14 @@ void setDOMException(ExecState* exec, ExceptionCode ec)
code -= XPathExceptionOffset;
nameTable = xpathExceptionNames;
nameTableSize = sizeof(xpathExceptionNames) / sizeof(xpathExceptionNames[0]);
#endif
#ifdef SVG_SUPPORT
} else if (code >= SVGExceptionOffset && code <= SVGExceptionMax) {
type = "DOM SVG";
code -= SVGExceptionOffset;
nameIndex = code;
nameTable = svgExceptionNames;
nameTableSize = sizeof(svgExceptionNames) / sizeof(svgExceptionNames[0]);
#endif
} else {
nameIndex = code;
......
......@@ -124,6 +124,7 @@
#ifdef SVG_SUPPORT
#import "DOMSVGAngleInternal.h"
#import "DOMSVGElementInternal.h"
#import "DOMSVGLengthInternal.h"
#import "DOMSVGLengthListInternal.h"
#import "DOMSVGMatrixInternal.h"
......
......@@ -31,6 +31,7 @@
#import "FrameMac.h"
#import "Range.h"
#import "RangeException.h"
#import "SVGException.h"
#import "WebScriptObjectPrivate.h"
#import "XPathEvaluator.h"
#import "kjs_dom.h"
......@@ -76,6 +77,9 @@ void removeDOMWrapper(DOMObjectInternal* impl)
NSString * const DOMException = @"DOMException";
NSString * const DOMRangeException = @"DOMRangeException";
NSString * const DOMEventException = @"DOMEventException";
#ifdef SVG_SUPPORT
NSString * const DOMSVGException = @"DOMSVGException";
#endif // SVG_SUPPORT
#ifdef XPATH_SUPPORT
NSString * const DOMXPathException = @"DOMXPathException";
#endif // XPATH_SUPPORT
......@@ -93,6 +97,11 @@ void raiseDOMException(ExceptionCode ec)
} else if (ec >= EventExceptionOffset && ec <= EventExceptionMax) {
name = DOMEventException;
code -= EventExceptionOffset;
#ifdef SVG_SUPPORT
} else if (ec >= SVGExceptionOffset && ec <= SVGExceptionMax) {
name = DOMSVGException;
code -= SVGExceptionOffset;
#endif // SVG_SUPPORT
#ifdef XPATH_SUPPORT
} else if (ec >= XPathExceptionOffset && ec <= XPathExceptionMax) {
name = DOMXPathException;
......
......@@ -25,6 +25,8 @@
*/
#import <WebCore/DOMSVGAngle.h>
#import <WebCore/DOMSVGElement.h>
#import <WebCore/DOMSVGException.h>
#import <WebCore/DOMSVGLength.h>
#import <WebCore/DOMSVGLengthList.h>
#import <WebCore/DOMSVGMatrix.h>
......
/*
* 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.
*/
@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
};
......@@ -24,6 +24,8 @@
#define KSVG_H
#ifdef SVG_SUPPORT
#include "SVGException.h"
/**
* @short General namespace specific definitions.
*/
......@@ -31,12 +33,6 @@ namespace WebCore {
/**
* All SVG constants
*/
enum SVGExceptionCode {
SVG_WRONG_TYPE_ERR = 1,
SVG_INVALID_VALUE_ERR = 2,
SVG_MATRIX_NOT_INVERTABLE = 3
};
enum SVGCSSRuleType {
COLOR_PROFILE_RULE = 7
};
......
......@@ -65,7 +65,7 @@ String SVGElement::id() const
return getAttribute(idAttr);
}
void SVGElement::setId(const String& value)
void SVGElement::setId(const String& value, ExceptionCode&)
{
setAttribute(idAttr, value);
}
......@@ -75,7 +75,7 @@ String SVGElement::xmlbase() const
return getAttribute(XMLNames::baseAttr);
}
void SVGElement::setXmlbase(const String& value)
void SVGElement::setXmlbase(const String& value, ExceptionCode&)
{
setAttribute(XMLNames::baseAttr, value);
}
......
......@@ -154,9 +154,9 @@ namespace WebCore {
virtual bool isSupported(StringImpl* feature, StringImpl* version) const;
String id() const;
void setId(const String&);
void setId(const String&, ExceptionCode&);
String xmlbase() const;
void setXmlbase(const String&);
void setXmlbase(const String&, ExceptionCode&);
SVGSVGElement* ownerSVGElement() const;
SVGElement* viewportElement() const;
......
/*
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
2004, 2005 Rob Buis <buis@kde.org>
Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
This file is part of the KDE project
......@@ -22,12 +23,18 @@
*/
module svg {
interface [GenerateNativeConverter, Conditional=SVG] SVGElement : core::Element {
attribute core::DOMString id
setter raises DOMException;
attribute core::DOMString xmlbase
setter raises DOMException;
interface [GenerateNativeConverter, Conditional=SVG] SVGElement : Element {
attribute DOMString id
setter raises(DOMException);
attribute DOMString xmlbase
setter raises(DOMException);
#if !defined(LANGUAGE_OBJECTIVE_C)
readonly attribute SVGSVGElement ownerSVGElement;
#endif
readonly attribute SVGElement viewportElement;
};
};
}
/*
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
* Copyright (C) 2006 Apple Computer, Inc.
*
* 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef SVGException_h
#define SVGException_h
#ifdef SVG_SUPPORT
namespace WebCore {
const int SVGExceptionOffset = 300;
const int SVGExceptionMax = 399;
enum SVGExceptionCode {
SVG_WRONG_TYPE_ERR = SVGExceptionOffset,
SVG_INVALID_VALUE_ERR = SVGExceptionOffset + 1,
SVG_MATRIX_NOT_INVERTABLE = SVGExceptionOffset + 2
};
} // namespace WebCore
#endif // SVG_SUPPORT
#endif // SVGException_h
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment