Index: sky/sdk/lib/framework/layout2.dart |
diff --git a/sky/sdk/lib/framework/layout2.dart b/sky/sdk/lib/framework/layout2.dart |
index 98a929bc1f27bffee425dd4a0493cac81875e199..ac060ab2dfea09b2a2507263ab2cae14eb10a359 100644 |
--- a/sky/sdk/lib/framework/layout2.dart |
+++ b/sky/sdk/lib/framework/layout2.dart |
@@ -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); |
+ } |
+} |