[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
zimmermann at webkit.org
zimmermann at webkit.org
Thu Feb 4 21:24:10 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit ec3a4abc0b5c298e1671d1694c5cffc0913c4e41
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 22 02:23:34 2010 +0000
2010-01-21 Nikolas Zimmermann <nzimmermann at rim.com>
Reviewed by Sam Weinig.
SVG JS bindings "context" pointer needs to move onto binding impls
https://bugs.webkit.org/show_bug.cgi?id=27243
Rewrite SVG DOM JSC bindings to use a global DOMObject <-> SVGElement context map, similar to V8's approach.
This allows us to remove DOMObjectWithSVGContext and make all SVG JS objects use DOMObjectWithGlobalPointer.
We're fitting again in JS_CELL_SIZE, and there's no need to special case SVG anymore.
Not adding a new test, as we have yet to identify how to test that we're passing around correct global objects.
For now this is just a code cleanup which lets me continue making progress in that area of the code.
* GNUmakefile.am: Add new DOMObjectWithSVGContext.h to build.
* WebCore.gypi: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* bindings/js/DOMObjectWithSVGContext.h: Removed.
* bindings/js/JSDOMBinding.cpp:
(WebCore::setDOMException): Add comment, that passing 0 context is intentional.
* bindings/js/JSDOMBinding.h:
(WebCore::createDOMObjectWrapper): Add to JSSVGContextCache, when creating wrappers.
(WebCore::getDOMObjectWrapper): Add assertion guarding the JSSVGContextCache is in-sync with the passed context.
* bindings/js/JSSVGContextCache.h: Added. Maps DOMObjects to SVGElements - just like V8 approachs to this problem.
(WebCore::JSSVGContextCache::wrapperMap):
(WebCore::JSSVGContextCache::addWrapper):
(WebCore::JSSVGContextCache::forgetWrapper):
(WebCore::JSSVGContextCache::propagateSVGDOMChange):
(WebCore::JSSVGContextCache::svgContextForDOMObject):
* bindings/js/JSSVGLengthCustom.cpp: Retrieve context from cache, instead of taking it from the JS* class.
(WebCore::JSSVGLength::value):
(WebCore::JSSVGLength::convertToSpecifiedUnits):
* bindings/js/JSSVGMatrixCustom.cpp Ditto.:
(WebCore::JSSVGMatrix::multiply):
(WebCore::JSSVGMatrix::inverse):
(WebCore::JSSVGMatrix::rotateFromVector):
* bindings/js/JSSVGPODListCustom.h: Ditto.
(WebCore::JSSVGPODListCustom::finishGetter):
(WebCore::JSSVGPODListCustom::finishSetter):
(WebCore::JSSVGPODListCustom::finishSetterReadOnlyResult):
(WebCore::JSSVGPODListCustom::clear):
(WebCore::JSSVGPODListCustom::initialize):
* bindings/js/JSSVGPODTypeWrapper.h: Ditto.
(WebCore::JSSVGDynamicPODTypeWrapper::commitChange):
(WebCore::JSSVGStaticPODTypeWrapper::commitChange):
(WebCore::JSSVGStaticPODTypeWrapperWithPODTypeParent::commitChange):
(WebCore::JSSVGStaticPODTypeWrapperWithParent::commitChange):
(WebCore::JSSVGPODTypeWrapperCreatorForList::create):
(WebCore::JSSVGPODTypeWrapperCreatorForList::commitChange):
* bindings/js/JSSVGPathSegCustom.cpp: Ditto.
(WebCore::toJS):
* bindings/js/JSSVGPathSegListCustom.cpp: Ditto.
(WebCore::JSSVGPathSegList::clear):
(WebCore::JSSVGPathSegList::initialize):
(WebCore::JSSVGPathSegList::getItem):
(WebCore::JSSVGPathSegList::insertItemBefore):
(WebCore::JSSVGPathSegList::replaceItem):
(WebCore::JSSVGPathSegList::removeItem):
(WebCore::JSSVGPathSegList::appendItem):
* bindings/scripts/CodeGeneratorJS.pm:
* svg/SVGAngle.h: Remove unneeded associatedAttributeName() method.
* svg/SVGPreserveAspectRatio.h: Ditto.
* svg/SVGTransform.h: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53666 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 87fefe5..f013b7c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,68 @@
+2010-01-21 Nikolas Zimmermann <nzimmermann at rim.com>
+
+ Reviewed by Sam Weinig.
+
+ SVG JS bindings "context" pointer needs to move onto binding impls
+ https://bugs.webkit.org/show_bug.cgi?id=27243
+
+ Rewrite SVG DOM JSC bindings to use a global DOMObject <-> SVGElement context map, similar to V8's approach.
+ This allows us to remove DOMObjectWithSVGContext and make all SVG JS objects use DOMObjectWithGlobalPointer.
+ We're fitting again in JS_CELL_SIZE, and there's no need to special case SVG anymore.
+
+ Not adding a new test, as we have yet to identify how to test that we're passing around correct global objects.
+ For now this is just a code cleanup which lets me continue making progress in that area of the code.
+
+ * GNUmakefile.am: Add new DOMObjectWithSVGContext.h to build.
+ * WebCore.gypi: Ditto.
+ * WebCore.vcproj/WebCore.vcproj: Ditto.
+ * WebCore.xcodeproj/project.pbxproj: Ditto.
+ * bindings/js/DOMObjectWithSVGContext.h: Removed.
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::setDOMException): Add comment, that passing 0 context is intentional.
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::createDOMObjectWrapper): Add to JSSVGContextCache, when creating wrappers.
+ (WebCore::getDOMObjectWrapper): Add assertion guarding the JSSVGContextCache is in-sync with the passed context.
+ * bindings/js/JSSVGContextCache.h: Added. Maps DOMObjects to SVGElements - just like V8 approachs to this problem.
+ (WebCore::JSSVGContextCache::wrapperMap):
+ (WebCore::JSSVGContextCache::addWrapper):
+ (WebCore::JSSVGContextCache::forgetWrapper):
+ (WebCore::JSSVGContextCache::propagateSVGDOMChange):
+ (WebCore::JSSVGContextCache::svgContextForDOMObject):
+ * bindings/js/JSSVGLengthCustom.cpp: Retrieve context from cache, instead of taking it from the JS* class.
+ (WebCore::JSSVGLength::value):
+ (WebCore::JSSVGLength::convertToSpecifiedUnits):
+ * bindings/js/JSSVGMatrixCustom.cpp Ditto.:
+ (WebCore::JSSVGMatrix::multiply):
+ (WebCore::JSSVGMatrix::inverse):
+ (WebCore::JSSVGMatrix::rotateFromVector):
+ * bindings/js/JSSVGPODListCustom.h: Ditto.
+ (WebCore::JSSVGPODListCustom::finishGetter):
+ (WebCore::JSSVGPODListCustom::finishSetter):
+ (WebCore::JSSVGPODListCustom::finishSetterReadOnlyResult):
+ (WebCore::JSSVGPODListCustom::clear):
+ (WebCore::JSSVGPODListCustom::initialize):
+ * bindings/js/JSSVGPODTypeWrapper.h: Ditto.
+ (WebCore::JSSVGDynamicPODTypeWrapper::commitChange):
+ (WebCore::JSSVGStaticPODTypeWrapper::commitChange):
+ (WebCore::JSSVGStaticPODTypeWrapperWithPODTypeParent::commitChange):
+ (WebCore::JSSVGStaticPODTypeWrapperWithParent::commitChange):
+ (WebCore::JSSVGPODTypeWrapperCreatorForList::create):
+ (WebCore::JSSVGPODTypeWrapperCreatorForList::commitChange):
+ * bindings/js/JSSVGPathSegCustom.cpp: Ditto.
+ (WebCore::toJS):
+ * bindings/js/JSSVGPathSegListCustom.cpp: Ditto.
+ (WebCore::JSSVGPathSegList::clear):
+ (WebCore::JSSVGPathSegList::initialize):
+ (WebCore::JSSVGPathSegList::getItem):
+ (WebCore::JSSVGPathSegList::insertItemBefore):
+ (WebCore::JSSVGPathSegList::replaceItem):
+ (WebCore::JSSVGPathSegList::removeItem):
+ (WebCore::JSSVGPathSegList::appendItem):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * svg/SVGAngle.h: Remove unneeded associatedAttributeName() method.
+ * svg/SVGPreserveAspectRatio.h: Ditto.
+ * svg/SVGTransform.h: Ditto.
+
2010-01-21 Kevin Ollivier <kevino at theolliviers.com>
Build fix, add missing header.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 9d7f1b4..b933ea5 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2931,6 +2931,7 @@ webcore_cppflags += \
-DENABLE_SVG=1
webcore_sources += \
+ WebCore/bindings/js/JSSVGContextCache.h \
WebCore/bindings/js/JSSVGElementInstanceCustom.cpp \
WebCore/bindings/js/JSSVGLengthCustom.cpp \
WebCore/bindings/js/JSSVGMatrixCustom.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 491eb8b..f163f4e 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -585,6 +585,7 @@
'bindings/js/JSStorageCustom.h',
'bindings/js/JSStyleSheetCustom.cpp',
'bindings/js/JSStyleSheetListCustom.cpp',
+ 'bindings/js/JSSVGContextCache.h',
'bindings/js/JSSVGElementInstanceCustom.cpp',
'bindings/js/JSSVGLengthCustom.cpp',
'bindings/js/JSSVGMatrixCustom.cpp',
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index f4bddc6..4f955d5 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -38960,6 +38960,10 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\bindings\js\JSSVGContextCache.h"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSSVGElementInstanceCustom.cpp"
>
<FileConfiguration
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 5ae7c58..4735cfd 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -62,6 +62,7 @@
08203AA00ED8C35300B8B61A /* WMLAccessElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08203A9E0ED8C35300B8B61A /* WMLAccessElement.h */; };
082341C50FCF3A9500D75BD6 /* WMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 082341C30FCF3A9400D75BD6 /* WMLSelectElement.cpp */; };
082341C60FCF3A9500D75BD6 /* WMLSelectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 082341C40FCF3A9400D75BD6 /* WMLSelectElement.h */; };
+ 082FCAC4110927CE00CC4821 /* JSSVGContextCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 082FCAC3110927CE00CC4821 /* JSSVGContextCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
08385FF610F0186000BFE07B /* SVGMarkerData.h in Headers */ = {isa = PBXBuildFile; fileRef = 08385FF510F0186000BFE07B /* SVGMarkerData.h */; };
0839476C0ECE4BD600027350 /* WMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08FB84B00ECE373300DC064E /* WMLElementFactory.cpp */; };
0839476D0ECE4BD600027350 /* WMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FB84B10ECE373300DC064E /* WMLElementFactory.h */; };
@@ -5326,6 +5327,7 @@
08203A9E0ED8C35300B8B61A /* WMLAccessElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLAccessElement.h; sourceTree = "<group>"; };
082341C30FCF3A9400D75BD6 /* WMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLSelectElement.cpp; sourceTree = "<group>"; };
082341C40FCF3A9400D75BD6 /* WMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLSelectElement.h; sourceTree = "<group>"; };
+ 082FCAC3110927CE00CC4821 /* JSSVGContextCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGContextCache.h; sourceTree = "<group>"; };
08385FF510F0186000BFE07B /* SVGMarkerData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerData.h; sourceTree = "<group>"; };
083DAEA20F01A7FB00342754 /* RenderTextControlMultiLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextControlMultiLine.cpp; sourceTree = "<group>"; };
083DAEA30F01A7FB00342754 /* RenderTextControlMultiLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTextControlMultiLine.h; sourceTree = "<group>"; };
@@ -14762,6 +14764,7 @@
51D0C5150DAA90B7003B3831 /* JSStorageCustom.cpp */,
BC98A27C0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp */,
A84EBD770CB8C89200079609 /* JSStyleSheetListCustom.cpp */,
+ 082FCAC3110927CE00CC4821 /* JSSVGContextCache.h */,
08A48A6D0E86CF6D00E225DD /* JSSVGElementInstanceCustom.cpp */,
08E4FE450E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp */,
B25DFAAE0B2E2929000E6510 /* JSSVGMatrixCustom.cpp */,
@@ -18447,6 +18450,7 @@
2E2D99EA10E2BC3800496337 /* DOMBlobInternal.h in Headers */,
59B5977511086579007159E8 /* BridgeJSC.h in Headers */,
93C4F6EB1108F9A50099D0DB /* AccessibilityScrollbar.h in Headers */,
+ 082FCAC4110927CE00CC4821 /* JSSVGContextCache.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/bindings/js/DOMObjectWithSVGContext.h b/WebCore/bindings/js/DOMObjectWithSVGContext.h
deleted file mode 100644
index 3d435cb..0000000
--- a/WebCore/bindings/js/DOMObjectWithSVGContext.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2009 Google, 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 THE AUTHOR ``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 THE AUTHOR 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 DOMObjectWithSVGContext_h
-#define DOMObjectWithSVGContext_h
-
-#if ENABLE(SVG)
-
-#include "JSDOMBinding.h"
-#include "SVGElement.h"
-
-namespace WebCore {
-
- // FIXME: This class (and file) should be removed once all SVG bindings
- // have moved context() onto the various impl() pointers.
- class DOMObjectWithSVGContext : public DOMObject {
- public:
- SVGElement* context() const { return m_context.get(); }
-
- protected:
- DOMObjectWithSVGContext(NonNullPassRefPtr<JSC::Structure> structure, JSDOMGlobalObject*, SVGElement* context)
- : DOMObject(structure)
- , m_context(context)
- {
- // No space to store the JSDOMGlobalObject w/o hitting the CELL_SIZE limit.
- }
-
- protected: // FIXME: Many custom bindings use m_context directly. Making this protected to temporariliy reduce code churn.
- RefPtr<SVGElement> m_context;
- };
-
-} // namespace WebCore
-
-#endif // ENABLE(SVG)
-#endif // DOMObjectWithSVGContext_h
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index 13f542e..cfa6761 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -730,7 +730,7 @@ void setDOMException(ExecState* exec, ExceptionCode ec)
break;
#if ENABLE(SVG)
case SVGExceptionType:
- errorObject = toJS(exec, globalObject, SVGException::create(description).get(), 0);
+ errorObject = toJS(exec, globalObject, SVGException::create(description).get(), 0 /* no context on purpose */);
break;
#endif
#if ENABLE(XPATH)
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index abacce2..e17b9fc 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -23,6 +23,7 @@
#define JSDOMBinding_h
#include "JSDOMGlobalObject.h"
+#include "JSSVGContextCache.h"
#include "Document.h"
#include <runtime/Completion.h>
#include <runtime/Lookup.h>
@@ -301,19 +302,21 @@ namespace WebCore {
#define CREATE_SVG_OBJECT_WRAPPER(exec, globalObject, className, object, context) createDOMObjectWrapper<JS##className>(exec, globalObject, static_cast<className*>(object), context)
template<class WrapperClass, class DOMClass> inline DOMObject* createDOMObjectWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* object, SVGElement* context)
{
- ASSERT(object);
- ASSERT(!getCachedDOMObjectWrapper(exec, object));
- WrapperClass* wrapper = new (exec) WrapperClass(getDOMStructure<WrapperClass>(exec, globalObject), globalObject, object, context);
- cacheDOMObjectWrapper(exec, object, wrapper);
+ DOMObject* wrapper = createDOMObjectWrapper<WrapperClass, DOMClass>(exec, globalObject, object);
+ ASSERT(wrapper);
+ if (context)
+ JSSVGContextCache::addWrapper(wrapper, context);
return wrapper;
}
template<class WrapperClass, class DOMClass> inline JSC::JSValue getDOMObjectWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* object, SVGElement* context)
{
if (!object)
return JSC::jsNull();
- if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object))
+ if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object)) {
+ ASSERT(JSSVGContextCache::svgContextForDOMObject(wrapper) == context);
return wrapper;
- return createDOMObjectWrapper<WrapperClass>(exec, globalObject, object, context);
+ }
+ return createDOMObjectWrapper<WrapperClass, DOMClass>(exec, globalObject, object, context);
}
#endif
diff --git a/WebCore/bindings/js/JSSVGContextCache.h b/WebCore/bindings/js/JSSVGContextCache.h
new file mode 100644
index 0000000..75ed324
--- /dev/null
+++ b/WebCore/bindings/js/JSSVGContextCache.h
@@ -0,0 +1,97 @@
+/*
+ Copyright (C) Research In Motion Limited 2009-2010. 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.
+*/
+
+#ifndef JSSVGContextCache_h
+#define JSSVGContextCache_h
+
+#if ENABLE(SVG)
+#include "SVGElement.h"
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+class DOMObject;
+
+class JSSVGContextCache : public Noncopyable {
+public:
+ typedef HashMap<DOMObject*, SVGElement*> WrapperMap;
+
+ static WrapperMap& wrapperMap()
+ {
+ DEFINE_STATIC_LOCAL(WrapperMap, s_wrapperMap, ());
+ return s_wrapperMap;
+ }
+
+ static void addWrapper(DOMObject* wrapper, SVGElement* context)
+ {
+ ASSERT(wrapper);
+ ASSERT(context);
+
+ pair<WrapperMap::iterator, bool> result = wrapperMap().add(wrapper, context);
+ if (result.second) {
+ WrapperMap::iterator& it = result.first;
+ ASSERT_UNUSED(it, it->second == context);
+ }
+ }
+
+ static void forgetWrapper(DOMObject* wrapper)
+ {
+ ASSERT(wrapper);
+
+ WrapperMap& map = wrapperMap();
+ WrapperMap::iterator it = map.find(wrapper);
+ if (it == map.end())
+ return;
+
+ map.remove(it);
+ }
+
+ static void propagateSVGDOMChange(DOMObject* wrapper, const QualifiedName& attributeName)
+ {
+ WrapperMap& map = wrapperMap();
+ WrapperMap::iterator it = map.find(wrapper);
+ if (it == map.end())
+ return;
+
+ SVGElement* context = it->second;
+ ASSERT(context);
+
+ context->svgAttributeChanged(attributeName);
+ }
+
+ static SVGElement* svgContextForDOMObject(DOMObject* wrapper)
+ {
+ ASSERT(wrapper);
+
+ WrapperMap& map = wrapperMap();
+ WrapperMap::iterator it = map.find(wrapper);
+ if (it == map.end())
+ return 0;
+
+ SVGElement* context = it->second;
+ ASSERT(context);
+ return context;
+ }
+
+};
+
+}
+
+#endif
+#endif
diff --git a/WebCore/bindings/js/JSSVGLengthCustom.cpp b/WebCore/bindings/js/JSSVGLengthCustom.cpp
index bad52ae..33bbf30 100644
--- a/WebCore/bindings/js/JSSVGLengthCustom.cpp
+++ b/WebCore/bindings/js/JSSVGLengthCustom.cpp
@@ -28,18 +28,22 @@ namespace WebCore {
JSValue JSSVGLength::value(ExecState* exec) const
{
- SVGLength imp(*impl());
- return jsNumber(exec, imp.value(context()));
+ JSSVGPODTypeWrapper<SVGLength>* imp = impl();
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(const_cast<JSSVGLength*>(this));
+
+ SVGLength podImp(*imp);
+ return jsNumber(exec, podImp.value(context));
}
JSValue JSSVGLength::convertToSpecifiedUnits(ExecState* exec, const ArgList& args)
{
- JSSVGPODTypeWrapper<SVGLength>* wrapper = impl();
+ JSSVGPODTypeWrapper<SVGLength>* imp = impl();
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- SVGLength imp(*wrapper);
- imp.convertToSpecifiedUnits(args.at(0).toInt32(exec), context());
+ SVGLength podImp(*imp);
+ podImp.convertToSpecifiedUnits(args.at(0).toInt32(exec), context);
- wrapper->commitChange(imp, context());
+ imp->commitChange(podImp, this);
return jsUndefined();
}
diff --git a/WebCore/bindings/js/JSSVGMatrixCustom.cpp b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
index a9d0e54..d2d3d6f 100644
--- a/WebCore/bindings/js/JSSVGMatrixCustom.cpp
+++ b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
@@ -44,15 +44,16 @@ JSValue JSSVGMatrix::multiply(ExecState* exec, const ArgList& args)
TransformationMatrix m1(*impl());
TransformationMatrix m2(*(matrixObj->impl()));
- JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2)).get(), m_context.get());
-
- return result;
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
+ return toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2)).get(), context);
}
JSValue JSSVGMatrix::inverse(ExecState* exec, const ArgList&)
{
TransformationMatrix imp(*impl());
- JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(imp.inverse()).get(), m_context.get());
+
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
+ JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(imp.inverse()).get(), context);
if (!imp.isInvertible())
setDOMException(exec, SVGException::SVG_MATRIX_NOT_INVERTABLE);
@@ -67,7 +68,8 @@ JSValue JSSVGMatrix::rotateFromVector(ExecState* exec, const ArgList& args)
float x = args.at(0).toFloat(exec);
float y = args.at(1).toFloat(exec);
- JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(imp.rotateFromVector(x, y)).get(), m_context.get());
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
+ JSValue result = toJS(exec, globalObject(), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(imp.rotateFromVector(x, y)).get(), context);
if (x == 0.0 || y == 0.0)
setDOMException(exec, SVGException::SVG_INVALID_VALUE_ERR);
diff --git a/WebCore/bindings/js/JSSVGPODListCustom.h b/WebCore/bindings/js/JSSVGPODListCustom.h
index 3852505..8a0654c 100644
--- a/WebCore/bindings/js/JSSVGPODListCustom.h
+++ b/WebCore/bindings/js/JSSVGPODListCustom.h
@@ -22,6 +22,7 @@
#ifndef JSSVGPODListCustom_h
#define JSSVGPODListCustom_h
+#include "JSSVGContextCache.h"
#include "JSSVGPODTypeWrapper.h"
#include "SVGList.h"
@@ -37,23 +38,24 @@ struct JSSVGPODListTraits {
typedef PODType (*ConversionCallback)(JSC::JSValue);
};
-template<typename PODType>
-static JSC::JSValue finishGetter(JSC::ExecState* exec, ExceptionCode& ec, SVGElement* context,
- typename JSSVGPODListTraits<PODType>::PODList* list,
+template<typename JSPODListType, typename PODType>
+static JSC::JSValue finishGetter(JSC::ExecState* exec, ExceptionCode& ec, JSPODListType* wrapper,
PassRefPtr<typename JSSVGPODListTraits<PODType>::PODListItem> item)
{
if (ec) {
setDOMException(exec, ec);
return JSC::jsUndefined();
}
+
+ typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return toJS(exec, deprecatedGlobalObjectForPrototype(exec),
- JSSVGPODTypeWrapperCreatorForList<PODType>::create(item.get(), list->associatedAttributeName()).get(), context);
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(wrapper);
+ return toJS(exec, wrapper->globalObject(),
+ JSSVGPODTypeWrapperCreatorForList<PODType>::create(item.get(), listImp->associatedAttributeName()).get(), context);
}
-template<typename PODType>
-static JSC::JSValue finishSetter(JSC::ExecState* exec, ExceptionCode& ec, SVGElement* context,
- typename JSSVGPODListTraits<PODType>::PODList* list,
+template<typename JSPODListType, typename PODType>
+static JSC::JSValue finishSetter(JSC::ExecState* exec, ExceptionCode& ec, JSPODListType* wrapper,
PassRefPtr<typename JSSVGPODListTraits<PODType>::PODListItem> item)
{
if (ec) {
@@ -61,24 +63,29 @@ static JSC::JSValue finishSetter(JSC::ExecState* exec, ExceptionCode& ec, SVGEle
return JSC::jsUndefined();
}
- const QualifiedName& attributeName = list->associatedAttributeName();
- context->svgAttributeChanged(attributeName);
+ typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
+
+ const QualifiedName& attributeName = listImp->associatedAttributeName();
+ JSSVGContextCache::propagateSVGDOMChange(wrapper, attributeName);
- return toJS(exec, deprecatedGlobalObjectForPrototype(exec),
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(wrapper);
+ return toJS(exec, wrapper->globalObject(),
JSSVGPODTypeWrapperCreatorForList<PODType>::create(item.get(), attributeName).get(), context);
}
-template<typename PODType>
-static JSC::JSValue finishSetterReadOnlyResult(JSC::ExecState* exec, ExceptionCode& ec, SVGElement* context,
- typename JSSVGPODListTraits<PODType>::PODList* list,
+template<typename JSPODListType, typename PODType>
+static JSC::JSValue finishSetterReadOnlyResult(JSC::ExecState* exec, ExceptionCode& ec, JSPODListType* wrapper,
PassRefPtr<typename JSSVGPODListTraits<PODType>::PODListItem> item)
{
if (ec) {
setDOMException(exec, ec);
return JSC::jsUndefined();
}
- context->svgAttributeChanged(list->associatedAttributeName());
- return toJS(exec, deprecatedGlobalObjectForPrototype(exec), JSSVGStaticPODTypeWrapper<PODType>::create(*item).get(), context);
+
+ typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
+ JSSVGContextCache::propagateSVGDOMChange(wrapper, listImp->associatedAttributeName());
+ return toJS(exec, wrapper->globalObject(),
+ JSSVGStaticPODTypeWrapper<PODType>::create(*item).get(), 0 /* no context on purpose */);
}
template<typename JSPODListType, typename PODType>
@@ -92,7 +99,7 @@ static JSC::JSValue clear(JSPODListType* wrapper, JSC::ExecState* exec, const JS
if (ec)
setDOMException(exec, ec);
else
- wrapper->context()->svgAttributeChanged(listImp->associatedAttributeName());
+ JSSVGContextCache::propagateSVGDOMChange(wrapper, listImp->associatedAttributeName());
return JSC::jsUndefined();
}
@@ -103,9 +110,8 @@ static JSC::JSValue initialize(JSPODListType* wrapper, JSC::ExecState* exec, con
{
ExceptionCode ec = 0;
typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetter<PODType>(exec, ec, wrapper->context(), listImp,
- listImp->initialize(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), ec));
-
+ return finishSetter<JSPODListType, PODType>(exec, ec, wrapper,
+ listImp->initialize(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), ec));
}
template<typename JSPODListType, typename PODType>
@@ -121,8 +127,8 @@ static JSC::JSValue getItem(JSPODListType* wrapper, JSC::ExecState* exec, const
ExceptionCode ec = 0;
typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishGetter<PODType>(exec, ec, wrapper->context(), listImp,
- listImp->getItem(index, ec));
+ return finishGetter<JSPODListType, PODType>(exec, ec, wrapper,
+ listImp->getItem(index, ec));
}
template<typename JSPODListType, typename PODType>
@@ -138,8 +144,8 @@ static JSC::JSValue insertItemBefore(JSPODListType* wrapper, JSC::ExecState* exe
ExceptionCode ec = 0;
typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetter<PODType>(exec, ec, wrapper->context(), listImp,
- listImp->insertItemBefore(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), index, ec));
+ return finishSetter<JSPODListType, PODType>(exec, ec, wrapper,
+ listImp->insertItemBefore(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), index, ec));
}
template<typename JSPODListType, typename PODType>
@@ -155,8 +161,8 @@ static JSC::JSValue replaceItem(JSPODListType* wrapper, JSC::ExecState* exec, co
ExceptionCode ec = 0;
typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetter<PODType>(exec, ec, wrapper->context(), listImp,
- listImp->replaceItem(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), index, ec));
+ return finishSetter<JSPODListType, PODType>(exec, ec, wrapper,
+ listImp->replaceItem(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), index, ec));
}
template<typename JSPODListType, typename PODType>
@@ -172,8 +178,8 @@ static JSC::JSValue removeItem(JSPODListType* wrapper, JSC::ExecState* exec, con
ExceptionCode ec = 0;
typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetterReadOnlyResult<PODType>(exec, ec, wrapper->context(), listImp,
- listImp->removeItem(index, ec));
+ return finishSetterReadOnlyResult<JSPODListType, PODType>(exec, ec, wrapper,
+ listImp->removeItem(index, ec));
}
template<typename JSPODListType, typename PODType>
@@ -182,8 +188,8 @@ static JSC::JSValue appendItem(JSPODListType* wrapper, JSC::ExecState* exec, con
{
ExceptionCode ec = 0;
typename JSSVGPODListTraits<PODType>::PODList* listImp = wrapper->impl();
- return finishSetter<PODType>(exec, ec, wrapper->context(), listImp,
- listImp->appendItem(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), ec));
+ return finishSetter<JSPODListType, PODType>(exec, ec, wrapper,
+ listImp->appendItem(JSSVGPODListTraits<PODType>::PODListItem::copy(conversion(args.at(0))), ec));
}
}
diff --git a/WebCore/bindings/js/JSSVGPODTypeWrapper.h b/WebCore/bindings/js/JSSVGPODTypeWrapper.h
index fea7a5f..d68c445 100644
--- a/WebCore/bindings/js/JSSVGPODTypeWrapper.h
+++ b/WebCore/bindings/js/JSSVGPODTypeWrapper.h
@@ -28,18 +28,21 @@
#define JSSVGPODTypeWrapper_h
#if ENABLE(SVG)
+#include "JSSVGContextCache.h"
#include "SVGElement.h"
#include <wtf/StdLibExtras.h>
namespace WebCore {
+class DOMObject;
+
template<typename PODType>
class JSSVGPODTypeWrapper : public RefCounted<JSSVGPODTypeWrapper<PODType> > {
public:
virtual ~JSSVGPODTypeWrapper() { }
virtual operator PODType() = 0;
- virtual void commitChange(PODType, SVGElement*) = 0;
+ virtual void commitChange(PODType, DOMObject*) = 0;
};
// This file contains JS wrapper objects for SVG datatypes, that are passed around by value
@@ -86,12 +89,10 @@ public:
return (m_creator.get()->*m_getter)();
}
- virtual void commitChange(PODType type, SVGElement* context)
+ virtual void commitChange(PODType type, DOMObject* wrapper)
{
(m_creator.get()->*m_setter)(type);
-
- if (context)
- context->svgAttributeChanged(m_creator->associatedAttributeName());
+ JSSVGContextCache::propagateSVGDOMChange(wrapper, m_creator->associatedAttributeName());
}
private:
@@ -130,7 +131,7 @@ public:
return m_podType;
}
- virtual void commitChange(PODType type, SVGElement*)
+ virtual void commitChange(PODType type, DOMObject*)
{
m_podType = type;
}
@@ -154,10 +155,10 @@ public:
return adoptRef(new JSSVGStaticPODTypeWrapperWithPODTypeParent(type, parent));
}
- virtual void commitChange(PODType type, SVGElement* context)
+ virtual void commitChange(PODType type, DOMObject* wrapper)
{
- JSSVGStaticPODTypeWrapper<PODType>::commitChange(type, context);
- m_parentType->commitChange(ParentTypeArg(type), context);
+ JSSVGStaticPODTypeWrapper<PODType>::commitChange(type, wrapper);
+ m_parentType->commitChange(ParentTypeArg(type), wrapper);
}
private:
@@ -192,7 +193,7 @@ public:
return (m_parent.get()->*m_getter)();
}
- virtual void commitChange(PODType type, SVGElement*)
+ virtual void commitChange(PODType type, DOMObject*)
{
(m_parent.get()->*m_setter)(type);
}
@@ -237,15 +238,13 @@ public:
return (m_creator.get()->*m_getter)();
}
- virtual void commitChange(PODType type, SVGElement* context)
+ virtual void commitChange(PODType type, DOMObject* wrapper)
{
if (!m_setter)
return;
(m_creator.get()->*m_setter)(type);
-
- if (context)
- context->svgAttributeChanged(m_associatedAttributeName);
+ JSSVGContextCache::propagateSVGDOMChange(wrapper, m_associatedAttributeName);
}
private:
diff --git a/WebCore/bindings/js/JSSVGPathSegCustom.cpp b/WebCore/bindings/js/JSSVGPathSegCustom.cpp
index d5be3fd..eac2c4b 100644
--- a/WebCore/bindings/js/JSSVGPathSegCustom.cpp
+++ b/WebCore/bindings/js/JSSVGPathSegCustom.cpp
@@ -21,6 +21,8 @@
#if ENABLE(SVG)
#include "JSSVGPathSeg.h"
+
+#include "JSDOMBinding.h"
#include "JSSVGPathSegArcAbs.h"
#include "JSSVGPathSegArcRel.h"
#include "JSSVGPathSegClosePath.h"
@@ -40,9 +42,6 @@
#include "JSSVGPathSegLinetoVerticalRel.h"
#include "JSSVGPathSegMovetoAbs.h"
#include "JSSVGPathSegMovetoRel.h"
-
-#include "JSDOMBinding.h"
-
#include "SVGPathSeg.h"
#include "SVGPathSegArc.h"
#include "SVGPathSegClosePath.h"
@@ -64,8 +63,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, SVGPathSeg* objec
if (!object)
return jsNull();
- if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object))
+ if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object)) {
+ ASSERT(JSSVGContextCache::svgContextForDOMObject(wrapper) == context);
return wrapper;
+ }
switch (object->pathSegType()) {
case SVGPathSeg::PATHSEG_CLOSEPATH:
@@ -115,5 +116,3 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, SVGPathSeg* objec
}
#endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/bindings/js/JSSVGPathSegListCustom.cpp b/WebCore/bindings/js/JSSVGPathSegListCustom.cpp
index b71f3a6..4831727 100644
--- a/WebCore/bindings/js/JSSVGPathSegListCustom.cpp
+++ b/WebCore/bindings/js/JSSVGPathSegListCustom.cpp
@@ -24,6 +24,7 @@
#include "Document.h"
#include "Frame.h"
+#include "JSSVGContextCache.h"
#include "JSSVGPathSeg.h"
#include "SVGDocumentExtensions.h"
#include "SVGElement.h"
@@ -39,12 +40,12 @@ JSValue JSSVGPathSegList::clear(ExecState* exec, const ArgList&)
{
ExceptionCode ec = 0;
- SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
- imp->clear(ec);
+ SVGPathSegList* list = impl();
+ list->clear(ec);
setDOMException(exec, ec);
- m_context->svgAttributeChanged(imp->associatedAttributeName());
+ JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
return jsUndefined();
}
@@ -53,14 +54,15 @@ JSValue JSSVGPathSegList::initialize(ExecState* exec, const ArgList& args)
ExceptionCode ec = 0;
SVGPathSeg* newItem = toSVGPathSeg(args.at(0));
- SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
+ SVGPathSegList* list = impl();
- SVGPathSeg* obj = WTF::getPtr(imp->initialize(newItem, ec));
+ SVGPathSeg* obj = WTF::getPtr(list->initialize(newItem, ec));
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), obj, m_context.get());
+ JSValue result = toJS(exec, globalObject(), obj, context);
setDOMException(exec, ec);
- m_context->svgAttributeChanged(imp->associatedAttributeName());
+ JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
return result;
}
@@ -75,10 +77,11 @@ JSValue JSSVGPathSegList::getItem(ExecState* exec, const ArgList& args)
return jsUndefined();
}
- SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
- SVGPathSeg* obj = WTF::getPtr(imp->getItem(index, ec));
+ SVGPathSegList* list = impl();
+ SVGPathSeg* obj = WTF::getPtr(list->getItem(index, ec));
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), obj, m_context.get());
+ JSValue result = toJS(exec, globalObject(), obj, context);
setDOMException(exec, ec);
return result;
}
@@ -95,12 +98,13 @@ JSValue JSSVGPathSegList::insertItemBefore(ExecState* exec, const ArgList& args)
return jsUndefined();
}
- SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
+ SVGPathSegList* list = impl();
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), WTF::getPtr(imp->insertItemBefore(newItem, index, ec)), m_context.get());
+ JSValue result = toJS(exec, globalObject(), WTF::getPtr(list->insertItemBefore(newItem, index, ec)), context);
setDOMException(exec, ec);
- m_context->svgAttributeChanged(imp->associatedAttributeName());
+ JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
return result;
}
@@ -116,12 +120,13 @@ JSValue JSSVGPathSegList::replaceItem(ExecState* exec, const ArgList& args)
return jsUndefined();
}
- SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
+ SVGPathSegList* list = impl();
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), WTF::getPtr(imp->replaceItem(newItem, index, ec)), m_context.get());
+ JSValue result = toJS(exec, globalObject(), WTF::getPtr(list->replaceItem(newItem, index, ec)), context);
setDOMException(exec, ec);
- m_context->svgAttributeChanged(imp->associatedAttributeName());
+ JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
return result;
}
@@ -136,14 +141,15 @@ JSValue JSSVGPathSegList::removeItem(ExecState* exec, const ArgList& args)
return jsUndefined();
}
- SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
+ SVGPathSegList* list = impl();
- RefPtr<SVGPathSeg> obj(imp->removeItem(index, ec));
+ RefPtr<SVGPathSeg> obj(list->removeItem(index, ec));
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), obj.get(), m_context.get());
+ JSValue result = toJS(exec, globalObject(), obj.get(), context);
setDOMException(exec, ec);
- m_context->svgAttributeChanged(imp->associatedAttributeName());
+ JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
return result;
}
@@ -152,12 +158,13 @@ JSValue JSSVGPathSegList::appendItem(ExecState* exec, const ArgList& args)
ExceptionCode ec = 0;
SVGPathSeg* newItem = toSVGPathSeg(args.at(0));
- SVGPathSegList* imp = static_cast<SVGPathSegList*>(impl());
+ SVGPathSegList* list = impl();
+ SVGElement* context = JSSVGContextCache::svgContextForDOMObject(this);
- JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), WTF::getPtr(imp->appendItem(newItem, ec)), m_context.get());
+ JSValue result = toJS(exec, globalObject(), WTF::getPtr(list->appendItem(newItem, ec)), context);
setDOMException(exec, ec);
- m_context->svgAttributeChanged(imp->associatedAttributeName());
+ JSSVGContextCache::propagateSVGDOMChange(this, list->associatedAttributeName());
return result;
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 76bb5b9..9937167 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -132,15 +132,7 @@ sub GetParentClassName
my $dataNode = shift;
return $dataNode->extendedAttributes->{"LegacyParent"} if $dataNode->extendedAttributes->{"LegacyParent"};
- if (@{$dataNode->parents} eq 0) {
- # FIXME: SVG types requiring a context() pointer do not have enough
- # space to hold a globalObject pointer as well w/o hitting the CELL_SIZE limit.
- # This could be fixed by moving context() into the various impl() classes.
- # Until then, we special case these SVG bindings and allow them to return
- # the wrong prototypes and constructors during x-frame access. See bug 27088.
- return "DOMObjectWithSVGContext" if IsSVGTypeNeedingContextParameter($dataNode->name);
- return "DOMObjectWithGlobalPointer";
- }
+ return "DOMObjectWithGlobalPointer" if (@{$dataNode->parents} eq 0);
return "JS" . $codeGenerator->StripModule($dataNode->parents(0));
}
@@ -169,16 +161,6 @@ sub IndexGetterReturnsStrings
return 0;
}
-sub CreateSVGContextInterfaceName
-{
- my $type = shift;
-
- return $type if $codeGenerator->IsSVGAnimatedType($type);
- return "SVGPathSeg" if $type =~ /^SVGPathSeg/ and $type ne "SVGPathSegList";
-
- return "";
-}
-
sub AddIncludesForType
{
my $type = $codeGenerator->StripModule(shift);
@@ -493,7 +475,6 @@ sub GenerateHeader
my $hasParent = $hasLegacyParent || $hasRealParent;
my $parentClassName = GetParentClassName($dataNode);
my $conditional = $dataNode->extendedAttributes->{"Conditional"};
- my $needsSVGContext = IsSVGTypeNeedingContextParameter($interfaceName);
my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"};
my $needsMarkChildren = $dataNode->extendedAttributes->{"CustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"};
@@ -513,8 +494,7 @@ sub GenerateHeader
if ($hasParent) {
$headerIncludes{"$parentClassName.h"} = 1;
} else {
- $headerIncludes{"DOMObjectWithSVGContext.h"} = $needsSVGContext;
- $headerIncludes{"JSDOMBinding.h"} = !$needsSVGContext;
+ $headerIncludes{"JSDOMBinding.h"} = 1;
$headerIncludes{"<runtime/JSGlobalObject.h>"} = 1;
$headerIncludes{"<runtime/ObjectPrototype.h>"} = 1;
}
@@ -561,8 +541,6 @@ sub GenerateHeader
push(@headerContent, " $className(NonNullPassRefPtr<JSC::Structure>, PassRefPtr<$implType>, JSDOMWindowShell*);\n");
} elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) {
push(@headerContent, " $className(NonNullPassRefPtr<JSC::Structure>, PassRefPtr<$implType>);\n");
- } elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@headerContent, " $className(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<$implType>, SVGElement* context);\n");
} else {
push(@headerContent, " $className(NonNullPassRefPtr<JSC::Structure>, JSDOMGlobalObject*, PassRefPtr<$implType>);\n");
}
@@ -783,7 +761,7 @@ sub GenerateHeader
if (!$hasParent || $dataNode->extendedAttributes->{"GenerateToJS"} || $dataNode->extendedAttributes->{"CustomToJS"}) {
if ($podType) {
- push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSSVGPODTypeWrapper<$podType>*, SVGElement* context);\n");
+ push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, JSSVGPODTypeWrapper<$podType>*, SVGElement*);\n");
} elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*, SVGElement* context);\n");
} else {
@@ -1173,9 +1151,6 @@ sub GenerateImplementation
my $podType = $dataNode->extendedAttributes->{"PODType"};
my $implType = $podType ? "JSSVGPODTypeWrapper<$podType> " : $implClassName;
- my $needsSVGContext = IsSVGTypeNeedingContextParameter($implClassName);
- my $parentNeedsSVGContext = ($needsSVGContext and $parentClassName =~ /SVG/);
-
# Constructor
if ($interfaceName eq "DOMWindow") {
AddIncludesForType("JSDOMWindowShell");
@@ -1186,12 +1161,11 @@ sub GenerateImplementation
push(@implContent, "${className}::$className(NonNullPassRefPtr<Structure> structure, PassRefPtr<$implType> impl)\n");
push(@implContent, " : $parentClassName(structure, impl)\n");
} else {
- my $contextArg = $needsSVGContext ? ", SVGElement* context" : "";
- push(@implContent, "${className}::$className(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl$contextArg)\n");
+ push(@implContent, "${className}::$className(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl)\n");
if ($hasParent) {
- push(@implContent, " : $parentClassName(structure, globalObject, impl" . ($parentNeedsSVGContext ? ", context" : "") . ")\n");
+ push(@implContent, " : $parentClassName(structure, globalObject, impl)\n");
} else {
- push(@implContent, " : $parentClassName(structure, globalObject" . ($needsSVGContext ? ", context" : "") . ")\n");
+ push(@implContent, " : $parentClassName(structure, globalObject)\n");
push(@implContent, " , m_impl(impl)\n");
}
}
@@ -1214,6 +1188,8 @@ sub GenerateImplementation
} else {
push(@implContent, " forgetDOMObject(this, impl());\n");
}
+
+ push(@implContent, " JSSVGContextCache::forgetWrapper(this);\n") if IsSVGTypeNeedingContextParameter($implClassName);
}
push(@implContent, "}\n\n");
@@ -1395,15 +1371,8 @@ sub GenerateImplementation
push(@implContent, "JSValue ${constructorFunctionName}(ExecState* exec, const Identifier&, const PropertySlot& slot)\n");
push(@implContent, "{\n");
- if (IsSVGTypeNeedingContextParameter($interfaceName)) {
- # FIXME: SVG bindings with a context pointer have no space to store a globalObject
- # so we use deprecatedGlobalObjectForPrototype instead.
- push(@implContent, " UNUSED_PARAM(slot);\n");
- push(@implContent, " return ${className}::getConstructor(exec, deprecatedGlobalObjectForPrototype(exec));\n");
- } else {
- push(@implContent, " ${className}* domObject = static_cast<$className*>(asObject(slot.slotBase()));\n");
- push(@implContent, " return ${className}::getConstructor(exec, domObject->globalObject());\n");
- }
+ push(@implContent, " ${className}* domObject = static_cast<$className*>(asObject(slot.slotBase()));\n");
+ push(@implContent, " return ${className}::getConstructor(exec, domObject->globalObject());\n");
push(@implContent, "}\n");
}
}
@@ -1488,16 +1457,17 @@ sub GenerateImplementation
push(@implContent, " // Shadowing a built-in object\n");
push(@implContent, " static_cast<$className*>(thisObject)->putDirect(Identifier(exec, \"$name\"), value);\n");
} else {
+ push(@implContent, " $className* castedThisObj = static_cast<$className*>(thisObject);\n");
+ push(@implContent, " $implType* imp = static_cast<$implType*>(castedThisObj->impl());\n");
if ($podType) {
- push(@implContent, " $podType imp(*static_cast<$className*>(thisObject)->impl());\n");
+ push(@implContent, " $podType podImp(*imp);\n");
if ($podType eq "float") { # Special case for JSSVGNumber
- push(@implContent, " imp = " . JSValueToNative($attribute->signature, "value") . ";\n");
+ push(@implContent, " podImp = " . JSValueToNative($attribute->signature, "value") . ";\n");
} else {
- push(@implContent, " imp.set$implSetterFunctionName(" . JSValueToNative($attribute->signature, "value") . ");\n");
+ push(@implContent, " podImp.set$implSetterFunctionName(" . JSValueToNative($attribute->signature, "value") . ");\n");
}
- push(@implContent, " static_cast<$className*>(thisObject)->impl()->commitChange(imp, static_cast<$className*>(thisObject)->context());\n");
+ push(@implContent, " imp->commitChange(podImp, castedThisObj);\n");
} else {
- push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(thisObject)->impl());\n");
my $nativeValue = JSValueToNative($attribute->signature, "value");
push(@implContent, " ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions};
my $reflect = $attribute->signature->extendedAttributes->{"Reflect"};
@@ -1513,10 +1483,8 @@ sub GenerateImplementation
push(@implContent, ", ec") if @{$attribute->setterExceptions};
push(@implContent, ");\n");
push(@implContent, " setDOMException(exec, ec);\n") if @{$attribute->setterExceptions};
-
if (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@implContent, " if (static_cast<$className*>(thisObject)->context())\n");
- push(@implContent, " static_cast<$className*>(thisObject)->context()->svgAttributeChanged(static_cast<$className*>(thisObject)->impl()->associatedAttributeName());\n");
+ push(@implContent, " JSSVGContextCache::propagateSVGDOMChange(castedThisObj, imp->associatedAttributeName());\n");
}
}
}
@@ -1602,12 +1570,8 @@ sub GenerateImplementation
push(@implContent, " return JSSVGPODListCustom::$functionImplementationName<$className, " . GetNativeType($svgPODListType)
. ">(castedThisObj, exec, args, to" . $svgPODListType . ");\n");
} else {
- if ($podType) {
- push(@implContent, " JSSVGPODTypeWrapper<$podType>* wrapper = castedThisObj->impl();\n");
- push(@implContent, " $podType imp(*wrapper);\n");
- } else {
- push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(castedThisObj->impl());\n");
- }
+ push(@implContent, " $implType* imp = static_cast<$implType*>(castedThisObj->impl());\n");
+ push(@implContent, " $podType podImp(*imp);\n") if $podType;
my $numParameters = @{$function->parameters};
@@ -1627,7 +1591,7 @@ sub GenerateImplementation
}
my $paramIndex = 0;
- my $functionString = "imp" . ($podType ? "." : "->") . $functionImplementationName . "(";
+ my $functionString = ($podType ? "podImp." : "imp->") . $functionImplementationName . "(";
my $hasOptionalArguments = 0;
@@ -1738,11 +1702,10 @@ sub GenerateImplementation
if ($podType) {
push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, JSSVGPODTypeWrapper<$podType>* object, SVGElement* context)\n");
} elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object, SVGElement* context)\n");
+ push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object, SVGElement* context)\n");
} else {
push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* object)\n");
}
-
push(@implContent, "{\n");
if ($podType) {
push(@implContent, " return getDOMObjectWrapper<$className, JSSVGPODTypeWrapper<$podType> >(exec, globalObject, object, context);\n");
@@ -1800,11 +1763,7 @@ sub GenerateImplementationFunctionCall()
if ($function->signature->type eq "void") {
push(@implContent, $indent . "$functionString;\n");
push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions};
-
- if ($podType) {
- push(@implContent, $indent . "wrapper->commitChange(imp, castedThisObj->context());\n");
- }
-
+ push(@implContent, $indent . "imp->commitChange(podImp, castedThisObj);\n") if $podType;
push(@implContent, $indent . "return jsUndefined();\n");
} else {
push(@implContent, "\n" . $indent . "JSC::JSValue result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThisObj") . ";\n");
@@ -1813,7 +1772,7 @@ sub GenerateImplementationFunctionCall()
if ($podType and not $function->signature->extendedAttributes->{"Immutable"}) {
# Immutable methods do not commit changes back to the instance, thus producing
# a new instance rather than mutating existing one.
- push(@implContent, $indent . "wrapper->commitChange(imp, castedThisObj->context());\n");
+ push(@implContent, $indent . "imp->commitChange(podImp, castedThisObj);\n");
}
push(@implContent, $indent . "return result;\n");
@@ -1937,9 +1896,7 @@ sub NativeToJSValue
return "jsString(exec, $value)";
}
- # Some SVG bindings don't have space to store a globalObject pointer, for those, we use the deprecatedGlobalObjectForPrototype hack for now.
- my $globalObject = IsSVGTypeNeedingContextParameter($implClassName) ? "deprecatedGlobalObjectForPrototype(exec)" : "$thisValue->globalObject()";
-
+ my $globalObject = "$thisValue->globalObject()";
if ($codeGenerator->IsPodType($type)) {
$implIncludes{"JS$type.h"} = 1;
@@ -1957,25 +1914,16 @@ sub NativeToJSValue
and $codeGenerator->IsPodTypeWithWriteableProperties($type)
and not defined $signature->extendedAttributes->{"Immutable"}) {
if ($codeGenerator->IsPodType($implClassName)) {
- return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapperWithPODTypeParent<$nativeType, $implClassName>::create($value, $thisValue->impl()).get(), $thisValue->context())";
+ return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapperWithPODTypeParent<$nativeType, $implClassName>::create($value, $thisValue->impl()).get(), JSSVGContextCache::svgContextForDOMObject(castedThis))";
} else {
return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapperWithParent<$nativeType, $implClassName>::create(imp, &${implClassName}::$getter, &${implClassName}::$setter).get(), imp)";
}
}
if ($implClassNameForValueConversion eq "") {
- # SVGZoomEvent has no context() pointer, and is also not an SVGElement.
- # This is not a problem, because SVGZoomEvent has no read/write properties.
- return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), 0)" if $implClassName eq "SVGZoomEvent";
-
- if (IsSVGTypeNeedingContextParameter($implClassName)) {
- return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), castedThisObj->context())" if $inFunctionCall;
- return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), $thisValue->context())";
- } else {
- return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), imp)";
- }
- } else { # These classes, always have a m_context pointer!
- return "toJS(exec, $globalObject, JSSVGDynamicPODTypeWrapperCache<$nativeType, $implClassNameForValueConversion>::lookupOrCreateWrapper(imp, &${implClassNameForValueConversion}::$getter, &${implClassNameForValueConversion}::$setter).get(), $thisValue->context())";
+ return "toJS(exec, $globalObject, JSSVGStaticPODTypeWrapper<$nativeType>::create($value).get(), 0 /* no context on purpose */)";
+ } else {
+ return "toJS(exec, $globalObject, JSSVGDynamicPODTypeWrapperCache<$nativeType, $implClassNameForValueConversion>::lookupOrCreateWrapper(imp, &${implClassNameForValueConversion}::$getter, &${implClassNameForValueConversion}::$setter).get(), JSSVGContextCache::svgContextForDOMObject(castedThis));"
}
}
@@ -2016,7 +1964,7 @@ sub NativeToJSValue
return $value if $codeGenerator->IsSVGAnimatedType($type);
if (IsSVGTypeNeedingContextParameter($type)) {
- my $contextPtr = IsSVGTypeNeedingContextParameter($implClassName) ? "$thisValue->context()" : "imp";
+ my $contextPtr = IsSVGTypeNeedingContextParameter($implClassName) ? "JSSVGContextCache::svgContextForDOMObject(castedThis)" : "imp";
return "toJS(exec, $globalObject, WTF::getPtr($value), $contextPtr)";
}
diff --git a/WebCore/svg/SVGAngle.h b/WebCore/svg/SVGAngle.h
index 9841098..3d0bdeb 100644
--- a/WebCore/svg/SVGAngle.h
+++ b/WebCore/svg/SVGAngle.h
@@ -27,8 +27,6 @@
namespace WebCore {
- class SVGStyledElement;
-
class SVGAngle {
public:
SVGAngle();
@@ -56,9 +54,6 @@ namespace WebCore {
void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits);
void convertToSpecifiedUnits(unsigned short unitType);
- // Throughout SVG 1.1 'SVGAngle' is only used for 'SVGMarkerElement' (orient-angle)
- const QualifiedName& associatedAttributeName() const { return SVGNames::orientAttr; }
-
private:
SVGAngleType m_unitType;
float m_value;
diff --git a/WebCore/svg/SVGPreserveAspectRatio.h b/WebCore/svg/SVGPreserveAspectRatio.h
index bbd9256..2be053c 100644
--- a/WebCore/svg/SVGPreserveAspectRatio.h
+++ b/WebCore/svg/SVGPreserveAspectRatio.h
@@ -84,8 +84,6 @@ namespace WebCore {
String valueAsString() const;
- const QualifiedName& associatedAttributeName() const { return SVGNames::preserveAspectRatioAttr; }
-
private:
unsigned short m_align;
unsigned short m_meetOrSlice;
diff --git a/WebCore/svg/SVGTransform.h b/WebCore/svg/SVGTransform.h
index 1e15468..aad7a60 100644
--- a/WebCore/svg/SVGTransform.h
+++ b/WebCore/svg/SVGTransform.h
@@ -54,7 +54,6 @@ namespace WebCore {
float angle() const;
FloatPoint rotationCenter() const;
-// void setMatrix(const TransformationMatrix&);
void setMatrix(TransformationMatrix);
void setTranslate(float tx, float ty);
@@ -69,9 +68,6 @@ namespace WebCore {
bool isValid();
- // Throughout SVG 1.1 'SVGTransform' is only used for the 'transform' attribute
- const QualifiedName& associatedAttributeName() const { return SVGNames::transformAttr; }
-
private:
SVGTransformType m_type;
float m_angle;
@@ -93,5 +89,3 @@ namespace WebCore {
#endif // ENABLE(SVG)
#endif
-
-// vim:ts=4:noet
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list