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

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: Remove keyframe view 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 {string}
2016 */
2017 id: function()
2018 {
2019 return this._payload.id;
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);
vsevik 2014/10/14 09:08:09 This could be done in constructor to avoid creatio
samli 2014/10/15 08:46:44 Done.
2068 },
2069
2070 /**
2071 * @param {function(?WebInspector.DOMModel.AnimationPlayer)} callback
2072 */
2073 pause: function(callback)
2074 {
2075 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "DOM Agent.pauseAnimationPlayer(): ", WebInspector.DOMModel.AnimationPlayer.bind(null , this._target));
2076 this.target().domModel._agent.pauseAnimationPlayer(this.id(), wrappedCal lback);
2077 },
2078
2079 /**
2080 * @param {function(?WebInspector.DOMModel.AnimationPlayer)} callback
2081 */
2082 play: function(callback)
2083 {
2084 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "DOM Agent.playAnimationPlayer(): ", WebInspector.DOMModel.AnimationPlayer.bind(null, this._target));
2085 this.target().domModel._agent.playAnimationPlayer(this.id(), wrappedCall back);
2086 },
2087
2088 /**
2089 * @param {number} currentTime
2090 * @param {function(?WebInspector.DOMModel.AnimationPlayer)} callback
2091 */
2092 setCurrentTime: function(currentTime, callback)
2093 {
2094 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "DOM Agent.setAnimationPlayerCurrentTime(): ", WebInspector.DOMModel.AnimationPlayer. bind(null, this._target));
2095 this.target().domModel._agent.setAnimationPlayerCurrentTime(this.id(), c urrentTime, wrappedCallback);
2096 },
2097
2098 /**
2099 * @param {function(number, boolean)} callback
2100 */
2101 getCurrentState: function(callback)
2102 {
2103 var target = this.target();
2104 /**
2105 * @param {?Protocol.Error} error
2106 * @param {number} currentTime
2107 * @param {boolean} isRunning
2108 */
2109 function mycallback(error, currentTime, isRunning)
2110 {
2111 callback(currentTime, isRunning);
vsevik 2014/10/14 09:08:09 You might want to add console.error calls when err
samli 2014/10/15 08:46:45 Done.
2112 }
2113 this.target().domModel._agent.getAnimationPlayerState(this.id(), mycallb ack);
2114 },
2115
2116 __proto__: WebInspector.SDKObject.prototype
2117 }
2118
2119 /**
2120 * @constructor
2121 * @extends {WebInspector.SDKObject}
2122 * @param {!WebInspector.Target} target
2123 * @param {!DOMAgent.AnimationNode} payload
2124 */
2125 WebInspector.DOMModel.AnimationNode = function(target, payload)
2126 {
2127 WebInspector.SDKObject.call(this, target);
2128 this._payload = payload;
2129 }
2130
2131 WebInspector.DOMModel.AnimationNode.prototype = {
2132 /**
2133 * @return {!DOMAgent.AnimationNode}
2134 */
2135 payload: function()
vsevik 2014/10/14 09:08:09 I don't think this is needed
samli 2014/10/15 08:46:45 Done.
2136 {
2137 return this._payload;
2138 },
2139
2140 /**
2141 * @return {number}
2142 */
2143 startDelay: function()
2144 {
2145 return this._payload.startDelay;
2146 },
2147
2148 /**
2149 * @return {number}
2150 */
2151 playbackRate: function()
2152 {
2153 return this._payload.playbackRate;
2154 },
2155
2156 /**
2157 * @return {number}
2158 */
2159 iterationStart: function()
2160 {
2161 return this._payload.iterationStart;
2162 },
2163
2164 /**
2165 * @return {number}
2166 */
2167 iterationCount: function()
2168 {
2169 return this._payload.iterationCount;
2170 },
2171
2172 /**
2173 * @return {number}
2174 */
2175 duration: function()
2176 {
2177 return this._payload.duration;
2178 },
2179
2180 /**
2181 * @return {number}
2182 */
2183 direction: function()
2184 {
2185 return this._payload.direction;
2186 },
2187
2188 /**
2189 * @return {number}
2190 */
2191 fillMode: function()
2192 {
2193 return this._payload.fillMode;
2194 },
2195
2196 /**
2197 * @return {number}
2198 */
2199 timeFraction: function()
2200 {
2201 return this._payload.timeFraction;
2202 },
2203
2204 /**
2205 * @return {string}
2206 */
2207 name: function()
2208 {
2209 return this._payload.name;
2210 },
2211
2212 __proto__: WebInspector.SDKObject.prototype
2213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698