190 Commits

Author SHA1 Message Date
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
Adam Barth
ff13e9ae9e Add material shadows to toolbar and drawer
Also, I've fixed the mask color on the drawer.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1168203004.
2015-06-09 12:07:14 -07:00
Hans Muller
65926f65fb Added a key: parameter to ParentDataNode, ContentDataNode
The FlexExpandingChild flex parameter is now a keyword as
well, which adds a small readability benefit.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1172503004.
2015-06-09 11:00:47 -07:00
Adam Barth
2368f9b985 Add boxShadow to BoxDecoration#toString
TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1174623002.
2015-06-09 10:39:52 -07:00
Adam Barth
7a930b8352 Add a proper material shadow the popup menu
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1172723002.
2015-06-09 10:31:39 -07:00
Adam Barth
f183f6a173 Position the popup menu in stocks2 correctly
This CL pulled an implementation of position: absolute in RenderStackContainer.

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

Review URL: https://codereview.chromium.org/1166363002.
2015-06-09 09:22:50 -07:00
Benjamin Lerman
f054a99b83 Sky: Use the authenticated network service.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1146813013
2015-06-09 09:46:18 +02:00
Adam Barth
e50d0e622b ShrinkWrap the Stocks menu
The popup menu in the stocks app is supposed to size its width to the max
intrinsic width of the menu. This CL teaches it how to do that.

It's a shame that we need to ceilToDouble the output of RenderParagraph. If we
don't do that, we run into floating point layout trouble and the menu triggers
a line break. The correct fix is to do layout in fixed point.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1168113005
2015-06-08 16:20:11 -07:00
Eric Seidel
92fd88b73f Fix RenderParagraph to respect text color.
I don't think this is the final API we're going to use.

I suspect we'll add a TextStyle struct to hold
color and size, etc. which back-ends into CSS like
this does today.

Currently no one uses this color even though it exists.

This is one step towards fixing:
https://github.com/domokit/mojo/issues/213

R=ianh@google.com

Review URL: https://codereview.chromium.org/1162573007
2015-06-08 15:22:18 -07:00
Adam Barth
903ef07abb Split getIntrinsicDimensions into four pieces
This CL splits getIntrinsicDimensions into getMinIntrinsicWidth,
getMaxIntrinsicWidth, getMinIntrinsicHeight, and getMaxIntrinsicHeight so that
we can properly shrink-wrap the stocks app menu. This CL just contains the
refactoring. The use in stocks app will come in a later CL.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1167293003
2015-06-08 14:40:34 -07:00
Hixie
c4b64d74f3 Rename Container's desiredSize argument to width and height arguments.
Also change SizedBox.

This makes the code that uses Container() and SizedBox() much more readable.

The underlying RenderSizedBox is not affected by this change.

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

Review URL: https://codereview.chromium.org/1166203002
2015-06-08 14:36:19 -07:00
Collin Jackson
d4ef9dcb26 Sky support for flexbox justify content
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1164363002
2015-06-08 14:14:02 -07:00
Adam Barth
5a14f03f7b Add Point.origin for new Point(0.0, 0.0)
R=eseidel@chromium.org, ianh@google.com

Review URL: https://codereview.chromium.org/1166183002
2015-06-08 13:36:52 -07:00
John McCutchan
49add313cc Ensure CHANGELOG.md and README.md ship with sky, mojo, and mojom packages
Review URL: https://codereview.chromium.org/1165243002
2015-06-08 13:27:46 -07:00
John McCutchan
ec5a1743b2 In preparation of release, bump the mojom and sky package version numbers
BUG=
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1168143002
2015-06-08 13:16:17 -07:00
Adam Barth
b311e286f3 Add a basic popup menu implementation to stocks2
The popup menu is displayed in the wrong location with the wrong width, but it
does draw. I've also removed the checkbox because the flex container was
causing me trouble.  I'll add it back in a later CL.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1166153002
2015-06-08 12:52:15 -07:00
John McCutchan
641c8603ab Fixup Sky and Mojo dart pkg's exported mojoms
This populates each package's lib/mojom directory with the generated .mojom.dart files.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1164323002
2015-06-08 12:48:39 -07:00
Hixie
5588221364 Add some commentary to node.dart to explain AbstractNode a bit better.
TBR=abarth

Review URL: https://codereview.chromium.org/1170783002
2015-06-08 12:36:55 -07:00
Adam Barth
c0d900414f Add |constraints| to Container for PopupMenuItem
This CL is the first step towards getting PopupMenuItem working in fn2. We
introduce the ability to add a minWidth to a Container by creating a
RenderConstrainedBox class to apply the new constraints.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1155683011
2015-06-08 12:22:52 -07:00
Hixie
5703762fc1 Port DrawerHeader to fn2 world.
This includes making SizedBox default to infinite size, and making
Container default to containing one infinite-sized SizedBox. That way,
you can use an empty Container as a spacer in a flex box.

The rendering doesn't quite work, because of a bug in flex whereby it
doesn't shrink-wrap its contents in the cross-direction, it fills the
parent. Collin is on that.

R=jackson@google.com

Review URL: https://codereview.chromium.org/1163633003
2015-06-08 11:00:05 -07:00
Adam Barth
2384779263 Introduce sky.Sky.zero
And deploy it in a few places.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1164303002
2015-06-08 10:09:03 -07:00
Hixie
878c984d39 Fix syntax error that resulted from badly converting a .forEach() to a for-in.
TBR=abarth

Review URL: https://codereview.chromium.org/1169543009
2015-06-08 10:05:08 -07:00
Hixie
76310148a0 Handle UINodes being moved around the Effen tree.
Changes:
- Remove all the old tracing logic since that was a lot of code for
  just random printf debugging and nobody seems to use it
- Convert "defunct", a permanent state transition, to "mounted", a
  state that can be entered and exitted arbitrarily
- Coallesce mount/unmount notifications so there's only one per frame
- Remove handleRemoved() since we don't use it
- Rename a local variable 'parent' to 'ancestor' to avoid shadowing
  the field
- Replace uses of forEach() with for-in

Effects:
- Reusing a node provided to a constructor in a new place in a tree
  (especially at a different depth) no longer fails (it used to fail
  because the node would be marked defunct then remounted later, at
  which point it would fail)

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1169673002
2015-06-08 09:59:25 -07:00
Collin Jackson
668e1e37ab Implement a simple checkbox in Sky’s fn2 components library
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1161813005
2015-06-05 14:51:37 -07:00
Eric Seidel
9af8d548e5 Make Text size to its content instead of always 100% width
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1156383006
2015-06-05 14:20:16 -07:00
Adam Barth
e6ad96e3e1 Don't crash when removing a radio button
We were hitting an assert in RenderCustomPaint that the callback wasn't null.

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

Review URL: https://codereview.chromium.org/1162023010
2015-06-05 12:17:21 -07:00