OLD | NEW |
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; |
11 | 11 |
12 // GENERIC BOX RENDERING | 12 // GENERIC BOX RENDERING |
13 // Anything that has a concept of x, y, width, height is going to derive from th
is | 13 // Anything that has a concept of x, y, width, height is going to derive from th
is |
14 | 14 |
15 class EdgeDims { | 15 class EdgeDims { |
16 // used for e.g. padding | 16 // used for e.g. padding |
17 const EdgeDims(this.top, this.right, this.bottom, this.left); | 17 const EdgeDims(this.top, this.right, this.bottom, this.left); |
18 const EdgeDims.all(double value) | 18 const EdgeDims.all(double value) |
19 : top = value, right = value, bottom = value, left = value; | 19 : top = value, right = value, bottom = value, left = value; |
20 | 20 const EdgeDims.only({ this.top: 0.0, |
21 const EdgeDims.onlyLeft(double value) | 21 this.right: 0.0, |
22 : top = 0.0, right = 0.0, bottom = 0.0, left = value; | 22 this.bottom: 0.0, |
23 const EdgeDims.onlyRight(double value) | 23 this.left: 0.0 }); |
24 : top = 0.0, right = value, bottom = 0.0, left = 0.0; | 24 const EdgeDims.symmetric({ double vertical: 0.0, |
25 const EdgeDims.onlyTop(double value) | 25 double horizontal: 0.0 }) |
26 : top = value, right = 0.0, bottom = 0.0, left = 0.0; | 26 : top = vertical, left = horizontal, bottom = vertical, right = horizontal; |
27 const EdgeDims.onlyBottom(double value) | |
28 : top = 0.0, right = 0.0, bottom = value, left = 0.0; | |
29 | 27 |
30 final double top; | 28 final double top; |
31 final double right; | 29 final double right; |
32 final double bottom; | 30 final double bottom; |
33 final double left; | 31 final double left; |
34 | 32 |
35 operator ==(EdgeDims other) => (top == other.top) || | 33 operator ==(EdgeDims other) => (top == other.top) || |
36 (right == other.right) || | 34 (right == other.right) || |
37 (bottom == other.bottom) || | 35 (bottom == other.bottom) || |
38 (left == other.left); | 36 (left == other.left); |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 | 654 |
657 void defaultPaint(RenderObjectDisplayList canvas) { | 655 void defaultPaint(RenderObjectDisplayList canvas) { |
658 RenderBox child = firstChild; | 656 RenderBox child = firstChild; |
659 while (child != null) { | 657 while (child != null) { |
660 assert(child.parentData is ParentDataType); | 658 assert(child.parentData is ParentDataType); |
661 canvas.paintChild(child, child.parentData.position); | 659 canvas.paintChild(child, child.parentData.position); |
662 child = child.parentData.nextSibling; | 660 child = child.parentData.nextSibling; |
663 } | 661 } |
664 } | 662 } |
665 } | 663 } |
OLD | NEW |