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

Side by Side Diff: sky/sdk/lib/framework/rendering/box.dart

Issue 1166363002: Position the popup menu in stocks2 correctly (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/framework/fn2.dart ('k') | sky/sdk/lib/framework/rendering/flex.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:math' as math; 5 import 'dart:math' as math;
6 import 'dart:sky' as sky; 6 import 'dart:sky' as sky;
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 import 'object.dart'; 8 import 'object.dart';
9 import 'package:vector_math/vector_math.dart'; 9 import 'package:vector_math/vector_math.dart';
10 import 'package:sky/framework/net/image_cache.dart' as image_cache; 10 import 'package:sky/framework/net/image_cache.dart' as image_cache;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 BoxConstraints apply(BoxConstraints constraints) { 80 BoxConstraints apply(BoxConstraints constraints) {
81 return new BoxConstraints( 81 return new BoxConstraints(
82 minWidth: math.max(minWidth, constraints.minWidth), 82 minWidth: math.max(minWidth, constraints.minWidth),
83 maxWidth: math.min(maxWidth, constraints.maxWidth), 83 maxWidth: math.min(maxWidth, constraints.maxWidth),
84 minHeight: math.max(minHeight, constraints.minHeight), 84 minHeight: math.max(minHeight, constraints.minHeight),
85 maxHeight: math.min(maxHeight, constraints.maxHeight)); 85 maxHeight: math.min(maxHeight, constraints.maxHeight));
86 } 86 }
87 87
88 BoxConstraints applyWidth(double width) { 88 BoxConstraints applyWidth(double width) {
89 return new BoxConstraints(minWidth: width, 89 return new BoxConstraints(minWidth: math.max(minWidth, width),
90 maxWidth: width, 90 maxWidth: math.min(maxWidth, width),
91 minHeight: minHeight, 91 minHeight: minHeight,
92 maxHeight: maxHeight); 92 maxHeight: maxHeight);
93 } 93 }
94
95 BoxConstraints applyMinWidth(double width) {
96 return new BoxConstraints(minWidth: math.max(minWidth, width),
97 maxWidth: maxWidth,
98 minHeight: minHeight,
99 maxHeight: maxHeight);
100 }
101
102 BoxConstraints applyMaxWidth(double width) {
103 return new BoxConstraints(minWidth: minWidth,
104 maxWidth: math.min(maxWidth, width),
105 minHeight: minHeight,
106 maxHeight: maxHeight);
107 }
94 108
95 BoxConstraints applyHeight(double height) { 109 BoxConstraints applyHeight(double height) {
96 return new BoxConstraints(minWidth: minWidth, 110 return new BoxConstraints(minWidth: minWidth,
97 maxWidth: maxWidth, 111 maxWidth: maxWidth,
98 minHeight: height, 112 minHeight: math.max(minHeight, height),
99 maxHeight: height); 113 maxHeight: math.min(maxHeight, height));
114 }
115
116 BoxConstraints applyMinHeight(double height) {
117 return new BoxConstraints(minWidth: minWidth,
118 maxWidth: maxWidth,
119 minHeight: math.max(minHeight, height),
120 maxHeight: maxHeight);
121 }
122
123 BoxConstraints applyMaxHeight(double height) {
124 return new BoxConstraints(minWidth: minWidth,
125 maxWidth: maxWidth,
126 minHeight: minHeight,
127 maxHeight: math.min(maxHeight, height));
100 } 128 }
101 129
102 final double minWidth; 130 final double minWidth;
103 final double maxWidth; 131 final double maxWidth;
104 final double minHeight; 132 final double minHeight;
105 final double maxHeight; 133 final double maxHeight;
106 134
107 double constrainWidth(double width) { 135 double constrainWidth(double width) {
108 return clamp(min: minWidth, max: maxWidth, value: width); 136 return clamp(min: minWidth, max: maxWidth, value: width);
109 } 137 }
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 1013
986 void defaultPaint(RenderObjectDisplayList canvas) { 1014 void defaultPaint(RenderObjectDisplayList canvas) {
987 RenderBox child = firstChild; 1015 RenderBox child = firstChild;
988 while (child != null) { 1016 while (child != null) {
989 assert(child.parentData is ParentDataType); 1017 assert(child.parentData is ParentDataType);
990 canvas.paintChild(child, child.parentData.position); 1018 canvas.paintChild(child, child.parentData.position);
991 child = child.parentData.nextSibling; 1019 child = child.parentData.nextSibling;
992 } 1020 }
993 } 1021 }
994 } 1022 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/fn2.dart ('k') | sky/sdk/lib/framework/rendering/flex.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698