OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Test UseCounters for border-image with border-style: none</title> |
2 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
3 <script src="../../resources/run-after-layout-and-paint.js"></script> | 4 <script src="../../resources/run-after-layout-and-paint.js"></script> |
4 <style> | 5 <style> |
5 .test { | 6 .test { |
6 width: 100px; | 7 width: 100px; |
7 height: 100px; | 8 height: 100px; |
8 } | 9 } |
9 </style> | 10 </style> |
10 <div class="test"></div> | 11 <div class="test"></div> |
11 <script> | 12 <script> |
12 var BorderImageWithBorderStyleNone = 1026; // From UseCounter.h | 13 var BorderImageWithBorderStyleNone = 1026; // From UseCounter.h |
13 window.jsTestIsAsync = true; | 14 window.jsTestIsAsync = true; |
14 | 15 |
15 shouldBeFalse("window.internals.isUseCounted(document, BorderImageWithBorderSt
yleNone)"); | 16 shouldBeFalse("window.internals.isUseCounted(document, BorderImageWithBorder
StyleNone)"); |
16 | 17 |
17 var style = document.querySelector('.test').style; | 18 var style = document.querySelector('.test').style; |
18 | 19 |
19 // Set a solid border-image; expect no hit | 20 // Set a solid border-image; expect no hit |
20 style.borderWidth = '20px'; | 21 style.borderWidth = '20px'; |
21 style.borderStyle = 'solid'; | 22 style.borderStyle = 'solid'; |
22 style.borderImage = 'linear-gradient(to bottom, blue, white) 1 repeat'; | 23 style.borderImage = 'linear-gradient(to bottom, blue, white) 1 repeat'; |
23 | |
24 runAfterLayoutAndPaint( | |
25 function() { | |
26 shouldBeFalse("window.internals.isUseCounted(document, BorderImageWith
BorderStyleNone)"); | |
27 | 24 |
28 // Set one border to none but nuke all border widths; expect no hit | 25 runAfterLayoutAndPaint(function() { |
29 style.borderWidth = '0px'; | 26 shouldBeFalse("window.internals.isUseCounted(document, BorderImageWithBo
rderStyleNone)"); |
30 style.borderTopStyle = 'none'; | |
31 | 27 |
32 runAfterLayoutAndPaint( | 28 // Set one border to none but nuke all border widths; expect no hit |
33 function() { | 29 style.borderWidth = '0px'; |
34 shouldBeFalse("window.internals.isUseCounted(document, BorderI
mageWithBorderStyleNone)"); | 30 style.borderTopStyle = 'none'; |
35 | 31 |
36 // Add fill to trigger more border-image code; expect no hit | 32 runAfterLayoutAndPaint(function() { |
37 style.borderImage = 'linear-gradient(to bottom, blue, white) f
ill 1 repeat'; | 33 shouldBeFalse("window.internals.isUseCounted(document, BorderImageWi
thBorderStyleNone)"); |
38 | 34 |
39 runAfterLayoutAndPaint( | 35 // Add fill to trigger more border-image code; expect no hit |
40 function() { | 36 style.borderImage = 'linear-gradient(to bottom, blue, white) fill 1
repeat'; |
41 shouldBeFalse("window.internals.isUseCounted(document,
BorderImageWithBorderStyleNone)"); | |
42 | 37 |
43 // Add a top border width that according to spec shoul
d be clamped to zero because | 38 runAfterLayoutAndPaint(function() { |
44 // border-top-style is none; expect hit | 39 shouldBeFalse("window.internals.isUseCounted(document, BorderIma
geWithBorderStyleNone)"); |
45 style.borderTopWidth = '10px'; | |
46 | 40 |
47 runAfterLayoutAndPaint( | 41 // Add a top border width that according to spec should be clamp
ed to zero because |
48 function() { | 42 // border-top-style is none; expect hit |
49 shouldBeTrue("window.internals.isUseCounted(do
cument, BorderImageWithBorderStyleNone)"); | 43 style.borderTopWidth = '10px'; |
50 finishJSTest(); | 44 |
51 }); | 45 runAfterLayoutAndPaint(function() { |
52 }); | 46 shouldBeTrue("window.internals.isUseCounted(document, Border
ImageWithBorderStyleNone)"); |
53 }); | 47 finishJSTest(); |
54 }); | 48 }); |
| 49 }); |
| 50 }); |
| 51 }); |
55 </script> | 52 </script> |
OLD | NEW |