提交 faf554f0 编写于 作者: E Eric Seidel

Move RenderParagraph into layout2.dart

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1155103003
上级 108863ab
......@@ -6,36 +6,6 @@ import 'dart:sky';
import 'package:sky/framework/app.dart';
import 'package:sky/framework/layout2.dart';
class RenderParagraph extends RenderDecoratedBox {
final String text;
LayoutRoot _layoutRoot = new LayoutRoot();
Document _document;
RenderParagraph(String this.text) :
super(new BoxDecoration(backgroundColor: 0xFFFFFFFF)) {
_document = new Document();
_layoutRoot.rootElement = _document.createElement('p');
_layoutRoot.rootElement.appendChild(_document.createText(this.text));
}
void performLayout() {
_layoutRoot.maxWidth = constraints.maxWidth;
_layoutRoot.minWidth = constraints.minWidth;
_layoutRoot.layout();
width = _layoutRoot.rootElement.width;
height = _layoutRoot.rootElement.height;
}
void hitTestChildren(HitTestResult result, { double x, double y }) {
// defaultHitTestChildren(result, x: x, y: y);
}
void paint(RenderNodeDisplayList canvas) {
super.paint(canvas);
_layoutRoot.paint(canvas);
}
}
class RenderSolidColor extends RenderDecoratedBox {
final double desiredHeight;
final double desiredWidth;
......
......@@ -188,7 +188,7 @@ abstract class RenderNode extends AbstractNode {
void paint(RenderNodeDisplayList canvas) { }
// HIT TESTING
// HIT TESTING
void handlePointer(sky.PointerEvent event) {
// override this if you have a client, to hand it to the client
......@@ -922,3 +922,33 @@ class RenderFlex extends RenderDecoratedBox with ContainerRenderNodeMixin<Render
defaultPaint(canvas);
}
}
class RenderParagraph extends RenderDecoratedBox {
final String text;
LayoutRoot _layoutRoot = new LayoutRoot();
Document _document;
RenderParagraph(String this.text) :
super(new BoxDecoration(backgroundColor: 0xFFFFFFFF)) {
_document = new Document();
_layoutRoot.rootElement = _document.createElement('p');
_layoutRoot.rootElement.appendChild(_document.createText(this.text));
}
void performLayout() {
_layoutRoot.maxWidth = constraints.maxWidth;
_layoutRoot.minWidth = constraints.minWidth;
_layoutRoot.layout();
width = _layoutRoot.rootElement.width;
height = _layoutRoot.rootElement.height;
}
void hitTestChildren(HitTestResult result, { double x, double y }) {
// defaultHitTestChildren(result, x: x, y: y);
}
void paint(RenderNodeDisplayList canvas) {
super.paint(canvas);
_layoutRoot.paint(canvas);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册