10 box-shadow:
1.4px
1.4px blue;
14 <script src=
"../../resources/js-test.js"></script>
15 <script src=
"../../resources/run-after-layout-and-paint.js"></script>
17 var jsTestIsAsync
= true;
18 description('Tests whether a repaint rect encompasses box-shadow with subpixel offset when the shadow changes.');
20 // Accepts [x, y, width, height] rects. Checks if the first argument contains the second.
21 function rectContainsRect(outer
, inner
) {
22 return outer
[0] <= inner
[0]
23 && outer
[1] <= inner
[1]
24 && outer
[0] + outer
[2] >= inner
[0] + inner
[2]
25 && outer
[1] + outer
[3] >= inner
[1] + inner
[3];
28 if (!window
.internals
) {
29 testFailed('Test requires window.internals.');
32 var box
= document
.getElementById('box');
33 runAfterLayoutAndPaint(function() {
34 internals
.startTrackingRepaints(document
);
35 box
.style
.boxShadow
= 'none';
37 runAfterLayoutAndPaint(function() {
38 var layerTree
= JSON
.parse(internals
.layerTreeAsText(document
, internals
.LAYER_TREE_INCLUDES_REPAINT_RECTS
));
39 var repaintRects
= layerTree
.children
[0].repaintRects
;
40 var shadowRect
= [1.4, 1.4, 100, 100];
41 if (repaintRects
.some(repaintRect
=> rectContainsRect(repaintRect
, shadowRect
)))
42 testPassed('Subpixel shadow was repainted.');
44 testFailed('Subpixel shadow ' + JSON
.stringify(shadowRect
) + ' was not repainted. Repaint rects were ' + JSON
.stringify(repaintRects
) + '.');
46 internals
.stopTrackingRepaints(document
);