Changeset 76677 in webkit
- Timestamp:
- Jan 26, 2011 1:18:17 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r76675 r76677 1 2011-01-26 James Robinson <jamesr@chromium.org> 2 3 Reviewed by Nate Chapin. 4 5 Add a DOMTimeStamp parameter to the requestAnimationFrame callback 6 https://bugs.webkit.org/show_bug.cgi?id=53142 7 8 Adds a test for the parameter passed to the requestAnimationFrame callback. 9 10 * fast/animation/request-animation-frame-timestamps-expected.txt: Added. 11 * fast/animation/request-animation-frame-timestamps.html: Added. 12 * fast/animation/script-tests/request-animation-frame-timestamps.js: Added. 13 1 14 2011-01-25 Yuzo Fujishima <yuzo@google.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r76676 r76677 1 2011-01-26 James Robinson <jamesr@chromium.org> 2 3 Reviewed by Nate Chapin. 4 5 Add a DOMTimeStamp parameter to the requestAnimationFrame callback 6 https://bugs.webkit.org/show_bug.cgi?id=53142 7 8 This adds a DOMTimeStamp parameter to the requestAnimationFrame callback to more 9 closely match mozilla's proposal. This is useful if the page has multiple imperative animations 10 and wants to ensure that they all remain synchronized. If each callback used Date.now() to 11 update its animation state, they would potentially be out of sync with each other. If they use 12 the timestamp then all callbacks for the same "frame" will update to the same state. 13 14 Test: fast/animation/request-animation-frame-timestamps.html 15 16 * bindings/scripts/CodeGeneratorV8.pm: 17 * bindings/scripts/test/V8/V8TestCallback.cpp: 18 (WebCore::V8TestCallback::callbackWithClass2Param): 19 * dom/Document.cpp: 20 (WebCore::Document::serviceScriptedAnimations): 21 * dom/Document.h: 22 * dom/RequestAnimationFrameCallback.h: 23 * dom/RequestAnimationFrameCallback.idl: 24 * page/FrameView.cpp: 25 (WebCore::FrameView::serviceScriptedAnimations): 26 * page/FrameView.h: 27 1 28 2011-01-25 Yuzo Fujishima <yuzo@google.com> 2 29 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r76531 r76677 2394 2394 foreach my $param (@params) { 2395 2395 my $paramName = $param->name; 2396 push(@implContent, " v8::Handle<v8::Value> ${paramName}Handle = toV8(${paramName});\n");2396 push(@implContent, " v8::Handle<v8::Value> ${paramName}Handle = " . NativeToJSValue($param, $paramName) . ";\n"); 2397 2397 push(@implContent, " if (${paramName}Handle.IsEmpty()) {\n"); 2398 2398 push(@implContent, " CRASH();\n"); … … 3090 3090 3091 3091 3092 sub ReturnNativeToJSValue3092 sub NativeToJSValue 3093 3093 { 3094 3094 my $signature = shift; … … 3097 3097 my $type = GetTypeFromSignature($signature); 3098 3098 3099 return " returnv8Boolean($value)" if $type eq "boolean";3100 return " returnv8::Handle<v8::Value>()" if $type eq "void"; # equivalent to v8::Undefined()3099 return "v8Boolean($value)" if $type eq "boolean"; 3100 return "v8::Handle<v8::Value>()" if $type eq "void"; # equivalent to v8::Undefined() 3101 3101 3102 3102 # HTML5 says that unsigned reflected attributes should be in the range … … 3105 3105 if ($signature->extendedAttributes->{"Reflect"} and ($type eq "unsigned long" or $type eq "unsigned short")) { 3106 3106 $value =~ s/getUnsignedIntegralAttribute/getIntegralAttribute/g; 3107 return " returnv8::Integer::NewFromUnsigned(std::max(0, " . $value . "))";3107 return "v8::Integer::NewFromUnsigned(std::max(0, " . $value . "))"; 3108 3108 } 3109 3109 … … 3111 3111 # we use Integer::New which has a fast Smi conversion check. 3112 3112 my $nativeType = GetNativeType($type); 3113 return " returnv8::Integer::New($value)" if $nativeType eq "int";3114 return " returnv8::Integer::NewFromUnsigned($value)" if $nativeType eq "unsigned";3115 3116 return " returnv8DateOrNull($value)" if $type eq "Date";3113 return "v8::Integer::New($value)" if $nativeType eq "int"; 3114 return "v8::Integer::NewFromUnsigned($value)" if $nativeType eq "unsigned"; 3115 3116 return "v8DateOrNull($value)" if $type eq "Date"; 3117 3117 # long long and unsigned long long are not representable in ECMAScript. 3118 return " returnv8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTimeStamp";3119 return " returnv8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType";3120 return " return$value.v8Value()" if $nativeType eq "ScriptValue";3118 return "v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long" or $type eq "DOMTimeStamp"; 3119 return "v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType"; 3120 return "$value.v8Value()" if $nativeType eq "ScriptValue"; 3121 3121 3122 3122 if ($codeGenerator->IsStringType($type)) { 3123 3123 my $conv = $signature->extendedAttributes->{"ConvertNullStringTo"}; 3124 3124 if (defined $conv) { 3125 return " returnv8StringOrNull($value)" if $conv eq "Null";3126 return " returnv8StringOrUndefined($value)" if $conv eq "Undefined";3127 return " returnv8StringOrFalse($value)" if $conv eq "False";3125 return "v8StringOrNull($value)" if $conv eq "Null"; 3126 return "v8StringOrUndefined($value)" if $conv eq "Undefined"; 3127 return "v8StringOrFalse($value)" if $conv eq "False"; 3128 3128 3129 3129 die "Unknown value for ConvertNullStringTo extended attribute"; 3130 3130 } 3131 3131 $conv = $signature->extendedAttributes->{"ConvertScriptString"}; 3132 return " returnv8StringOrNull($value)" if $conv;3133 return " returnv8String($value)";3132 return "v8StringOrNull($value)" if $conv; 3133 return "v8String($value)"; 3134 3134 } 3135 3135 … … 3138 3138 # special case for non-DOM node interfaces 3139 3139 if (IsDOMNodeType($type)) { 3140 return " returntoV8(${value}" . ($signature->extendedAttributes->{"ReturnsNew"} ? ", true)" : ")");3140 return "toV8(${value}" . ($signature->extendedAttributes->{"ReturnsNew"} ? ", true)" : ")"); 3141 3141 } 3142 3142 3143 3143 if ($type eq "EventTarget") { 3144 return " returnV8DOMWrapper::convertEventTargetToV8Object($value)";3144 return "V8DOMWrapper::convertEventTargetToV8Object($value)"; 3145 3145 } 3146 3146 3147 3147 if ($type eq "EventListener") { 3148 3148 $implIncludes{"V8AbstractEventListener.h"} = 1; 3149 return " return${value} ? v8::Handle<v8::Value>(static_cast<V8AbstractEventListener*>(${value})->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(v8::Null())";3149 return "${value} ? v8::Handle<v8::Value>(static_cast<V8AbstractEventListener*>(${value})->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(v8::Null())"; 3150 3150 } 3151 3151 3152 3152 if ($type eq "SerializedScriptValue") { 3153 3153 $implIncludes{"$type.h"} = 1; 3154 return " return$value->deserialize()";3154 return "$value->deserialize()"; 3155 3155 } 3156 3156 … … 3159 3159 $implIncludes{"wtf/GetPtr.h"} = 1; 3160 3160 3161 return "return toV8($value)"; 3161 return "toV8($value)"; 3162 } 3163 3164 sub ReturnNativeToJSValue 3165 { 3166 return "return " . NativeToJSValue(@_); 3162 3167 } 3163 3168 -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
r76277 r76677 30 30 #include "V8DOMString.h" 31 31 #include "V8Proxy.h" 32 #include <wtf/GetPtr.h> 33 #include <wtf/RefCounted.h> 34 #include <wtf/RefPtr.h> 32 35 33 36 #include <wtf/Assertions.h> … … 114 117 return true; 115 118 } 116 v8::Handle<v8::Value> strArgHandle = toV8(strArg);119 v8::Handle<v8::Value> strArgHandle = v8String(strArg); 117 120 if (strArgHandle.IsEmpty()) { 118 121 CRASH(); -
trunk/Source/WebCore/dom/Document.cpp
r76278 r76677 4987 4987 } 4988 4988 4989 void Document::serviceScriptedAnimations( )4989 void Document::serviceScriptedAnimations(DOMTimeStamp time) 4990 4990 { 4991 4991 if (!m_requestAnimationFrameCallbacks) … … 5015 5015 if (!callback->m_firedOrCancelled && (!callback->m_element || callback->m_element->renderer())) { 5016 5016 callback->m_firedOrCancelled = true; 5017 callback->handleEvent( );5017 callback->handleEvent(time); 5018 5018 firedCallback = true; 5019 5019 callbacks.remove(i); -
trunk/Source/WebCore/dom/Document.h
r76278 r76677 33 33 #include "Color.h" 34 34 #include "ContainerNode.h" 35 #include "DOMTimeStamp.h" 35 36 #include "DocumentTiming.h" 36 37 #include "QualifiedName.h" … … 1079 1080 int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>, Element*); 1080 1081 void webkitCancelRequestAnimationFrame(int id); 1081 void serviceScriptedAnimations( );1082 void serviceScriptedAnimations(DOMTimeStamp); 1082 1083 #endif 1083 1084 -
trunk/Source/WebCore/dom/RequestAnimationFrameCallback.h
r76278 r76677 41 41 public: 42 42 virtual ~RequestAnimationFrameCallback() { } 43 virtual bool handleEvent( ) = 0;43 virtual bool handleEvent(DOMTimeStamp) = 0; 44 44 45 45 RefPtr<Element> m_element; -
trunk/Source/WebCore/dom/RequestAnimationFrameCallback.idl
r76278 r76677 33 33 Callback=FunctionOnly,Conditional=REQUEST_ANIMATION_FRAME 34 34 ] RequestAnimationFrameCallback{ 35 boolean handleEvent( );35 boolean handleEvent(in DOMTimeStamp time); 36 36 }; 37 37 } -
trunk/Source/WebCore/page/FrameView.cpp
r76437 r76677 1652 1652 1653 1653 #if ENABLE(REQUEST_ANIMATION_FRAME) 1654 void FrameView::serviceScriptedAnimations( )1654 void FrameView::serviceScriptedAnimations(DOMTimeStamp time) 1655 1655 { 1656 1656 for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext()) 1657 frame->document()->serviceScriptedAnimations( );1657 frame->document()->serviceScriptedAnimations(time); 1658 1658 } 1659 1659 #endif -
trunk/Source/WebCore/page/FrameView.h
r76378 r76677 102 102 103 103 #if ENABLE(REQUEST_ANIMATION_FRAME) 104 void serviceScriptedAnimations( );104 void serviceScriptedAnimations(DOMTimeStamp); 105 105 #endif 106 106 -
trunk/Source/WebKit/chromium/ChangeLog
r76668 r76677 1 2011-01-26 James Robinson <jamesr@chromium.org> 2 3 Reviewed by Nate Chapin. 4 5 Add a DOMTimeStamp parameter to the requestAnimationFrame callback 6 https://bugs.webkit.org/show_bug.cgi?id=53142 7 8 Provides a timestamp to use for imperative animation callbacks. In this patch the timestamp is 9 just the current time at the start of the callback invocation algorithm. In the future we 10 could enhance this to try to take the compositing delay into effect to try to synchronize 11 imperative animations more closely with declarative ones, but this should do for now. 12 13 * src/WebViewImpl.cpp: 14 (WebKit::WebViewImpl::animate): 15 1 16 2011-01-25 Kent Tamura <tkent@chromium.org> 2 17 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r76340 r76677 122 122 #include "WebViewClient.h" 123 123 #include <wtf/ByteArray.h> 124 #include <wtf/CurrentTime.h> 124 125 #include <wtf/RefPtr.h> 125 126 … … 980 981 FrameView* view = webframe->frameView(); 981 982 if (view) 982 view->serviceScriptedAnimations( );983 view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime())); 983 984 } 984 985 #endif
Note: See TracChangeset
for help on using the changeset viewer.