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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/app-layout/app-scroll-effects/app-scroll-effects-behavior-extracted.js

Issue 2074813002: Roll Polymer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: chromium.patch Created 4 years, 6 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 * `Polymer.AppScrollEffectsBehavior` provides an interface that allows an ele ment to use scrolls effects. 2 * `Polymer.AppScrollEffectsBehavior` provides an interface that allows an ele ment to use scrolls effects.
3 * 3 *
4 * ### Importing the app-layout effects 4 * ### Importing the app-layout effects
5 * 5 *
6 * app-layout provides a set of scroll effects that can be used by explicitly importing 6 * app-layout provides a set of scroll effects that can be used by explicitly importing
7 * `app-scroll-effects.html`: 7 * `app-scroll-effects.html`:
8 * 8 *
9 * ```html 9 * ```html
10 * <link rel="import" href="/bower_components/app-layout/app-scroll-effects/ap p-scroll-effects.html"> 10 * <link rel="import" href="/bower_components/app-layout/app-scroll-effects/ap p-scroll-effects.html">
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 * Disables CSS transitions and scroll effects on the element. 126 * Disables CSS transitions and scroll effects on the element.
127 */ 127 */
128 disabled: { 128 disabled: {
129 type: Boolean, 129 type: Boolean,
130 reflectToAttribute: true, 130 reflectToAttribute: true,
131 value: false 131 value: false
132 } 132 }
133 }, 133 },
134 134
135 observers: [ 135 observers: [
136 '_effectsChanged(effects, effectsConfig)' 136 '_effectsChanged(effects, effectsConfig, isAttached)'
137 ], 137 ],
138 138
139 /** 139 /**
140 * Updates the scroll state. This method should be overridden 140 * Updates the scroll state. This method should be overridden
141 * by the consumer of this behavior. 141 * by the consumer of this behavior.
142 * 142 *
143 * @method _updateScrollState 143 * @method _updateScrollState
144 */ 144 */
145 _updateScrollState: function() {}, 145 _updateScrollState: function() {},
146 146
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 throw new ReferenceError(this._getUndefinedMsg(effectName)); 220 throw new ReferenceError(this._getUndefinedMsg(effectName));
221 } 221 }
222 var prop = this._boundEffect(effectDef, effectConfig || {}); 222 var prop = this._boundEffect(effectDef, effectConfig || {});
223 prop.setUp(); 223 prop.setUp();
224 return prop; 224 return prop;
225 }, 225 },
226 226
227 /** 227 /**
228 * Called when `effects` or `effectsConfig` changes. 228 * Called when `effects` or `effectsConfig` changes.
229 */ 229 */
230 _effectsChanged: function(effects, effectsConfig) { 230 _effectsChanged: function(effects, effectsConfig, isAttached) {
231 this._tearDownEffects(); 231 this._tearDownEffects();
232 232
233 if (effects === '') { 233 if (effects === '' || !isAttached) {
234 return; 234 return;
235 } 235 }
236 effects.split(' ').forEach(function(effectName) { 236 effects.split(' ').forEach(function(effectName) {
237 var effectDef; 237 var effectDef;
238 if (effectName !== '') { 238 if (effectName !== '') {
239 if ((effectDef = Polymer.AppLayout._scrollEffects[effectName])) { 239 if ((effectDef = Polymer.AppLayout._scrollEffects[effectName])) {
240 this._effects.push(this._boundEffect(effectDef, effectsConfig[effect Name])); 240 this._effects.push(this._boundEffect(effectDef, effectsConfig[effect Name]));
241 } else { 241 } else {
242 this._warn(this._logf('_effectsChanged', this._getUndefinedMsg(effec tName))); 242 this._warn(this._logf('_effectsChanged', this._getUndefinedMsg(effec tName)));
243 } 243 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 }, 322 },
323 323
324 /** 324 /**
325 * Overrides the `_scrollHandler`. 325 * Overrides the `_scrollHandler`.
326 */ 326 */
327 _scrollHandler: function() { 327 _scrollHandler: function() {
328 if (!this.disabled) { 328 if (!this.disabled) {
329 this._updateScrollState(this._clampedScrollTop); 329 this._updateScrollState(this._clampedScrollTop);
330 } 330 }
331 }, 331 },
332
333 /**
334 * Override this method to return a reference to a node in the local DOM.
335 * The node is consumed by a scroll effect.
336 *
337 * @param {string} id The id for the node.
338 */
339 _getDOMRef: function(id) {
340 this._warn(this._logf('_getDOMRef', '`'+ id +'` is undefined'));
341 },
332 342
333 _getUndefinedMsg: function(effectName) { 343 _getUndefinedMsg: function(effectName) {
334 return 'Scroll effect `' + effectName + '` is undefined. ' + 344 return 'Scroll effect `' + effectName + '` is undefined. ' +
335 'Did you forget to import app-layout/app-scroll-effects/effects/' + ef fectName + '.html ?'; 345 'Did you forget to import app-layout/app-scroll-effects/effects/' + ef fectName + '.html ?';
336 } 346 }
337 347
338 }]; 348 }];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698