From 6fc343a09762f46d58367198576e84429d499960 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 8 Sep 2015 10:49:04 -0700 Subject: [PATCH] Remove package:sky/base These files really belong on other libraries. --- packages/flutter/lib/README.md | 10 +---- packages/flutter/lib/base/README.md | 45 ------------------- packages/flutter/lib/gestures/long_press.dart | 2 +- .../{base => gestures}/pointer_router.dart | 0 packages/flutter/lib/gestures/recognizer.dart | 4 +- packages/flutter/lib/mojo/asset_bundle.dart | 2 +- .../lib/{base => mojo}/image_resource.dart | 0 .../flutter/lib/mojo/net/image_cache.dart | 2 +- packages/flutter/lib/rendering.dart | 3 ++ packages/flutter/lib/src/painting/README.md | 4 +- .../flutter/lib/src/painting/box_painter.dart | 2 +- packages/flutter/lib/src/rendering/README.md | 1 - packages/flutter/lib/src/rendering/box.dart | 2 +- .../lib/{base => src/rendering}/debug.dart | 0 .../lib/{base => src/rendering}/hit_test.dart | 0 .../lib/{base => src/rendering}/node.dart | 31 +++++++++++++ .../flutter/lib/src/rendering/object.dart | 8 ++-- .../lib/src/rendering/sky_binding.dart | 4 +- packages/flutter/lib/src/widgets/README.md | 1 - packages/flutter/lib/src/widgets/basic.dart | 4 +- .../flutter/lib/src/widgets/drag_target.dart | 4 +- .../flutter/lib/src/widgets/framework.dart | 4 +- .../unit/test/gestures/long_press_test.dart | 2 +- .../pointer_router_test.dart | 2 +- packages/unit/test/gestures/scroll_test.dart | 2 +- .../unit/test/gestures/show_press_test.dart | 2 +- packages/unit/test/gestures/tap_test.dart | 2 +- 27 files changed, 61 insertions(+), 82 deletions(-) delete mode 100644 packages/flutter/lib/base/README.md rename packages/flutter/lib/{base => gestures}/pointer_router.dart (100%) rename packages/flutter/lib/{base => mojo}/image_resource.dart (100%) rename packages/flutter/lib/{base => src/rendering}/debug.dart (100%) rename packages/flutter/lib/{base => src/rendering}/hit_test.dart (100%) rename packages/flutter/lib/{base => src/rendering}/node.dart (61%) rename packages/unit/test/{base => gestures}/pointer_router_test.dart (93%) diff --git a/packages/flutter/lib/README.md b/packages/flutter/lib/README.md index d0c359c13c..4ef76df2d0 100644 --- a/packages/flutter/lib/README.md +++ b/packages/flutter/lib/README.md @@ -8,12 +8,6 @@ The bottom-most layer is the Sky Platform, which is exposed to Dart code as [various `dart:` packages](https://api.dartlang.org/), including `dart:sky`. -The [base/](base/) directory contains libraries that extend these core -APIs to provide base classes for tree structures -([base/node.dart](base/node.dart)), hit testing -([base/hit_test.dart](base/hit_test.dart)), and debugging -([base/debug.dart](base/debug.dart)). - Above this layer is the [animation](animation.dart) library, which provides core animation primitives, and the [gestures/](gestures/) directory, which define a gesture recognition and disambiguation system. @@ -49,8 +43,8 @@ Here is a diagram summarizing all this: | | | painting | | +-+ +------------+ | | gestures/ | animation | | - +-----------+---+--------+ | - | base/ | mojo/ | + +-----------+------------+ | + | mojo/ | +------------+--+-+----+------+ ------- | dart:sky | | | Host | +--------+---+ | | APIs | C++ diff --git a/packages/flutter/lib/base/README.md b/packages/flutter/lib/base/README.md deleted file mode 100644 index 7c533c105f..0000000000 --- a/packages/flutter/lib/base/README.md +++ /dev/null @@ -1,45 +0,0 @@ -Sky Base -======== - -AbstractNode ------------- - -The [node.dart](node.dart) file defines a class, `AbstractNode`, which -can be used to build mutable trees. - -* When a subclass is changing the parent of a child, it should - call either parent.adoptChild(child) or parent.dropChild(child) - as appropriate. Subclasses should expose an API for - manipulating the tree if you want to (e.g. a setter for a - 'child' property, or an 'add()' method to manipulate a list). - -* You can see the current parent by querying 'parent'. - -* You can see the current attachment state by querying - 'attached'. The root of any tree that is to be considered - attached should be manually attached by calling 'attach()'. - Other than that, don't call 'attach()' or 'detach()'. This is - all managed automatically assuming you call the 'adoptChild()' - and 'dropChild()' methods appropriately. - -* Subclasses that have children must override 'attach()' and - 'detach()' as described below. - -* Nodes always have a 'depth' greater than their ancestors'. - There's no guarantee regarding depth between siblings. The - depth of a node is used to ensure that nodes are processed in - depth order. The 'depth' of a child can be more than one - greater than the 'depth' of the parent, because the 'depth' - values are never decreased: all that matters is that it's - greater than the parent. Consider a tree with a root node A, a - child B, and a grandchild C. Initially, A will have 'depth' 0, - B 'depth' 1, and C 'depth' 2. If C is moved to be a child of A, - sibling of B, then the numbers won't change. C's 'depth' will - still be 2. This is all managed automatically assuming you call - 'adoptChild()' and 'dropChild()' appropriately. - - -Dependencies ------------- - -No dependencies except for `dart:sky` and Dart's core libraries. diff --git a/packages/flutter/lib/gestures/long_press.dart b/packages/flutter/lib/gestures/long_press.dart index d450ee0b60..0cb35c5ad0 100644 --- a/packages/flutter/lib/gestures/long_press.dart +++ b/packages/flutter/lib/gestures/long_press.dart @@ -4,9 +4,9 @@ import 'dart:sky' as sky; -import 'package:sky/base/pointer_router.dart'; import 'package:sky/gestures/arena.dart'; import 'package:sky/gestures/constants.dart'; +import 'package:sky/gestures/pointer_router.dart'; import 'package:sky/gestures/recognizer.dart'; typedef void GestureLongPressListener(); diff --git a/packages/flutter/lib/base/pointer_router.dart b/packages/flutter/lib/gestures/pointer_router.dart similarity index 100% rename from packages/flutter/lib/base/pointer_router.dart rename to packages/flutter/lib/gestures/pointer_router.dart diff --git a/packages/flutter/lib/gestures/recognizer.dart b/packages/flutter/lib/gestures/recognizer.dart index 436b65a118..6834552566 100644 --- a/packages/flutter/lib/gestures/recognizer.dart +++ b/packages/flutter/lib/gestures/recognizer.dart @@ -5,11 +5,11 @@ import 'dart:async'; import 'dart:sky' as sky; -import 'package:sky/base/pointer_router.dart'; import 'package:sky/gestures/arena.dart'; import 'package:sky/gestures/constants.dart'; +import 'package:sky/gestures/pointer_router.dart'; -export 'package:sky/base/pointer_router.dart' show PointerRouter; +export 'package:sky/gestures/pointer_router.dart' show PointerRouter; abstract class GestureRecognizer extends GestureArenaMember { GestureRecognizer({ PointerRouter router }) : _router = router; diff --git a/packages/flutter/lib/mojo/asset_bundle.dart b/packages/flutter/lib/mojo/asset_bundle.dart index 7cce717693..705214eb54 100644 --- a/packages/flutter/lib/mojo/asset_bundle.dart +++ b/packages/flutter/lib/mojo/asset_bundle.dart @@ -9,7 +9,7 @@ import 'dart:typed_data'; import 'package:mojo/core.dart' as core; import 'package:mojo_services/mojo/asset_bundle/asset_bundle.mojom.dart'; -import 'package:sky/base/image_resource.dart'; +import 'package:sky/mojo/image_resource.dart'; import 'package:sky/mojo/net/fetch.dart'; import 'package:sky/mojo/net/image_cache.dart' as image_cache; import 'package:sky/mojo/shell.dart' as shell; diff --git a/packages/flutter/lib/base/image_resource.dart b/packages/flutter/lib/mojo/image_resource.dart similarity index 100% rename from packages/flutter/lib/base/image_resource.dart rename to packages/flutter/lib/mojo/image_resource.dart diff --git a/packages/flutter/lib/mojo/net/image_cache.dart b/packages/flutter/lib/mojo/net/image_cache.dart index 8acabf70fe..03d435c6b8 100644 --- a/packages/flutter/lib/mojo/net/image_cache.dart +++ b/packages/flutter/lib/mojo/net/image_cache.dart @@ -7,7 +7,7 @@ import 'dart:collection'; import 'dart:sky' as sky; import 'package:mojo/mojo/url_response.mojom.dart'; -import 'package:sky/base/image_resource.dart'; +import 'package:sky/mojo/image_resource.dart'; import 'package:sky/mojo/net/fetch.dart'; final HashMap _cache = new Map(); diff --git a/packages/flutter/lib/rendering.dart b/packages/flutter/lib/rendering.dart index d4998db78a..8b49bbfd4e 100644 --- a/packages/flutter/lib/rendering.dart +++ b/packages/flutter/lib/rendering.dart @@ -10,10 +10,13 @@ library rendering; export 'package:sky/src/rendering/auto_layout.dart'; export 'package:sky/src/rendering/block.dart'; export 'package:sky/src/rendering/box.dart'; +export 'package:sky/src/rendering/debug.dart'; export 'package:sky/src/rendering/flex.dart'; export 'package:sky/src/rendering/grid.dart'; +export 'package:sky/src/rendering/hit_test.dart'; export 'package:sky/src/rendering/image.dart'; export 'package:sky/src/rendering/layer.dart'; +export 'package:sky/src/rendering/node.dart'; export 'package:sky/src/rendering/object.dart'; export 'package:sky/src/rendering/paragraph.dart'; export 'package:sky/src/rendering/proxy_box.dart'; diff --git a/packages/flutter/lib/src/painting/README.md b/packages/flutter/lib/src/painting/README.md index ed05e995f6..cf4e957ddb 100644 --- a/packages/flutter/lib/src/painting/README.md +++ b/packages/flutter/lib/src/painting/README.md @@ -1,3 +1,3 @@ This directory contains painting-related libraries that only depend on -core Dart libraries, `../base/*`, and [animation.dart](../animation.dart). Note -that [animation.dart](../animation.dart) depends on the Newton Dart library. +core Dart libraries and [animation.dart](../../animation.dart). Note +that [animation.dart](../../animation.dart) depends on the Newton Dart library. diff --git a/packages/flutter/lib/src/painting/box_painter.dart b/packages/flutter/lib/src/painting/box_painter.dart index 5aef8c0128..fa03f081ad 100644 --- a/packages/flutter/lib/src/painting/box_painter.dart +++ b/packages/flutter/lib/src/painting/box_painter.dart @@ -6,7 +6,7 @@ import 'dart:math' as math; import 'dart:sky' as sky; import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path; -import 'package:sky/base/image_resource.dart'; +import 'package:sky/mojo/image_resource.dart'; import 'package:sky/src/painting/shadows.dart'; /// An immutable set of offsets in each of the four cardinal directions diff --git a/packages/flutter/lib/src/rendering/README.md b/packages/flutter/lib/src/rendering/README.md index 69f6e1af03..72f80d7c99 100644 --- a/packages/flutter/lib/src/rendering/README.md +++ b/packages/flutter/lib/src/rendering/README.md @@ -385,6 +385,5 @@ Dependencies ------------ * [`package:sky/animation.dart`](../../animation.dart) - * [`package:sky/base`](../../base) * [`package:sky/mojo`](../../mojo) * [`package:sky/painting.dart`](../../painting.dart) diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index caa89e2025..ca7d6f86cc 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -5,8 +5,8 @@ import 'dart:math' as math; import 'dart:sky' as sky; -import 'package:sky/base/debug.dart'; import 'package:sky/painting.dart'; +import 'package:sky/src/rendering/debug.dart'; import 'package:sky/src/rendering/object.dart'; import 'package:vector_math/vector_math.dart'; diff --git a/packages/flutter/lib/base/debug.dart b/packages/flutter/lib/src/rendering/debug.dart similarity index 100% rename from packages/flutter/lib/base/debug.dart rename to packages/flutter/lib/src/rendering/debug.dart diff --git a/packages/flutter/lib/base/hit_test.dart b/packages/flutter/lib/src/rendering/hit_test.dart similarity index 100% rename from packages/flutter/lib/base/hit_test.dart rename to packages/flutter/lib/src/rendering/hit_test.dart diff --git a/packages/flutter/lib/base/node.dart b/packages/flutter/lib/src/rendering/node.dart similarity index 61% rename from packages/flutter/lib/base/node.dart rename to packages/flutter/lib/src/rendering/node.dart index 7d5f285499..e4902add2b 100644 --- a/packages/flutter/lib/base/node.dart +++ b/packages/flutter/lib/src/rendering/node.dart @@ -6,6 +6,37 @@ /// /// AbstractNode has as notion of depth, attachment, and parent, but does not /// have a model for children. +/// +/// * When a subclass is changing the parent of a child, it should +/// call either parent.adoptChild(child) or parent.dropChild(child) +/// as appropriate. Subclasses should expose an API for +/// manipulating the tree if you want to (e.g. a setter for a +/// 'child' property, or an 'add()' method to manipulate a list). +/// +/// * You can see the current parent by querying 'parent'. +/// +/// * You can see the current attachment state by querying +/// 'attached'. The root of any tree that is to be considered +/// attached should be manually attached by calling 'attach()'. +/// Other than that, don't call 'attach()' or 'detach()'. This is +/// all managed automatically assuming you call the 'adoptChild()' +/// and 'dropChild()' methods appropriately. +/// +/// * Subclasses that have children must override 'attach()' and +/// 'detach()' as described below. +/// +/// * Nodes always have a 'depth' greater than their ancestors'. +/// There's no guarantee regarding depth between siblings. The +/// depth of a node is used to ensure that nodes are processed in +/// depth order. The 'depth' of a child can be more than one +/// greater than the 'depth' of the parent, because the 'depth' +/// values are never decreased: all that matters is that it's +/// greater than the parent. Consider a tree with a root node A, a +/// child B, and a grandchild C. Initially, A will have 'depth' 0, +/// B 'depth' 1, and C 'depth' 2. If C is moved to be a child of A, +/// sibling of B, then the numbers won't change. C's 'depth' will +/// still be 2. This is all managed automatically assuming you call +/// 'adoptChild()' and 'dropChild()' appropriately. class AbstractNode { // AbstractNode represents a node in a tree. diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index 886769038d..5d85ad6fb6 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -7,14 +7,14 @@ import 'dart:sky' as sky; import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path; import 'package:sky/animation.dart'; -import 'package:sky/base/debug.dart'; -import 'package:sky/base/hit_test.dart'; -import 'package:sky/base/node.dart'; +import 'package:sky/src/rendering/debug.dart'; +import 'package:sky/src/rendering/hit_test.dart'; import 'package:sky/src/rendering/layer.dart'; +import 'package:sky/src/rendering/node.dart'; import 'package:vector_math/vector_math.dart'; export 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path; -export 'package:sky/base/hit_test.dart' show EventDisposition, HitTestTarget, HitTestEntry, HitTestResult; +export 'package:sky/src/rendering/hit_test.dart' show EventDisposition, HitTestTarget, HitTestEntry, HitTestResult; /// Base class for data associated with a [RenderObject] by its parent /// diff --git a/packages/flutter/lib/src/rendering/sky_binding.dart b/packages/flutter/lib/src/rendering/sky_binding.dart index d5ce39530a..bfa175d973 100644 --- a/packages/flutter/lib/src/rendering/sky_binding.dart +++ b/packages/flutter/lib/src/rendering/sky_binding.dart @@ -5,10 +5,10 @@ import 'dart:sky' as sky; import 'package:sky/animation.dart'; -import 'package:sky/base/hit_test.dart'; -import 'package:sky/base/pointer_router.dart'; import 'package:sky/gestures/arena.dart'; +import 'package:sky/gestures/pointer_router.dart'; import 'package:sky/src/rendering/box.dart'; +import 'package:sky/src/rendering/hit_test.dart'; import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/view.dart'; diff --git a/packages/flutter/lib/src/widgets/README.md b/packages/flutter/lib/src/widgets/README.md index 1797b3a697..4d7e501caa 100644 --- a/packages/flutter/lib/src/widgets/README.md +++ b/packages/flutter/lib/src/widgets/README.md @@ -501,7 +501,6 @@ Dependencies * `package:vector_math` * [`package:sky/animation.dart`](../../animation.dart) - * [`package:sky/base`](../../base) * [`package:sky/painting.dart`](../../painting.dart) * [`package:sky/rendering.dart`](../../rendering.dart) * [`package:sky/theme`](../../theme) diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 24f853dcdf..78c88b8262 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -6,8 +6,8 @@ import 'dart:sky' as sky; import 'package:vector_math/vector_math.dart'; -import 'package:sky/base/image_resource.dart'; import 'package:sky/mojo/asset_bundle.dart'; +import 'package:sky/mojo/image_resource.dart'; import 'package:sky/mojo/net/image_cache.dart' as image_cache; import 'package:sky/src/painting/text_painter.dart'; import 'package:sky/src/painting/text_style.dart'; @@ -25,11 +25,11 @@ import 'package:sky/src/rendering/viewport.dart'; import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/framework.dart'; -export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispositions; export 'package:sky/src/painting/text_style.dart'; export 'package:sky/src/rendering/block.dart' show BlockDirection; export 'package:sky/src/rendering/box.dart' show BoxConstraints; export 'package:sky/src/rendering/flex.dart' show FlexJustifyContent, FlexAlignItems, FlexDirection; +export 'package:sky/src/rendering/hit_test.dart' show EventDisposition, combineEventDispositions; export 'package:sky/src/rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path; export 'package:sky/src/rendering/proxy_box.dart' show BackgroundImage, BoxDecoration, BoxDecorationPosition, BoxShadow, Border, BorderSide, EdgeDims, Shape; export 'package:sky/src/rendering/shifted_box.dart' show ShrinkWrap; diff --git a/packages/flutter/lib/src/widgets/drag_target.dart b/packages/flutter/lib/src/widgets/drag_target.dart index 3b9b2d5a38..191fd48d8d 100644 --- a/packages/flutter/lib/src/widgets/drag_target.dart +++ b/packages/flutter/lib/src/widgets/drag_target.dart @@ -4,9 +4,7 @@ import 'dart:collection'; -import 'package:sky/base/hit_test.dart'; -import 'package:sky/src/rendering/object.dart'; -import 'package:sky/src/rendering/sky_binding.dart'; +import 'package:sky/rendering.dart'; import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/framework.dart'; diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 3f982b72ed..1720c7848d 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -7,15 +7,15 @@ import 'dart:collection'; import 'dart:sky' as sky; import 'package:sky/animation.dart'; -import 'package:sky/base/hit_test.dart'; import 'package:sky/mojo/activity.dart'; import 'package:sky/src/rendering/box.dart'; +import 'package:sky/src/rendering/hit_test.dart'; import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/sky_binding.dart'; import 'package:sky/src/rendering/view.dart'; -export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispositions; export 'package:sky/src/rendering/box.dart' show BoxConstraints, BoxDecoration, Border, BorderSide, EdgeDims; +export 'package:sky/src/rendering/hit_test.dart' show EventDisposition, combineEventDispositions; export 'package:sky/src/rendering/object.dart' show Point, Offset, Size, Rect, Color, Paint, Path; final bool _shouldLogRenderDuration = false; // see also 'enableProfilingLoop' argument to runApp() diff --git a/packages/unit/test/gestures/long_press_test.dart b/packages/unit/test/gestures/long_press_test.dart index b97b4bdc6f..4ecead1488 100644 --- a/packages/unit/test/gestures/long_press_test.dart +++ b/packages/unit/test/gestures/long_press_test.dart @@ -1,7 +1,7 @@ import 'package:quiver/testing/async.dart'; -import 'package:sky/base/pointer_router.dart'; import 'package:sky/gestures/arena.dart'; import 'package:sky/gestures/long_press.dart'; +import 'package:sky/gestures/pointer_router.dart'; import 'package:sky/gestures/show_press.dart'; import 'package:test/test.dart'; diff --git a/packages/unit/test/base/pointer_router_test.dart b/packages/unit/test/gestures/pointer_router_test.dart similarity index 93% rename from packages/unit/test/base/pointer_router_test.dart rename to packages/unit/test/gestures/pointer_router_test.dart index 6381722df0..7865773657 100644 --- a/packages/unit/test/base/pointer_router_test.dart +++ b/packages/unit/test/gestures/pointer_router_test.dart @@ -1,6 +1,6 @@ import 'dart:sky' as sky; -import 'package:sky/base/pointer_router.dart'; +import 'package:sky/gestures/pointer_router.dart'; import 'package:test/test.dart'; import '../engine/mock_events.dart'; diff --git a/packages/unit/test/gestures/scroll_test.dart b/packages/unit/test/gestures/scroll_test.dart index bc8963df5e..793dabb45a 100644 --- a/packages/unit/test/gestures/scroll_test.dart +++ b/packages/unit/test/gestures/scroll_test.dart @@ -1,7 +1,7 @@ import 'dart:sky' as sky; -import 'package:sky/base/pointer_router.dart'; import 'package:sky/gestures/arena.dart'; +import 'package:sky/gestures/pointer_router.dart'; import 'package:sky/gestures/scroll.dart'; import 'package:sky/gestures/tap.dart'; import 'package:test/test.dart'; diff --git a/packages/unit/test/gestures/show_press_test.dart b/packages/unit/test/gestures/show_press_test.dart index 8bf2eadc5b..cd4078f87d 100644 --- a/packages/unit/test/gestures/show_press_test.dart +++ b/packages/unit/test/gestures/show_press_test.dart @@ -1,6 +1,6 @@ import 'package:quiver/testing/async.dart'; -import 'package:sky/base/pointer_router.dart'; import 'package:sky/gestures/arena.dart'; +import 'package:sky/gestures/pointer_router.dart'; import 'package:sky/gestures/show_press.dart'; import 'package:test/test.dart'; diff --git a/packages/unit/test/gestures/tap_test.dart b/packages/unit/test/gestures/tap_test.dart index 9d2dad201b..ffef98ebee 100644 --- a/packages/unit/test/gestures/tap_test.dart +++ b/packages/unit/test/gestures/tap_test.dart @@ -1,5 +1,5 @@ -import 'package:sky/base/pointer_router.dart'; import 'package:sky/gestures/arena.dart'; +import 'package:sky/gestures/pointer_router.dart'; import 'package:sky/gestures/tap.dart'; import 'package:test/test.dart';