layout/style/xbl-marquee/xbl-marquee.xml

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 5
michael@0 6 <bindings id="marqueeBindings"
michael@0 7 xmlns="http://www.mozilla.org/xbl"
michael@0 8 xmlns:html="http://www.w3.org/1999/xhtml"
michael@0 9 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 10 xmlns:xbl="http://www.mozilla.org/xbl">
michael@0 11
michael@0 12
michael@0 13 <binding id="marquee">
michael@0 14
michael@0 15 <resources>
michael@0 16 <stylesheet src="chrome://xbl-marquee/content/xbl-marquee.css"/>
michael@0 17 </resources>
michael@0 18 <implementation>
michael@0 19
michael@0 20 <property name="scrollAmount" exposeToUntrustedContent="true">
michael@0 21 <getter>
michael@0 22 <![CDATA[
michael@0 23 var val = parseInt(this.getAttribute("scrollamount"));
michael@0 24
michael@0 25 if (val <= 0 || isNaN(val))
michael@0 26 return this._scrollAmount;
michael@0 27
michael@0 28 return val;
michael@0 29 ]]>
michael@0 30 </getter>
michael@0 31 <setter>
michael@0 32 this.setAttribute("scrollamount", val);
michael@0 33 </setter>
michael@0 34 </property>
michael@0 35
michael@0 36 <property name="scrollDelay" exposeToUntrustedContent="true">
michael@0 37 <getter>
michael@0 38 <![CDATA[
michael@0 39 var val = parseInt(this.getAttribute("scrolldelay"));
michael@0 40
michael@0 41 if (val <= 0 || isNaN(val))
michael@0 42 return this._scrollDelay;
michael@0 43
michael@0 44 return val;
michael@0 45 ]]>
michael@0 46 </getter>
michael@0 47 <setter>
michael@0 48 this.setAttribute("scrolldelay", val);
michael@0 49 </setter>
michael@0 50 </property>
michael@0 51
michael@0 52 <property name="trueSpeed" exposeToUntrustedContent="true">
michael@0 53 <getter>
michael@0 54 <![CDATA[
michael@0 55 if (!this.hasAttribute("truespeed"))
michael@0 56 return false;
michael@0 57
michael@0 58 return true;
michael@0 59 ]]>
michael@0 60 </getter>
michael@0 61 <setter>
michael@0 62 <![CDATA[
michael@0 63 if (val)
michael@0 64 this.setAttribute("truespeed", "truespeed");
michael@0 65 else
michael@0 66 this.removeAttribute('truespeed');
michael@0 67 ]]>
michael@0 68 </setter>
michael@0 69 </property>
michael@0 70
michael@0 71 <property name="direction" exposeToUntrustedContent="true">
michael@0 72 <getter>
michael@0 73 return this.getAttribute("direction");
michael@0 74 </getter>
michael@0 75 <setter>
michael@0 76 this.setAttribute("direction", val);
michael@0 77 </setter>
michael@0 78 </property>
michael@0 79
michael@0 80 <property name="behavior" exposeToUntrustedContent="true">
michael@0 81 <getter>
michael@0 82 return this._behavior;
michael@0 83 </getter>
michael@0 84 <setter>
michael@0 85 this.setAttribute("behavior", val);
michael@0 86 </setter>
michael@0 87 </property>
michael@0 88
michael@0 89
michael@0 90 <property name="loop" exposeToUntrustedContent="true">
michael@0 91 <getter>
michael@0 92 <![CDATA[
michael@0 93 var val = parseInt(this.getAttribute('loop'));
michael@0 94
michael@0 95 if (val < -1 || isNaN(val))
michael@0 96 return this._loop;
michael@0 97
michael@0 98 return val;
michael@0 99 ]]>
michael@0 100 </getter>
michael@0 101 <setter>
michael@0 102 this.setAttribute("loop", val);
michael@0 103 </setter>
michael@0 104 </property>
michael@0 105
michael@0 106
michael@0 107 <property name="onstart" exposeToUntrustedContent="true">
michael@0 108 <getter>
michael@0 109 return this.getAttribute("onstart");
michael@0 110 </getter>
michael@0 111 <setter>
michael@0 112 this._setEventListener("start", val, true);
michael@0 113 this.setAttribute("onstart", val);
michael@0 114 </setter>
michael@0 115 </property>
michael@0 116
michael@0 117 <property name="onfinish" exposeToUntrustedContent="true">
michael@0 118 <getter>
michael@0 119 return this.getAttribute("onfinish");
michael@0 120 </getter>
michael@0 121 <setter>
michael@0 122 this._setEventListener("finish", val, true);
michael@0 123 this.setAttribute("onfinish", val);
michael@0 124 </setter>
michael@0 125 </property>
michael@0 126
michael@0 127 <property name="onbounce" exposeToUntrustedContent="true">
michael@0 128 <getter>
michael@0 129 return this.getAttribute("onbounce");
michael@0 130 </getter>
michael@0 131 <setter>
michael@0 132 this._setEventListener("bounce", val, true);
michael@0 133 this.setAttribute("onbounce", val);
michael@0 134 </setter>
michael@0 135 </property>
michael@0 136
michael@0 137 <property name="outerDiv"
michael@0 138 onget="return document.getAnonymousNodes(this)[0]"
michael@0 139 />
michael@0 140
michael@0 141 <property name="innerDiv"
michael@0 142 onget="return document.getAnonymousElementByAttribute(this, 'class', 'innerDiv');"
michael@0 143 />
michael@0 144
michael@0 145 <property name="height" exposeToUntrustedContent="true"
michael@0 146 onget="return this.getAttribute('height');"
michael@0 147 onset="this.setAttribute('height', val);"
michael@0 148 />
michael@0 149
michael@0 150 <property name="width" exposeToUntrustedContent="true"
michael@0 151 onget="return this.getAttribute('width');"
michael@0 152 onset="this.setAttribute('width', val);"
michael@0 153 />
michael@0 154
michael@0 155 <method name="_set_scrollDelay">
michael@0 156 <parameter name="aValue"/>
michael@0 157 <body>
michael@0 158 <![CDATA[
michael@0 159 if (aValue <= 0 || isNaN(aValue) || aValue == null)
michael@0 160 return false;
michael@0 161
michael@0 162 if (aValue < 60) {
michael@0 163 if (this.trueSpeed == true)
michael@0 164 this._scrollDelay = aValue;
michael@0 165 else
michael@0 166 this._scrollDelay = 60;
michael@0 167 }
michael@0 168 else {
michael@0 169 this._scrollDelay = aValue;
michael@0 170 }
michael@0 171 return true;
michael@0 172 ]]>
michael@0 173 </body>
michael@0 174 </method>
michael@0 175
michael@0 176 <method name="_set_scrollAmount">
michael@0 177 <parameter name="aValue"/>
michael@0 178 <body>
michael@0 179 <![CDATA[
michael@0 180 if (aValue < 0 || isNaN(aValue) || aValue == null)
michael@0 181 return false;
michael@0 182
michael@0 183 this._scrollAmount = aValue;
michael@0 184 return true;
michael@0 185 ]]>
michael@0 186 </body>
michael@0 187 </method>
michael@0 188
michael@0 189 <method name="_set_behavior">
michael@0 190 <parameter name="aValue"/>
michael@0 191 <body>
michael@0 192 <![CDATA[
michael@0 193 if (typeof aValue == 'string')
michael@0 194 aValue = aValue.toLowerCase();
michael@0 195 if (aValue != 'alternate' && aValue != 'slide' && aValue != 'scroll')
michael@0 196 return false;
michael@0 197
michael@0 198 this._behavior = aValue;
michael@0 199 return true;
michael@0 200 ]]>
michael@0 201 </body>
michael@0 202 </method>
michael@0 203
michael@0 204 <method name="_set_direction">
michael@0 205 <parameter name="aValue"/>
michael@0 206 <body>
michael@0 207 <![CDATA[
michael@0 208 if (typeof aValue == 'string')
michael@0 209 aValue = aValue.toLowerCase();
michael@0 210 if (aValue != 'left' && aValue != 'right' && aValue != 'up' && aValue != 'down')
michael@0 211 return false;
michael@0 212
michael@0 213 if (aValue != this._direction)
michael@0 214 this.startNewDirection = true;
michael@0 215 this._direction = aValue;
michael@0 216 return true;
michael@0 217 ]]>
michael@0 218 </body>
michael@0 219 </method>
michael@0 220
michael@0 221 <method name="_set_loop">
michael@0 222 <parameter name="aValue"/>
michael@0 223 <body>
michael@0 224 <![CDATA[
michael@0 225 if (!aValue || isNaN(aValue))
michael@0 226 return false;
michael@0 227
michael@0 228 if (aValue < -1)
michael@0 229 aValue = -1;
michael@0 230
michael@0 231 this._loop = aValue;
michael@0 232 return true;
michael@0 233 ]]>
michael@0 234 </body>
michael@0 235 </method>
michael@0 236
michael@0 237 <method name="_setEventListener">
michael@0 238 <parameter name="aName"/>
michael@0 239 <parameter name="aValue"/>
michael@0 240 <parameter name="aIgnoreNextCall"/>
michael@0 241 <body>
michael@0 242 <![CDATA[
michael@0 243 if (this._ignoreNextCall)
michael@0 244 return this._ignoreNextCall = false;
michael@0 245
michael@0 246 if (aIgnoreNextCall)
michael@0 247 this._ignoreNextCall = true;
michael@0 248
michael@0 249 if (typeof this["_on" + aName] == 'function')
michael@0 250 this.removeEventListener(aName, this["_on" + aName], false);
michael@0 251
michael@0 252 switch (typeof aValue)
michael@0 253 {
michael@0 254 case "function":
michael@0 255 this["_on" + aName] = aValue;
michael@0 256 this.addEventListener(aName, this["_on" + aName], false);
michael@0 257 break;
michael@0 258
michael@0 259 case "string":
michael@0 260 if (!aIgnoreNextCall) {
michael@0 261 try {
michael@0 262 // Things to watch out for here:
michael@0 263 // * Weird |new| precedence.
michael@0 264 // * Getting the correct constructor (via Xrays).
michael@0 265 // * Waiving the constructor before invoking it, so that we can
michael@0 266 // call it (since XBL gets opaque non-callable wrappers to content).
michael@0 267 // * The fact that contentFn is transitively waived, which we need
michael@0 268 // in order to be able to invoke it.
michael@0 269 this["_on" + aName] = new (XPCNativeWrapper.unwrap(window.Function))("event", aValue);
michael@0 270 }
michael@0 271 catch(e) {
michael@0 272 return false;
michael@0 273 }
michael@0 274 this.addEventListener(aName, this["_on" + aName], false);
michael@0 275 }
michael@0 276 else {
michael@0 277 this["_on" + aName] = aValue;
michael@0 278 }
michael@0 279 break;
michael@0 280
michael@0 281 case "object":
michael@0 282 this["_on" + aName] = aValue;
michael@0 283 break;
michael@0 284
michael@0 285 default:
michael@0 286 this._ignoreNextCall = false;
michael@0 287 throw new Error("Invalid argument for Marquee::on" + aName);
michael@0 288 }
michael@0 289 return true;
michael@0 290 ]]>
michael@0 291 </body>
michael@0 292 </method>
michael@0 293
michael@0 294 <method name="_fireEvent">
michael@0 295 <parameter name="aName"/>
michael@0 296 <parameter name="aBubbles"/>
michael@0 297 <parameter name="aCancelable"/>
michael@0 298 <body>
michael@0 299 <![CDATA[
michael@0 300 var e = document.createEvent("Events");
michael@0 301 e.initEvent(aName, aBubbles, aCancelable);
michael@0 302 this.dispatchEvent(e);
michael@0 303 ]]>
michael@0 304 </body>
michael@0 305 </method>
michael@0 306
michael@0 307 <method name="start" exposeToUntrustedContent="true">
michael@0 308 <body>
michael@0 309 <![CDATA[
michael@0 310 if (this.runId == 0) {
michael@0 311 var myThis = this;
michael@0 312 var lambda = function myTimeOutFunction(){myThis._doMove(false);}
michael@0 313 this.runId = window.setTimeout(lambda, this._scrollDelay - this._deltaStartStop);
michael@0 314 this._deltaStartStop = 0;
michael@0 315 }
michael@0 316 ]]>
michael@0 317 </body>
michael@0 318 </method>
michael@0 319
michael@0 320 <method name="stop" exposeToUntrustedContent="true">
michael@0 321 <body>
michael@0 322 <![CDATA[
michael@0 323 if (this.runId != 0) {
michael@0 324 this._deltaStartStop = Date.now()- this._lastMoveDate;
michael@0 325 clearTimeout(this.runId);
michael@0 326 }
michael@0 327
michael@0 328 this.runId = 0;
michael@0 329 ]]>
michael@0 330 </body>
michael@0 331 </method>
michael@0 332
michael@0 333 <method name="_doMove">
michael@0 334 <parameter name="aResetPosition"/>
michael@0 335 <body>
michael@0 336 <![CDATA[
michael@0 337 this._lastMoveDate = Date.now();
michael@0 338
michael@0 339 //startNewDirection is true at first load and whenever the direction is changed
michael@0 340 if (this.startNewDirection) {
michael@0 341 this.startNewDirection = false; //we only want this to run once every scroll direction change
michael@0 342
michael@0 343 var corrvalue = 0;
michael@0 344
michael@0 345 switch (this._direction)
michael@0 346 {
michael@0 347 case "up":
michael@0 348 var height = document.defaultView.getComputedStyle(this, "").height;
michael@0 349 this.outerDiv.style.height = height;
michael@0 350 if (this.originalHeight > this.outerDiv.offsetHeight)
michael@0 351 corrvalue = this.originalHeight - this.outerDiv.offsetHeight;
michael@0 352 this.innerDiv.style.padding = height + " 0";
michael@0 353 this.dirsign = 1;
michael@0 354 this.startAt = (this._behavior == 'alternate') ? (this.originalHeight - corrvalue) : 0;
michael@0 355 this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ?
michael@0 356 (parseInt(height) + corrvalue) : (this.originalHeight + parseInt(height));
michael@0 357 break;
michael@0 358
michael@0 359 case "down":
michael@0 360 var height = document.defaultView.getComputedStyle(this, "").height;
michael@0 361 this.outerDiv.style.height = height;
michael@0 362 if (this.originalHeight > this.outerDiv.offsetHeight)
michael@0 363 corrvalue = this.originalHeight - this.outerDiv.offsetHeight;
michael@0 364 this.innerDiv.style.padding = height + " 0";
michael@0 365 this.dirsign = -1;
michael@0 366 this.startAt = (this._behavior == 'alternate') ?
michael@0 367 (parseInt(height) + corrvalue) : (this.originalHeight + parseInt(height));
michael@0 368 this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ?
michael@0 369 (this.originalHeight - corrvalue) : 0;
michael@0 370 break;
michael@0 371
michael@0 372 case "right":
michael@0 373 if (this.innerDiv.offsetWidth > this.outerDiv.offsetWidth)
michael@0 374 corrvalue = this.innerDiv.offsetWidth - this.outerDiv.offsetWidth;
michael@0 375 this.dirsign = -1;
michael@0 376 this.stopAt = (this._behavior == 'alternate' || this._behavior == 'slide') ?
michael@0 377 (this.innerDiv.offsetWidth - corrvalue) : 0;
michael@0 378 this.startAt = this.outerDiv.offsetWidth + ((this._behavior == 'alternate') ?
michael@0 379 corrvalue : (this.innerDiv.offsetWidth + this.stopAt));
michael@0 380 break;
michael@0 381
michael@0 382 case "left":
michael@0 383 default:
michael@0 384 if (this.innerDiv.offsetWidth > this.outerDiv.offsetWidth)
michael@0 385 corrvalue = this.innerDiv.offsetWidth - this.outerDiv.offsetWidth;
michael@0 386 this.dirsign = 1;
michael@0 387 this.startAt = (this._behavior == 'alternate') ? (this.innerDiv.offsetWidth - corrvalue) : 0;
michael@0 388 this.stopAt = this.outerDiv.offsetWidth +
michael@0 389 ((this._behavior == 'alternate' || this._behavior == 'slide') ?
michael@0 390 corrvalue : (this.innerDiv.offsetWidth + this.startAt));
michael@0 391 }
michael@0 392
michael@0 393 if (aResetPosition) {
michael@0 394 this.newPosition = this.startAt;
michael@0 395 this._fireEvent("start", false, false);
michael@0 396 }
michael@0 397 } //end if
michael@0 398
michael@0 399 this.newPosition = this.newPosition + (this.dirsign * this._scrollAmount);
michael@0 400
michael@0 401 if ((this.dirsign == 1 && this.newPosition > this.stopAt) ||
michael@0 402 (this.dirsign == -1 && this.newPosition < this.stopAt))
michael@0 403 {
michael@0 404 switch (this._behavior)
michael@0 405 {
michael@0 406 case 'alternate':
michael@0 407 // lets start afresh
michael@0 408 this.startNewDirection = true;
michael@0 409
michael@0 410 // swap direction
michael@0 411 const swap = {left: "right", down: "up", up: "down", right: "left"};
michael@0 412 this._direction = swap[this._direction];
michael@0 413 this.newPosition = this.stopAt;
michael@0 414
michael@0 415 if ((this._direction == "up") || (this._direction == "down"))
michael@0 416 this.outerDiv.scrollTop = this.newPosition;
michael@0 417 else
michael@0 418 this.outerDiv.scrollLeft = this.newPosition;
michael@0 419
michael@0 420 if (this._loop != 1)
michael@0 421 this._fireEvent("bounce", false, true);
michael@0 422 break;
michael@0 423
michael@0 424 case 'slide':
michael@0 425 if (this._loop > 1)
michael@0 426 this.newPosition = this.startAt;
michael@0 427 break;
michael@0 428
michael@0 429 default:
michael@0 430 this.newPosition = this.startAt;
michael@0 431
michael@0 432 if ((this._direction == "up") || (this._direction == "down"))
michael@0 433 this.outerDiv.scrollTop = this.newPosition;
michael@0 434 else
michael@0 435 this.outerDiv.scrollLeft = this.newPosition;
michael@0 436
michael@0 437 //dispatch start event, even when this._loop == 1, comp. with IE6
michael@0 438 this._fireEvent("start", false, false);
michael@0 439 }
michael@0 440
michael@0 441 if (this._loop > 1)
michael@0 442 this._loop--;
michael@0 443 else if (this._loop == 1) {
michael@0 444 if ((this._direction == "up") || (this._direction == "down"))
michael@0 445 this.outerDiv.scrollTop = this.stopAt;
michael@0 446 else
michael@0 447 this.outerDiv.scrollLeft = this.stopAt;
michael@0 448 this.stop();
michael@0 449 this._fireEvent("finish", false, true);
michael@0 450 return;
michael@0 451 }
michael@0 452 }
michael@0 453 else {
michael@0 454 if ((this._direction == "up") || (this._direction == "down"))
michael@0 455 this.outerDiv.scrollTop = this.newPosition;
michael@0 456 else
michael@0 457 this.outerDiv.scrollLeft = this.newPosition;
michael@0 458 }
michael@0 459
michael@0 460 var myThis = this;
michael@0 461 var lambda = function myTimeOutFunction(){myThis._doMove(false);}
michael@0 462 this.runId = window.setTimeout(lambda, this._scrollDelay);
michael@0 463 ]]>
michael@0 464 </body>
michael@0 465 </method>
michael@0 466
michael@0 467 <method name="init">
michael@0 468 <body>
michael@0 469 <![CDATA[
michael@0 470 this.stop();
michael@0 471
michael@0 472 if ((this._direction != "up") && (this._direction != "down")) {
michael@0 473 var width = window.getComputedStyle(this, "").width;
michael@0 474 this.innerDiv.parentNode.style.margin = '0 ' + width;
michael@0 475
michael@0 476 //XXX Adding the margin sometimes causes the marquee to widen,
michael@0 477 // see testcase from bug bug 364434:
michael@0 478 // https://bugzilla.mozilla.org/attachment.cgi?id=249233
michael@0 479 // Just add a fixed width with current marquee's width for now
michael@0 480 if (width != window.getComputedStyle(this, "").width) {
michael@0 481 var width = window.getComputedStyle(this, "").width;
michael@0 482 this.outerDiv.style.width = width;
michael@0 483 this.innerDiv.parentNode.style.margin = '0 ' + width;
michael@0 484 }
michael@0 485 }
michael@0 486 else {
michael@0 487 // store the original height before we add padding
michael@0 488 this.innerDiv.style.padding = 0;
michael@0 489 this.originalHeight = this.innerDiv.offsetHeight;
michael@0 490 }
michael@0 491
michael@0 492 this._doMove(true);
michael@0 493 ]]>
michael@0 494 </body>
michael@0 495 </method>
michael@0 496
michael@0 497 <constructor>
michael@0 498 <![CDATA[
michael@0 499 // Set up state.
michael@0 500 this._scrollAmount = 6;
michael@0 501 this._scrollDelay = 85;
michael@0 502 this._direction = "left";
michael@0 503 this._behavior = "scroll";
michael@0 504 this._loop = -1;
michael@0 505 this.dirsign = 1;
michael@0 506 this.startAt = 0;
michael@0 507 this.stopAt = 0;
michael@0 508 this.newPosition = 0;
michael@0 509 this.runId = 0;
michael@0 510 this.originalHeight = 0;
michael@0 511 this.startNewDirection = true;
michael@0 512
michael@0 513 // hack needed to fix js error, see bug 386470
michael@0 514 var myThis = this;
michael@0 515 var lambda = function myScopeFunction() { if (myThis.init) myThis.init(); }
michael@0 516
michael@0 517 this._set_direction(this.getAttribute('direction'));
michael@0 518 this._set_behavior(this.getAttribute('behavior'));
michael@0 519 this._set_scrollDelay(this.getAttribute('scrolldelay'));
michael@0 520 this._set_scrollAmount(this.getAttribute('scrollamount'));
michael@0 521 this._set_loop(this.getAttribute('loop'));
michael@0 522 this._setEventListener("start", this.getAttribute("onstart"));
michael@0 523 this._setEventListener("finish", this.getAttribute("onfinish"));
michael@0 524 this._setEventListener("bounce", this.getAttribute("onbounce"));
michael@0 525 this.startNewDirection = true;
michael@0 526
michael@0 527 // init needs to be run after the page has loaded in order to calculate
michael@0 528 // the correct height/width
michael@0 529 if (document.readyState == "complete")
michael@0 530 lambda();
michael@0 531 else
michael@0 532 window.addEventListener("load", lambda, false);
michael@0 533 ]]>
michael@0 534 </constructor>
michael@0 535 </implementation>
michael@0 536
michael@0 537 <handlers>
michael@0 538 <handler event="DOMAttrModified" phase="target">
michael@0 539 <![CDATA[
michael@0 540 var attrName = event.attrName.toLowerCase();
michael@0 541 var oldValue = event.prevValue.toLowerCase();
michael@0 542 var newValue = event.newValue.toLowerCase();
michael@0 543 var attributeRemoval = false;
michael@0 544 if (event.attrChange == event.REMOVAL) {
michael@0 545 newValue = null;
michael@0 546 attributeRemoval = true;
michael@0 547 };
michael@0 548
michael@0 549 if (oldValue != newValue) {
michael@0 550 switch (attrName) {
michael@0 551 case "loop":
michael@0 552 if (!this._set_loop(newValue)) {
michael@0 553 if (attributeRemoval) {
michael@0 554 this._loop = -1;
michael@0 555 if (this.runId == 0)
michael@0 556 this.start();
michael@0 557 }
michael@0 558 else
michael@0 559 throw new Error("Invalid argument for Marquee::loop");
michael@0 560 }
michael@0 561 if (this.rundId == 0)
michael@0 562 this.start();
michael@0 563 break;
michael@0 564 case "scrollamount":
michael@0 565 if (!this._set_scrollAmount(newValue)) {
michael@0 566 if (attributeRemoval)
michael@0 567 this._scrollAmount = 6;
michael@0 568 else
michael@0 569 throw new Error("Invalid argument for Marquee::scrollAmount");
michael@0 570 }
michael@0 571 break;
michael@0 572 case "scrolldelay":
michael@0 573 if (!this._set_scrollDelay(newValue)) {
michael@0 574 if (attributeRemoval)
michael@0 575 this._scrollDelay = 85;
michael@0 576 else
michael@0 577 throw new Error("Invalid argument for Marquee::scrollDelay");
michael@0 578 }
michael@0 579 this.stop();
michael@0 580 this.start();
michael@0 581 break;
michael@0 582 case "truespeed":
michael@0 583 //needed to update this._scrollDelay
michael@0 584 var myThis = this;
michael@0 585 var lambda = function() {myThis._set_scrollDelay(myThis.getAttribute('scrolldelay'));}
michael@0 586 window.setTimeout(lambda, 0);
michael@0 587 break;
michael@0 588 case "behavior":
michael@0 589 if (!this._set_behavior(newValue)) {
michael@0 590 if (attributeRemoval)
michael@0 591 this._behavior = "scroll";
michael@0 592 else
michael@0 593 throw new Error("Invalid argument for Marquee::behavior");
michael@0 594 }
michael@0 595
michael@0 596 this.startNewDirection = true;
michael@0 597 if ((oldValue == "slide" && this.newPosition == this.stopAt) ||
michael@0 598 newValue == "alternate" || newValue == "slide") {
michael@0 599 this.stop();
michael@0 600 this._doMove(true);
michael@0 601 }
michael@0 602 break;
michael@0 603 case "direction":
michael@0 604 if (!this._set_direction(newValue)) {
michael@0 605 if (attributeRemoval)
michael@0 606 this._direction = "left";
michael@0 607 else
michael@0 608 throw new Error("Invalid argument for Marquee::direction");
michael@0 609 }
michael@0 610 break;
michael@0 611 case "width":
michael@0 612 case "height":
michael@0 613 this.startNewDirection = true;
michael@0 614 break;
michael@0 615 case "onstart":
michael@0 616 this._setEventListener("start", newValue);
michael@0 617 break;
michael@0 618 case "onfinish":
michael@0 619 this._setEventListener("finish", newValue);
michael@0 620 break;
michael@0 621 case "onbounce":
michael@0 622 this._setEventListener("bounce", newValue);
michael@0 623 break;
michael@0 624 }
michael@0 625 }
michael@0 626 ]]>
michael@0 627 </handler>
michael@0 628 </handlers>
michael@0 629
michael@0 630 </binding>
michael@0 631
michael@0 632 <binding id="marquee-horizontal"
michael@0 633 extends="chrome://xbl-marquee/content/xbl-marquee.xml#marquee"
michael@0 634 inheritstyle="false">
michael@0 635
michael@0 636 <!-- White-space isn't allowed because a marquee could be
michael@0 637 inside 'white-space: pre' -->
michael@0 638 <content>
michael@0 639 <html:div style="display: -moz-box; overflow: hidden; width: -moz-available;"
michael@0 640 ><html:div style="display: -moz-box;"
michael@0 641 ><html:div class="innerDiv" style="display: table; border-spacing: 0;"
michael@0 642 ><html:div
michael@0 643 ><children
michael@0 644 /></html:div
michael@0 645 ></html:div
michael@0 646 ></html:div
michael@0 647 ></html:div>
michael@0 648 </content>
michael@0 649
michael@0 650 </binding>
michael@0 651
michael@0 652 <binding id="marquee-vertical"
michael@0 653 extends="chrome://xbl-marquee/content/xbl-marquee.xml#marquee"
michael@0 654 inheritstyle="false">
michael@0 655
michael@0 656 <!-- White-space isn't allowed because a marquee could be
michael@0 657 inside 'white-space: pre' -->
michael@0 658 <content>
michael@0 659 <html:div style="overflow: hidden; width: -moz-available;"
michael@0 660 ><html:div class="innerDiv"
michael@0 661 ><children
michael@0 662 /></html:div
michael@0 663 ></html:div>
michael@0 664 </content>
michael@0 665
michael@0 666 </binding>
michael@0 667
michael@0 668 <binding id="marquee-horizontal-editable"
michael@0 669 inheritstyle="false">
michael@0 670
michael@0 671 <!-- White-space isn't allowed because a marquee could be
michael@0 672 inside 'white-space: pre' -->
michael@0 673 <content>
michael@0 674 <html:div style="display: inline-block; overflow: auto; width: -moz-available;"
michael@0 675 ><children
michael@0 676 /></html:div>
michael@0 677 </content>
michael@0 678
michael@0 679 </binding>
michael@0 680
michael@0 681 <binding id="marquee-vertical-editable"
michael@0 682 inheritstyle="false">
michael@0 683
michael@0 684 <!-- White-space isn't allowed because a marquee could be
michael@0 685 inside 'white-space: pre' -->
michael@0 686 <content>
michael@0 687 <html:div style="overflow: auto; height: inherit; width: -moz-available;"
michael@0 688 ><children/></html:div>
michael@0 689 </content>
michael@0 690
michael@0 691 </binding>
michael@0 692
michael@0 693 </bindings>

mercurial