| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 installClass('HTMLMarqueeElement', function(HTMLMarqueeElementPrototype) { | 7 privateScriptController.installClass('HTMLMarqueeElement', function(HTMLMarqueeE
lementPrototype) { |
| 8 | 8 |
| 9 var kDefaultScrollAmount = 6; | 9 var kDefaultScrollAmount = 6; |
| 10 var kDefaultScrollDelayMS = 85; | 10 var kDefaultScrollDelayMS = 85; |
| 11 var kMinimumScrollDelayMS = 60; | 11 var kMinimumScrollDelayMS = 60; |
| 12 | 12 |
| 13 var kDefaultLoopLimit = -1; | 13 var kDefaultLoopLimit = -1; |
| 14 | 14 |
| 15 var kBehaviorScroll = 'scroll'; | 15 var kBehaviorScroll = 'scroll'; |
| 16 var kBehaviorSlide = 'slide'; | 16 var kBehaviorSlide = 'slide'; |
| 17 var kBehaviorAlternate = 'alternate'; | 17 var kBehaviorAlternate = 'alternate'; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 Object.defineProperty(HTMLMarqueeElementPrototype, 'scrollAmount', { | 156 Object.defineProperty(HTMLMarqueeElementPrototype, 'scrollAmount', { |
| 157 get: function() { | 157 get: function() { |
| 158 var value = this.getAttribute('scrollamount'); | 158 var value = this.getAttribute('scrollamount'); |
| 159 var scrollAmount = convertToLong(value); | 159 var scrollAmount = convertToLong(value); |
| 160 if (isNaN(scrollAmount) || scrollAmount < 0) | 160 if (isNaN(scrollAmount) || scrollAmount < 0) |
| 161 return kDefaultScrollAmount; | 161 return kDefaultScrollAmount; |
| 162 return scrollAmount; | 162 return scrollAmount; |
| 163 }, | 163 }, |
| 164 set: function(value) { | 164 set: function(value) { |
| 165 if (value < 0) | 165 if (value < 0) |
| 166 throwException(PrivateScriptDOMException.IndexSizeError, "The pr
ovided value (" + value + ") is negative."); | 166 privateScriptController.throwException(privateScriptController.D
OMException.IndexSizeError, "The provided value (" + value + ") is negative."); |
| 167 this.setAttribute('scrollamount', value); | 167 this.setAttribute('scrollamount', value); |
| 168 }, | 168 }, |
| 169 }); | 169 }); |
| 170 | 170 |
| 171 Object.defineProperty(HTMLMarqueeElementPrototype, 'scrollDelay', { | 171 Object.defineProperty(HTMLMarqueeElementPrototype, 'scrollDelay', { |
| 172 get: function() { | 172 get: function() { |
| 173 var value = this.getAttribute('scrolldelay'); | 173 var value = this.getAttribute('scrolldelay'); |
| 174 var scrollDelay = convertToLong(value); | 174 var scrollDelay = convertToLong(value); |
| 175 if (isNaN(scrollDelay) || scrollDelay < 0) | 175 if (isNaN(scrollDelay) || scrollDelay < 0) |
| 176 return kDefaultScrollDelayMS; | 176 return kDefaultScrollDelayMS; |
| 177 return scrollDelay; | 177 return scrollDelay; |
| 178 }, | 178 }, |
| 179 set: function(value) { | 179 set: function(value) { |
| 180 if (value < 0) | 180 if (value < 0) |
| 181 throwException(PrivateScriptDOMException.IndexSizeError, "The pr
ovided value (" + value + ") is negative."); | 181 privateScriptController.throwException(privateScriptController.D
OMException.IndexSizeError, "The provided value (" + value + ") is negative."); |
| 182 this.setAttribute('scrolldelay', value); | 182 this.setAttribute('scrolldelay', value); |
| 183 }, | 183 }, |
| 184 }); | 184 }); |
| 185 | 185 |
| 186 Object.defineProperty(HTMLMarqueeElementPrototype, 'loop', { | 186 Object.defineProperty(HTMLMarqueeElementPrototype, 'loop', { |
| 187 get: function() { | 187 get: function() { |
| 188 var value = this.getAttribute('loop'); | 188 var value = this.getAttribute('loop'); |
| 189 var loop = convertToLong(value); | 189 var loop = convertToLong(value); |
| 190 if (isNaN(loop) || loop <= 0) | 190 if (isNaN(loop) || loop <= 0) |
| 191 return kDefaultLoopLimit; | 191 return kDefaultLoopLimit; |
| 192 return loop; | 192 return loop; |
| 193 }, | 193 }, |
| 194 set: function(value) { | 194 set: function(value) { |
| 195 if (value <= 0 && value != -1) | 195 if (value <= 0 && value != -1) |
| 196 throwException(PrivateScriptDOMException.IndexSizeError, "The pr
ovided value (" + value + ") is neither positive nor -1."); | 196 privateScriptController.throwException(privateScriptController.D
OMException.IndexSizeError, "The provided value (" + value + ") is neither posit
ive nor -1."); |
| 197 this.setAttribute('loop', value); | 197 this.setAttribute('loop', value); |
| 198 }, | 198 }, |
| 199 }); | 199 }); |
| 200 | 200 |
| 201 HTMLMarqueeElementPrototype.getGetMetrics_ = function() { | 201 HTMLMarqueeElementPrototype.getGetMetrics_ = function() { |
| 202 if (this.direction === 'up' || this.direction === 'down') | 202 if (this.direction === 'up' || this.direction === 'down') |
| 203 this.mover_.style.height = '-webkit-max-content'; | 203 this.mover_.style.height = '-webkit-max-content'; |
| 204 else | 204 else |
| 205 this.mover_.style.width = '-webkit-max-content'; | 205 this.mover_.style.width = '-webkit-max-content'; |
| 206 | 206 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 cancelAnimationFrame(this.continueCallback_); | 380 cancelAnimationFrame(this.continueCallback_); |
| 381 this.continueCallback_ = null; | 381 this.continueCallback_ = null; |
| 382 return; | 382 return; |
| 383 } | 383 } |
| 384 | 384 |
| 385 if (this.player_) { | 385 if (this.player_) { |
| 386 this.player_.pause(); | 386 this.player_.pause(); |
| 387 } | 387 } |
| 388 }; | 388 }; |
| 389 }); | 389 }); |
| OLD | NEW |