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 | 7 |
| 8 import 'package:vector_math/vector_math.dart'; | 8 import 'package:vector_math/vector_math.dart'; |
| 9 | 9 |
| 10 import '../base/debug.dart'; | 10 import '../base/debug.dart'; |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 956 | 956 |
| 957 RenderDecoratedBox({ | 957 RenderDecoratedBox({ |
| 958 BoxDecoration decoration, | 958 BoxDecoration decoration, |
| 959 RenderBox child | 959 RenderBox child |
| 960 }) : _painter = new BoxPainter(decoration), super(child); | 960 }) : _painter = new BoxPainter(decoration), super(child); |
| 961 | 961 |
| 962 BoxPainter _painter; | 962 BoxPainter _painter; |
| 963 BoxDecoration get decoration => _painter.decoration; | 963 BoxDecoration get decoration => _painter.decoration; |
| 964 void set decoration (BoxDecoration value) { | 964 void set decoration (BoxDecoration value) { |
| 965 assert(value != null); | 965 assert(value != null); |
| 966 if (value.backgroundImage != null) { | |
| 967 if (_painter.decoration.backgroundImage != null) | |
| 968 _painter.decoration.backgroundImage.removeChangeListener(markNeedsPaint) ; | |
|
abarth-chromium
2015/06/26 23:35:59
Don't we need to removeChangeListener even if valu
jackson
2015/06/29 16:53:25
We do, thanks
| |
| 969 value.backgroundImage.addChangeListener(markNeedsPaint); | |
| 970 } | |
| 966 if (value == _painter.decoration) | 971 if (value == _painter.decoration) |
| 967 return; | 972 return; |
| 968 _painter.decoration = value; | 973 _painter.decoration = value; |
| 969 markNeedsPaint(); | 974 markNeedsPaint(); |
| 970 } | 975 } |
| 971 | 976 |
| 972 void paint(RenderCanvas canvas) { | 977 void paint(RenderCanvas canvas) { |
| 973 assert(size.width != null); | 978 assert(size.width != null); |
| 974 assert(size.height != null); | 979 assert(size.height != null); |
| 975 _painter.paint(canvas, new Rect.fromSize(size)); | 980 _painter.paint(canvas, new Rect.fromSize(size)); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1251 | 1256 |
| 1252 void defaultPaint(RenderCanvas canvas) { | 1257 void defaultPaint(RenderCanvas canvas) { |
| 1253 RenderBox child = firstChild; | 1258 RenderBox child = firstChild; |
| 1254 while (child != null) { | 1259 while (child != null) { |
| 1255 assert(child.parentData is ParentDataType); | 1260 assert(child.parentData is ParentDataType); |
| 1256 canvas.paintChild(child, child.parentData.position); | 1261 canvas.paintChild(child, child.parentData.position); |
| 1257 child = child.parentData.nextSibling; | 1262 child = child.parentData.nextSibling; |
| 1258 } | 1263 } |
| 1259 } | 1264 } |
| 1260 } | 1265 } |
| OLD | NEW |