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

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

Issue 1162623011: Fix some minor warnings from the analyzer in the framework. (Closed) Base URL: https://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') | no next file » | 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 18 matching lines...) Expand all
29 final double right; 29 final double right;
30 final double bottom; 30 final double bottom;
31 final double left; 31 final double left;
32 32
33 operator ==(EdgeDims other) => (top == other.top) || 33 operator ==(EdgeDims other) => (top == other.top) ||
34 (right == other.right) || 34 (right == other.right) ||
35 (bottom == other.bottom) || 35 (bottom == other.bottom) ||
36 (left == other.left); 36 (left == other.left);
37 37
38 int get hashCode { 38 int get hashCode {
39 value = 373; 39 int value = 373;
40 value = 37 * value + top.hashCode; 40 value = 37 * value + top.hashCode;
41 value = 37 * value + left.hashCode; 41 value = 37 * value + left.hashCode;
42 value = 37 * value + bottom.hashCode; 42 value = 37 * value + bottom.hashCode;
43 value = 37 * value + right.hashCode; 43 value = 37 * value + right.hashCode;
44 return value; 44 return value;
45 } 45 }
46 String toString() => "EdgeDims($top, $right, $bottom, $left)"; 46 String toString() => "EdgeDims($top, $right, $bottom, $left)";
47 } 47 }
48 48
49 class BoxConstraints { 49 class BoxConstraints {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return clamp(min: minHeight, max: maxHeight, value: height); 90 return clamp(min: minHeight, max: maxHeight, value: height);
91 } 91 }
92 92
93 sky.Size constrain(sky.Size size) { 93 sky.Size constrain(sky.Size size) {
94 return new sky.Size(constrainWidth(size.width), constrainHeight(size.height) ); 94 return new sky.Size(constrainWidth(size.width), constrainHeight(size.height) );
95 } 95 }
96 96
97 bool get isInfinite => maxWidth >= double.INFINITY || maxHeight >= double.INFI NITY; 97 bool get isInfinite => maxWidth >= double.INFINITY || maxHeight >= double.INFI NITY;
98 98
99 int get hashCode { 99 int get hashCode {
100 value = 373; 100 int value = 373;
101 value = 37 * value + minWidth.hashCode; 101 value = 37 * value + minWidth.hashCode;
102 value = 37 * value + maxWidth.hashCode; 102 value = 37 * value + maxWidth.hashCode;
103 value = 37 * value + minHeight.hashCode; 103 value = 37 * value + minHeight.hashCode;
104 value = 37 * value + maxHeight.hashCode; 104 value = 37 * value + maxHeight.hashCode;
105 return value; 105 return value;
106 } 106 }
107 String toString() => "BoxConstraints($minWidth<=w<$maxWidth, $minHeight<=h<$ma xHeight)"; 107 String toString() => "BoxConstraints($minWidth<=w<$maxWidth, $minHeight<=h<$ma xHeight)";
108 } 108 }
109 109
110 class BoxParentData extends ParentData { 110 class BoxParentData extends ParentData {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 double height = requestedSize.height == null ? 0.0 : requestedSize.height; 325 double height = requestedSize.height == null ? 0.0 : requestedSize.height;
326 size = constraints.constrain(new sky.Size(width, height)); 326 size = constraints.constrain(new sky.Size(width, height));
327 return; 327 return;
328 } 328 }
329 329
330 // If neither height nor width are specified, use inherent image dimensions 330 // If neither height nor width are specified, use inherent image dimensions
331 // If only one dimension is specified, adjust the other dimension to 331 // If only one dimension is specified, adjust the other dimension to
332 // maintain the aspect ratio 332 // maintain the aspect ratio
333 if (requestedSize.width == null) { 333 if (requestedSize.width == null) {
334 if (requestedSize.height == null) { 334 if (requestedSize.height == null) {
335 size = constraints.constrain(new sky.Size(_image.width, _image.height)); 335 size = constraints.constrain(new sky.Size(_image.width.toDouble(), _imag e.height.toDouble()));
336 } else { 336 } else {
337 double width = requestedSize.height * _image.width / _image.height; 337 double width = requestedSize.height * _image.width / _image.height;
338 size = constraints.constrain(new sky.Size(width, requestedSize.height)); 338 size = constraints.constrain(new sky.Size(width, requestedSize.height));
339 } 339 }
340 } else if (requestedSize.height == null) { 340 } else if (requestedSize.height == null) {
341 double height = requestedSize.width * _image.height / _image.width; 341 double height = requestedSize.width * _image.height / _image.width;
342 size = constraints.constrain(new sky.Size(requestedSize.width, height)); 342 size = constraints.constrain(new sky.Size(requestedSize.width, height));
343 } else { 343 } else {
344 size = constraints.constrain(requestedSize); 344 size = constraints.constrain(requestedSize);
345 } 345 }
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 683
684 void defaultPaint(RenderObjectDisplayList canvas) { 684 void defaultPaint(RenderObjectDisplayList canvas) {
685 RenderBox child = firstChild; 685 RenderBox child = firstChild;
686 while (child != null) { 686 while (child != null) {
687 assert(child.parentData is ParentDataType); 687 assert(child.parentData is ParentDataType);
688 canvas.paintChild(child, child.parentData.position); 688 canvas.paintChild(child, child.parentData.position);
689 child = child.parentData.nextSibling; 689 child = child.parentData.nextSibling;
690 } 690 }
691 } 691 }
692 } 692 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/fn2.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698