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

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

Issue 1177563002: SkyView should handle screen rotation (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fixed 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/app.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 '../painting/shadows.dart'; 9 import '../painting/shadows.dart';
10 import 'package:vector_math/vector_math.dart'; 10 import 'package:vector_math/vector_math.dart';
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } 940 }
941 941
942 Size _size = Size.zero; 942 Size _size = Size.zero;
943 double get width => _size.width; 943 double get width => _size.width;
944 double get height => _size.height; 944 double get height => _size.height;
945 945
946 int _orientation; // 0..3 946 int _orientation; // 0..3
947 int get orientation => _orientation; 947 int get orientation => _orientation;
948 Duration timeForRotation; 948 Duration timeForRotation;
949 949
950 ViewConstraints _rootConstraints;
951 ViewConstraints get rootConstraints => _rootConstraints;
952 void set rootConstraints(ViewConstraints value) {
953 if (_rootConstraints == value)
954 return;
955 _rootConstraints = value;
956 markNeedsLayout();
957 }
958
950 ViewConstraints get constraints => super.constraints as ViewConstraints; 959 ViewConstraints get constraints => super.constraints as ViewConstraints;
951 bool get sizedByParent => true; 960
952 void performResize() { 961 void performLayout() {
953 if (constraints.orientation != _orientation) { 962 if (_rootConstraints.orientation != _orientation) {
954 if (_orientation != null && child != null) 963 if (_orientation != null && child != null)
955 child.rotate(oldAngle: _orientation, newAngle: constraints.orientation, time: timeForRotation); 964 child.rotate(oldAngle: _orientation, newAngle: _rootConstraints.orientat ion, time: timeForRotation);
956 _orientation = constraints.orientation; 965 _orientation = _rootConstraints.orientation;
957 } 966 }
958 _size = new Size(constraints.width, constraints.height); 967 _size = new Size(_rootConstraints.width, _rootConstraints.height);
959 assert(_size.height < double.INFINITY); 968 assert(_size.height < double.INFINITY);
960 assert(_size.width < double.INFINITY); 969 assert(_size.width < double.INFINITY);
961 } 970
962 void performLayout() {
963 if (child != null) { 971 if (child != null) {
964 child.layout(new BoxConstraints.tight(_size)); 972 child.layout(new BoxConstraints.tight(_size));
965 assert(child.size.width == width); 973 assert(child.size.width == width);
966 assert(child.size.height == height); 974 assert(child.size.height == height);
967 } 975 }
968 } 976 }
969 977
970 void rotate({ int oldAngle, int newAngle, Duration time }) { 978 void rotate({ int oldAngle, int newAngle, Duration time }) {
971 assert(false); // nobody tells the screen to rotate, the whole rotate() danc e is started from our performResize() 979 assert(false); // nobody tells the screen to rotate, the whole rotate() danc e is started from our performResize()
972 } 980 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 1024
1017 void defaultPaint(RenderObjectDisplayList canvas) { 1025 void defaultPaint(RenderObjectDisplayList canvas) {
1018 RenderBox child = firstChild; 1026 RenderBox child = firstChild;
1019 while (child != null) { 1027 while (child != null) {
1020 assert(child.parentData is ParentDataType); 1028 assert(child.parentData is ParentDataType);
1021 canvas.paintChild(child, child.parentData.position); 1029 canvas.paintChild(child, child.parentData.position);
1022 child = child.parentData.nextSibling; 1030 child = child.parentData.nextSibling;
1023 } 1031 }
1024 } 1032 }
1025 } 1033 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/app.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698