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

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

Issue 1145263006: Add RenderClip and use it in FixedHeightScrollable (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
« 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return constraints.constrain(_desiredSize); 210 return constraints.constrain(_desiredSize);
211 } 211 }
212 212
213 void performLayout() { 213 void performLayout() {
214 size = constraints.constrain(_desiredSize); 214 size = constraints.constrain(_desiredSize);
215 if (child != null) 215 if (child != null)
216 child.layout(new BoxConstraints.tight(size)); 216 child.layout(new BoxConstraints.tight(size));
217 } 217 }
218 } 218 }
219 219
220 class RenderClip extends RenderProxyBox {
221 RenderClip({ RenderBox child }) : super(child);
222
223 void paint(RenderObjectDisplayList canvas) {
224 if (child != null) {
225 canvas.save();
226 canvas.clipRect(new sky.Rect.fromSize(size));
227 child.paint(canvas);
228 canvas.restore();
229 }
230 }
231 }
232
220 class RenderPadding extends RenderBox with RenderObjectWithChildMixin<RenderBox> { 233 class RenderPadding extends RenderBox with RenderObjectWithChildMixin<RenderBox> {
221 234
222 RenderPadding({ EdgeDims padding, RenderBox child }) { 235 RenderPadding({ EdgeDims padding, RenderBox child }) {
223 assert(padding != null); 236 assert(padding != null);
224 this.padding = padding; 237 this.padding = padding;
225 this.child = child; 238 this.child = child;
226 } 239 }
227 240
228 EdgeDims _padding; 241 EdgeDims _padding;
229 EdgeDims get padding => _padding; 242 EdgeDims get padding => _padding;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 669
657 void defaultPaint(RenderObjectDisplayList canvas) { 670 void defaultPaint(RenderObjectDisplayList canvas) {
658 RenderBox child = firstChild; 671 RenderBox child = firstChild;
659 while (child != null) { 672 while (child != null) {
660 assert(child.parentData is ParentDataType); 673 assert(child.parentData is ParentDataType);
661 canvas.paintChild(child, child.parentData.position); 674 canvas.paintChild(child, child.parentData.position);
662 child = child.parentData.nextSibling; 675 child = child.parentData.nextSibling;
663 } 676 }
664 } 677 }
665 } 678 }
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