Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path; | 7 import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path; |
| 8 | 8 |
| 9 import '../base/hit_test.dart'; | 9 import '../base/hit_test.dart'; |
| 10 import '../base/node.dart'; | 10 import '../base/node.dart'; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 return true; | 192 return true; |
| 193 }); | 193 }); |
| 194 performLayout(); | 194 performLayout(); |
| 195 assert(() { | 195 assert(() { |
| 196 _debugActiveLayout = debugPreviousActiveLayout; | 196 _debugActiveLayout = debugPreviousActiveLayout; |
| 197 _debugDoingThisLayout = false; | 197 _debugDoingThisLayout = false; |
| 198 _debugCanParentUseSize = null; | 198 _debugCanParentUseSize = null; |
| 199 _debugMutationsLocked = false; | 199 _debugMutationsLocked = false; |
| 200 return true; | 200 return true; |
| 201 }); | 201 }); |
| 202 } catch (e) { | 202 } catch (e, stack) { // TODO(ianh): Figure out how we can not ask for the st ack trace in prod mode |
|
abarth-chromium
2015/07/09 23:39:35
Please don't check this in.
| |
| 203 print('Exception raised during layout:\n${e}\nContext:\n${this}'); | 203 print('Exception raised during layout:\n${e}\n${stack}\nContext:\n${this}' ); |
| 204 return; | 204 return; |
| 205 } | 205 } |
| 206 _needsLayout = false; | 206 _needsLayout = false; |
| 207 markNeedsPaint(); | 207 markNeedsPaint(); |
| 208 } | 208 } |
| 209 void layout(Constraints constraints, { bool parentUsesSize: false }) { | 209 void layout(Constraints constraints, { bool parentUsesSize: false }) { |
| 210 final parent = this.parent; // TODO(ianh): Remove this once the analyzer is cleverer | 210 final parent = this.parent; // TODO(ianh): Remove this once the analyzer is cleverer |
| 211 RenderObject relayoutSubtreeRoot; | 211 RenderObject relayoutSubtreeRoot; |
| 212 if (!parentUsesSize || sizedByParent || constraints.isTight || parent is! Re nderObject) | 212 if (!parentUsesSize || sizedByParent || constraints.isTight || parent is! Re nderObject) |
| 213 relayoutSubtreeRoot = this; | 213 relayoutSubtreeRoot = this; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 static void flushPaint() { | 333 static void flushPaint() { |
| 334 try { | 334 try { |
| 335 _debugDoingPaint = true; | 335 _debugDoingPaint = true; |
| 336 List<RenderObject> dirtyNodes = _nodesNeedingPaint; | 336 List<RenderObject> dirtyNodes = _nodesNeedingPaint; |
| 337 _nodesNeedingPaint = new List<RenderObject>(); | 337 _nodesNeedingPaint = new List<RenderObject>(); |
| 338 for (RenderObject node in dirtyNodes..sort((a, b) => a.depth - b.depth)) { | 338 for (RenderObject node in dirtyNodes..sort((a, b) => a.depth - b.depth)) { |
| 339 if (node._needsPaint && node.attached) | 339 if (node._needsPaint && node.attached) |
| 340 node._updatePaintingCanvas(); | 340 node._updatePaintingCanvas(); |
| 341 }; | 341 }; |
| 342 assert(_nodesNeedingPaint.length == 0); | 342 assert(_nodesNeedingPaint.length == 0); |
| 343 } catch (e) { | |
| 344 print('Exception raised during flushPaint:\n${e}'); | |
| 345 } finally { | 343 } finally { |
| 346 _debugDoingPaint = false; | 344 _debugDoingPaint = false; |
| 347 } | 345 } |
| 348 } | 346 } |
| 349 | 347 |
| 350 void _updatePaintingCanvas() { | 348 void _updatePaintingCanvas() { |
| 351 assert(!_needsLayout); | 349 assert(!_needsLayout); |
| 352 assert(createNewDisplayList); | 350 assert(createNewDisplayList); |
| 353 sky.PictureRecorder recorder = new sky.PictureRecorder(); | 351 sky.PictureRecorder recorder = new sky.PictureRecorder(); |
| 354 PaintingCanvas canvas = new PaintingCanvas(recorder, paintBounds); | 352 PaintingCanvas canvas = new PaintingCanvas(recorder, paintBounds); |
| 355 _needsPaint = false; | 353 _needsPaint = false; |
| 356 try { | 354 try { |
| 357 _paintOnCanvas(canvas, Offset.zero); | 355 _paintOnCanvas(canvas, Offset.zero); |
| 358 } catch (e) { | 356 } catch (e, stack) { // TODO(ianh): Figure out how we can not ask for the st ack trace in prod mode |
|
abarth-chromium
2015/07/09 23:39:35
ditto
| |
| 359 print('Exception raised during _updatePaintingCanvas:\n${e}\nContext:\n${t his}'); | 357 print('Exception raised during paint:\n${e}\n${stack}\nContext:\n${this}') ; |
| 360 return; | 358 return; |
| 361 } | 359 } |
| 362 assert(!_needsLayout); // check that the paint() method didn't mark us dirty again | 360 assert(!_needsLayout); // check that the paint() method didn't mark us dirty again |
| 363 assert(!_needsPaint); // check that the paint() method didn't mark us dirty again | 361 assert(!_needsPaint); // check that the paint() method didn't mark us dirty again |
| 364 _paintingNode.setBackingDrawable(recorder.endRecordingAsDrawable()); | 362 _paintingNode.setBackingDrawable(recorder.endRecordingAsDrawable()); |
| 365 | 363 |
| 366 if (canvas._descendentsWithPaintingCanvases != null) { | 364 if (canvas._descendentsWithPaintingCanvases != null) { |
| 367 for (RenderObject node in canvas._descendentsWithPaintingCanvases) { | 365 for (RenderObject node in canvas._descendentsWithPaintingCanvases) { |
| 368 assert(node.attached == attached); | 366 assert(node.attached == attached); |
| 369 if (node._needsPaint) | 367 if (node._needsPaint) |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 int count = 1; | 678 int count = 1; |
| 681 ChildType child = _firstChild; | 679 ChildType child = _firstChild; |
| 682 while (child != null) { | 680 while (child != null) { |
| 683 result += '${prefix}child ${count}: ${child.toString(prefix)}'; | 681 result += '${prefix}child ${count}: ${child.toString(prefix)}'; |
| 684 count += 1; | 682 count += 1; |
| 685 child = child.parentData.nextSibling; | 683 child = child.parentData.nextSibling; |
| 686 } | 684 } |
| 687 return result; | 685 return result; |
| 688 } | 686 } |
| 689 } | 687 } |
| OLD | NEW |