130 Commits

Author SHA1 Message Date
Adam Barth
4ad83fa059 Port some more tests to fn3 2015-09-25 11:27:48 -07:00
Adam Barth
7d02880cf4 Port some more tests to fn3 2015-09-25 10:51:56 -07:00
Adam Barth
06ffa75919 Convert some tests to fn3 2015-09-25 09:29:04 -07:00
Hixie
c3b3b71bed Rename ComponentState and use initState().
ComponentState becomes State, for brevity.
Instead of overriding its constructor, override initState().
This makes writing States much simpler.
2015-09-24 16:00:51 -07:00
Hixie
b948967855 fn3: MixedViewport
Also:
- Expose the slot of each Element.
- Minor improvements to HomogeneousViewport.
- Replace TestComponent with FlipComponent in tests.
2015-09-24 14:52:13 -07:00
Adam Barth
0d63d6b775 Port most of scrollable.dart to fn3 2015-09-24 10:26:27 -07:00
James Robinson
e854d7457d Update to Mojo 4e4d51ce28a8edcb32b9c7f555e38e2ae84a825e, update deps
This updates to mojo 4e4d51ce28a and mojo sdk 711a0bcfb141b4 and updates the sky
package's pubspec.yaml dependency to '>=0.1.0 <0.2.0' to be compatible with
the current mojo package. This includes an update to the Mojo Dart generator to
produce real classes for enums and the corresponding updates for users of the
KeyboardType enum in Sky as well as one scoped_ptr->std::unique_ptr in shell
corresponding to a change in the Mojo EDK.

When a new version of the sky and sky_services package are pushed this will fix
domokit/mojo#440.
2015-09-23 17:26:46 -07:00
Hixie
ea45169083 fn3: Port HomogeneousViewport 2015-09-23 16:21:13 -07:00
Hixie
6ea86b6a2f fn3: Listener
In this new world, Listener is just a wrapper around a node in the
render tree that hooks directly into the event handling logic.
2015-09-23 11:22:51 -07:00
Hixie
b3ebd4406b Expose _descendantRenderObject as 'renderer'
This allows people to use localToGlobal and company.
2015-09-23 11:13:45 -07:00
Adam Barth
fa119c38b9 Add tests for ParentData 2015-09-23 10:59:49 -07:00
Hixie
2a5fad937b fn3: Minor cleanup
- Remove the unique objects used as slots since we decided 'null' was
  fine after all
- Rename 'slot' to 'newSlot' when it's used as an argument to change the
  _slot field, to clarify which variable has the newer value
- Remove the RenderObject registry since we'll do listeners a different
  way. This also removes handleEvent for the same reason.
- Remove the TODOs for mount/unmount becoming didMount/didUnmount since
  the methods do in fact do the mounting/unmounting.
2015-09-23 09:24:13 -07:00
Hixie
555138e60e fn3: Binding to RenderView
In the old world, we had two ways to bind a Widget tree to a
RenderObject node, one way for RenderView and one mostly untested way
for other cases (it's only tested by the spinning_mixed.dart demo). For
fn3, I made these the same code path.

This patch also introduces GlobalKey, though the GlobalKey logic isn't
hooked in yet.

This is Hello World in the new world:

```dart
import 'package:sky/src/fn3.dart';

void main() {
  runApp(new Text('Hello World!'));
}
```
2015-09-23 09:12:01 -07:00
Adam Barth
8b162b5950 Add tests for MultiChildRenderWidget 2015-09-23 08:52:15 -07:00
Adam Barth
fb4a87ad68 Add ParentDataWidget and InheritedWidget to fn3 2015-09-22 16:07:27 -07:00
Hixie
b73b06e4ad fn3: Add a binding for fn3 and sky.
- I extracted the BuildScheduler into a separate binding.dart file.
- Various changes to expose private members that are needed by
  binding.dart.
- Registering the render objects for event dispatch.
- Convert the tests to use the new binding mechanism.

This doesn't yet have a RenderView or event handling.
2015-09-22 12:30:37 -07:00
Hixie
59f7e7f08e Fix scrolling of Block.
Since our build function depends on scrollBehavior.isScrollable, any
time we update scrollBehavior we are implicitly updating our state. As
such, we must do so during a setState() call, or else we won't rebuild
and might not bother to listen to the scroll gestures.

This probably broke when we made Block not listen to gestures if it
wasn't overflowing.
2015-09-22 10:36:34 -07:00
Jason Simmons
963fb41334 Merge pull request #1245 from jason-simmons/editable_text_initial_blink
Ensure that EditableText always shows a cursor
2015-09-22 09:29:52 -07:00
Jason Simmons
9b84e6b8e9 Merge pull request #1255 from jason-simmons/skyanalyzer_pub_cache
Some cleanup of the Sky analyzer script
2015-09-22 09:29:27 -07:00
Hixie
ba41fd3538 More dartdoc for fn3, and sundry changes.
- move _uniqueChild earlier since a comment now mentions it earlier.
- reorder methods in Element to more closely reflect call order.
- change mount to be the place that sets the parent pointer, for consistency.
- make the lifecycleState a purely debug-time thing for consistency.
- make BuildableElement.unmount set dirty to false so that we won't
  build unmounted objects.
- rename "updated" to "newWidget" for clarity.
- change how we unmount things so that the slot is reset up to a
  RenderObjectElement, but not further, and don't reset the depth.
2015-09-21 17:44:15 -07:00
Adam Barth
12097bdde0 Remove uses of sky.GestureEvent 2015-09-21 17:05:45 -07:00
Adam Barth
051354ae1d Remove EventDisposition
All the use cases for EventDisposition are now addressed by the gesture
detection system.
2015-09-21 16:45:09 -07:00
Hixie
205335f0f0 Fix fn3 build errors
Add a LeafRenderObjectElement, fix a test to use the new contract.
2015-09-21 15:45:49 -07:00
Hixie
547c324d4b fn3 review
- adds dartdocs
- replaces config setter with didUpdateConfig() so that you can't replace
the config outside of the system
- renames didUnmount() with destroy().
- rename Component to StatelessComponent, ComponentConfiguration to
StatefulComponent
- move debug dump to end of file
- renamed _holder to _element
2015-09-21 15:42:18 -07:00
Adam Barth
d27f3d5251 Merge pull request #1259 from abarth/fn3_rebuild
fn3 shouldn't rebuild components that don't change identity
2015-09-21 15:05:14 -07:00
Collin Jackson
746134a3c9 Merge pull request #1214 from collinjackson/scale_tests
add a test for scale gestures
2015-09-21 14:47:50 -07:00
Jason Simmons
64f75399ef Some cleanup of the Sky analyzer script
* If no source path is provided, then run the analyzer on the Sky unit tests
* Fix the filter for errors found in pub cache packages
* Generalize the filter for the analyzer's "xx errors/warnings/hints found" status message

Also fix a test that caused a warning in the analyzer.
2015-09-21 14:14:30 -07:00
Jason Simmons
58b421aaf4 Ensure that EditableText always shows a cursor
Previously EditableText would render a text widget with no cursor if the text
value was empty.

Also adjust the height of the cursor widget to reflect the style's line
height, and update the cursor painting to match.
2015-09-21 14:12:55 -07:00
Adam Barth
b361a3b4a8 fn3 shouldn't rebuild components that don't change identity 2015-09-21 14:00:26 -07:00
Adam Barth
b9c06c0ade Make stateful components work in fn3 2015-09-21 11:02:36 -07:00
Ian Hickson
6a88ec6d71 Merge pull request #1248 from abarth/fn3
Prototype of fn3
2015-09-21 10:26:25 -07:00
Adam Barth
130a5cb6dc Fix analyzer warnings
We were just missing a few type casts in tests to make the analyzer happy.
2015-09-19 19:21:11 -07:00
Adam Barth
b4ff5ca6ae Prototype of fn3
This patch contains a prototype of a new widget framework. In this framework,
Components can be reused in the tree as many times as the author desires. Also,
StatefulComponent is split into two pieces, a ComponentConfiguration and a
ComponentState. The ComponentConfiguration is created by the author and can be
reused as many times as desired. When mounted into the tree, the
ComponentConfiguration creates a ComponentState to hold the state for the
component. The state remains in the tree and cannot be reused.
2015-09-18 23:17:52 -07:00
krisgiesing
93ebc9e417 Merge pull request #1242 from krisgiesing/master
Fix Rect intersection; add test
2015-09-18 15:28:35 -07:00
Kris Giesing
c52b6fb9e8 Fix Rect intersection; add test 2015-09-18 15:22:59 -07:00
jason-simmons
682116529e Merge pull request #1229 from jason-simmons/editable_text_placeholder_flex
In EditableText, wrap the placeholder text in a Row so it will expand to its parent's width
2015-09-18 14:24:26 -07:00
Jason Simmons
80b2c1732a In EditableText, wrap the placeholder text in a Row so it will expand to its parent's width
This will ensure that the width of an empty Input is consistent with the
width of an Input that contains text.

Also add a unit test for the Input widget and a way for tests to provide mock
implementations of Mojo services such as the keyboard.
2015-09-18 13:46:31 -07:00
Adam Barth
4467a268ce Move theme into material.dart
Also, introduce Colors and Typography to hold the material colors and the
typography declarations. Previously we expected clients of these libraries to
import them into a namespace, but that doesn't play nice with re-exporting them
from material.dart.
2015-09-18 09:57:21 -07:00
Hixie
499d832259 Handle the case of a Widget being moved down
When we sync() a Component, we need to clear the old Component's _child
pointer, otherwise if we reuse that Component we'll get confused about
what the old child is.
2015-09-17 17:23:20 -07:00
Hixie
b1e64571e6 Fix removal logic in widgets
We were not removing children if they were more recently synced than we
were. This makes no sense. We should remove all children unless they
were synced this very generation already (in which case they'll be
somewhere else in the tree by now).
2015-09-17 13:30:27 -07:00
Collin Jackson
6dd58b2108 add a test for scale gestures 2015-09-17 12:45:13 -07:00
Adam Barth
41b8ffd623 Create gestures.dart
This patch is part of a sequence of patches towards fewer top-level libraries.
In this patch, the gesture libraries are combined into one gestures.dart
library.
2015-09-16 18:25:00 -07:00
Ian Hickson
ebf71f59d6 Merge pull request #1191 from Hixie/flex
FlexAlignItems.stretch didn't stretch
2015-09-16 13:09:08 -07:00
Adam Barth
699fa2415c Merge pull request #1194 from abarth/drawer_gestures
Move Drawer to GestureDetector
2015-09-16 12:38:28 -07:00
Adam Barth
74f7d9efee Move Drawer to GestureDetector
This fixes an issue in the stocks app in horizontal mode where you could both
scroll and drag the drawer at the same time.
2015-09-16 12:33:51 -07:00
Hixie
07e010de1b FlexAlignItems.stretch didn't stretch 2015-09-16 12:22:37 -07:00
Hixie
cd6c4da3c6 Refactor rendering_tester
RenderView has to be a singleton for sanity during tests, otherwise they
all end up in the dirty lists and we end up pumping all of them each frame.
2015-09-16 12:03:57 -07:00
Hixie
dfd821e595 Ignore generation of child if child is unchanged
Also:

 - don't mark a node as from the new generation if it is dirty, since we
   know it still has to be built.

 - establish the rule that you can't call setState() during initState()
   or build().

 - make syncChild() return early for unchanged children.

 - update the tests, including adding a new one.
2015-09-15 13:20:37 -07:00
Ian Hickson
942d1fa6ac Merge pull request #1157 from Hixie/minor-fixes
Minor cleanups (spelling mistakes, unneeded casts)
2015-09-14 12:11:31 -07:00
Adam Barth
b0c300e526 Add dartdoc for proxy_box.dart and other code in rendering
Almost done adding dartdoc to the rendering layer.
2015-09-14 10:35:31 -07:00