提交 42fc77f4 编写于 作者: B Benjamin Lerman

Revert "[Effen] Move 'flex' out of CSS also."

This reverts commit 1a4db2e964de8a2eba7c76c0904027150cc0c387.

This broke the bots.

TBR=github.com@spam.hixie.ch

Review URL: https://codereview.chromium.org/1137153002
上级 8873061d
......@@ -16,9 +16,8 @@ class ActionBar extends Component {
padding-top: ${kStatusBarHeight}px;''');
static Style _centerStyle = new Style('''
padding-left: 24px;''');
static FlexBoxParentData _centerLayoutSettings = new FlexBoxParentData()..flex = 1;
padding-left: 24px;
flex: 1;''');
UINode left;
UINode center;
......@@ -32,7 +31,7 @@ class ActionBar extends Component {
}) : super(key: key);
UINode build() {
List<UINode> children = [left, new StyleNode(new ParentDataNode(center, _centerLayoutSettings), _centerStyle)];
List<UINode> children = [left, new StyleNode(center, _centerStyle)];
if (right != null)
children.addAll(right);
......
......@@ -148,12 +148,6 @@ 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
......@@ -395,28 +389,14 @@ abstract class SkyElementWrapper extends SkyNodeWrapper {
List<Style> styles = new List<Style>();
if (style != null)
styles.add(style);
ParentData parentData = null;
UINode parent = _parent;
while (parent != null && parent is! SkyNodeWrapper) {
if (parent is StyleNode && parent.style != null)
styles.add(parent.style);
else
if (parent is ParentDataNode && parent.parentData != null) {
if (parentData != null)
parentData.merge(parent.parentData); // this will throw if the types aren't the same
else
parentData = parent.parentData;
}
parent = parent._parent;
}
_root.updateStyles(styles);
if (parentData != null) {
assert(_root.parentData != null);
_root.parentData.merge(parentData); // this will throw if the types aren't approriate
assert(parent != null);
assert(parent._root != null);
parent._root.markNeedsLayout();
}
_root.updateInlineStyle(inlineStyle);
_syncChildren(oldSkyElementWrapper);
......
......@@ -53,10 +53,6 @@ class ParentData {
detachSiblings();
}
void detachSiblings() { } // workaround for lack of inter-class mixins in Dart
void merge(ParentData other) {
// override this in subclasses to merge in data from other into this
assert(other.runtimeType == this.runtimeType);
}
}
abstract class RenderNode extends Node {
......@@ -265,16 +261,8 @@ abstract class RenderCSS extends RenderBox {
return styles.map((s) => s._className).join(' ');
}
String _inlineStyles = '';
String _additionalStylesFromParent = ''; // used internally to propagate parentData settings to the child
void updateInlineStyle(String newStyle) {
_inlineStyles = newStyle;
_updateInlineStyleAttribute();
}
void _updateInlineStyleAttribute() {
_skyElement.setAttribute('style', "$_inlineStyles;$_additionalStylesFromParent");
_skyElement.setAttribute('style', newStyle);
}
double get width {
......@@ -332,14 +320,7 @@ class RenderCSSContainer extends RenderCSS with ContainerRenderNodeMixin<RenderC
}
class FlexBoxParentData extends CSSParentData {
int flex;
void merge(FlexBoxParentData other) {
if (other.flex != null)
flex = other.flex;
super.merge(other);
}
}
class FlexBoxParentData extends CSSParentData { }
enum FlexDirection { Row }
......@@ -370,21 +351,6 @@ class RenderCSSFlex extends RenderCSSContainer {
return super.stylesToClasses(styles) + ' ' + settings;
}
void markNeedsLayout() {
super.markNeedsLayout();
// pretend we did the layout:
RenderCSS child = _firstChild;
while (child != null) {
assert(child.parentData is FlexBoxParentData);
if (child.parentData.flex != null) {
child._additionalStylesFromParent = 'flex:${child.parentData.flex};';
child._updateInlineStyleAttribute();
}
child = child.parentData.nextSibling;
}
}
}
class RenderCSSText extends RenderCSS {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册