| 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 'node.dart'; | 5 import 'node.dart'; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 | 7 |
| 8 // ABSTRACT LAYOUT | 8 // ABSTRACT LAYOUT |
| 9 | 9 |
| 10 class ParentData { | 10 class ParentData { |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 void hitTestChildren(HitTestResult result, { sky.Point position }) { | 961 void hitTestChildren(HitTestResult result, { sky.Point position }) { |
| 962 defaultHitTestChildren(result, position: position); | 962 defaultHitTestChildren(result, position: position); |
| 963 } | 963 } |
| 964 | 964 |
| 965 void paint(RenderNodeDisplayList canvas) { | 965 void paint(RenderNodeDisplayList canvas) { |
| 966 super.paint(canvas); | 966 super.paint(canvas); |
| 967 defaultPaint(canvas); | 967 defaultPaint(canvas); |
| 968 } | 968 } |
| 969 } | 969 } |
| 970 | 970 |
| 971 class RenderInline extends RenderNode { |
| 972 String data; |
| 973 |
| 974 RenderInline(this.data); |
| 975 } |
| 976 |
| 971 class RenderParagraph extends RenderDecoratedBox { | 977 class RenderParagraph extends RenderDecoratedBox { |
| 972 final String text; | 978 String text; |
| 973 LayoutRoot _layoutRoot = new LayoutRoot(); | 979 sky.LayoutRoot _layoutRoot = new sky.LayoutRoot(); |
| 974 Document _document; | 980 sky.Document _document; |
| 975 | 981 |
| 976 RenderParagraph(String this.text) : | 982 RenderParagraph(String this.text) : |
| 977 super(new BoxDecoration(backgroundColor: 0xFFFFFFFF)) { | 983 super(new BoxDecoration(backgroundColor: 0xFFFFFFFF)) { |
| 978 _document = new Document(); | 984 _document = new sky.Document(); |
| 979 _layoutRoot.rootElement = _document.createElement('p'); | 985 _layoutRoot.rootElement = _document.createElement('p'); |
| 980 _layoutRoot.rootElement.appendChild(_document.createText(this.text)); | 986 _layoutRoot.rootElement.appendChild(_document.createText(this.text)); |
| 981 } | 987 } |
| 982 | 988 |
| 983 void performLayout() { | 989 void performLayout() { |
| 984 _layoutRoot.maxWidth = constraints.maxWidth; | 990 _layoutRoot.maxWidth = constraints.maxWidth; |
| 985 _layoutRoot.minWidth = constraints.minWidth; | 991 _layoutRoot.minWidth = constraints.minWidth; |
| 992 _layoutRoot.minHeight = constraints.minHeight; |
| 993 _layoutRoot.maxHeight = constraints.maxHeight; |
| 986 _layoutRoot.layout(); | 994 _layoutRoot.layout(); |
| 987 width = _layoutRoot.rootElement.width; | 995 width = _layoutRoot.rootElement.width; |
| 988 height = _layoutRoot.rootElement.height; | 996 // TODO(eseidel): LayoutRoot will not expand to fill height. :( |
| 997 height = _constraints.constrainHeight(_layoutRoot.rootElement.height); |
| 989 } | 998 } |
| 990 | 999 |
| 991 void hitTestChildren(HitTestResult result, { double x, double y }) { | 1000 void hitTestChildren(HitTestResult result, { double x, double y }) { |
| 992 // defaultHitTestChildren(result, x: x, y: y); | 1001 // defaultHitTestChildren(result, x: x, y: y); |
| 993 } | 1002 } |
| 994 | 1003 |
| 995 void paint(RenderNodeDisplayList canvas) { | 1004 void paint(RenderNodeDisplayList canvas) { |
| 996 super.paint(canvas); | 1005 super.paint(canvas); |
| 997 _layoutRoot.paint(canvas); | 1006 _layoutRoot.paint(canvas); |
| 998 } | 1007 } |
| 999 } | 1008 } |
| OLD | NEW |