From 8873061dffe136cdbf55ab7a6292982dfc02efdb Mon Sep 17 00:00:00 2001 From: Hixie Date: Mon, 11 May 2015 16:20:20 -0700 Subject: [PATCH] [Effen] Move 'flex' out of CSS also. This introduces a new kind of ContentNode similar to Style but which instead of changing the styles that apply to the node, provides new settings to apply to the "parentData" structure. If you have better ideas for the class names here let me know. Note that the layout.dart backend of this is hacky (more so than before, even); once we have something other than the DOM and CSS to back it, it'll get rewritten. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/1129893006 --- framework/components/action_bar.dart | 7 ++--- framework/fn.dart | 22 +++++++++++++++- framework/layout.dart | 38 ++++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 6 deletions(-) diff --git a/framework/components/action_bar.dart b/framework/components/action_bar.dart index f874009412c..309fb9b8661 100644 --- a/framework/components/action_bar.dart +++ b/framework/components/action_bar.dart @@ -16,8 +16,9 @@ class ActionBar extends Component { padding-top: ${kStatusBarHeight}px;'''); static Style _centerStyle = new Style(''' - padding-left: 24px; - flex: 1;'''); + padding-left: 24px;'''); + + static FlexBoxParentData _centerLayoutSettings = new FlexBoxParentData()..flex = 1; UINode left; UINode center; @@ -31,7 +32,7 @@ class ActionBar extends Component { }) : super(key: key); UINode build() { - List children = [left, new StyleNode(center, _centerStyle)]; + List children = [left, new StyleNode(new ParentDataNode(center, _centerLayoutSettings), _centerStyle)]; if (right != null) children.addAll(right); diff --git a/framework/fn.dart b/framework/fn.dart index 1a1118c07e5..29caedab927 100644 --- a/framework/fn.dart +++ b/framework/fn.dart @@ -148,6 +148,12 @@ class StyleNode extends ContentNode { StyleNode(UINode content, this.style): super(content); } +class ParentDataNode extends ContentNode { + final ParentData parentData; + + ParentDataNode(UINode content, this.parentData): super(content); +} + /* * SkyNodeWrappers correspond to a desired state of a RenderCSS. They are fully * immutable, with one exception: A UINode which is a Component which lives within @@ -389,14 +395,28 @@ abstract class SkyElementWrapper extends SkyNodeWrapper { List