| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import re | 5 import re |
| 6 | 6 |
| 7 | 7 |
| 8 def result_contains_repaint_rects(text): | 8 def result_contains_repaint_rects(text): |
| 9 return isinstance(text, str) and ( | 9 return isinstance(text, str) and ( |
| 10 re.search('"repaintRects": \[$', text, re.MULTILINE) != None or | 10 re.search('"repaintRects": \[$', text, re.MULTILINE) != None or |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 context.save(); | 132 context.save(); |
| 133 if (result.position) | 133 if (result.position) |
| 134 context.translate(result.position[0], result.position[1]); | 134 context.translate(result.position[0], result.position[1]); |
| 135 var t = result.transform; | 135 var t = result.transform; |
| 136 if (t) { | 136 if (t) { |
| 137 var origin = result.transformOrigin || [result.bounds[0] / 2, result.bou
nds[1] / 2]; | 137 var origin = result.transformOrigin || [result.bounds[0] / 2, result.bou
nds[1] / 2]; |
| 138 context.translate(origin[0], origin[1]); | 138 context.translate(origin[0], origin[1]); |
| 139 context.transform(t[0][0], t[0][1], t[1][0], t[1][1], t[3][0], t[3][1]); | 139 context.transform(t[0][0], t[0][1], t[1][0], t[1][1], t[3][0], t[3][1]); |
| 140 context.translate(-origin[0], -origin[1]); | 140 context.translate(-origin[0], -origin[1]); |
| 141 } | 141 } |
| 142 if (result.repaintRects) | 142 if (result.repaintRects) { |
| 143 draw_rects(context, result.repaintRects); | 143 draw_rects(context, result.repaintRects); |
| 144 } else if (result.paintInvalidations) { |
| 145 var rects = []; |
| 146 for (var i = 0; i < result.paintInvalidations.length; ++i) |
| 147 rects.push(result.paintInvalidations[i].rect); |
| 148 draw_rects(context, rects); |
| 149 } |
| 144 if (result.children) { | 150 if (result.children) { |
| 145 for (var i = 0; i < result.children.length; ++i) | 151 for (var i = 0; i < result.children.length; ++i) |
| 146 draw_layer_rects(context, result.children[i]); | 152 draw_layer_rects(context, result.children[i]); |
| 147 } | 153 } |
| 148 context.restore(); | 154 context.restore(); |
| 149 } | 155 } |
| 150 | 156 |
| 151 var expected_canvas = document.getElementById('expected'); | 157 var expected_canvas = document.getElementById('expected'); |
| 152 var actual_canvas = document.getElementById('actual'); | 158 var actual_canvas = document.getElementById('actual'); |
| 153 var minimum_repaint_canvas = document.getElementById('minimum-repaint'); | 159 var minimum_repaint_canvas = document.getElementById('minimum-repaint'); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 setInterval(flip, 3000); | 206 setInterval(flip, 3000); |
| 201 </script> | 207 </script> |
| 202 </body> | 208 </body> |
| 203 </html> | 209 </html> |
| 204 """ % { | 210 """ % { |
| 205 'title': test_name, | 211 'title': test_name, |
| 206 'expected': expected_layer_tree, | 212 'expected': expected_layer_tree, |
| 207 'actual': actual_layer_tree, | 213 'actual': actual_layer_tree, |
| 208 'minimum_repaint': minimum_repaint, | 214 'minimum_repaint': minimum_repaint, |
| 209 } | 215 } |
| OLD | NEW |