diff --git a/examples/raw/simple_render_tree.dart b/examples/raw/simple_render_tree.dart index 7740970d99b1ecc821b7bb0be9f61ea726810f0d..552cf552d9553cacddc3e9629e35a5e5b882ce71 100644 --- a/examples/raw/simple_render_tree.dart +++ b/examples/raw/simple_render_tree.dart @@ -30,9 +30,9 @@ class RenderSolidColor extends RenderDecoratedBox { void handlePointer(PointerEvent event) { if (event.type == 'pointerdown') - setBoxDecoration(new BoxDecoration(backgroundColor: 0xFFFF0000)); + decoration = new BoxDecoration(backgroundColor: 0xFFFF0000); else if (event.type == 'pointerup') - setBoxDecoration(new BoxDecoration(backgroundColor: backgroundColor)); + decoration = new BoxDecoration(backgroundColor: backgroundColor); } } diff --git a/sdk/lib/framework/layout2.dart b/sdk/lib/framework/layout2.dart index 967ea8e79fa01063af57090b1aa22fd2b3df0f7d..d31fce2c9b7d508fc28e142aa843761520d4a7ad 100644 --- a/sdk/lib/framework/layout2.dart +++ b/sdk/lib/framework/layout2.dart @@ -504,6 +504,7 @@ abstract class RenderBox extends RenderNode { double height; } +// This must be immutable, because we won't notice when it changes class BoxDecoration { const BoxDecoration({ this.backgroundColor @@ -513,14 +514,15 @@ class BoxDecoration { } class RenderDecoratedBox extends RenderBox { - BoxDecoration _decoration; RenderDecoratedBox(BoxDecoration decoration) : _decoration = decoration; - void setBoxDecoration(BoxDecoration decoration) { - if (_decoration == decoration) + BoxDecoration _decoration; + BoxDecoration get decoration => _decoration; + void set decoration (BoxDecoration value) { + if (value == _decoration) return; - _decoration = decoration; + _decoration = value; markNeedsPaint(); } @@ -536,6 +538,7 @@ class RenderDecoratedBox extends RenderBox { canvas.drawRect(new sky.Rect()..setLTRB(0.0, 0.0, width, height), paint); } } + } @@ -680,7 +683,7 @@ class RenderBlock extends RenderDecoratedBox with ContainerRenderNodeMixin _padding; - void set padding(EdgeDims value) { + void set padding (EdgeDims value) { assert(value != null); if (_padding != value) { _padding = value;