Skip to content

Commit e0b5bd7

Browse files
Psychpsyogmta
authored andcommitted
LibWeb: Make transition order return -1 and 1 instead of 0 and 1
The old behavior was plain incorrect for a sorting function.
1 parent 2c4f2a3 commit e0b5bd7

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Libraries/LibWeb/CSS/CSSTransition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int CSSTransition::class_specific_composite_order(GC::Ref<Animations::Animation>
7878
// property name of each transition (i.e. without attempting case conversion and such that ‘-moz-column-width’
7979
// sorts before ‘column-width’).
8080
// FIXME: This should operate on Unicode strings, not StringViews.
81-
return transition_property() > other->transition_property();
81+
return transition_property().compare(other->transition_property());
8282
}
8383

8484
CSSTransition::CSSTransition(JS::Realm& realm, DOM::AbstractElement abstract_element, PropertyID property_id, size_t transition_generation,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Order: left, right, top
1+
Order: bottom, height, left, right, top, width

Tests/LibWeb/Text/input/css/transition-ordering.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22
<html>
33
<style>
44
#foo {
5-
transition-property: top, left, right;
5+
transition-property: top, right, left, width, height, bottom;
66
transition-duration: 1s;
77
}
88
</style>
9-
<div id="foo" style="top: 0; left: 0; right: 0"></div>
9+
<div id="foo" style="top: 0; left: 0; right: 0; width: 0; height: 0; bottom: 0"></div>
1010
<script src="../include.js"></script>
1111
<script>
1212
promiseTest(async () => {
1313
await animationFrame();
1414
await animationFrame();
1515

16-
foo.style.left = "10px";
1716
foo.style.top = "10px";
1817
foo.style.right = "10px";
18+
foo.style.left = "10px";
19+
foo.style.width = "10px";
20+
foo.style.height = "10px";
21+
foo.style.bottom = "10px";
1922

2023
println("Order: " + document.getAnimations().map(animation => animation.transitionProperty).join(", "));
2124
});

0 commit comments

Comments
 (0)