1556 Commits

Author SHA1 Message Date
Hixie
34e7b69a79 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
cc5fde4e61 Fix bustage from my previous CL: "Color.fromARGB" becomes "new Color.fromARGB".
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1184523002.
2015-06-11 15:59:10 -04:00
Matt Perry
7357aa443b Remove redundant Paint.setARGB in favor of assigning to Paint.color.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1182563002.
2015-06-11 15:43:53 -04:00
Matt Perry
f8b4af944c 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
Hixie
5d676f8549 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
a523d7f3ea 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
6ed8fb863c 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
b656316b4b 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
Viktor Lidholt
dcb0fa4312 Adds hit tests and transformations between coordinate systems in sprites
Sprite nodes use Point instead of Vector2

Updates sprite test app

Refactors accounting for pivot points in sprites

Adds abstract NodeWithSize class in Sprites.

Refactors SpriteNode to Sprite

Refactors TransformNode to Node (may need to find another name as it conflicts with Sky's Node).

Sprite system now uses and caches transformation matrices.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1180703002.
2015-06-11 08:44:22 -07:00
Hixie
42877fd114 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
Hixie
6a8dd7d284 Separate out the raw (directly manipulating sky.view) examples from the rendering (using RenderObject et al) examples.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1173233002
2015-06-10 16:23:43 -07:00
Hixie
ee42b94fa2 Move spinning_arabic.dart to the raw/ examples directory for consistency with the others.
R=eseidel@chromium.org, eseidel

Review URL: https://codereview.chromium.org/1180623003
2015-06-10 16:07:12 -07:00
Hixie
3627cefc7e 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
Adam Barth
a5a56cbdc1 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
58efa250e5 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
Adam Barth
492f5919c7 Rows in stocks app should have ink splashes
R=ianh@google.com

Review URL: https://codereview.chromium.org/1174153002.
2015-06-10 14:58:21 -07:00
Adam Barth
ac7f2ff860 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
4d6d57690e 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
b6a3f8eef9 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
fe153f179a 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
Viktor Lidholt
3260d9988d Adds support for zOrder and references to parent nodes in sprites, also start of new test app.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1177563004.
2015-06-10 09:21:01 -07:00
Adam Barth
0e5bb2d231 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
Hans Muller
ad5df9147f Vertically center stock demo row contents, better up/down arrows
StockRows are now a relatively simple application of flex layout.

The up/down arrows are now rendered within a circle, like
the original version. The arrows are a little bigger,
because.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1165223005.
2015-06-09 15:59:18 -07:00
Hixie
be5cc1a27e 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
Matt Perry
ba6a9a2ba5 Sky: Allow clients to specify tile mode for gradients (repeating or mirror).
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1166223004.
2015-06-09 15:21:46 -04:00
Eric Seidel
6b3840e384 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
Matt Perry
5a0b18490f Change the ColorFilter constructor to ColorFilter.Mode, in case we want to add
more ColorFilter types.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1163373007.
2015-06-09 14:55:52 -04:00
Hans Muller
3aeadb34a6 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
44a0af042c 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
Matt Perry
71cf849271 Sky: Added radial gradients.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1169863002.
2015-06-09 12:45:02 -04:00
Adam Barth
2bc982d676 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
Hans Muller
e158527d6d Restore stock_arrow element of the stocks2 demo
This version doesn't add any visual punch.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1172513002.
2015-06-09 09:05:25 -07:00
Adam Barth
b7e81c798a 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
37f0b0240b Convert everything in the Sky API from degrees to radians.
Radians are the one true angle unit.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1164393002
2015-06-08 14:38:06 -07:00
Hixie
8ade37c5aa 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
62bff5f7ef 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
824bc31626 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
Adam Barth
81e8e2b564 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
Hixie
77f5d4724a 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
Matt Perry
1f26d65757 Add support for linear gradients, implemented as skia shaders.
I had to complicate the IDL bindings generation to allow passing an array of
colors. Without these changes, we'd try to convert the dart object to
Vector<SkColor>, which C++ thinks is Vector<unsigned>, and we'd use the wrong
converter. So I added some template grease to force it to use a
Vector<CanvasColor> converter.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1152963009
2015-06-08 13:49:10 -04:00
Adam Barth
1526e5f8e0 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
Collin Jackson
c6a1a066f2 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
Adam Barth
f2bc5caa07 Add the floating action button to stocks2
The + isn't quite centered properly, but the button is a circle in the right
place.

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

Review URL: https://codereview.chromium.org/1156383004
2015-06-05 10:07:51 -07:00
Collin Jackson
baa62abc67 Implement radio button for Sky’s fn2
R=abarth@chromium.org, eseidel@chromium.org, abarth

Review URL: https://codereview.chromium.org/1157573012
2015-06-04 17:24:38 -07:00
Viktor Lidholt
824a66399e Adds a spaceship and (somewhat crappy) controls to the example game.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1151793003
2015-06-04 17:14:46 -07:00
Adam Barth
e5581e80ed stock2 should actually show some stocks data
We're having trouble shrinkwrapping text, so this CL sets an explicit size for
the last sale and the change in price.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1164763006
2015-06-04 16:35:56 -07:00
Hixie
b7c588661c Rename "BorderSide.None" to "BorderSide.none", since it's a constant, and change the sky.Size.infinite() constructor to a constant.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1158263005
2015-06-04 16:17:20 -07:00
Adam Barth
6559a8b68e Make the StockList actually work in stocks2
RenderScaffold needs to attach and detach its children when asked.

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

Review URL: https://codereview.chromium.org/1149893025
2015-06-04 15:50:07 -07:00
Hixie
a33db92d62 Improve the RenderObject.toString() logic so that there's not blank lines everywhere and to generally be better.
Adds sizes, positions, transforms, improves RenderParagraph's output.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1160233004
2015-06-04 15:45:44 -07:00
Eric Seidel
7ebb281c5c Fix examples/game to work after Hixie's grand rename.
TBR=viktorl@google.com

Review URL: https://codereview.chromium.org/1158273009
2015-06-04 15:25:46 -07:00