| 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:sky' as sky; | 5 import 'dart:sky' as sky; |
| 6 import 'box.dart'; | 6 import 'box.dart'; |
| 7 import 'object.dart'; | 7 import 'object.dart'; |
| 8 | 8 |
| 9 class RenderInline extends RenderObject { | 9 class RenderInline extends RenderObject { |
| 10 RenderInline(this.data); | 10 RenderInline(this.data); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 void performLayout() { | 90 void performLayout() { |
| 91 _layout(constraints); | 91 _layout(constraints); |
| 92 sky.Element root = _layoutRoot.rootElement; | 92 sky.Element root = _layoutRoot.rootElement; |
| 93 // rootElement.width always expands to fill, use maxContentWidth instead. | 93 // rootElement.width always expands to fill, use maxContentWidth instead. |
| 94 size = constraints.constrain(new Size(_applyFloatingPointHack(root.maxConten
tWidth), | 94 size = constraints.constrain(new Size(_applyFloatingPointHack(root.maxConten
tWidth), |
| 95 _applyFloatingPointHack(root.height)))
; | 95 _applyFloatingPointHack(root.height)))
; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void paint(RenderObjectDisplayList canvas) { | 98 void paint(sky.Canvas canvas) { |
| 99 // Ideally we could compute the min/max intrinsic width/height with a | 99 // Ideally we could compute the min/max intrinsic width/height with a |
| 100 // non-destructive operation. However, currently, computing these values | 100 // non-destructive operation. However, currently, computing these values |
| 101 // will destroy state inside the layout root. If that happens, we need to | 101 // will destroy state inside the layout root. If that happens, we need to |
| 102 // get back the correct state by calling _layout again. | 102 // get back the correct state by calling _layout again. |
| 103 // | 103 // |
| 104 // TODO(abarth): Make computing the min/max intrinsic width/height a | 104 // TODO(abarth): Make computing the min/max intrinsic width/height a |
| 105 // non-destructive operation. | 105 // non-destructive operation. |
| 106 if (_constraintsForCurrentLayout != constraints && constraints != null) | 106 if (_constraintsForCurrentLayout != constraints && constraints != null) |
| 107 _layout(constraints); | 107 _layout(constraints); |
| 108 | 108 |
| 109 if (_color != null) { | 109 if (_color != null) { |
| 110 _layoutRoot.rootElement.style['color'] = | 110 _layoutRoot.rootElement.style['color'] = |
| 111 'rgba(${_color.red}, ${_color.green}, ${_color.blue}, ${_color.alpha /
255.0 })'; | 111 'rgba(${_color.red}, ${_color.green}, ${_color.blue}, ${_color.alpha /
255.0 })'; |
| 112 } | 112 } |
| 113 _layoutRoot.paint(canvas); | 113 _layoutRoot.paint(canvas); |
| 114 } | 114 } |
| 115 | 115 |
| 116 // we should probably expose a way to do precise (inter-glpyh) hit testing | 116 // we should probably expose a way to do precise (inter-glpyh) hit testing |
| 117 | 117 |
| 118 String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(
prefix)}${prefix}color: ${color}\n${prefix}text: ${text}\n'; | 118 String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(
prefix)}${prefix}color: ${color}\n${prefix}text: ${text}\n'; |
| 119 } | 119 } |
| OLD | NEW |