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

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

Issue 1147143005: Make Drawer in components2 work (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix margin 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
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 'node.dart'; 8 import 'node.dart';
9 import 'package:vector_math/vector_math.dart'; 9 import 'package:vector_math/vector_math.dart';
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 this.maxWidth: double.INFINITY, 43 this.maxWidth: double.INFINITY,
44 this.minHeight: 0.0, 44 this.minHeight: 0.0,
45 this.maxHeight: double.INFINITY}); 45 this.maxHeight: double.INFINITY});
46 46
47 BoxConstraints.tight(sky.Size size) 47 BoxConstraints.tight(sky.Size size)
48 : minWidth = size.width, 48 : minWidth = size.width,
49 maxWidth = size.width, 49 maxWidth = size.width,
50 minHeight = size.height, 50 minHeight = size.height,
51 maxHeight = size.height; 51 maxHeight = size.height;
52 52
53 BoxConstraints.loose(sky.Size size)
54 : minWidth = 0.0,
55 maxWidth = size.width,
56 minHeight = 0.0,
57 maxHeight = size.height;
58
53 BoxConstraints deflate(EdgeDims edges) { 59 BoxConstraints deflate(EdgeDims edges) {
54 assert(edges != null); 60 assert(edges != null);
55 double horizontal = edges.left + edges.right; 61 double horizontal = edges.left + edges.right;
56 double vertical = edges.top + edges.bottom; 62 double vertical = edges.top + edges.bottom;
57 return new BoxConstraints( 63 return new BoxConstraints(
58 minWidth: math.min(0.0, minWidth - horizontal), 64 minWidth: math.min(0.0, minWidth - horizontal),
59 maxWidth: maxWidth - horizontal, 65 maxWidth: maxWidth - horizontal,
60 minHeight: math.min(0.0, minHeight - vertical), 66 minHeight: math.min(0.0, minHeight - vertical),
61 maxHeight: maxHeight - vertical 67 maxHeight: maxHeight - vertical
62 ); 68 );
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 Vector3 position3 = new Vector3(position.x, position.y, 0.0); 349 Vector3 position3 = new Vector3(position.x, position.y, 0.0);
344 Vector3 transformed3 = inverse.transform3(position3); 350 Vector3 transformed3 = inverse.transform3(position3);
345 sky.Point transformed = new sky.Point(transformed3.x, transformed3.y); 351 sky.Point transformed = new sky.Point(transformed3.x, transformed3.y);
346 super.hitTestChildren(result, position: transformed); 352 super.hitTestChildren(result, position: transformed);
347 } 353 }
348 354
349 void paint(RenderNodeDisplayList canvas) { 355 void paint(RenderNodeDisplayList canvas) {
350 Float32List storage = _transform.storage; 356 Float32List storage = _transform.storage;
351 357
352 canvas.save(); 358 canvas.save();
353 canvas.concat([ 359 canvas.concat([
Matt Perry 2015/06/03 21:29:50 We could change Canvas.concat to take a Float32Lis
Matt Perry 2015/06/03 22:15:52 Here's what it would look like: https://codereview
354 storage[ 0], storage[ 1], storage[ 3], 360 storage[ 0], storage[ 4], storage[12],
355 storage[ 4], storage[ 5], storage[ 7], 361 storage[ 1], storage[ 5], storage[13],
356 storage[12], storage[13], storage[15], 362 storage[ 3], storage[ 7], storage[15],
Hixie 2015/06/03 21:39:56 Why doesn't canvas take a Matrix, the same way it
abarth-chromium 2015/06/03 22:33:42 The answer here is slightly complicated. The shor
357 ]); 363 ]);
358 super.paint(canvas); 364 super.paint(canvas);
359 canvas.restore(); 365 canvas.restore();
360 } 366 }
361 } 367 }
362 368
363 369
364 // RENDER VIEW LAYOUT MANAGER 370 // RENDER VIEW LAYOUT MANAGER
365 371
366 class ViewConstraints { 372 class ViewConstraints {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 467
462 void defaultPaint(RenderNodeDisplayList canvas) { 468 void defaultPaint(RenderNodeDisplayList canvas) {
463 RenderBox child = firstChild; 469 RenderBox child = firstChild;
464 while (child != null) { 470 while (child != null) {
465 assert(child.parentData is ParentDataType); 471 assert(child.parentData is ParentDataType);
466 canvas.paintChild(child, child.parentData.position); 472 canvas.paintChild(child, child.parentData.position);
467 child = child.parentData.nextSibling; 473 child = child.parentData.nextSibling;
468 } 474 }
469 } 475 }
470 } 476 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698