Make marquee work again when direction is rtl, by working around changes to range of offsetLeft. b=336736 Patch by Daniel Holbert <dholbert@mozilla.com>. r=martijn sr=dbaron

This commit is contained in:
dbaron@dbaron.org 2007-06-18 16:21:56 -07:00
parent 50513d81cc
commit 39a48943d0
4 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<html>
<body>
<!-- The "alternate" behavior is necessary for the
marquee text to start out on the screen. -->
<MARQUEE
direction="right"
scrollamount="0"
behavior="alternate"
>
a
</MARQUEE>
</body>
</html>

View File

@ -0,0 +1,13 @@
<html>
<body dir="rtl">
<!-- The "alternate" behavior is necessary for the
marquee text to start out on the screen. -->
<MARQUEE
direction="right"
scrollamount="0"
behavior="alternate"
>
a
</MARQUEE>
</body>
</html>

View File

@ -121,6 +121,7 @@ random == 328829-1.xhtml 328829-1-ref.xhtml # bug 369046 (intermittent)
== 335628-1.html 335628-1-ref.html
!= 335628-2.xul 335628-2-ref.xul
== 336147-1.html 336147-1-ref.html
== 336736-1.html 336736-1-ref.html
fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 339289-1.html 339289-1-ref.html # mac bug 382399
== 341043-1a.html 341043-1-ref.html
!= 341043-1b.html 341043-1-ref.html

View File

@ -434,6 +434,17 @@
corrvalue : (this.innerDiv.offsetWidth + this.startAt));
}
// RTL Support. If text direction is right-to-left and marquee
// axis is horizontal, then negate and swap stopAt and startAt.
var dir = document.defaultView.getComputedStyle(this, "").direction;
if (dir == "rtl") {
if (this._direction == "right" || this._direction == "left") {
var tmp = this.startAt;
this.startAt = -this.stopAt;
this.stopAt = -tmp;
}
}
if (aResetPosition) {
this.newPosition = this.startAt;
this._fireEvent("start", false, false);