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

Unified Diff: sky/sdk/lib/framework/rendering/stack.dart

Issue 1147143005: Make Drawer in components2 work (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase 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/sdk/lib/framework/rendering/box.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/rendering/stack.dart
diff --git a/sky/sdk/lib/framework/rendering/stack.dart b/sky/sdk/lib/framework/rendering/stack.dart
new file mode 100644
index 0000000000000000000000000000000000000000..adad8ce6b90b3f2e6c877d91f65d2d3e2c59879c
--- /dev/null
+++ b/sky/sdk/lib/framework/rendering/stack.dart
@@ -0,0 +1,52 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:sky' as sky;
+import 'box.dart';
+import 'node.dart';
+
+class StackParentData extends BoxParentData with ContainerParentDataMixin<RenderBox> { }
+
+class RenderStack extends RenderBox with ContainerRenderNodeMixin<RenderBox, StackParentData>,
+ RenderBoxContainerDefaultsMixin<RenderBox, StackParentData> {
+ RenderStack({
+ List<RenderBox> children
+ }) {
+ if (children != null)
+ children.forEach((child) { add(child); });
+ }
+
+ void setParentData(RenderBox child) {
+ if (child.parentData is! StackParentData)
+ child.parentData = new StackParentData();
+ }
+
+ sky.Size getIntrinsicDimensions(BoxConstraints constraints) {
+ return constraints.constrain(new sky.Size.infinite());
+ }
+
+ void performLayout() {
+ size = constraints.constrain(new sky.Size.infinite());
+ assert(size.width < double.INFINITY);
+ assert(size.height < double.INFINITY);
+ BoxConstraints innerConstraints = new BoxConstraints.loose(size);
+
+ sky.Point origin = new sky.Point(0.0, 0.0);
+ RenderBox child = firstChild;
+ while (child != null) {
+ child.layout(innerConstraints);
+ assert(child.parentData is StackParentData);
+ child.parentData.position = origin;
+ child = child.parentData.nextSibling;
+ }
+ }
+
+ void hitTestChildren(HitTestResult result, { sky.Point position }) {
+ defaultHitTestChildren(result, position: position);
+ }
+
+ void paint(RenderNodeDisplayList canvas) {
+ defaultPaint(canvas);
+ }
+}
« no previous file with comments | « sky/sdk/lib/framework/rendering/box.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698