Chromium Code Reviews| Index: sky/framework/layout.dart |
| diff --git a/sky/framework/layout.dart b/sky/framework/layout.dart |
| index eb5ff2f39ed81309c98ba4695e67cf655e4145ca..5678fd88f35a839c39f05ea5533e5294ad1c360a 100644 |
| --- a/sky/framework/layout.dart |
| +++ b/sky/framework/layout.dart |
| @@ -254,7 +254,11 @@ abstract class RenderCSS extends RenderBox { |
| sky.Element createSkyElement(); |
| void updateStyles(List<Style> styles) { |
| - _skyElement.setAttribute('class', styles.map((s) => s._className).join(' ')); |
| + _skyElement.setAttribute('class', stylesToClasses(styles)); |
| + } |
| + |
| + String stylesToClasses(List<Style> styles) { |
| + return styles.map((s) => s._className).join(' '); |
| } |
| void updateInlineStyle(String newStyle) { |
| @@ -316,6 +320,39 @@ class RenderCSSContainer extends RenderCSS with ContainerRenderNodeMixin<RenderC |
| } |
| +class FlexBoxParentData extends CSSParentData { } |
| + |
| +enum FlexDirection { Row } |
|
eseidel
2015/05/11 22:04:24
Did you wish to support both?
Hixie
2015/05/11 22:06:07
Eventually. I'll add column when I run into someth
|
| + |
| +class RenderCSSFlex extends RenderCSSContainer { |
| + |
| + RenderCSSFlex(debug, FlexDirection direction) : _direction = direction, super(debug); |
| + |
| + FlexDirection _direction; |
| + FlexDirection get direction => _direction; |
| + void set direction (FlexDirection value) { |
| + _direction = value; |
| + markNeedsLayout(); |
| + } |
| + |
| + void setupPos(RenderNode child) { |
| + if (child.parentData is! FlexBoxParentData) |
| + child.parentData = new FlexBoxParentData(); |
| + } |
| + |
| + static final Style _displayFlex = new Style('display:flex'); |
| + static final Style _displayFlexRow = new Style('flex-direction:row'); |
| + |
| + String stylesToClasses(List<Style> styles) { |
| + var settings = _displayFlex._className; |
| + switch (_direction) { |
| + case FlexDirection.Row: settings += ' ' + _displayFlexRow._className; |
| + } |
| + return super.stylesToClasses(styles) + ' ' + settings; |
| + } |
| + |
| +} |
| + |
| class RenderCSSText extends RenderCSS { |
| RenderCSSText(debug, String newData) : super(debug) { |