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

Unified Diff: sky/framework/layout.dart

Issue 1128103009: [Effen] Start removing 'position'. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/fn.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/layout.dart
diff --git a/sky/framework/layout.dart b/sky/framework/layout.dart
index f402b990263fc118518d0e5894927b95480c952b..2580942222ad0d4fdad1cbff456fd3ccf6a72268 100644
--- a/sky/framework/layout.dart
+++ b/sky/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<Style> styles) {
+ return super.stylesToClasses(styles) + ' ' + _displayPosition._className;
+ }
+
+ void markNeedsLayout() {
+ super.markNeedsLayout();
+
+ // pretend we did the layout:
+ RenderCSS child = _firstChild;
+ while (child != null) {
+ assert(child.parentData is StackParentData);
+ var style = 'position:absolute;';
+ if (child.parentData.top != null)
+ style += 'top:${child.parentData.top};';
+ if (child.parentData.left != null)
+ style += 'left:${child.parentData.left};';
+ if (child.parentData.right != null)
+ style += 'right:${child.parentData.right};';
+ if (child.parentData.bottom != null)
+ style += 'bottom:${child.parentData.bottom};';
+ child._additionalStylesFromParent = style;
+ child._updateInlineStyleAttribute();
+ child = child.parentData.nextSibling;
+ }
+ }
+
+}
+
class RenderCSSParagraph extends RenderCSSContainer {
RenderCSSParagraph(debug) : super(debug);
« no previous file with comments | « sky/framework/fn.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698