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

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

Issue 1166183002: Add Point.origin for new Point(0.0, 0.0) (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
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 value = 37 * value + minWidth.hashCode; 109 value = 37 * value + minWidth.hashCode;
110 value = 37 * value + maxWidth.hashCode; 110 value = 37 * value + maxWidth.hashCode;
111 value = 37 * value + minHeight.hashCode; 111 value = 37 * value + minHeight.hashCode;
112 value = 37 * value + maxHeight.hashCode; 112 value = 37 * value + maxHeight.hashCode;
113 return value; 113 return value;
114 } 114 }
115 String toString() => "BoxConstraints($minWidth<=w<$maxWidth, $minHeight<=h<$ma xHeight)"; 115 String toString() => "BoxConstraints($minWidth<=w<$maxWidth, $minHeight<=h<$ma xHeight)";
116 } 116 }
117 117
118 class BoxParentData extends ParentData { 118 class BoxParentData extends ParentData {
119 Point position = new Point(0.0, 0.0); 119 Point position = Point.origin;
120 String toString() => 'position=$position'; 120 String toString() => 'position=$position';
121 } 121 }
122 122
123 abstract class RenderBox extends RenderObject { 123 abstract class RenderBox extends RenderObject {
124 124
125 void setParentData(RenderObject child) { 125 void setParentData(RenderObject child) {
126 if (child.parentData is! BoxParentData) 126 if (child.parentData is! BoxParentData)
127 child.parentData = new BoxParentData(); 127 child.parentData = new BoxParentData();
128 } 128 }
129 129
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 Rect childBounds = new Rect.fromSize(child.size); 802 Rect childBounds = new Rect.fromSize(child.size);
803 if (childBounds.contains(position)) 803 if (childBounds.contains(position))
804 child.hitTest(result, position: position); 804 child.hitTest(result, position: position);
805 } 805 }
806 result.add(this); 806 result.add(this);
807 return true; 807 return true;
808 } 808 }
809 809
810 void paint(RenderObjectDisplayList canvas) { 810 void paint(RenderObjectDisplayList canvas) {
811 if (child != null) 811 if (child != null)
812 canvas.paintChild(child, new Point(0.0, 0.0)); 812 canvas.paintChild(child, Point.origin);
813 } 813 }
814 814
815 void paintFrame() { 815 void paintFrame() {
816 RenderObject.debugDoingPaint = true; 816 RenderObject.debugDoingPaint = true;
817 RenderObjectDisplayList canvas = new RenderObjectDisplayList(sky.view.width, sky.view.height); 817 RenderObjectDisplayList canvas = new RenderObjectDisplayList(sky.view.width, sky.view.height);
818 paint(canvas); 818 paint(canvas);
819 sky.view.picture = canvas.endRecording(); 819 sky.view.picture = canvas.endRecording();
820 RenderObject.debugDoingPaint = false; 820 RenderObject.debugDoingPaint = false;
821 } 821 }
822 822
(...skipping 19 matching lines...) Expand all
842 842
843 void defaultPaint(RenderObjectDisplayList canvas) { 843 void defaultPaint(RenderObjectDisplayList canvas) {
844 RenderBox child = firstChild; 844 RenderBox child = firstChild;
845 while (child != null) { 845 while (child != null) {
846 assert(child.parentData is ParentDataType); 846 assert(child.parentData is ParentDataType);
847 canvas.paintChild(child, child.parentData.position); 847 canvas.paintChild(child, child.parentData.position);
848 child = child.parentData.nextSibling; 848 child = child.parentData.nextSibling;
849 } 849 }
850 } 850 }
851 } 851 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/components2/scaffold.dart ('k') | sky/sdk/lib/framework/rendering/stack.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698