diff options
author | ager@google.com <ager@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 14:23:54 +0000 |
---|---|---|
committer | ager@google.com <ager@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 14:23:54 +0000 |
commit | 2efd98c3394b2e8f244936d8e3e21fdf8af5c944 (patch) | |
tree | b8e6f9c0dc34408f213c5e85c1e7b797f0dc3880 /webkit/port | |
parent | f6c135caf66962d03f769d1255c62496f0c147c0 (diff) | |
download | chromium_src-2efd98c3394b2e8f244936d8e3e21fdf8af5c944.zip chromium_src-2efd98c3394b2e8f244936d8e3e21fdf8af5c944.tar.gz chromium_src-2efd98c3394b2e8f244936d8e3e21fdf8af5c944.tar.bz2 |
Fix a number of layout tests.
- Add v8 binding for animation and transition types.
- Update SVGPODTypeWrappers to follow the latest webkit changes.
- Remove a rebaselining that is no longer needed.
Review URL: http://codereview.chromium.org/7298
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3343 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r-- | webkit/port/DerivedSources.make | 6 | ||||
-rw-r--r-- | webkit/port/bindings/scripts/CodeGenerator.pm | 16 | ||||
-rw-r--r-- | webkit/port/bindings/scripts/CodeGeneratorV8.pm | 71 | ||||
-rw-r--r-- | webkit/port/bindings/v8/V8SVGPODTypeWrapper.h | 165 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.cpp | 52 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_index.cpp | 6 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_index.h | 4 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.cpp | 49 | ||||
-rw-r--r-- | webkit/port/page/DOMWindow.idl | 4 |
9 files changed, 253 insertions, 120 deletions
diff --git a/webkit/port/DerivedSources.make b/webkit/port/DerivedSources.make index f9622e7..870d73e 100644 --- a/webkit/port/DerivedSources.make +++ b/webkit/port/DerivedSources.make @@ -890,12 +890,16 @@ all : \ V8TreeWalker.h \ V8UIEvent.h \ V8VoidCallback.h \ + V8WebKitAnimationEvent.h \ V8WebKitCSSKeyframeRule.h \ V8WebKitCSSKeyframesRule.h \ + V8WebKitCSSTransformValue.h \ + V8WebKitTransitionEvent.h \ V8WheelEvent.h \ V8XMLHttpRequest.h \ - V8XMLHttpRequestUpload.h \ V8XMLHttpRequestException.h \ + V8XMLHttpRequestProgressEvent.h \ + V8XMLHttpRequestUpload.h \ V8XMLSerializer.h \ V8XPathEvaluator.h \ V8XPathException.h \ diff --git a/webkit/port/bindings/scripts/CodeGenerator.pm b/webkit/port/bindings/scripts/CodeGenerator.pm index d6900ee..d115459 100644 --- a/webkit/port/bindings/scripts/CodeGenerator.pm +++ b/webkit/port/bindings/scripts/CodeGenerator.pm @@ -35,14 +35,14 @@ my $codeGenerator = 0; my $verbose = 0; -my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, +my %primitiveTypeHash = ("int" => 1, "short" => 1, "long" => 1, "long long" => 1, "unsigned int" => 1, "unsigned short" => 1, "unsigned long" => 1, "float" => 1, "unsigned long long" => 1, "double" => 1, "boolean" => 1, "void" => 1); -my %podTypeHash = ("SVGLength" => 1, "SVGPoint" => 1, "SVGRect" => 1, "SVGNumber" => 1, "SVGMatrix" => 1, "SVGTransform" => 1); - +my %podTypeHash = ("SVGNumber" => 1, "SVGTransform" => 1); +my %podTypeWithWriteablePropertiesHash = ("SVGLength" => 1, "SVGMatrix" => 1, "SVGPoint" => 1, "SVGRect" => 1); my %stringTypeHash = ("DOMString" => 1, "AtomicString" => 1); my %nonPointerTypeHash = ("DOMTimeStamp" => 1, "CompareHow" => 1, "SVGPaintType" => 1); @@ -233,9 +233,19 @@ sub IsPodType my $type = shift; return 1 if $podTypeHash{$type}; + return 1 if $podTypeWithWriteablePropertiesHash{$type}; return 0; } +sub IsPodTypeWithWriteableProperties +{ + my $object = shift; + my $type = shift; + + return 1 if $podTypeWithWriteablePropertiesHash{$type}; + return 0; +} + sub IsPrimitiveType { my $object = shift; diff --git a/webkit/port/bindings/scripts/CodeGeneratorV8.pm b/webkit/port/bindings/scripts/CodeGeneratorV8.pm index 7186575..81391b9 100644 --- a/webkit/port/bindings/scripts/CodeGeneratorV8.pm +++ b/webkit/port/bindings/scripts/CodeGeneratorV8.pm @@ -452,13 +452,6 @@ sub GenerateNormalAttrGetter $attrIsPodType = 0; } - my $creatorType = ""; - if ($attrIsPodType) { - if ($codeGenerator->IsSVGAnimatedType($implClassName)) { - $creatorType = $implClassName; - } - } - my $getterStringUsesImp = $implClassName ne "double"; # Getter @@ -538,7 +531,30 @@ END my $wrapper; if ($attrIsPodType) { - $wrapper = GeneratePodTypeWrapper($attribute->signature, $getterString, $creatorType); + $implIncludes{"V8SVGPODTypeWrapper.h"} = 1; + + my $getter = $getterString; + $getter =~ s/imp->//; + $getter =~ s/\(\)//; + my $setter = "set" . WK_ucfirst($getter); + + my $implClassIsAnimatedType = $codeGenerator->IsSVGAnimatedType($implClassName); + if (not $implClassIsAnimatedType + and $codeGenerator->IsPodTypeWithWriteableProperties($attrType) + and not defined $attribute->signature->extendedAttributes->{"Immutable"}) { + if ($codeGenerator->IsPodType($implClassName)) { + $wrapper = "new V8SVGStaticPODTypeWrapperWithPODTypeParent<$nativeType, $implClassName>($getterString, imp_wrapper)"; + } else { + $wrapper = "new V8SVGStaticPODTypeWrapperWithParent<$nativeType, $implClassName>(imp, &${implClassName}::$getter, &${implClassName}::$setter)"; + } + } else { + if ($implClassIsAnimatedType) { + $wrapper = "V8SVGDynamicPODTypeWrapperCache<$nativeType, $implClassName>::lookupOrCreateWrapper(imp, &${implClassName}::$getter, &${implClassName}::$setter)"; + } else { + $wrapper = GenerateSVGStaticPodTypeWrapper($returnType, $getterString); + } + } + push(@implContentDecls, " Peerable* wrapper = $wrapper;\n"); } elsif ($nativeType ne "RGBColor") { push(@implContentDecls, " $nativeType v = "); @@ -1315,7 +1331,7 @@ sub GenerateFunctionCallString() $return = "wrapper"; } elsif ($returnsPodType) { $result .= $indent . "V8SVGPODTypeWrapper<" . $nativeReturnType . ">* wrapper = "; - $result .= GenerateReadOnlyPodTypeWrapper($returnType, $return) . ";\n"; + $result .= GenerateSVGStaticPodTypeWrapper($returnType, $return) . ";\n"; $return = "wrapper"; } @@ -1737,9 +1753,7 @@ sub NativeToJSValue { my $signature = shift; my $value = shift; - - my $signatureType = $signature->type; - my $type = $codeGenerator->StripModule($signatureType); + my $type = $codeGenerator->StripModule($signature->type); my $className= "V8$type"; return "v8::Date::New(static_cast<double>($value))" if $type eq "DOMTimeStamp"; @@ -1800,41 +1814,14 @@ sub NativeToJSValue my $classIndex = uc($type); if ($codeGenerator->IsPodType($type)) { - $value = GenerateReadOnlyPodTypeWrapper($type, $value); + $value = GenerateSVGStaticPodTypeWrapper($type, $value); } return "V8Proxy::ToV8Object(V8ClassIndex::$classIndex, $value)"; } } -sub GeneratePodTypeWrapper { - my $signature = shift; - my $value = shift; - my $creatorType = shift; - - my $signatureType = $signature->type; - my $type = $codeGenerator->StripModule($signatureType); - - my $classIndex = uc($type); - my $nativeType = GetNativeType($type); - $implIncludes{"V8$type.h"}=1; - $implIncludes{"V8SVGPODTypeWrapper.h"} = 1; - - if ($creatorType ne "") { - my $getter = $value; - $getter =~ s/imp->//; - $getter =~ s/\(\)//; - my $setter = "set" . WK_ucfirst($getter); - $value = "V8SVGPODTypeWrapperCache<$nativeType, $creatorType>::lookupOrCreateWrapper(imp, &${creatorType}::$getter, &${creatorType}::$setter)"; - } else { - $value = GenerateReadOnlyPodTypeWrapper($type, $value); - } - AddIncludesForType($type); - - return $value; -} - -sub GenerateReadOnlyPodTypeWrapper { +sub GenerateSVGStaticPodTypeWrapper { my $type = shift; my $value = shift; @@ -1842,7 +1829,7 @@ sub GenerateReadOnlyPodTypeWrapper { $implIncludes{"V8SVGPODTypeWrapper.h"} = 1; my $nativeType = GetNativeType($type); - return "new V8SVGPODTypeWrapperCreatorReadOnly<$nativeType>($value)"; + return "new V8SVGStaticPODTypeWrapper<$nativeType>($value)"; } # Internal helper diff --git a/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h b/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h index 94ddf5d..2638b79 100644 --- a/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h +++ b/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h @@ -1,6 +1,29 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. +/* + * Copyright (C) 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008 The Chromium Authors. 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 V8SVGPODTypeWrapper_h #define V8SVGPODTypeWrapper_h @@ -19,15 +42,11 @@ namespace WebCore { template<typename PODType> class V8SVGPODTypeWrapper : public RefCounted<V8SVGPODTypeWrapper<PODType> > { public: - V8SVGPODTypeWrapper() : RefCounted<V8SVGPODTypeWrapper<PODType> >(0) { - } - virtual ~V8SVGPODTypeWrapper() { - } - - // Getter wrapper + // Start with a refcount of 0 because the only reference to this + // object will be the JavaScript peer created for it. + V8SVGPODTypeWrapper() : RefCounted<V8SVGPODTypeWrapper<PODType> >(0) { } + virtual ~V8SVGPODTypeWrapper() { } virtual operator PODType() = 0; - - // Setter wrapper virtual void commitChange(PODType, SVGElement*) = 0; }; @@ -75,14 +94,14 @@ private: }; template<typename PODType> -class V8SVGPODTypeWrapperCreatorReadOnly : public V8SVGPODTypeWrapper<PODType> +class V8SVGStaticPODTypeWrapper : public V8SVGPODTypeWrapper<PODType> { public: - V8SVGPODTypeWrapperCreatorReadOnly(PODType type) + V8SVGStaticPODTypeWrapper(PODType type) : m_podType(type) { } - virtual ~V8SVGPODTypeWrapperCreatorReadOnly() { } + virtual ~V8SVGStaticPODTypeWrapper() { } // Getter wrapper virtual operator PODType() { return m_podType; } @@ -97,15 +116,69 @@ private: PODType m_podType; }; +template<typename PODType, typename ParentTypeArg> +class V8SVGStaticPODTypeWrapperWithPODTypeParent : public V8SVGStaticPODTypeWrapper<PODType> { +public: + typedef V8SVGPODTypeWrapper<ParentTypeArg> ParentType; + + V8SVGStaticPODTypeWrapperWithPODTypeParent(PODType type, ParentType* parent) + : V8SVGStaticPODTypeWrapper<PODType>(type) + , m_parentType(parent) + { + } + + virtual void commitChange(PODType type, SVGElement* context) + { + V8SVGStaticPODTypeWrapper<PODType>::commitChange(type, context); + m_parentType->commitChange(ParentTypeArg(type), context); + } + +private: + RefPtr<ParentType> m_parentType; +}; + +template<typename PODType, typename ParentType> +class V8SVGStaticPODTypeWrapperWithParent : public V8SVGPODTypeWrapper<PODType> { +public: + typedef PODType (ParentType::*GetterMethod)() const; + typedef void (ParentType::*SetterMethod)(const PODType&); + + V8SVGStaticPODTypeWrapperWithParent(ParentType* parent, GetterMethod getter, SetterMethod setter) + : m_parent(parent) + , m_getter(getter) + , m_setter(setter) + { + ASSERT(m_parent); + ASSERT(m_getter); + ASSERT(m_setter); + } + + virtual operator PODType() + { + return (m_parent.get()->*m_getter)(); + } + + virtual void commitChange(PODType type, SVGElement* context) + { + (m_parent.get()->*m_setter)(type); + } + +private: + // Update callbacks + RefPtr<ParentType> m_parent; + GetterMethod m_getter; + SetterMethod m_setter; +}; + template<typename PODType, typename PODTypeCreator> -class V8SVGPODTypeWrapperCreatorReadWrite : public V8SVGPODTypeWrapper<PODType> +class V8SVGDynamicPODTypeWrapper : public V8SVGPODTypeWrapper<PODType> { public: typedef PODType (PODTypeCreator::*GetterMethod)() const; typedef void (PODTypeCreator::*SetterMethod)(PODType); typedef void (*CacheRemovalCallback)(V8SVGPODTypeWrapper<PODType>*); - V8SVGPODTypeWrapperCreatorReadWrite(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter, CacheRemovalCallback cacheRemovalCallback) + V8SVGDynamicPODTypeWrapper(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter, CacheRemovalCallback cacheRemovalCallback) : m_creator(creator) , m_getter(getter) , m_setter(setter) @@ -117,7 +190,7 @@ public: ASSERT(cacheRemovalCallback); } - virtual ~V8SVGPODTypeWrapperCreatorReadWrite() { + virtual ~V8SVGDynamicPODTypeWrapper() { ASSERT(m_cacheRemovalCallback); (*m_cacheRemovalCallback)(this); @@ -129,9 +202,6 @@ public: // Setter wrapper virtual void commitChange(PODType type, SVGElement* context) { - if (!m_setter) - return; - (m_creator.get()->*m_setter)(type); if (context) @@ -148,19 +218,19 @@ private: // Caching facilities template<typename PODType, typename PODTypeCreator> -struct PODTypeReadWriteHashInfo { +struct PODTypeWrapperCacheInfo { typedef PODType (PODTypeCreator::*GetterMethod)() const; typedef void (PODTypeCreator::*SetterMethod)(PODType); // Empty value - PODTypeReadWriteHashInfo() + PODTypeWrapperCacheInfo() : creator(0) , getter(0) , setter(0) { } // Deleted value - explicit PODTypeReadWriteHashInfo(WTF::HashTableDeletedValueType) + explicit PODTypeWrapperCacheInfo(WTF::HashTableDeletedValueType) : creator(reinterpret_cast<PODTypeCreator*>(-1)) { } @@ -169,7 +239,7 @@ struct PODTypeReadWriteHashInfo { return creator == reinterpret_cast<PODTypeCreator*>(-1); } - PODTypeReadWriteHashInfo(PODTypeCreator* _creator, GetterMethod _getter, SetterMethod _setter) + PODTypeWrapperCacheInfo(PODTypeCreator* _creator, GetterMethod _getter, SetterMethod _setter) : creator(_creator) , getter(_getter) , setter(_setter) @@ -178,7 +248,7 @@ struct PODTypeReadWriteHashInfo { ASSERT(getter); } - bool operator==(const PODTypeReadWriteHashInfo& other) const + bool operator==(const PODTypeWrapperCacheInfo& other) const { return creator == other.creator && getter == other.getter && setter == other.setter; } @@ -189,13 +259,13 @@ struct PODTypeReadWriteHashInfo { }; template<typename PODType, typename PODTypeCreator> -struct PODTypeReadWriteHashInfoHash { - static unsigned hash(const PODTypeReadWriteHashInfo<PODType, PODTypeCreator>& info) +struct PODTypeWrapperCacheInfoHash { + static unsigned hash(const PODTypeWrapperCacheInfo<PODType, PODTypeCreator>& info) { - return StringImpl::computeHash((::UChar*) &info, sizeof(PODTypeReadWriteHashInfo<PODType, PODTypeCreator>) / sizeof(::UChar)); + return StringImpl::computeHash((::UChar*) &info, sizeof(PODTypeWrapperCacheInfo<PODType, PODTypeCreator>) / sizeof(::UChar)); } - static bool equal(const PODTypeReadWriteHashInfo<PODType, PODTypeCreator>& a, const PODTypeReadWriteHashInfo<PODType, PODTypeCreator>& b) + static bool equal(const PODTypeWrapperCacheInfo<PODType, PODTypeCreator>& a, const PODTypeWrapperCacheInfo<PODType, PODTypeCreator>& b) { return a == b; } @@ -204,8 +274,8 @@ struct PODTypeReadWriteHashInfoHash { }; template<typename PODType, typename PODTypeCreator> -struct PODTypeReadWriteHashInfoTraits : WTF::GenericHashTraits<PODTypeReadWriteHashInfo<PODType, PODTypeCreator> > { - typedef PODTypeReadWriteHashInfo<PODType, PODTypeCreator> CacheInfo; +struct PODTypeWrapperCacheInfoTraits : WTF::GenericHashTraits<PODTypeWrapperCacheInfo<PODType, PODTypeCreator> > { + typedef PODTypeWrapperCacheInfo<PODType, PODTypeCreator> CacheInfo; static const bool emptyValueIsZero = true; static const bool needsDestruction = false; @@ -228,31 +298,38 @@ struct PODTypeReadWriteHashInfoTraits : WTF::GenericHashTraits<PODTypeReadWriteH }; template<typename PODType, typename PODTypeCreator> -class V8SVGPODTypeWrapperCache +class V8SVGDynamicPODTypeWrapperCache { public: typedef PODType (PODTypeCreator::*GetterMethod)() const; typedef void (PODTypeCreator::*SetterMethod)(PODType); - typedef HashMap<PODTypeReadWriteHashInfo<PODType, PODTypeCreator>, V8SVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator>*, PODTypeReadWriteHashInfoHash<PODType, PODTypeCreator>, PODTypeReadWriteHashInfoTraits<PODType, PODTypeCreator> > ReadWriteHashMap; - typedef typename ReadWriteHashMap::const_iterator ReadWriteHashMapIterator; + typedef PODTypeWrapperCacheInfo<PODType, PODTypeCreator> CacheInfo; + typedef PODTypeWrapperCacheInfoHash<PODType, PODTypeCreator> CacheInfoHash; + typedef PODTypeWrapperCacheInfoTraits<PODType, PODTypeCreator> CacheInfoTraits; + + typedef V8SVGPODTypeWrapper<PODType> WrapperBase; + typedef V8SVGDynamicPODTypeWrapper<PODType, PODTypeCreator> DynamicWrapper; + + typedef HashMap<CacheInfo, DynamicWrapper*, CacheInfoHash, CacheInfoTraits> DynamicWrapperHashMap; + typedef typename DynamicWrapperHashMap::const_iterator DynamicWrapperHashMapIterator; - static ReadWriteHashMap& readWriteHashMap() + static DynamicWrapperHashMap& dynamicWrapperHashMap() { - static ReadWriteHashMap _readWriteHashMap; - return _readWriteHashMap; + static DynamicWrapperHashMap _dynamicWrapperHashMap; + return _dynamicWrapperHashMap; } // Used for readwrite attributes only - static V8SVGPODTypeWrapper<PODType>* lookupOrCreateWrapper(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter) + static WrapperBase* lookupOrCreateWrapper(PODTypeCreator* creator, GetterMethod getter, SetterMethod setter) { - ReadWriteHashMap& map(readWriteHashMap()); - PODTypeReadWriteHashInfo<PODType, PODTypeCreator> info(creator, getter, setter); + DynamicWrapperHashMap& map(dynamicWrapperHashMap()); + CacheInfo info(creator, getter, setter); if (map.contains(info)) return map.get(info); - V8SVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator>* wrapper = new V8SVGPODTypeWrapperCreatorReadWrite<PODType, PODTypeCreator>( + DynamicWrapper* wrapper = new V8SVGDynamicPODTypeWrapper<PODType, PODTypeCreator>( creator, getter, setter, forgetWrapper); map.set(info, wrapper); return wrapper; @@ -260,10 +337,10 @@ public: static void forgetWrapper(V8SVGPODTypeWrapper<PODType>* wrapper) { - ReadWriteHashMap& map(readWriteHashMap()); + DynamicWrapperHashMap& map(dynamicWrapperHashMap()); - ReadWriteHashMapIterator it = map.begin(); - ReadWriteHashMapIterator end = map.end(); + DynamicWrapperHashMapIterator it = map.begin(); + DynamicWrapperHashMapIterator end = map.end(); for (; it != end; ++it) { if (it->second != wrapper) diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp index ea290e0..032e30e 100644 --- a/webkit/port/bindings/v8/v8_custom.cpp +++ b/webkit/port/bindings/v8/v8_custom.cpp @@ -3238,6 +3238,33 @@ CALLBACK_FUNC_DECL(NSResolverLookupNamespaceURI) { return v8::Undefined(); } + +static String EventNameFromAttributeName(const String& name) { + ASSERT(name.startsWith("on")); + String event_type = name.substring(2); + + if (event_type.startsWith("w")) { + switch(event_type[event_type.length() - 1]) { + case 't': + event_type = "webkitAnimationStart"; + break; + case 'n': + event_type = "webkitAnimationIteration"; + break; + case 'd': + ASSERT(event_type.length() > 7); + if (event_type[7] == 'a') + event_type = "webkitAnimationEnd"; + else + event_type = "webkitTransitionEnd"; + break; + } + } + + return event_type; +} + + ACCESSOR_SETTER(DOMWindowEventHandler) { v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper( V8ClassIndex::DOMWINDOW, info.This()); @@ -3253,11 +3280,9 @@ ACCESSOR_SETTER(DOMWindowEventHandler) { if (!doc) return; - // Name starts with 'on', remove them. String key = ToWebCoreString(name); - ASSERT(key.startsWith("on")); - String event_type = key.substring(2); - + String event_type = EventNameFromAttributeName(key); + if (value->IsNull()) { // Clear the event listener doc->removeHTMLWindowEventListener(event_type); @@ -3290,10 +3315,8 @@ ACCESSOR_GETTER(DOMWindowEventHandler) { if (!doc) return v8::Undefined(); - // Name starts with 'on', remove them. String key = ToWebCoreString(name); - ASSERT(key.startsWith("on")); - String event_type = key.substring(2); + String event_type = EventNameFromAttributeName(key); EventListener* listener = doc->getHTMLWindowEventListener(event_type); return V8Proxy::EventListenerToV8Object(listener); @@ -3370,14 +3393,17 @@ ACCESSOR_SETTER(HTMLOptionsCollectionLength) { ACCESSOR_GETTER(SVGLengthValue) { INC_STATS(L"DOM.SVGLength.value"); V8SVGPODTypeWrapper<SVGLength>* wrapper = V8Proxy::ToNativeObject<V8SVGPODTypeWrapper<SVGLength> >(V8ClassIndex::SVGLENGTH, info.Holder()); - SVGLength imp_instance = *wrapper; - SVGLength* imp = &imp_instance; - return v8::Number::New(imp->value(V8Proxy::GetSVGContext(wrapper))); + SVGLength imp = *wrapper; + return v8::Number::New(imp.value(V8Proxy::GetSVGContext(wrapper))); } CALLBACK_FUNC_DECL(SVGLengthConvertToSpecifiedUnits) { INC_STATS(L"DOM.SVGLength.convertToSpecifiedUnits"); - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); + V8SVGPODTypeWrapper<SVGLength>* wrapper = V8Proxy::ToNativeObject<V8SVGPODTypeWrapper<SVGLength> >(V8ClassIndex::SVGLENGTH, args.Holder()); + SVGLength imp = *wrapper; + SVGElement* context = V8Proxy::GetSVGContext(wrapper); + imp.convertToSpecifiedUnits(ToInt32(args[0]), context); + wrapper->commitChange(imp, context); return v8::Undefined(); } @@ -3397,7 +3423,7 @@ CALLBACK_FUNC_DECL(SVGMatrixInverse) { } Peerable* peer = static_cast<Peerable*>( - new V8SVGPODTypeWrapperCreatorReadOnly<AffineTransform>(result)); + new V8SVGStaticPODTypeWrapper<AffineTransform>(result)); return V8Proxy::ToV8Object(V8ClassIndex::SVGMATRIX, peer); } @@ -3420,7 +3446,7 @@ CALLBACK_FUNC_DECL(SVGMatrixRotateFromVector) { } Peerable* peer = static_cast<Peerable*>( - new V8SVGPODTypeWrapperCreatorReadOnly<AffineTransform>(result)); + new V8SVGStaticPODTypeWrapper<AffineTransform>(result)); return V8Proxy::ToV8Object(V8ClassIndex::SVGMATRIX, peer); } diff --git a/webkit/port/bindings/v8/v8_index.cpp b/webkit/port/bindings/v8/v8_index.cpp index 821072f..da59756 100644 --- a/webkit/port/bindings/v8/v8_index.cpp +++ b/webkit/port/bindings/v8/v8_index.cpp @@ -155,8 +155,11 @@ #include "V8EventTargetNode.h" #include "V8KeyboardEvent.h" #include "V8MouseEvent.h" +#include "V8WebKitAnimationEvent.h" #include "V8WebKitCSSKeyframeRule.h" #include "V8WebKitCSSKeyframesRule.h" +#include "V8WebKitCSSTransformValue.h" +#include "V8WebKitTransitionEvent.h" #include "V8WheelEvent.h" #include "V8UIEvent.h" #include "V8MutationEvent.h" @@ -182,8 +185,9 @@ #include "V8XPathExpression.h" #include "V8XPathNSResolver.h" #include "V8XMLHttpRequest.h" -#include "V8XMLHttpRequestUpload.h" #include "V8XMLHttpRequestException.h" +#include "V8XMLHttpRequestProgressEvent.h" +#include "V8XMLHttpRequestUpload.h" #include "V8XMLSerializer.h" #include "V8XPathEvaluator.h" #include "V8XSLTProcessor.h" diff --git a/webkit/port/bindings/v8/v8_index.h b/webkit/port/bindings/v8/v8_index.h index 538326d..4be3f1bf9 100644 --- a/webkit/port/bindings/v8/v8_index.h +++ b/webkit/port/bindings/v8/v8_index.h @@ -275,12 +275,16 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); V(TEXTMETRICS, TextMetrics) \ V(TREEWALKER, TreeWalker) \ V(UIEVENT, UIEvent) \ + V(WEBKITANIMATIONEVENT, WebKitAnimationEvent) \ V(WEBKITCSSKEYFRAMERULE, WebKitCSSKeyframeRule) \ V(WEBKITCSSKEYFRAMESRULE, WebKitCSSKeyframesRule) \ + V(WEBKITCSSTRANSFORMVALUE, WebKitCSSTransformValue) \ + V(WEBKITTRANSITIONEVENT, WebKitTransitionEvent) \ V(WHEELEVENT, WheelEvent) \ V(XMLHTTPREQUEST, XMLHttpRequest) \ V(XMLHTTPREQUESTUPLOAD, XMLHttpRequestUpload) \ V(XMLHTTPREQUESTEXCEPTION, XMLHttpRequestException) \ + V(XMLHTTPREQUESTPROGRESSEVENT, XMLHttpRequestProgressEvent) \ V(XMLSERIALIZER, XMLSerializer) \ V(XPATHEVALUATOR, XPathEvaluator) \ V(XPATHEXCEPTION, XPathException) \ diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp index d6055ea..2d4109a 100644 --- a/webkit/port/bindings/v8/v8_proxy.cpp +++ b/webkit/port/bindings/v8/v8_proxy.cpp @@ -86,6 +86,7 @@ #include "ScriptController.h" #include "NodeFilter.h" #include "SecurityOrigin.h" +#include "WebKitCSSTransformValue.h" #include "XMLHttpRequestException.h" #include "XPathException.h" @@ -93,6 +94,7 @@ #include "SVGElement.h" #include "SVGElementInstance.h" #include "SVGException.h" +#include "SVGZoomEvent.h" #endif #if ENABLE(XPATH) @@ -2312,24 +2314,37 @@ v8::Handle<v8::Value> V8Proxy::EventToV8Object(Event* event) V8ClassIndex::V8WrapperType type = V8ClassIndex::EVENT; - if (event->isKeyboardEvent()) - type = V8ClassIndex::KEYBOARDEVENT; - else if (event->isMouseEvent()) - type = V8ClassIndex::MOUSEEVENT; - else if (event->isMessageEvent()) - type = V8ClassIndex::MESSAGEEVENT; - else if (event->isWheelEvent()) - type = V8ClassIndex::WHEELEVENT; - else if (event->isTextEvent()) - type = V8ClassIndex::TEXTEVENT; - else if (event->isUIEvent()) - type = V8ClassIndex::UIEVENT; - else if (event->isMutationEvent()) + if (event->isUIEvent()) { + if (event->isKeyboardEvent()) + type = V8ClassIndex::KEYBOARDEVENT; + else if (event->isTextEvent()) + type = V8ClassIndex::TEXTEVENT; + else if (event->isMouseEvent()) + type = V8ClassIndex::MOUSEEVENT; + else if (event->isWheelEvent()) + type = V8ClassIndex::WHEELEVENT; +#if ENABLE(SVG) + else if (event->isSVGZoomEvent()) + type = V8ClassIndex::SVGZOOMEVENT; +#endif + else + type = V8ClassIndex::UIEVENT; + } else if (event->isMutationEvent()) type = V8ClassIndex::MUTATIONEVENT; else if (event->isOverflowEvent()) type = V8ClassIndex::OVERFLOWEVENT; - else if (event->isProgressEvent()) - type = V8ClassIndex::PROGRESSEVENT; + else if (event->isMessageEvent()) + type = V8ClassIndex::MESSAGEEVENT; + else if (event->isProgressEvent()) { + if (event->isXMLHttpRequestProgressEvent()) + type = V8ClassIndex::XMLHTTPREQUESTPROGRESSEVENT; + else + type = V8ClassIndex::PROGRESSEVENT; + } else if (event->isWebKitAnimationEvent()) + type = V8ClassIndex::WEBKITANIMATIONEVENT; + else if (event->isWebKitTransitionEvent()) + type = V8ClassIndex::WEBKITTRANSITIONEVENT; + // Set the peer object for future access. v8::Handle<v8::Object> result = @@ -2582,7 +2597,9 @@ v8::Handle<v8::Value> V8Proxy::CSSValueToV8Object(CSSValue* value) { V8ClassIndex::V8WrapperType type; - if (value->isValueList()) + if (value->isWebKitCSSTransformValue()) + type = V8ClassIndex::WEBKITCSSTRANSFORMVALUE; + else if (value->isValueList()) type = V8ClassIndex::CSSVALUELIST; else if (value->isPrimitiveValue()) type = V8ClassIndex::CSSPRIMITIVEVALUE; diff --git a/webkit/port/page/DOMWindow.idl b/webkit/port/page/DOMWindow.idl index 6626c31..e6e0c31 100644 --- a/webkit/port/page/DOMWindow.idl +++ b/webkit/port/page/DOMWindow.idl @@ -445,6 +445,10 @@ module window { attribute [Custom=DOMWindowEventHandler] DOMString onsubmit; attribute [Custom=DOMWindowEventHandler] DOMString onunload; attribute [Custom=DOMWindowEventHandler] DOMString onbeforeunload; + attribute [Custom=DOMWindowEventHandler] DOMString onwebkitanimationstart; + attribute [Custom=DOMWindowEventHandler] DOMString onwebkitanimationiteration; + attribute [Custom=DOMWindowEventHandler] DOMString onwebkitanimationend; + attribute [Custom=DOMWindowEventHandler] DOMString onwebkittransitionend; #endif // defined(V8_BINDING) }; } |