Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Side by Side Diff: Source/devtools/front_end/sdk/DOMModel.js

Issue 620783002: Devtools Animations: Basic animation inspection & control in Styles pane (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review changes for AnimationSection Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 }, 864 },
865 865
866 /** 866 /**
867 * @param {function(?DOMAgent.BoxModel)} callback 867 * @param {function(?DOMAgent.BoxModel)} callback
868 */ 868 */
869 boxModel: function(callback) 869 boxModel: function(callback)
870 { 870 {
871 this._agent.getBoxModel(this.id, this._domModel._wrapClientCallback(call back)); 871 this._agent.getBoxModel(this.id, this._domModel._wrapClientCallback(call back));
872 }, 872 },
873 873
874 /**
875 * @param {function(?Array.<!WebInspector.DOMModel.AnimationPlayer>)} callba ck
876 */
877 animationPlayers: function(callback)
878 {
879 var target = this.target();
880 /**
881 * @param {?Protocol.Error} error
882 * @param {!Array.<!DOMAgent.AnimationPlayer>} payloads
883 */
884 function mycallback(error, payloads)
885 {
886 if (error) {
887 callback(null);
888 return;
889 }
890 callback(payloads.map(function(payload) {
891 return new WebInspector.DOMModel.AnimationPlayer(target, payload );
892 }));
893 }
894 this._agent.getAnimationPlayersForNode(this.id, mycallback);
895 },
896
874 __proto__: WebInspector.SDKObject.prototype 897 __proto__: WebInspector.SDKObject.prototype
875 } 898 }
876 899
877 /** 900 /**
878 * @param {!WebInspector.Target} target 901 * @param {!WebInspector.Target} target
879 * @param {number} backendNodeId 902 * @param {number} backendNodeId
880 * @constructor 903 * @constructor
881 */ 904 */
882 WebInspector.DeferredDOMNode = function(target, backendNodeId) 905 WebInspector.DeferredDOMNode = function(target, backendNodeId)
883 { 906 {
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 * @param {boolean} inspectUAShadowDOM 1982 * @param {boolean} inspectUAShadowDOM
1960 * @param {!DOMAgent.HighlightConfig} config 1983 * @param {!DOMAgent.HighlightConfig} config
1961 * @param {function(?Protocol.Error)=} callback 1984 * @param {function(?Protocol.Error)=} callback
1962 */ 1985 */
1963 setInspectModeEnabled: function(enabled, inspectUAShadowDOM, config, callbac k) 1986 setInspectModeEnabled: function(enabled, inspectUAShadowDOM, config, callbac k)
1964 { 1987 {
1965 WebInspector.overridesSupport.setTouchEmulationSuspended(enabled); 1988 WebInspector.overridesSupport.setTouchEmulationSuspended(enabled);
1966 this._agent.setInspectModeEnabled(enabled, inspectUAShadowDOM, config, c allback); 1989 this._agent.setInspectModeEnabled(enabled, inspectUAShadowDOM, config, c allback);
1967 } 1990 }
1968 } 1991 }
1992
1993 /**
1994 * @constructor
1995 * @extends {WebInspector.SDKObject}
1996 * @param {!WebInspector.Target} target
1997 * @param {!DOMAgent.AnimationPlayer} payload
1998 */
1999 WebInspector.DOMModel.AnimationPlayer = function(target, payload)
2000 {
2001 WebInspector.SDKObject.call(this, target);
2002 this._payload = payload;
2003 }
2004
2005 WebInspector.DOMModel.AnimationPlayer.prototype = {
2006 /**
2007 * @return {!DOMAgent.AnimationPlayer}
2008 */
2009 payload: function()
2010 {
2011 return this._payload;
2012 },
2013
2014 /**
2015 * @return {number}
2016 */
2017 sequenceNumber: function()
2018 {
2019 return this._payload.sequenceNumber;
2020 },
2021
2022 /**
2023 * @return {boolean}
2024 */
2025 paused: function()
2026 {
2027 return this._payload.paused;
2028 },
2029
2030 /**
2031 * @return {boolean}
2032 */
2033 finished: function()
2034 {
2035 return this._payload.finished;
2036 },
2037
2038 /**
2039 * @return {number}
2040 */
2041 playbackRate: function()
2042 {
2043 return this._payload.playbackRate;
2044 },
2045
2046 /**
2047 * @return {number}
2048 */
2049 startTime: function()
2050 {
2051 return this._payload.startTime;
2052 },
2053
2054 /**
2055 * @return {number}
2056 */
2057 currentTime: function()
2058 {
2059 return this._payload.currentTime;
2060 },
2061
2062 /**
2063 * @return {!WebInspector.DOMModel.AnimationNode}
2064 */
2065 animation: function()
2066 {
2067 return new WebInspector.DOMModel.AnimationNode(this.target(), this._payl oad.animation);
2068 },
2069
2070 /**
2071 * @param {function(?WebInspector.DOMModel.AnimationPlayer)} callback
2072 */
2073 pause: function(callback)
2074 {
2075 var target = this.target();
2076 /**
2077 * @param {?Protocol.Error} error
2078 * @param {!DOMAgent.AnimationPlayer} player
2079 */
2080 function mycallback(error, player)
caseq 2014/10/02 10:02:26 Here and below, please consider using InspectorBac
samli 2014/10/03 06:05:05 Done.
2081 {
2082 if (error) {
2083 callback(null);
2084 return;
2085 }
2086
2087 callback(new WebInspector.DOMModel.AnimationPlayer(target, player));
2088 }
2089 this.target().domModel._agent.pauseAnimationPlayer(this.sequenceNumber() , mycallback);
2090 },
2091
2092 /**
2093 * @param {function(?WebInspector.DOMModel.AnimationPlayer)} callback
2094 */
2095 play: function(callback)
2096 {
2097 var target = this.target();
2098 /**
2099 * @param {?Protocol.Error} error
2100 * @param {!DOMAgent.AnimationPlayer} player
2101 */
2102 function mycallback(error, player)
2103 {
2104 if (error) {
2105 callback(null);
2106 return;
2107 }
2108
2109 callback(new WebInspector.DOMModel.AnimationPlayer(target, player));
2110 }
2111 this.target().domModel._agent.playAnimationPlayer(this.sequenceNumber(), mycallback);
2112 },
2113
2114 /**
2115 * @param {number} currentTime
2116 * @param {function(?WebInspector.DOMModel.AnimationPlayer)} callback
2117 */
2118 setCurrentTime: function(currentTime, callback)
2119 {
2120 var target = this.target();
2121 /**
2122 * @param {?Protocol.Error} error
2123 * @param {!DOMAgent.AnimationPlayer} payload
2124 */
2125 function mycallback(error, payload)
2126 {
2127 if (error) {
2128 callback(null);
2129 return;
2130 }
2131 callback(new WebInspector.DOMModel.AnimationPlayer(target, payload)) ;
2132 }
2133 this.target().domModel._agent.setCurrentTimeAnimationPlayer(this.sequenc eNumber(), currentTime, mycallback);
2134 },
2135
2136 /**
2137 * @param {function(number, boolean)} callback
2138 */
2139 getCurrentState: function(callback)
2140 {
2141 var target = this.target();
2142 /**
2143 * @param {?Protocol.Error} error
2144 * @param {number} currentTime
2145 * @param {boolean} isRunning
2146 */
2147 function mycallback(error, currentTime, isRunning)
2148 {
2149 callback(currentTime, isRunning);
2150 }
2151 this.target().domModel._agent.getStateAnimationPlayer(this.sequenceNumbe r(), mycallback);
2152 },
2153
2154 __proto__: WebInspector.SDKObject.prototype
2155 }
2156
2157 /**
2158 * @constructor
2159 * @extends {WebInspector.SDKObject}
2160 * @param {!WebInspector.Target} target
2161 * @param {!DOMAgent.AnimationNode} payload
2162 */
2163 WebInspector.DOMModel.AnimationNode = function(target, payload)
2164 {
2165 WebInspector.SDKObject.call(this, target);
2166 this._payload = payload;
2167 }
2168
2169 WebInspector.DOMModel.AnimationNode.prototype = {
2170 /**
2171 * @return {!DOMAgent.AnimationNode}
2172 */
2173 payload: function()
2174 {
2175 return this._payload;
2176 },
2177
2178 /**
2179 * @return {number}
2180 */
2181 startDelay: function()
2182 {
2183 return this._payload.startDelay;
2184 },
2185
2186 /**
2187 * @return {number}
2188 */
2189 playbackRate: function()
2190 {
2191 return this._payload.playbackRate;
2192 },
2193
2194 /**
2195 * @return {number}
2196 */
2197 iterationStart: function()
2198 {
2199 return this._payload.iterationStart;
2200 },
2201
2202 /**
2203 * @return {number}
2204 */
2205 iterationCount: function()
2206 {
2207 return this._payload.iterationCount;
2208 },
2209
2210 /**
2211 * @return {number}
2212 */
2213 duration: function()
2214 {
2215 return this._payload.duration;
2216 },
2217
2218 /**
2219 * @return {number}
2220 */
2221 direction: function()
2222 {
2223 return this._payload.direction;
2224 },
2225
2226 /**
2227 * @return {number}
2228 */
2229 fillMode: function()
2230 {
2231 return this._payload.fillMode;
2232 },
2233
2234 /**
2235 * @return {number}
2236 */
2237 timeFraction: function()
2238 {
2239 return this._payload.timeFraction;
2240 },
2241
2242 __proto__: WebInspector.SDKObject.prototype
2243 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698