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 String data; | 10 String data; |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 Color _color = const Color(0xFF000000); | 34 Color _color = const Color(0xFF000000); |
35 Color get color => _color; | 35 Color get color => _color; |
36 void set color (Color value) { | 36 void set color (Color value) { |
37 if (_color != value) { | 37 if (_color != value) { |
38 _color = value; | 38 _color = value; |
39 markNeedsPaint(); | 39 markNeedsPaint(); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 Size getIntrinsicDimensions(BoxConstraints constraints) { | 43 // We don't currently support this for RenderParagraph |
| 44 double getMinIntrinsicWidth(BoxConstraints constraints) { |
44 assert(false); | 45 assert(false); |
45 return null; | 46 return constraints.constrainWidth(0.0); |
46 // we don't currently support this for RenderParagraph | 47 } |
| 48 |
| 49 // We don't currently support this for RenderParagraph |
| 50 double getMaxIntrinsicWidth(BoxConstraints constraints) { |
| 51 assert(false); |
| 52 return constraints.constrainWidth(0.0); |
| 53 } |
| 54 |
| 55 // We don't currently support this for RenderParagraph |
| 56 double getMinIntrinsicHeight(BoxConstraints constraints) { |
| 57 assert(false); |
| 58 return constraints.constrainHeight(0.0); |
| 59 } |
| 60 |
| 61 // We don't currently support this for RenderParagraph |
| 62 double getMaxIntrinsicHeight(BoxConstraints constraints) { |
| 63 assert(false); |
| 64 return constraints.constrainHeight(0.0); |
47 } | 65 } |
48 | 66 |
49 void performLayout() { | 67 void performLayout() { |
50 _layoutRoot.maxWidth = constraints.maxWidth; | 68 _layoutRoot.maxWidth = constraints.maxWidth; |
51 _layoutRoot.minWidth = constraints.minWidth; | 69 _layoutRoot.minWidth = constraints.minWidth; |
52 _layoutRoot.minHeight = constraints.minHeight; | 70 _layoutRoot.minHeight = constraints.minHeight; |
53 _layoutRoot.maxHeight = constraints.maxHeight; | 71 _layoutRoot.maxHeight = constraints.maxHeight; |
54 _layoutRoot.layout(); | 72 _layoutRoot.layout(); |
55 // rootElement.width always expands to fill, use maxContentWidth instead. | 73 // rootElement.width always expands to fill, use maxContentWidth instead. |
56 sky.Element root = _layoutRoot.rootElement; | 74 sky.Element root = _layoutRoot.rootElement; |
57 size = constraints.constrain(new Size(root.maxContentWidth, root.height)); | 75 size = constraints.constrain(new Size(root.maxContentWidth, root.height)); |
58 } | 76 } |
59 | 77 |
60 void paint(RenderObjectDisplayList canvas) { | 78 void paint(RenderObjectDisplayList canvas) { |
61 // _layoutRoot.rootElement.style['color'] = 'rgba(' + ...color... + ')'; | 79 // _layoutRoot.rootElement.style['color'] = 'rgba(' + ...color... + ')'; |
62 _layoutRoot.paint(canvas); | 80 _layoutRoot.paint(canvas); |
63 } | 81 } |
64 | 82 |
65 // we should probably expose a way to do precise (inter-glpyh) hit testing | 83 // we should probably expose a way to do precise (inter-glpyh) hit testing |
66 | 84 |
67 String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(
prefix)}${prefix}color: ${color}\n${prefix}text: ${text}\n'; | 85 String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(
prefix)}${prefix}color: ${color}\n${prefix}text: ${text}\n'; |
68 } | 86 } |
OLD | NEW |