136 Commits

Author SHA1 Message Date
Rafael Weinstein
e109f30916 Change the name of Component.render to Component.build in Effen.
"Render" is misleading. "Build" may not be the best word either, it's closer to what's actually happening.

R=ojan@chromium.org
TBR=abarth
BUG=

Review URL: https://codereview.chromium.org/992033002
2015-03-09 13:30:13 -07:00
Rafael Weinstein
def96f0fd4 Ensure that sky Nodes are in the document when didMount() is fired. Refactor FixedHeightScrollable to inspect heights rather than having the passed in
BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/994553003
2015-03-09 12:39:10 -07:00
Adam Barth
4bb0ff3875 Fix shake-to-reload
The Dart bindings changed syntax a bit. This CL updates shake-to-reload to
match the new names.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/987103003
2015-03-09 10:49:46 -07:00
Rafael Weinstein
a77b1efd52 Prevent already scheduled-for-render fn components which become removed from rendering
This can occur, for instance, if a child component runs before a parent component within a single animation frame, and the child does setState() while the parent removes it. The child will already have been entered into the rendering queue.

TBR=eseidel
BUG=

Review URL: https://codereview.chromium.org/983793004
2015-03-06 14:16:16 -08:00
Rafael Weinstein
21a3cbab83 Correctly allow components to return different top-level nodes during different renderings
TBR=abarth
BUG=

Review URL: https://codereview.chromium.org/984983004
2015-03-06 13:32:07 -08:00
Rafael Weinstein
c3823b9204 Add back didMount
Sorry I keep changing my mind about this. My thinking had been since this was computable by just setting a bit and checking it in render(), that it was silly, but I keep finding uses for it and it's annoying to re-implement in each component.

TBR=eseidel
BUG=

Review URL: https://codereview.chromium.org/986753002
2015-03-06 12:50:42 -08:00
Rafael Weinstein
2c788c3e6d Effen: willUmount->didUnmount, allow setState after didUnmount
This patch changes the timing of the unmount call until after the component is removed (and marked as such) and allows setState to be called after this point. If this happens, setState will still invoke the closer to do any neccesary cleanup, but doesn't schedule the component for render

R=eseidel@chromium.org, eseidel
BUG=

Review URL: https://codereview.chromium.org/985853002
2015-03-06 12:23:53 -08:00
Eric Seidel
e2a00dd49d Add an assert that we don't schedule a render during render
In production I added an early return.  I don't bother to log
in production since no one is looking at the log anyway.

Unfortunately this currently only fires when using a debug build
we should fix our Release build to have a checked-mode option
or consider hacks like having all localhost urls enable checked
mode, etc.

R=ianh@google.com, rafaelw@chromium.org
BUG=

Review URL: https://codereview.chromium.org/983973005
2015-03-06 10:42:49 -08:00
Eric Seidel
bbeb05afb7 Make stocksapp.dart almost pass the dart analyzer.
To test:
sky/tools/shelldb analyze sky/examples/stocks-fn/stocksapp.dart

It prints 600+ warnings about the "native" keyword, and after
this change only a couple warnings about missing library names
which I don't fully understand.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/987613002
2015-03-05 16:52:14 -08:00
Hixie
88df817d43 fix typo in _syncEvent; make it possible for a component to entirely change the class of its rendering's component
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/986463003
2015-03-05 16:06:33 -08:00
Adam Barth
270d658ad9 Sometimes the drawer doesn't fully close
The AnimationGenerator didn't always generate the |end| value because of
floating point rounding. This CL causes it to always generate |end| at the end.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/983893002
2015-03-05 15:53:22 -08:00
Hixie
37c27faae4 fix the hang when clicking the drawer in the stocks app
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/980043005
2015-03-05 15:46:21 -08:00
Adam Barth
ca60f330e9 Move animationgenerator.dart to sky/framework/animation/generator.dart
That's where it belongs.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/979283002
2015-03-05 11:40:35 -08:00
Adam Barth
1f77a79a2c fn.dart shouldn't spam the log
This CL introduces a flag to control whether fn.dart prints the render duration
to the console. By default, the flag is off to avoid log spam.

Also, improve the way we intialize _isInCheckedMode to make use of the fact
that Dart intializes final fields lazily.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/982073002
2015-03-05 11:38:17 -08:00
Adam Barth
e3812af9c0 Move fn.dart into /sky/framework
It's awkward to work on fn.dart in the examples directory so this CL moves it
to /sky/framework. Also, I've merged the whole library into one file instead of
using the |part| mechanism. The whole thing isn't that big.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/987463002
2015-03-05 10:53:01 -08:00
Adam Barth
4df0891248 Organize sky/framework a bit
- Removed out-of-date README.md
- Moved fling-curve into the animation directory because it's part of the
  animation behavior of the system.
- Moved view-configuration into the theme directory because it's a collection
  of constants similar in flavor to the colors and the shadows. Eventually
  we'll want to make the theme configurable and have these all together will
  hopefully make that easier.
- Moved dom-serializer into tests/resources because it is used only by tests.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/980423002
2015-03-05 09:59:50 -08:00
Adam Barth
22f3af608c Add constants for material colors and shadows
This CL removes the hard-coded colors and shadows from the fn widgets and
replaces them with compile-time constants. The color values are from the
material spec:

http://www.google.com/design/spec/style/color.html#color-color-palette

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/983733003
2015-03-05 09:58:23 -08:00
Hixie
fd4e2c76d2 sky-element stocks demo: add splashes and highlights to menu items
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/961873004
2015-03-04 09:25:31 -08:00
Adam Barth
79aa3684b5 Attempt to fix the build
This CL attempts to fix clean builds by adding a missing dependency from
service_registry to service_provider.

Also, I've attempted to fix the sky tests by updating the reference to
service_registry.mojom.dart.

TBR=hansmuller@chromium.org

Review URL: https://codereview.chromium.org/968553002
2015-02-27 20:13:41 -08:00
Eric Seidel
c8912dd14c Add support for scroll and fling gestures to SkyShell.
This is not complete gesture support by far, but it's a start.
MojoShell and Chrome use a C++ GestureDetector, this code attempts
to use the Android (Java) GestureDetector instead.

We probably should not be sending gesturetap until we've decided
it's not a scroll, etc, but this implementation does not go that far.

I had to fix a bug whereby we were assuming the InputEvent.time_stamp
was in TimeDelta's internal format, which was wrong.  When we get
time_stamp from Android its in ms since boot.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/969493002
2015-02-27 16:46:19 -08:00
Adam Barth
29e3ba99e9 Make shake-to-reload actually work
We need to create a new service provider when we navigate to a new page
otherwise the new page is sad that the old page took its service provider.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/962383003
2015-02-27 16:38:40 -08:00
Adam Barth
b3b8d8cf1a Implement shake-to-reload
Apps can import this library if they wish to reload on shake.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/963303004
2015-02-27 15:31:11 -08:00
Adam Barth
e8b988e226 Expose Android sensors to via Mojo services
This CL adds a sensor_service to sky/services and wires it into SkyShell
The plan is to eventually use this data to implement shake-to-refresh.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/962043002
2015-02-27 14:37:50 -08:00
Hans Muller
d679a524b5 Added ServiceRegistry interface
ServiceRegistry enables a chain of Mojo applications to accumulate
services without wrapping and forwarding the incoming ServiceProvider
request.

Sky's DocumentView adds ViewManagerClient to the ServiceRegistry (if any)
that's provided to it via ConnectToApplication(). Sky applications can add
additional services with embedder.serviceRegistry.addServices().

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/958673002
2015-02-27 07:41:56 -08:00
Zachary Anderson
7da01c7c5e Dart: Removes name conflicts from generated bindings.
This change causes the generated abstract class having the same name as the interface to contain only the interface's method declarations. The generated Proxy class then implements the base class. In addition to implementing the interface methods, the generated Proxy class has one private field _proxyImpl, which is a MojoEventStreamListener and manages sending messages and receiving responses. Operations on the ProxyImpl (close, bind, etc.) are exposed through generated utility functions.

The generated Stub is largely as before with the difference that a class providing a service will implement the mojo interface and *have* a Stub rather than be a Stub. Where appropriate, this change also calls listen() immediately where a Stub is constructed.

BUG=
R=hansmuller@google.com, sky@chromium.org

Review URL: https://codereview.chromium.org/959993002
2015-02-26 15:16:14 -08:00
Zachary Anderson
b3b197fcf8 Dart: Renames dart:mojo_blah -> mojo:blah
This improves consistency with the convention that the dart: scheme is
only for things from the Dart standard library.

BUG=
R=erg@chromium.org

Review URL: https://codereview.chromium.org/951783004
2015-02-25 14:29:41 -08:00
Eric Seidel
ab273a8433 Make splash animations abort on scroll.
I also fixed the transform hack in material-element to clean
up after itself.

I also discovered that our namedSetter implementation did not
handle null (it crashed) while doing this.  I fixed that
and tested my fix.

This runs great on a Nexus 5, but poorly on an Nexus 10.

R=abarth@chromium.org
BUG=

Review URL: https://codereview.chromium.org/956753002
2015-02-24 17:20:18 -08:00
Adam Barth
c149c2802d Implement quantum ink splashes
These aren't 100% correct, but they look somewhat reasonable.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/954023002
2015-02-24 15:41:52 -08:00
Adam Barth
d8b20c7f2b Make the stock app demo list view prettier
This CL makes the list view in the stocks app more consistent with the material
spec by using a colored circle instead of color-coding the percentage change.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/932103004
2015-02-24 15:41:35 -08:00
Eric Seidel
4b1def112b Add ViewConfiguration and make our scrollbar size match Android
Turns out scrollbars are very inconsistent throughout Android apps.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/955653005
2015-02-24 14:23:54 -08:00
Adam Barth
f58bd3e40d Add a shadow to the sky-drawer
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/950353003
2015-02-24 11:33:26 -08:00
Adam Barth
f21b435d05 Make the stocks drawer look more realistic
The menu items don't quite make sense for this app, but they're closer in
visual styling.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/951413002
2015-02-24 10:48:23 -08:00
Adam Barth
17569631d9 Factor sky-toolbar into a componet and use a proper material shadow
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/953903004
2015-02-24 10:47:01 -08:00
Hans Muller
36e4b84dc0 Make Sky embedder.connection deal with null handles
Also: gratuitous simplication of ApplicationConnection.requestService().

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/954653002
2015-02-24 07:27:11 -08:00
Adam Barth
26460f8130 Update Sky widgets to have more material design
This CL updates the Sky widgets to be closer to the material design spec.
There's still a long way to go, but this CL is a start.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/951823002
2015-02-23 23:59:57 -08:00
Adam Barth
9ca8293ed4 Add <sky-icon> to access material design widgets
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/947383002
2015-02-23 17:26:19 -08:00
Scott Violet
15d7cd9b47 Gets HTMLIFrameElement::embedViewManagerClient to work with dart
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/948943002
2015-02-23 15:29:22 -08:00
Adam Barth
7c498977dc Remove outdated examples and framework pieces
None of this code runs in the current Sky. Some of it never ran.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/951673003
2015-02-23 15:09:36 -08:00
Adam Barth
bc9b3e319e Fix subtle bugs in sky-scrollable
Previously the scrollbar wasn't constrained to the scrollable element and we
had messed up the math on the fling curve.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/947303003
2015-02-23 14:20:52 -08:00
Adam Barth
798b67fe0c Fix typos in sky-drawer and sky-scrollable
Now that I can test these with a touch device, I found a few runtime errors
that are fixed in this CL.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/948073002
2015-02-23 10:12:34 -08:00
Adam Barth
e2c18721ff Port sky-drawer to Dart
Also, port the "appish" example to exercise the drawer.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/942413002
2015-02-23 08:30:58 -08:00
Adam Barth
b6f511c6a9 Port Sky widgets demo to Dart
This CL updates sky-box, sky-button, sky-checkbox, sky-input, and sky-radio to
work in Dart. We don't have a data binding system yet, so there's a bit more
plumbing in the code.

This CL adds support for sky-element@attributes, which lets you specify which
attributes your element supports. We use this information to synthesize getters
and setters for those attributes and to dispatch to mumbleChanged methods when
the attributes change.

I've also wrapped the widgets demo itself in a sky-scrollable so the whole
thing scrolls.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/946813005
2015-02-23 08:30:36 -08:00
Hans Muller
2cbb091137 Added an ApplicationConnection for the OnEmbed() SPs to Sky embedder
I also made the singleton embedder's fields static, so that they're lazily computed.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/945143003
2015-02-23 07:28:42 -08:00
Adam Barth
fe31fd0e4c Port sky-scrollable to Dart
This CL ports sky-scrollable to the new sky-element.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/950603002
2015-02-21 09:56:22 -08:00
Adam Barth
085b988e6a Make it possible for sky-element to register any tag name
... instead of hard-coding "example".

We do this by adding a custom constructor for Element that gets the |tagName|
property off the instance.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/943153002
2015-02-21 08:02:32 -08:00
Adam Barth
16db84fde1 Add a basic sky-element custom element
After this CL, you can use <sky-element> to describe custom elements. The
current iteration is very basic and is hardcoded to "example", but its a start.

This CL renames the |init| function to |_init| to prevent importers from
calling it directly. Also, we now pass the <script> element to |_init| to give
some context.

R=ojan@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/950493003
2015-02-20 21:45:36 -08:00
Hans Muller
3663c45619 Added Sky Mojo embedder singleton, restored network test
Currently the embedder is just an encapsulation of the Mojo shell. Exposing an ApplicationConnection that encapsulates the ViewManager Embed SPs is next.

R=abarth@chromium.org, zra@google.com

Review URL: https://codereview.chromium.org/948463003
2015-02-20 15:07:29 -08:00
Adam Barth
ec0a8e615c Sky should expose services provided to/by embedder
These now appear on internals as takeServicesProvidedToEmbedder and
takeServicesProvidedByEmbedder. When you call these functions, you get back the
raw int that represents the handle. We'll need to wrap them up inside the Dart
VM with the appropriate types. We can create a nice wrapper for that in a
future CL.

R=hansmuller@google.com, hansmuller@chromium.org

Review URL: https://codereview.chromium.org/944733002
2015-02-19 21:16:04 -08:00
Hans Muller
63dd3c3f5a Dart Bindings: ApplicationConnection
Replaced the Dart ServiceProvider class with a version
of ApplicationConnection that can both provide services
and connect to (request) them. ApplicationConnection
objects are returned by the Application ConnectToApplication()
method and they're passed to the Application AcceptConnection()
method.

R=zra@google.com

Review URL: https://codereview.chromium.org/934253003
2015-02-18 14:17:54 -08:00
Adam Barth
d1d6e4436d Make sky/tests/services/event-sender.sky pass
This CL ports sky/framework/shell.sky to Dart and makes event-sender.sky. I've
also removed a number of not-that-interesting tests for the JS Mojo bindings.

R=eseidel@chromium.org, rafaelw@chromium.org

Review URL: https://codereview.chromium.org/922123002
2015-02-13 13:52:08 -08:00