| 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'; | 5 import 'dart:sky'; |
| 6 import 'package:sky/framework/app.dart'; | 6 import 'package:sky/framework/app.dart'; |
| 7 import 'package:sky/framework/layout2.dart'; | 7 import 'package:sky/framework/layout2.dart'; |
| 8 | 8 |
| 9 class RenderParagraph extends RenderDecoratedBox { | |
| 10 final String text; | |
| 11 LayoutRoot _layoutRoot = new LayoutRoot(); | |
| 12 Document _document; | |
| 13 | |
| 14 RenderParagraph(String this.text) : | |
| 15 super(new BoxDecoration(backgroundColor: 0xFFFFFFFF)) { | |
| 16 _document = new Document(); | |
| 17 _layoutRoot.rootElement = _document.createElement('p'); | |
| 18 _layoutRoot.rootElement.appendChild(_document.createText(this.text)); | |
| 19 } | |
| 20 | |
| 21 void performLayout() { | |
| 22 _layoutRoot.maxWidth = constraints.maxWidth; | |
| 23 _layoutRoot.minWidth = constraints.minWidth; | |
| 24 _layoutRoot.layout(); | |
| 25 width = _layoutRoot.rootElement.width; | |
| 26 height = _layoutRoot.rootElement.height; | |
| 27 } | |
| 28 | |
| 29 void hitTestChildren(HitTestResult result, { double x, double y }) { | |
| 30 // defaultHitTestChildren(result, x: x, y: y); | |
| 31 } | |
| 32 | |
| 33 void paint(RenderNodeDisplayList canvas) { | |
| 34 super.paint(canvas); | |
| 35 _layoutRoot.paint(canvas); | |
| 36 } | |
| 37 } | |
| 38 | |
| 39 class RenderSolidColor extends RenderDecoratedBox { | 9 class RenderSolidColor extends RenderDecoratedBox { |
| 40 final double desiredHeight; | 10 final double desiredHeight; |
| 41 final double desiredWidth; | 11 final double desiredWidth; |
| 42 final int backgroundColor; | 12 final int backgroundColor; |
| 43 | 13 |
| 44 RenderSolidColor(int backgroundColor, { this.desiredHeight: double.INFINITY, | 14 RenderSolidColor(int backgroundColor, { this.desiredHeight: double.INFINITY, |
| 45 this.desiredWidth: double.INFINITY }) | 15 this.desiredWidth: double.INFINITY }) |
| 46 : backgroundColor = backgroundColor, | 16 : backgroundColor = backgroundColor, |
| 47 super(new BoxDecoration(backgroundColor: backgroundColor)); | 17 super(new BoxDecoration(backgroundColor: backgroundColor)); |
| 48 | 18 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 andouille leberkas capicola meatloaf. Chicken pig ball tip pork picanha bresaola | 52 andouille leberkas capicola meatloaf. Chicken pig ball tip pork picanha bresaola |
| 83 alcatra. Pork pork belly alcatra, flank chuck drumstick biltong doner jowl. | 53 alcatra. Pork pork belly alcatra, flank chuck drumstick biltong doner jowl. |
| 84 Pancetta meatball tongue tenderloin rump tail jowl boudin."""; | 54 Pancetta meatball tongue tenderloin rump tail jowl boudin."""; |
| 85 | 55 |
| 86 child = new RenderParagraph(meatyString); | 56 child = new RenderParagraph(meatyString); |
| 87 root.add(child); | 57 root.add(child); |
| 88 child.parentData.flex = 1; | 58 child.parentData.flex = 1; |
| 89 | 59 |
| 90 app = new AppView(root); | 60 app = new AppView(root); |
| 91 } | 61 } |
| OLD | NEW |