diff --git a/framework/components/drawer.dart b/framework/components/drawer.dart index b1e1a1be975..5959bab73c4 100644 --- a/framework/components/drawer.dart +++ b/framework/components/drawer.dart @@ -97,22 +97,13 @@ class Drawer extends AnimatedComponent { static final Style _maskStyle = new Style(''' background-color: black; - will-change: opacity; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0;''' + will-change: opacity;''' ); static final Style _contentStyle = new Style(''' background-color: ${Grey[50]}; will-change: transform; - position: absolute; - width: ${_kWidth}px; - top: 0; - left: 0; - bottom: 0;''' + width: ${_kWidth}px;''' ); List children; @@ -152,7 +143,7 @@ class Drawer extends AnimatedComponent { level: level); return new EventListenerNode( - new Container( + new FillStackContainer( style: _style, children: [ mask, content ] ), diff --git a/framework/fn.dart b/framework/fn.dart index 751aa43afef..427e4da8fd7 100644 --- a/framework/fn.dart +++ b/framework/fn.dart @@ -593,6 +593,42 @@ class FlexContainer extends SkyElementWrapper { } } +class FillStackContainer extends SkyElementWrapper { + + RenderCSSStack _root; + RenderCSSStack _createNode() => new RenderCSSStack(this); + + static final FillStackContainer _emptyContainer = new FillStackContainer(); + + SkyNodeWrapper get _emptyNode => _emptyContainer; + + FillStackContainer({ + Object key, + List children, + Style style, + String inlineStyle + }) : super( + key: key, + children: _positionNodesToFill(children), + style: style, + inlineStyle: inlineStyle + ); + + static StackParentData _fillParentData = new StackParentData() + ..top = 0.0 + ..left = 0.0 + ..right = 0.0 + ..bottom = 0.0; + + static List _positionNodesToFill(List input) { + if (input == null) + return null; + return input.map((node) { + return new ParentDataNode(node, _fillParentData); + }).toList(); + } +} + class TextFragment extends SkyElementWrapper { RenderCSSInline _root; diff --git a/framework/layout.dart b/framework/layout.dart index f402b990263..2580942222a 100644 --- a/framework/layout.dart +++ b/framework/layout.dart @@ -398,6 +398,63 @@ class RenderCSSFlex extends RenderCSSContainer { } +class StackParentData extends CSSParentData { + double top; + double left; + double right; + double bottom; + void merge(StackParentData other) { + if (other.top != null) + top = other.top; + if (other.left != null) + left = other.left; + if (other.right != null) + right = other.right; + if (other.bottom != null) + bottom = other.bottom; + super.merge(other); + } +} + +class RenderCSSStack extends RenderCSSContainer { + + RenderCSSStack(debug) : super(debug); + + void setupPos(RenderNode child) { + if (child.parentData is! StackParentData) + child.parentData = new StackParentData(); + } + + static final Style _displayPosition = new Style._addToCache('transform:translateX(0);position:relative'); + + String stylesToClasses(List