Commit eb53ec31 authored by Ian Hickson's avatar Ian Hickson

Merge pull request #1288 from Hixie/ViewConstraints-rename

Rename ViewConstraints to ViewConfiguration
parents a566afcb 71457844
...@@ -22,15 +22,15 @@ void main() { ...@@ -22,15 +22,15 @@ void main() {
tester.pump(const Duration(seconds: 1)); // Complete drawer animation tester.pump(const Duration(seconds: 1)); // Complete drawer animation
}); });
ViewConstraints big = const ViewConstraints(size: const Size(360.0, 640.0)); ViewConfiguration big = const ViewConfiguration(size: const Size(360.0, 640.0));
ViewConstraints small = const ViewConstraints(size: const Size(355.0, 635.0)); ViewConfiguration small = const ViewConfiguration(size: const Size(355.0, 635.0));
RenderView renderView = WidgetFlutterBinding.instance.renderView; RenderView renderView = WidgetFlutterBinding.instance.renderView;
Stopwatch watch = new Stopwatch() Stopwatch watch = new Stopwatch()
..start(); ..start();
for (int i = 0; i < _kNumberOfIterations || _kRunForever; ++i) { for (int i = 0; i < _kNumberOfIterations || _kRunForever; ++i) {
renderView.rootConstraints = (i % 2 == 0) ? big : small; renderView.configuration = (i % 2 == 0) ? big : small;
RenderObject.flushLayout(); RenderObject.flushLayout();
} }
......
...@@ -58,7 +58,7 @@ abstract class Renderer extends Scheduler ...@@ -58,7 +58,7 @@ abstract class Renderer extends Scheduler
void handleMetricsChanged() { void handleMetricsChanged() {
assert(renderView != null); assert(renderView != null);
renderView.rootConstraints = new ViewConstraints(size: ui.window.size); renderView.configuration = new ViewConfiguration(size: ui.window.size);
} }
void _handlePersistentFrameCallback(Duration timeStamp) { void _handlePersistentFrameCallback(Duration timeStamp) {
......
...@@ -15,8 +15,8 @@ import 'layer.dart'; ...@@ -15,8 +15,8 @@ import 'layer.dart';
import 'object.dart'; import 'object.dart';
/// The layout constraints for the root render object. /// The layout constraints for the root render object.
class ViewConstraints { class ViewConfiguration {
const ViewConstraints({ const ViewConfiguration({
this.size: Size.zero, this.size: Size.zero,
this.orientation this.orientation
}); });
...@@ -55,12 +55,12 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> ...@@ -55,12 +55,12 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
int _orientation; // 0..3 int _orientation; // 0..3
/// The constraints used for the root layout. /// The constraints used for the root layout.
ViewConstraints get rootConstraints => _rootConstraints; ViewConfiguration get configuration => _configuration;
ViewConstraints _rootConstraints; ViewConfiguration _configuration;
void set rootConstraints(ViewConstraints value) { void set configuration(ViewConfiguration value) {
if (rootConstraints == value) if (configuration == value)
return; return;
_rootConstraints = value; _configuration = value;
markNeedsLayout(); markNeedsLayout();
} }
...@@ -85,12 +85,12 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> ...@@ -85,12 +85,12 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
} }
void performLayout() { void performLayout() {
if (rootConstraints.orientation != _orientation) { if (configuration.orientation != _orientation) {
if (_orientation != null && child != null) if (_orientation != null && child != null)
child.rotate(oldAngle: _orientation, newAngle: rootConstraints.orientation, time: timeForRotation); child.rotate(oldAngle: _orientation, newAngle: configuration.orientation, time: timeForRotation);
_orientation = rootConstraints.orientation; _orientation = configuration.orientation;
} }
_size = rootConstraints.size; _size = configuration.size;
assert(!_size.isInfinite); assert(!_size.isInfinite);
if (child != null) if (child != null)
...@@ -146,6 +146,6 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> ...@@ -146,6 +146,6 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
// call to ${super.debugDescribeSettings(prefix)} is omitted because the root superclasses don't include any interesting information for this class // call to ${super.debugDescribeSettings(prefix)} is omitted because the root superclasses don't include any interesting information for this class
settings.add('window size: ${ui.window.size} (in device pixels)'); settings.add('window size: ${ui.window.size} (in device pixels)');
settings.add('device pixel ratio: ${ui.window.devicePixelRatio} (device pixels per logical pixel)'); settings.add('device pixel ratio: ${ui.window.devicePixelRatio} (device pixels per logical pixel)');
settings.add('root constraints: $rootConstraints (in logical pixels)'); settings.add('configuration: $configuration (in logical pixels)');
} }
} }
...@@ -11,7 +11,7 @@ const Size _kTestViewSize = const Size(800.0, 600.0); ...@@ -11,7 +11,7 @@ const Size _kTestViewSize = const Size(800.0, 600.0);
class TestRenderView extends RenderView { class TestRenderView extends RenderView {
TestRenderView() { TestRenderView() {
rootConstraints = new ViewConstraints(size: _kTestViewSize); configuration = new ViewConfiguration(size: _kTestViewSize);
} }
void scheduleInitialFrame() { void scheduleInitialFrame() {
scheduleInitialLayout(); scheduleInitialLayout();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment