Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: sky/sdk/lib/framework/layout2.dart

Issue 1160843005: Add hello_fn2.dart and make Text("Hello fn2") actually render something. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fixored Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/framework/fn2.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/fn2.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698