Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: LayoutTests/fast/repaint/subpixel-shadow-included-in-invalidation.html

Issue 1307223003: Remove pixelSnappedIntRect from BoxPainter::boundsForDrawingRecorder. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: finishJSTest Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <style>
3 #box {
4 position: absolute;
5 left: 0;
6 top: 0;
7 width: 100px;
8 height: 100px;
9 background: green;
10 box-shadow: 1.4px 1.4px blue;
11 }
12 </style>
13 <div id="box"></div>
14 <script src="../../resources/js-test.js"></script>
15 <script src="../../resources/run-after-layout-and-paint.js"></script>
16 <script>
17 var jsTestIsAsync = true;
18 description('Tests whether a repaint rect encompasses box-shadow with subpixel o ffset when the shadow changes.');
19
20 // Accepts [x, y, width, height] rects. Checks if the first argument contains th e 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];
26 }
27
28 if (!window.internals) {
29 testFailed('Test requires window.internals.');
30 finishJSTest();
31 } else {
32 var box = document.getElementById('box');
33 runAfterLayoutAndPaint(function() {
34 internals.startTrackingRepaints(document);
35 box.style.boxShadow = 'none';
36
37 runAfterLayoutAndPaint(function() {
38 var layerTree = JSON.parse(internals.layerTreeAsText(document, inter nals.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, s hadowRect)))
42 testPassed('Subpixel shadow was repainted.');
43 else
44 testFailed('Subpixel shadow ' + JSON.stringify(shadowRect) + ' w as not repainted. Repaint rects were ' + JSON.stringify(repaintRects) + '.');
45
46 internals.stopTrackingRepaints(document);
47 box.remove();
48 finishJSTest();
49 });
50 });
51 }
52 </script>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/repaint/subpixel-shadow-included-in-invalidation-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698