Skip to content

Commit fa18b0d

Browse files
committed
2008-08-25 Dean Jackson <dino@apple.com>
Reviewed by Dave Hyatt Make sure 'inherit' is handled by transition property. https://bugs.webkit.org/show_bug.cgi?id=20513 Test: transitions/inherit.html Test: transitions/inherit-other-props.html * css/CSSStyleSelector.cpp: fix macro to check existence of list before getting size Canonical link: https://commits.webkit.org/28328@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent d4bb96d commit fa18b0d

7 files changed

Lines changed: 236 additions & 4 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2008-08-25 Dean Jackson <dino@apple.com>
2+
3+
Reviewed by Dave Hyatt.
4+
5+
Tests for 'inherit' keyword in transition property.
6+
https://bugs.webkit.org/show_bug.cgi?id=20513
7+
8+
* transitions/inherit-expected.txt: Added.
9+
* transitions/inherit.html: Added.
10+
* transitions/inherit-other-props-expected.txt: Added.
11+
* transitions/inherit-other-props.html: Added.
12+
113
2008-08-24 Dan Bernstein <mitz@apple.com>
214

315
Reviewed by Darin Adler.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
PASS -- Box 1 computed transition property: all expected: all
2+
PASS -- Box 2 computed transition property: left expected: left
3+
PASS -- Box 3 computed transition property: left expected: left
4+
PASS -- Box 4 computed transition property: left expected: left
5+
PASS -- Box 5 computed transition property: left expected: left
6+
PASS -- Box 6 computed transition property: all expected: all
7+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
PASS -- Box 1 computed transition property: all expected: all
2+
PASS -- Box 1 computed transition duration: 0s expected: 0s
3+
PASS -- Box 1 computed transition timing function: cubic-bezier(0.25, 0.1, 0.25, 1) expected: cubic-bezier(0.25, 0.1, 0.25, 1)
4+
PASS -- Box 2 computed transition property: left expected: left
5+
PASS -- Box 2 computed transition duration: 2s expected: 2s
6+
PASS -- Box 2 computed transition timing function: cubic-bezier(0, 0, 0, 0) expected: cubic-bezier(0, 0, 0, 0)
7+
PASS -- Box 3 computed transition property: left expected: left
8+
PASS -- Box 3 computed transition duration: 2s expected: 2s
9+
PASS -- Box 3 computed transition timing function: cubic-bezier(0, 0, 0, 0) expected: cubic-bezier(0, 0, 0, 0)
10+
PASS -- Box 4 computed transition property: left expected: left
11+
PASS -- Box 4 computed transition duration: 2s expected: 2s
12+
PASS -- Box 4 computed transition timing function: cubic-bezier(0, 0, 0, 0) expected: cubic-bezier(0, 0, 0, 0)
13+
PASS -- Box 5 computed transition property: left expected: left
14+
PASS -- Box 5 computed transition duration: 2s expected: 2s
15+
PASS -- Box 5 computed transition timing function: cubic-bezier(0, 0, 0, 0) expected: cubic-bezier(0, 0, 0, 0)
16+
PASS -- Box 6 computed transition property: all expected: all
17+
PASS -- Box 6 computed transition duration: 0s expected: 0s
18+
PASS -- Box 6 computed transition timing function: cubic-bezier(0.25, 0.1, 0.25, 1) expected: cubic-bezier(0.25, 0.1, 0.25, 1)
19+
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<html>
2+
<head>
3+
<title>Testing inherit transitions</title>
4+
<style type="text/css" media="screen">
5+
.box {
6+
position: relative;
7+
left: 0;
8+
height: 100px;
9+
width: 100px;
10+
margin: 10px;
11+
background-color: blue;
12+
}
13+
.transition {
14+
-webkit-transition-property: left;
15+
-webkit-transition-duration: 2s;
16+
-webkit-transition-timing-function: linear;
17+
}
18+
#box4 {
19+
-webkit-transition-property: inherit;
20+
-webkit-transition-duration: inherit;
21+
-webkit-transition-timing-function: inherit;
22+
}
23+
</style>
24+
<script type="text/javascript" charset="utf-8">
25+
if (window.layoutTestController) {
26+
layoutTestController.dumpAsText();
27+
layoutTestController.waitUntilDone();
28+
}
29+
30+
var kExpectedProp = [
31+
'all', /* box1 */
32+
'left', /* box2 */
33+
'left', /* box3 */
34+
'left', /* box4 */ /* inherits from box3 */
35+
'left', /* box5 */
36+
'all', /* box6 */ /* does NOT inherit */
37+
];
38+
39+
var kExpectedDuration = [
40+
'0s', /* box1 */
41+
'2s', /* box2 */
42+
'2s', /* box3 */
43+
'2s', /* box4 */ /* inherits from box3 */
44+
'2s', /* box5 */
45+
'0s', /* box6 */ /* does NOT inherit */
46+
];
47+
48+
var kExpectedTimingFunction = [
49+
'cubic-bezier(0.25, 0.1, 0.25, 1)', /* box1 */
50+
'cubic-bezier(0, 0, 0, 0)', /* box2 */
51+
'cubic-bezier(0, 0, 0, 0)', /* box3 */
52+
'cubic-bezier(0, 0, 0, 0)', /* box4 */ /* inherits from box3 */
53+
'cubic-bezier(0, 0, 0, 0)', /* box5 */
54+
'cubic-bezier(0.25, 0.1, 0.25, 1)', /* box6 */ /* does NOT inherit */
55+
];
56+
57+
var result = '';
58+
59+
function testValue(index, name, actual, expected) {
60+
if (actual == expected)
61+
result += "PASS -- ";
62+
else
63+
result += "FAIL -- ";
64+
result += "Box " + index + " computed transition " + name + ": " + actual + " expected: " + expected + "<br>";
65+
}
66+
67+
function testProperties()
68+
{
69+
70+
var boxes = document.body.getElementsByClassName('box');
71+
for (var i = 0; i < boxes.length; ++i) {
72+
var curBox = boxes[i];
73+
testValue(i+1, "property", window.getComputedStyle(curBox).webkitTransitionProperty, kExpectedProp[i]);
74+
testValue(i+1, "duration", window.getComputedStyle(curBox).webkitTransitionDuration, kExpectedDuration[i]);
75+
testValue(i+1, "timing function", window.getComputedStyle(curBox).webkitTransitionTimingFunction, kExpectedTimingFunction[i]);
76+
}
77+
78+
document.body.removeChild(document.getElementById('container'));
79+
document.getElementById('result').innerHTML = result;
80+
if (window.layoutTestController)
81+
layoutTestController.notifyDone();
82+
83+
}
84+
85+
window.addEventListener('load', testProperties, false);
86+
</script>
87+
</head>
88+
<body>
89+
90+
<div id="container">
91+
<div id="box1" class="box"></div>
92+
<div id="box2" class="box transition"></div>
93+
<div id="box3" class="box transition">
94+
<div id="box4" class="box"></div>
95+
</div>
96+
<div id="box5" class="box transition">
97+
<div id="box6" class="box"></div>
98+
</div>
99+
</div>
100+
101+
<div id="result"></div>
102+
103+
</body>
104+
</html>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<html>
2+
<head>
3+
<title>Testing inherit transitions</title>
4+
<style type="text/css" media="screen">
5+
.box {
6+
position: relative;
7+
left: 0;
8+
height: 100px;
9+
width: 100px;
10+
margin: 10px;
11+
background-color: blue;
12+
}
13+
.transition {
14+
-webkit-transition-property: left;
15+
-webkit-transition-duration: 2s;
16+
}
17+
#box4 {
18+
-webkit-transition-property: inherit;
19+
}
20+
</style>
21+
<script type="text/javascript" charset="utf-8">
22+
if (window.layoutTestController) {
23+
layoutTestController.dumpAsText();
24+
layoutTestController.waitUntilDone();
25+
}
26+
27+
var kExpecteds = [
28+
'all', /* box1 */
29+
'left', /* box2 */
30+
'left', /* box3 */
31+
'left', /* box4 */ /* inherits from box3 */
32+
'left', /* box5 */
33+
'all', /* box6 */ /* does NOT inherit */
34+
];
35+
36+
function testProperties()
37+
{
38+
var result = '';
39+
40+
var boxes = document.body.getElementsByClassName('box');
41+
for (var i = 0; i < boxes.length; ++i) {
42+
var curBox = boxes[i];
43+
var curProp = window.getComputedStyle(curBox).webkitTransitionProperty;
44+
if (curProp == kExpecteds[i])
45+
result += "PASS -- ";
46+
else
47+
result += "FAIL -- ";
48+
result += "Box " + (i+1) + " computed transition property: " + curProp + " expected: " + kExpecteds[i] + "<br>";
49+
}
50+
51+
document.body.removeChild(document.getElementById('container'));
52+
document.getElementById('result').innerHTML = result;
53+
if (window.layoutTestController)
54+
layoutTestController.notifyDone();
55+
56+
}
57+
58+
window.addEventListener('load', testProperties, false);
59+
</script>
60+
</head>
61+
<body>
62+
63+
<div id="container">
64+
<div id="box1" class="box"></div>
65+
<div id="box2" class="box transition"></div>
66+
<div id="box3" class="box transition">
67+
<div id="box4" class="box"></div>
68+
</div>
69+
<div id="box5" class="box transition">
70+
<div id="box6" class="box"></div>
71+
</div>
72+
</div>
73+
74+
<div id="result"></div>
75+
76+
</body>
77+
</html>

WebCore/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2008-08-25 Dean Jackson <dino@apple.com>
2+
3+
Reviewed by Dave Hyatt
4+
5+
Make sure 'inherit' is handled by transition property.
6+
https://bugs.webkit.org/show_bug.cgi?id=20513
7+
8+
Test: transitions/inherit.html
9+
Test: transitions/inherit-other-props.html
10+
11+
* css/CSSStyleSelector.cpp:
12+
fix macro to check existence of list before getting size
13+
114
2008-08-25 Anders Carlsson <andersca@apple.com>
215

316
Reviewed by Mark.

WebCore/css/CSSStyleSelector.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ HANDLE_FILL_LAYER_VALUE(mask, Mask, prop, Prop, value)
188188
if (isInherit) { \
189189
AnimationList* list = m_style->accessAnimations(); \
190190
const AnimationList* parentList = m_parentStyle->animations(); \
191-
size_t i = 0; \
192-
for ( ; i < parentList->size() && (*parentList)[i]->is##Prop##Set(); ++i) { \
191+
size_t i = 0, parentSize = parentList ? parentList->size() : 0; \
192+
for ( ; i < parentSize && (*parentList)[i]->is##Prop##Set(); ++i) { \
193193
if (list->size() <= i) \
194194
list->append(Animation::create()); \
195195
(*list)[i]->set##Prop((*parentList)[i]->prop()); \
@@ -238,8 +238,8 @@ for ( ; childIndex < list->size(); ++childIndex) { \
238238
if (isInherit) { \
239239
AnimationList* list = m_style->accessTransitions(); \
240240
const AnimationList* parentList = m_parentStyle->transitions(); \
241-
size_t i = 0; \
242-
for ( ; i < parentList->size() && (*parentList)[i]->is##Prop##Set(); ++i) { \
241+
size_t i = 0, parentSize = parentList ? parentList->size() : 0; \
242+
for ( ; i < parentSize && (*parentList)[i]->is##Prop##Set(); ++i) { \
243243
if (list->size() <= i) \
244244
list->append(Animation::create()); \
245245
(*list)[i]->set##Prop((*parentList)[i]->prop()); \

0 commit comments

Comments
 (0)