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

Side by Side Diff: sky/sdk/lib/rendering/paragraph.dart

Issue 1209413004: Instead of applying a transform for every RenderObject, pass down an Offset for where to paint. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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:sky' as sky; 5 import 'dart:sky' as sky;
6 6
7 import 'box.dart'; 7 import 'box.dart';
8 import 'object.dart'; 8 import 'object.dart';
9 import '../painting/text_style.dart'; 9 import '../painting/text_style.dart';
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 void performLayout() { 167 void performLayout() {
168 _layout(constraints); 168 _layout(constraints);
169 sky.Element root = _layoutRoot.rootElement; 169 sky.Element root = _layoutRoot.rootElement;
170 // rootElement.width always expands to fill, use maxContentWidth instead. 170 // rootElement.width always expands to fill, use maxContentWidth instead.
171 size = constraints.constrain(new Size(_applyFloatingPointHack(root.maxConten tWidth), 171 size = constraints.constrain(new Size(_applyFloatingPointHack(root.maxConten tWidth),
172 _applyFloatingPointHack(root.height))) ; 172 _applyFloatingPointHack(root.height))) ;
173 } 173 }
174 174
175 void paint(RenderCanvas canvas) { 175 void paint(RenderCanvas canvas, Offset offset) {
176 // Ideally we could compute the min/max intrinsic width/height with a 176 // Ideally we could compute the min/max intrinsic width/height with a
177 // non-destructive operation. However, currently, computing these values 177 // non-destructive operation. However, currently, computing these values
178 // will destroy state inside the layout root. If that happens, we need to 178 // will destroy state inside the layout root. If that happens, we need to
179 // get back the correct state by calling _layout again. 179 // get back the correct state by calling _layout again.
180 // 180 //
181 // TODO(abarth): Make computing the min/max intrinsic width/height a 181 // TODO(abarth): Make computing the min/max intrinsic width/height a
182 // non-destructive operation. 182 // non-destructive operation.
183 _layout(constraints); 183 _layout(constraints);
184 canvas.translate(offset.dx, offset.dy);
184 _layoutRoot.paint(canvas); 185 _layoutRoot.paint(canvas);
186 canvas.translate(-offset.dx, -offset.dy);
abarth-chromium 2015/06/27 00:39:37 Ouch. Can you add a TODO about teaching layoutRoo
185 } 187 }
186 188
187 // we should probably expose a way to do precise (inter-glpyh) hit testing 189 // we should probably expose a way to do precise (inter-glpyh) hit testing
188 190
189 String debugDescribeSettings(String prefix) { 191 String debugDescribeSettings(String prefix) {
190 String result = '${super.debugDescribeSettings(prefix)}'; 192 String result = '${super.debugDescribeSettings(prefix)}';
191 result += '${prefix}inline:\n${inline.toString("$prefix ")}\n'; 193 result += '${prefix}inline:\n${inline.toString("$prefix ")}\n';
192 return result; 194 return result;
193 } 195 }
194 } 196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698