173 Commits

Author SHA1 Message Date
Matt Perry
08b0b8b540 Fix crash in stocks2 app caused by unspecified PaintBits.
TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1182613002.
2015-06-11 16:20:42 -04:00
Hixie
6cf4451a2c Add an example of an app that manipulates both a RenderObject tree and has some fn logic in it.
Also:
 - Make RenderProxyBox non-abstract
 - Upgrade the old container.dart example
 - Minor fixes to ui_mode.dart to make this work

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1183503003.
2015-06-11 13:08:00 -07:00
Matt Perry
85670ba03d Expose and use constants for DrawLooperLayerInfo.setPaintBits to dart.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1175403002.
2015-06-11 15:41:12 -04:00
Adam Barth
dcea536857 Teach stack to size to the max of its non-positioned children
Previously, it would always try to be as big as possible. This CL fixes a
problem with the search bar whereby the text wasn't centered. Now the Stack for
the text sizes its height properly and then becomes centered.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1184483002.
2015-06-11 12:32:43 -07:00
Adam Barth
2a86cc9ae3 Stop the search search button from crashing stocks2
There are still a number of problems with the search feature, but at least it
doesn't crash after this CL.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1179643004.
2015-06-11 11:08:14 -07:00
Hixie
9e73c7eeff Refactor fn2.dart, since it breached our 1000-line threshold.
This moves input.dart to editing2/, since that way we can define the layering as strictly unidirectional.
It also reorders a bunch of imports to fit the style guide.
I removed the old remnants of the widgets example, and put the fn2 examples into the examples/widgets/ directory, to parallel the framework directory names.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1177243002.
2015-06-11 10:26:11 -07:00
Matt Perry
c9dd71253c Fix up constructor naming style for MaskFilter and ColorFilter.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1179913002.
2015-06-11 13:15:20 -04:00
Matt Perry
b973810865 Sky: Small fixes to Gradient interface. Added comments and renamed constructors.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1180873003.
2015-06-11 13:14:51 -04:00
Adam Barth
7d788ecfc9 Make the popup menu animation correct
This CL wires up the opacity of the popup menu items and teaches the popup menu
how to draw its background at the right size.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1175353002.
2015-06-11 10:09:39 -07:00
Adam Barth
80fbf90cb9 Factor BoxPainter out of RenderDecoratedBox
This factoring will more code use BoxPainter in the future (in particular,
PopupMenu).

R=ianh@google.com

Review URL: https://codereview.chromium.org/1180633004.
2015-06-11 09:37:20 -07:00
Adam Barth
d0c30be6ca Make the stocks popup menu fade in
The final animation is more involved, but this CL starts implementing the menu
animation by making it fade in.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1174253003.
2015-06-10 17:28:43 -07:00
Hixie
508ff93761 Spinning Square example for the RenderObject API.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1178783002.
2015-06-10 17:27:49 -07:00
Collin Jackson
dd0cc7fc0b Support for alignItems (test incoming)
R=abarth@chromium.org, abarth, hansmuller

Review URL: https://codereview.chromium.org/1181533003
2015-06-10 16:35:49 -07:00
Collin Jackson
86b2b3ed28 Clip inkwell splash around the floating action button
R=abarth@chromium.org, ianh@google.com, abarth

Review URL: https://codereview.chromium.org/1174203002
2015-06-10 15:57:26 -07:00
Hixie
4ce574a199 Abstract out the AppView logic in fn so that it can also be used in non-pure-fn apps.
This lays the groundwork for using fn widgets in static environments.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1178703002
2015-06-10 15:55:25 -07:00
Hixie
4811d49753 Dispatch events to fn nodes for each RenderObject that the event goes through, instead of starting at the innermost target and just propagating through our tree.
This starts laying the groundwork for fn disconnected subtrees that are linked together into one RenderObject tree.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1181503002
2015-06-10 15:51:24 -07:00
Collin Jackson
e09dd96195 Fix analyzer warnings (and probably also bugs) in flex.dart
R=abarth@chromium.org, hixie

Review URL: https://codereview.chromium.org/1181523002
2015-06-10 15:36:12 -07:00
Adam Barth
358a22c9da Rename BlockContainer, StackContainer, and FlexContainer
These are now called Block, Stack, and Flex, respectively. Less verbose.

R=jackson@google.com, ianh@google.com

Review URL: https://codereview.chromium.org/1181533002.
2015-06-10 15:34:30 -07:00
Hixie
df5e4833d6 Replace some 'as' operators with equivalent code that doesn't do any checks in production mode.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1181453003
2015-06-10 15:00:34 -07:00
Hixie
9470872543 Fix inconsistency about how to spell "statusBar" which was causing warnings.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1174143002
2015-06-10 14:24:35 -07:00
Adam Barth
19d0230a33 Ink should propagate at a constant velocity
Previously it was propagating for a constant duration.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1173173002.
2015-06-10 14:16:11 -07:00
Hixie
5a9c944b7b Change how we narrow the "root" type on RenderObjectWrappers.
Turns out that reintroducing the field in each subclass is probably allocating more storage per node. So let's not do that.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1177483004
2015-06-10 14:13:36 -07:00
Adam Barth
df472efd57 Ink splashes should start at the touch point
Previously, they always started at the center of the RenderInkWell. Now we
remember the local coordinates we computed during the hit test and provide that
information when handling the event.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1180553002.
2015-06-10 13:55:20 -07:00
Hixie
32f027b65f Add some TODOs for renaming onTick and onValueChanged.
I'd do it now, but these files are still being used by fn.dart/stocks1, and it's not worth forking the whole animation directory just for this.

TBR=abarth

Review URL: https://codereview.chromium.org/1170033005
2015-06-10 13:43:42 -07:00
Hixie
47b275c1ad Kill onDidMount()/onDidUnmount() in favour of just overriding the relevant methods.
In general, we are hugely inconsistent in what onFoo/onFoo() means.
I'm cleaning out all the cases where onFoo() is a method.

Also, this fixes EditableText, which got missed in the recent syncFields() pass.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1175753003
2015-06-10 13:30:50 -07:00
Collin Jackson
56d1aa0b94 Fix cross size of flex items in stocks app (more tests incoming)
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1176053002
2015-06-10 12:54:26 -07:00
Adam Barth
4806a4cc04 Remove _emptyList from fn2.dart
We can use const [] instead and we'll be sure we don't mutate this constant.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1178623002.
2015-06-10 12:42:41 -07:00
Eric Seidel
58068b9e41 Add TODOs about components needing to adjust to screen size changes.
Our current static view_configuration design cannot work.

https://github.com/domokit/mojo/issues/231

R=ianh@google.com

Review URL: https://codereview.chromium.org/1169813009.
2015-06-10 11:28:00 -07:00
Eric Seidel
c87b98b687 Enable antialiasing on Paint by default.
The app looks so much better with this on.

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

Review URL: https://codereview.chromium.org/1172413002.
2015-06-10 11:11:03 -07:00
Hans Muller
c572af7f6e Right-size the toolbar
Tweaked the layout in Scaffold a little: the Scaffold
accounts for the (Android) notification bar's height,
instead of the ToolBar. I think it would be best if
moving the app below the notification area were handled
at a lower level. Doing it in Scaffold seemed OK for the
moment, since one could put a ToolBar component anywhere
in an app.

Closes #208

R=ianh@google.com

Review URL: https://codereview.chromium.org/1171173003.
2015-06-10 11:06:50 -07:00
Hixie
003083a12d Remove one more use of mirrors: Components now have to explicitly sync their fields.
This also removes one bit of magic to make it more obvious what on is
going on during a sync, which should hopefully help.

Components have to decide if they support being stateful or not. If
they do, then they must implement syncFields() and have mutable
fields; if they don't, then they must have final fields. This isn't
particularly enforced, though.

This also renames _willSync() to _retainStatefulNodeIfPossible(), for
clarity, and fixes some minor style issues and one typo that was
breaking the drawer.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1174023003
2015-06-10 10:33:04 -07:00
Collin Jackson
950b3d40c5 Extend Sky's RenderFlex with intrinsic sizes and compute cross-size height
Renders interactive_flex and stocks demos fine. Could use more testing,
so I'm going to work on that after I land this.

R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1173493003
2015-06-10 10:11:58 -07:00
Matt Perry
42892c733b Add LinearBoxGradient and RadialBoxGradient decorations for RenderDecoratedBox.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1175763002.
2015-06-10 12:23:57 -04:00
Adam Barth
38e39c0ec5 Make ink splashes work in MenuItem
Previously, the ink splashes would disappear immediately because the button
highlight would change the structure of the component hierarchy and we weren't
smart enough to retain the underlying RenderInkSplash. This CL is a point fix
for that issue by avoiding changing the structure of the component hierarchy. A
more complete fix would be to make Container smarter about how it syncs its
subcomponents.

R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1168323003.
2015-06-10 09:23:24 -07:00
Adam Barth
57df667f8f Add a basic InkWell implementation
This CL replaces the (non-working) components2 InkWell with some code based on
the ink_well example. There are at least two issues with the implementation:

1) The ink splash always starts at the center of the well because we don't have
   a facility for converting from global to local coordinates, which means we
   can't tell where the tap occurred in the local coordinates we need to use
   for painting.

2) When used inside a MenuItem, the in splash disappears shortly after
   starting, presumably because the button starts highlighting, which causes a
   component rebuild and somehow we lose the RenderInkWell instance.

I plan to address these issues in subsequent CLs.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1172033003.
2015-06-10 09:04:15 -07:00
Eric Seidel
52fd41bc88 Make Sky not crash when an image 404s.
I also fixed image_cache to not even bother
to call ImageDecoder in the 404 case, but I also
fixed CanvasImageDecoder not to blow up if the
buffer is empty and its not able to allocate
an ImageDecoder.

Closes https://github.com/domokit/mojo/issues/229

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

Review URL: https://codereview.chromium.org/1170413002.
2015-06-09 17:29:00 -07:00
Hixie
d9de344d6c I accidentally removed two lines of code in https://codereview.chromium.org/1172173002 when merging upsteam before landing.
TBR=abarth

Review URL: https://codereview.chromium.org/1171163005
2015-06-09 15:30:38 -07:00
Hixie
d54c213b24 Clean up a bunch of our Dart code.
- constructors first
 - have either a blank line at the top and bottom of each class, or no blank line in either place (it's still inconsistent about which we should do)
 - hide clamp()

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1172173002
2015-06-09 15:27:58 -07:00
Hixie
5156f12b32 Move AnimatedComponent away from mirrors and towards a callback-based setter.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1171273002
2015-06-09 15:24:51 -07:00
Hixie
c3eccc8556 Remove Component.getRoot(), since we don't use it anymore.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1174683005
2015-06-09 15:24:07 -07:00
Hixie
8198a29b67 Remove a bogus .ceilToDouble() call.
TBR=abarth

Review URL: https://codereview.chromium.org/1173783002
2015-06-09 14:12:28 -07:00
Adam Barth
a68b53ae91 Fix the Sky tests
Instead of triggering layout synchronously during AppView construction, we now
schedule the initial layout using a magic bootstrapping function.

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1172123003.
2015-06-09 14:07:17 -07:00
Adam Barth
4011ec97b8 SkyView should handle screen rotation
This CL implements a basic version of screen rotation where we just relayout at
the new size. In the future, we'll want a fancy version where we transition
between the two layouts.

R=ianh@google.com
BUG=

Review URL: https://codereview.chromium.org/1177563002.
2015-06-09 13:56:18 -07:00
Hixie
6495ef0710 Add asserts to prevent people from setting box.parentData.position or box.size except during layout.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1176623002
2015-06-09 13:11:11 -07:00
Matt Perry
7cbe385e8f Add a shadow to the FloatingActionButton.
Also added a helper class to Sky framework for building shadow DrawLoopers.

R=abarth@chromium.org, eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1175683002.
2015-06-09 15:51:04 -04:00
Hixie
4c86f98a1b Rename the confusingly named "ContentNode" class to "TagNode".
Also considered "AnnotationNode", "LabelNode", "BadgeNode", but "TagNode" seemed simplest.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1169853008
2015-06-09 12:44:38 -07:00
Adam Barth
3e5993eeee Give the popup menu a 2px border radius
This matches the material design spec.

R=ianh@google.com, jackson@chromium.org

Review URL: https://codereview.chromium.org/1169873003.
2015-06-09 12:43:27 -07:00
Hixie
2fa798966e OneChildRenderObjectWrapper and Scaffold were ignoring the return value of syncChild().
This would cause them to forget what the most recent child they'd been given was, with disastrous effects later.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1173683003
2015-06-09 12:23:17 -07:00
Eric Seidel
9f337a62e6 Fix typo in fetch.dart
TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1169253002.
2015-06-09 12:17:50 -07:00
Eric Seidel
8f975399e1 Move image loading out of C++ into Dart
We already know how to talk to the network_service from Dart
via fetch.dart.  Might as well use that for Image loading
as well insetad of having ImageLoader do it.

As part of this I've renamed *ImageLoader to *ImageDecoder
and moved all the image loading logic into Dart.  This required
me to teach the idl system about mojo handles so that I could
pass the resulting MojoHandle from fetch.dart up through to
ImageDecoder.

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

Review URL: https://codereview.chromium.org/1173703002.
2015-06-09 12:14:13 -07:00