Commit Graph

447 Commits

Author SHA1 Message Date
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
Eric Seidel
8a0caf8ed4 Start making input work
Does not work yet.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1163973005
2015-06-04 15:18:09 -07:00
Adam Barth
b76af41f63 Prepare StockList for use in stocks2
This CL does a bunch of ground work for getting StockList ready for use in
stocks2. It's still not quite working because of an interaction with Scaffold
that we don't fully understand.

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

Review URL: https://codereview.chromium.org/1148793005
2015-06-04 15:10:09 -07:00
Eric Seidel
b05d618e62 Attempt to write a RenderShadowedBox
The goal of this is to have a Renderer-layer abstraction
around the Sky Engine c++ apis for drawing a shadow.

R=mpcomplete@chromium.org

Review URL: https://codereview.chromium.org/1146893004
2015-06-04 14:49:24 -07:00
Collin Jackson
f66a933a55 Implement menu_divider
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1163913004
2015-06-04 13:11:40 -07:00
Hixie
68369e9d62 Style guide says enum values should be lowerCamelCase.
https://www.dartlang.org/articles/style-guide/#names

R=jackson@google.com

Review URL: https://codereview.chromium.org/1158813004
2015-06-04 12:24:10 -07:00
Viktor Lidholt
3b06e1e1f7 Adds support for transfer mode in Paint and SpriteNode classes. Adds support for opacity in sprites, and modifies example game.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1164633004
2015-06-04 11:14:07 -07:00
Collin Jackson
bcf65bd04c Stub out InkWell and implement Sky’s fn2 menu item
R=abarth@chromium.org, ianh@google.com, abarth, hixie

Review URL: https://codereview.chromium.org/1165983002
2015-06-04 11:04:01 -07:00
Matt Perry
30dac5853d Canvas.concat takes a 16-element Float32List instead of an array.
The array should be in column-major format, in the format used by vector_math.dart.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1155193004
2015-06-04 13:51:44 -04:00
Hixie
433df32cd0 Enable RenderDecoratedBox to draw borders.
Currently supports only solid borders, but of any colour and size, independently controlling each side.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1154903006
2015-06-04 10:50:59 -07:00
Adam Barth
9bdb39d0ec Fix build after hixie's rename
TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1164073002
2015-06-04 10:49:05 -07:00
Hixie
395102d5ca Rename RenderNode to RenderObject.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1165013003
2015-06-04 10:45:21 -07:00
Adam Barth
e99c880bc2 Fix gesture events in fn2
This CL makes gesture events work again in fn2.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1146923005
2015-06-03 16:06:15 -07:00
Hixie
d268da7ad5 Plug the drawer into stock2.
Not tested on device.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1160523005
2015-06-03 15:36:48 -07:00
Eric Seidel
7f705336e8 Fork theme to theme2 and use sky.Color types directly.
This also works around an Android-only crasher for the Dart VM:
https://github.com/domokit/mojo/issues/192

R=ianh@google.com

Review URL: https://codereview.chromium.org/1157243012
2015-06-03 15:22:08 -07:00
Collin Jackson
fef65fc431 Implement RenderImage and Image for Sky
This also fixes a bug that was preventing markNeedsLayout from working

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

Review URL: https://codereview.chromium.org/1160013004
2015-06-03 15:17:12 -07:00
Viktor Lidholt
006da931cf Sky example game enhancements, adds preloading of images and adds transform modes to SpriteBox
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1149183004
2015-06-03 15:05:55 -07:00
Hixie
686123e117 Add overlays back to stocks2.
Except that nothing actually uses these now so it's a no-op really.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1157243011
2015-06-03 15:03:34 -07:00
Hixie
3783ad3717 Fix scaffold to work for the toolbar.
Also, make the scaffold code more generic (with slots in a map,
instead of dedicated members for each slot).

This may eventually benefit from being split into a general
"multislot" superclass and a scaffold-specific subclass, but for now
it'll do.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1152163007
2015-06-03 14:50:32 -07:00
Matt Perry
dc4915059f Update BoxDecoration and RenderParagraph to use sky.Color instead of int.
Also add operator==, hashCode, toString, and some basic Color constants to
Color.

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

Review URL: https://codereview.chromium.org/1162023004
2015-06-03 16:57:04 -04:00
Eric Seidel
28a43627a2 Make tracing work in the new .dart world.
R=abarth@chromium.org, viktorl@google.com

Review URL: https://codereview.chromium.org/1152483006
2015-06-03 12:40:38 -07:00
Adam Barth
6543b55cb6 Add support for transforms to container
These transforms are currently very basic but they seem to mostly work.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1152273004
2015-06-03 10:20:33 -07:00
Eric Seidel
c47a82d5ca Give the Stocks2 App a new improved toolbar.
Looks horrible.  But it's a start.

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

Review URL: https://codereview.chromium.org/1146913005
2015-06-02 16:13:31 -07:00
Viktor Lidholt
3118a6fba1 Initial version of working game with Box2D, images, nodes and sprites.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1161023006
2015-06-02 15:09:01 -07:00
Adam Barth
81cc63edfe Implement Container in fn2
This CL is a first pass at implementing container in fn2. In this approach,
Container is a Component that builds a number of RenderNodeWrappers depending
on what is needed.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1158983005
2015-06-02 15:07:02 -07:00
Matt Perry
0f8ae9f16c Add a MaskFilter interface to dart:sky to handle blur.
For this, I added back my previous CustomDart attribute for customizing the
generated Dart code of an interface.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1162843003
2015-06-02 17:26:32 -04:00
Hixie
b53644f660 Rename rendering/render_*.dart to rendering/*.dart
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1166773003
2015-06-02 13:55:20 -07:00
Adam Barth
11d50579a1 Add BlockContainer to fn2
BlockContainer uses a RenderBlock to lay out its children.

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

Review URL: https://codereview.chromium.org/1166473005
2015-06-02 12:19:25 -07:00
Adam Barth
e0fc6df9a3 Mark fn2's EventListenerNode work for PointerEvent
Prevously we listened for events on the document and then walked up the
component hierarchy looking for EventListenerNodes. Now we do something similar
by hooking the event dispatching logic in the AppView.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1153343004
2015-06-02 12:18:13 -07:00
Matt Perry
9618a82750 Add TransferMode to dart:sky, and use it instead of passing ints around.
Also use Point in place of passing 2 ints to the DrawLooper API.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1158883004
2015-06-02 15:03:44 -04:00
Matt Perry
e28c832a79 Re-land "Add a Color class to dart:sky."
The previous patch broke the sky tests. I have updated the framework to use the new Color class.

R=jackson@google.com

Review URL: https://codereview.chromium.org/1159663003
2015-06-02 14:09:42 -04:00
Collin Jackson
dc9635dd33 Implement a simple image cache for Sky in Dart. This doesn't yet do any eviction from the cache.
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1165753004
2015-06-02 10:44:48 -07:00
Collin Jackson
2fe4b05e6d Refactor image handling in Sky to expose the loader and image as separate classes to Dart code. This makes it possible to avoid unnecessary paints, by only painting once when the image has loaded. Now that we've separated the loader and image classes, we can implement an image cache in Dart.
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1156003007
2015-06-01 16:21:21 -07:00
Matt Perry
4eb2ac712e Revert "Add a Color class to dart:sky."
This reverts commit a413c8319fe9a46dc131f6efe275d014c9cb7eb9.

Reason: seems to have broken Sky tests:
Regressions: Unexpected crashes (2)
  raw/render_box.dart [ Crash ]
  raw/render_flex.dart [ Crash ]

TBR=jackson@google.com

Review URL: https://codereview.chromium.org/1143133007
2015-06-01 18:13:35 -04:00
Matt Perry
e22b790e0c Add a Color class to dart:sky.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1161273004
2015-06-01 16:48:48 -04:00
Collin Jackson
205bd1449a Add Sky framework support for drawing images
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1151753009
2015-05-29 16:45:43 -07:00
Adam Barth
04169c4ce3 Add a simple inksplash example
We'll eventually turn this into a full fn2 component, but for now it's just an
example.

To make this work, I created a schedule.dart as a start to implementing
scheduler.md. For now, I've kept the API similar to the web platform so that
the old world can continue use it backed by sky.window.requestAnimationFrame.

R=eseidel@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1145973009
2015-05-29 13:55:12 -07:00
Adam Barth
dbbe62ea8f Split layout2.dart into several files
Previously layout2.dart was a thousand lines long.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1161003002
2015-05-28 16:42:04 -07:00
Hixie
46e47cf011 Make RenderParagraph mutable, and make it fit the new RenderNode protocols
R=abarth@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1165463002
2015-05-28 15:19:36 -07:00
Adam Barth
3f22019e66 Replace BoxDimensions with sky.Size
R=ianh@google.com

Review URL: https://codereview.chromium.org/1150253005
2015-05-28 14:29:29 -07:00
Adam Barth
b0e39b7d99 Move simple_render_tree into tests as render_flex
R=ianh@google.com

Review URL: https://codereview.chromium.org/1146123003
2015-05-28 14:29:10 -07:00
Matt Perry
96b04e34b1 Add an API to set the ColorFilter on a Paint object.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1158693005
2015-05-28 17:17:11 -04:00
Eric Seidel
db50ce1659 Add hello_fn2.dart and make Text("Hello fn2") actually render something.
R=ianh@google.com

Review URL: https://codereview.chromium.org/1160843005
2015-05-28 13:56:36 -07:00
Adam Barth
10901fabad Introduce RenderProxyBox and RenderSizedBox
Also makes Point, Size, and Rect immutable.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1162033002
2015-05-28 13:39:26 -07:00
Adam Barth
647232b8a5 Use Point, Size, and Rect in layout2.dart
R=ianh@google.com

Review URL: https://codereview.chromium.org/1156303004
2015-05-28 12:42:54 -07:00
Eric Seidel
081a440e6c Move RenderParagraph into layout2.dart
TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1155103003
2015-05-28 12:26:09 -07:00
Eric Seidel
54eb9b146e Add a very simple RenderParagraph example using LayoutRoot.
I'm sure we'll want something more sophisticated in the near future.

Next step is to actually animate this updating layout.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1150183005
2015-05-28 12:18:56 -07:00
Hixie
ec29082f84 Refactor layout/relayout into a single method.
This dramatically simplifies the layout model.
I haven't gone through and simplified the existing functions, we should probably go through and figure out if they can be cleaned up a bit.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1161983004
2015-05-28 11:15:58 -07:00
Hixie
e45a3f7b32 Refactor padding out of RenderBlock.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1143153011
2015-05-27 17:11:45 -07:00
Hixie
ac0d5e31a6 [Effen] port fn and stock to RenderNode, part 1 of many
This gets things off the ground barely enough to show some pixels.
These are not pixels that are actually part of the stock app, but
it's a start.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1157033006
2015-05-27 13:36:01 -07:00
Matt Perry
15687c8831 Sky: Add a DrawLooper interface to the painting API to be used for shadows.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1144193006
2015-05-27 16:22:01 -04:00
Hixie
270e386351 Fix compilation errors in render-sector.dart
TBR=abarth

Review URL: https://codereview.chromium.org/1153273002
2015-05-27 12:03:15 -07:00
Matt Perry
36baaf53a5 Sky: Add a Point class.
Also, fix the style in Rect.cpp/.h.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1158843002
2015-05-27 14:40:02 -04:00
Eric Seidel
b1b94b4770 Make it possible to draw Text in the new window/document-less world
I had to add back document.createText() since new Text()
does not work in the new world yet.

LayoutRoot is a new Dart-exposed class which holds the Frame and
all associated machinery, sufficient to trigger a restyle
and layout of the subtree.

This is all kinda hacky and I'm sure likely to cause many
crashes if folks call random methods on these disconnected
trees.

But this makes it at least possible to paint text for now
and we can improve this in the coming days.

This really should have Adam's review.  It's hugely hacky
but I'd like to negotiate out with him the timeline on
which we should fix some of these hacks.

R=ianh@google.com
TBR=abarth@chromium.org

Review URL: https://codereview.chromium.org/1148253003
2015-05-27 11:05:42 -07:00
Hixie
d88b117bcf [Effen] Point the stocks2 and components2 files at the forked libraries. (part II)
This was supposed to be in https://codereview.chromium.org/1153223003

TBR=abarth

Review URL: https://codereview.chromium.org/1160763003
2015-05-27 09:39:15 -07:00
Hixie
6ffea218fe Replace setBoxDecoration() with a decoration property. (part II)
This was supposed to be in https://codereview.chromium.org/1153893006/

TBR=abarth

Review URL: https://codereview.chromium.org/1151383003
2015-05-27 09:35:15 -07:00
Hixie
2415a118f6 Replace setBoxDecoration() with a decoration property.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1153893006
2015-05-27 09:30:25 -07:00
Hixie
f706d82828 [Effen] Point the stocks2 and components2 files at the forked libraries.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1153223003
2015-05-27 09:13:37 -07:00
Hixie
24e81ea037 [Effen] Fork stocks and fn.dart so we have something to work on during the porting process
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1156543004
2015-05-26 12:53:08 -07:00
Hixie
c09aac3f3f Rationalise hit testing in the new RenderNode world
- makes the event logic not involve a boolean return value (since we ignored it anyway)
- splits the event handling logic into two steps, hit testing and event dispatch
- introduces an App class on the Dart side to factor out the interaction with the C++ side
- ports sector-layout and simple_render_tree to the new App infrastructure
- port simple_render_tree to the new event handling logic
- implement hit testing for the sector-layout demo

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1143343004
2015-05-26 12:44:35 -07:00
Collin Jackson
3976cd7b28 Clean up syntax as suggested by sethladd
R=sethladd@google.com, sethladd

Review URL: https://codereview.chromium.org/1159763003
2015-05-26 10:20:37 -07:00
Hixie
2470cdcafa RenderSector example: add a class to stack in the other direction, and fix various bugs.
- the circle now fills the screen
- you can set dimensions on the solid color node
- debugging printfs and rects are gone
- the protocol is changed so that for sectors, you position before you size (since your size and your childrens' positions all depend on your own position)

TBR=abarth

Review URL: https://codereview.chromium.org/1154213003
2015-05-26 09:53:21 -07:00
Hixie
54403a610b A proof of concept for annular sector layout.
Could be useful for watch faces. :-)
Includes some minor fixes to layout2.dart.
Includes adding a very basic path API.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1152383002
2015-05-26 08:33:13 -07:00
Collin Jackson
87e8b162c7 WIP Flexbox Layout Manager for Sky framework.
This only handles really basic cases and doesn't understand
justification, wrapping, and so on. Submitting for code
review so I can get some early feedback before I invest
more time into making it correct.

R=ianh@google.com, abarth

Review URL: https://codereview.chromium.org/1151293002
2015-05-22 18:47:29 -07:00
Adam Barth
51c670e62b Address Ian's comments on layout2.dart
R=ianh@google.com

Review URL: https://codereview.chromium.org/1152603002
2015-05-21 13:32:21 -07:00
Adam Barth
af9a06c023 Port touch-demo.sky to SkyView universe
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1151613005
2015-05-21 12:34:38 -07:00
Adam Barth
ed38815dbd Port spinning_square to SkyView universe
This demo shows how to create a spinning square using the lowest-level APIs. We
should probably create more spinning square demos at the other layers of the
system.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1147393002
2015-05-21 12:14:10 -07:00
Adam Barth
c63c396da8 Make hit testing work in layout2.dart
This CL makes simple_render_tree.dart interactive by making the hit testing
system work. I've also added a mechanism for requesting an animation frame.

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

Review URL: https://codereview.chromium.org/1153543002
2015-05-21 11:22:17 -07:00
Adam Barth
400d6df700 Actually perform a block layout
This CL teaches simple_render_tree how to do a block layout using layout2.dart.

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

Review URL: https://codereview.chromium.org/1144423002
2015-05-21 11:15:50 -07:00
Adam Barth
3a6cab2c40 Add a simple_render_tree example
This example shows how to draw a circle using subclasses of RenderNode.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1144193004
2015-05-20 13:49:29 -07:00
Adam Barth
83805e2a9e Plumb input events into SkyView
Clients can now register a callback that gets called whenever we have an event
for the view. We'll need to update the Event class at some point, but this is a
start.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1129333005
2015-05-19 16:50:28 -07:00
Hixie
9523283bb4 [Effen] Rename Action Bar to Tool Bar.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1133353008
2015-05-19 15:52:12 -07:00
Adam Barth
17040ff355 Plumb display metrics into SkyView
This CL teaches SkyView the width, height, and device pixel ratio of the
display. In the future, we'll want some sort of notification system for when
these values change.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1139823010
2015-05-19 14:54:08 -07:00
Adam Barth
0b18d56d5a Teach SkyView path to draw a circle
This CL adds a global view object that can receive a Picture and be signaled to
draw. When using SkyView, this Picture shows up on screen.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1134913003
2015-05-19 14:20:04 -07:00
John McCutchan
5fd9d77387 Fix domokit.github.io site deployment script
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1145843002
2015-05-19 14:03:13 -07:00
Adam Barth
a21939bdaf Teach SkyView code path to print hello, world
This CL makes the SkyView codepath smart enough to print "hello, world" to the
console. The code path is off by default but can be enabled by changing one
line of code.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1131673011
2015-05-19 13:51:12 -07:00
Matt Perry
9dfbc4eea4 Sky: Add a CustomDart attribute to the IDL compiler, and use that with Canvas
to provide a better Dart API.

When the attribute is present on an IDL interface, the generate Dart code will be a private interface that can extended by custom dart code.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1135283005
2015-05-19 13:59:05 -04:00
John McCutchan
204298278a Suppress unnamed library analyzer spam in shelldb
Revert "Add library names to many sky libraries"

This reverts commit 1337e0a803a54ee92d6dce7f8c4a6335f7cbb9fa.

BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1142893007
2015-05-19 10:25:43 -07:00
John McCutchan
5d3bfd6108 Add library names to many sky libraries
- Analyzer complains about libraries not having names. This adds names to many libraries.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1150433002
2015-05-19 10:19:11 -07:00
Eric Seidel
293563078d Add Canvas.drawPicture
I wrote another copy of paint_element_into_displaylist
using this new technology.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1129353010
2015-05-18 15:13:15 -07:00
Eric Seidel
20459183e4 Make it possible to Paint elements into a display list.
Currently said elements need to be in the DOM and have
already been laid out for this to work, but follow-up patches
will remove these restrictions.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1144673002
2015-05-18 14:49:59 -07:00
Hixie
4c15a9688f [Layout] Put in some guards to prevent us from reintroducing 'display' properties into the CSS.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1132983007
2015-05-15 15:16:25 -07:00
Hixie
d7138735a5 [Effen] fix the stock README to be better markdown.
TBR=eseidel

Review URL: https://codereview.chromium.org/1141013003
2015-05-14 14:41:17 -07:00
Hixie
69c060a06e [Effen] Add a README.txt file that describes how to test Effen using the stock app.
Also includes a link to all the know bugs that affect the stock app.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1145523003
2015-05-14 14:34:45 -07:00
Hixie
2be9ca104b [Effen] Make the stock app use the radio button widget so that it's being tested.
Changes:
- adds a couple of radio buttons to the drawer menu list.
- makes menu items support being tapped and reporting the tap.
- hooks up the checkbox to actually support being checked.
- changes the drawer menu items to make more sense in a stock app.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1137373004
2015-05-14 13:16:35 -07:00
Hixie
156179769d [Effen] Make the drawer not be included in the build output when the drawer is not shown.
This is a prerequisite to dropping 'display:none'.
Included in this CL is making AnimatedValue able to animate more than one field.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1126333006
2015-05-14 09:44:22 -07:00
Matt Perry
769cef59ba Flesh out the Painting API a bit.
This exposes most methods from Skia's C canvas API to Dart. For now, SkRect and
SkMatrix are represented simply as an array of floats, which requires a
conversion at the bindings layer. More complex types like SkPath are still TODO.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1144483002
2015-05-13 17:17:26 -04:00
Eric Seidel
a0609d1f4e Make it possible to custom-paint without an Element.
This adds a new abstract 'Canvas' which is similar to SkCanvas.
PaintContext implements Canvas while still having its
own commit() method to cause the paint actions to apply to
the Element for the next frame.
This adds a new PictureRecorder which also implements Canvas
and has an endRecording() method which returns a Picture
(another new interface) which can be held from Dart.

There is also now a rootPicture setter on Document which takes
a Picture and will then make the Document draw that Picture
until changed.

This piggybacks on the existing custom painting system
which adds the painting at background-and-borders paint
time so technically if you both set rootPicture as well as
construct a DOM you will draw the DOM on top of your picture. :)

R=mpcomplete@chromium.org

Review URL: https://codereview.chromium.org/1122423009
2015-05-13 13:16:47 -07:00
Hixie
09183a7fd1 [Effen] Use the checkbox widget in the stocks app.
- add a checkbox to the stock app, so that we're testing the checkbox widget
  (it's not currently wired up to anything, that can come later)
- make InkSplash use FlexContainer so that we can use flex in the popup menu items
- make effen's Text be more similar to Image and Container, so that it can be styled
- make layout.dart's RenderCSSText correctly support being styled
- also fixes a bug with the stock list where we were rendering one too few a row when scrolling
- check in the code to dump the DOM so I don't have to keep remembering how to do this

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1134163003
2015-05-12 14:39:43 -07:00
Eric Seidel
f32b32343d Rename view-configuration to view_configuration to make analyzer happy.
Analyzer was complaining about '-' not being an allowed character
in dart file names.

R=jamesr@chromium.org
2015-05-04 14:18:19 -07:00
Eric Seidel
d12f84c818 Add pubspec.yaml files for each of the examples/ directories
so that pub get will create a packages/ directory for each
and users of packages/sky/sky_tool can run these examples
from sky_sdk as the instructions say to.

TBR=ianh@google.com
https://github.com/domokit/mojo/issues/128

Review URL: https://codereview.chromium.org/1110283002
2015-04-28 16:26:38 -07:00
Hixie
ab3b684f23 fix 'feeback' typo in stock app in menus
TBR=eseidel

Review URL: https://codereview.chromium.org/1065653009
2015-04-21 14:32:22 -07:00
Hixie
4398883334 [Effen] fix warnings
remove members that are never read
remove imports that are never used

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1099203002
2015-04-21 14:05:28 -07:00
Hixie
ebc879babf [Effen] Prevent scrolling past the bottom of a scrollable list.
- make the ScrollBehavior instance long-lived, rather than recreating
  it each time we update the list contents.
- have OverscrollBehavior track the total height of the contents and
  the height of the scrollable region, so that it can determine when
  to stop scrolling down.
- teach OverscrollBehavior about how to determine when to stop
  scrolling down, and how to bounce when it's too far down.
- replace the 'energy' concept in Particles with a method that sets
  the energy and direction at the same time, instead of assuming that
  the direction is always positive when setting energy.
- make FixedHeightScrollable lists track the number of items in the
  list and have them update their ScrollBehavior regarding this
  information as it changes.
- track how many items are currently showing in the list stock list.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1097373002
2015-04-21 13:20:30 -07:00
Hixie
23283319bc [Effen] Only skip rows we're showing, when skipping past the rows that we've scrolled beyond in the stock list.
Currently, if you then scroll down N items with a filter set, we select which
stock to show by taking the entire list of stocks, skipping the first N, then
filtering the list, then selecting as many stocks as needed to fill the list.

So suppose the list is A, B, Cx, Dx, Ex, F, and the filter is "x", and you've
scrolled down 1 item.

Currently we'd show Cx, Dx, Ex.

Scroll down 1 again.

We still show Cx, Dx, Ex.

What we _should_ show is Dx, Ex if you've scrolled down 1, and just Ex if you've
scrolled two.

This patch fixes this. We now skip rows _after_ filtering. This fixes
the bug whereby if you set a filter then fling the list, we show the
same item over and over as if in a loop.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1057603006
2015-04-20 16:35:49 -07:00
Eric Seidel
38472e4e87 Remove Widgets Demo, it's broken and doesn't provide any value over Stocks App
R=ianh@google.com, ojan@chromium.org

Review URL: https://codereview.chromium.org/1085933002
2015-04-14 14:47:21 -07:00
Eric Seidel
72902ef85b Teach window.location.href setter to handle relative urls.
Also fixed display of text in touch-demo.sky

R=ianh@google.com

Review URL: https://codereview.chromium.org/1059743004
2015-04-14 12:16:51 -07:00
Ojan Vafai
3f0f87ca22 Stop rendering text inside flex boxes.
Text can only only inside paragraphs and inlines. This patch makes it
so we stop putting such text nodes in the render tree at all if their
parent is not a paragraph or an inline.

This is the final step in making it so that we don't create anonymous
renderers, which fixes a crash in the new custom layout code.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1077473002
2015-04-09 11:40:03 -07:00
Eric Seidel
9717a17371 Unbreak widgets_app.dart (by disabling PopupMenu for now)
Also fix button.dart to include ink_well.dart.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1058013003
2015-04-07 11:17:26 -07:00
Ojan Vafai
a03a911e7c Remove all uses of display:block and display:inline-block.
-Make display:flex, flex-direction: column, flex-shrink: 1 the default.
-Simplify StyleAdjuster::adjustStyleForAlignment to remove special cases we
won't need as we make flex the default and remove absolute positioning.
-Fix a bug this exposed in column flexboxes where we'd apply the wrong edge
of border/padding/margin.
-For now leave the default of align-items:stretch. The main change here is
that iframe/img will do width:auto the same as blocks (i.e. the width of
the parent). I think this is a good change, but we'll have to see how it feels
in practice.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1061163002
2015-04-06 16:44:12 -07:00
Hixie
fd14a1d0f2 [Effen] s/Node/UINode/, s/Element/WrapperNode/, s/EventTarget/EventListenerNode/
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1043283003
2015-04-01 09:46:28 -07:00
Adam Barth
362f8193ab Improve Sky READMEs
TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/1037163002
2015-03-26 17:17:34 -07:00
Adam Barth
64d53aa0fa Move terminal example from //sky/examples to //examples
We're trying to clean up the //sky/examples directory to focus on mobile use
cases for the fn framework. Terminal is both focused on desktop and uses the
older custom-element framework.

R=viettrungluu@chromium.org

Review URL: https://codereview.chromium.org/1038813005
2015-03-26 14:53:38 -07:00
Adam Barth
854f083f1b Clean up examples directory
1) Merge input example into widgets example
2) Move single-file, non-fn examples into a "raw" directory
3) Rename stocks-fn and widgets-fn to stocks and widgets

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1005393006
2015-03-26 14:32:40 -07:00
Adam Barth
20a4c66ade Move fakesky.dart from examples to benchmark/resources
It's not really an example of how to use Sky. It's a resource for benchmarking.

TBR=raf@chromium.org

Review URL: https://codereview.chromium.org/1030423002
2015-03-26 14:08:10 -07:00
Adam Barth
52d8ea0c23 Remove flights example
Flights is not longer a good example of something you can build wity Sky.
Restore the flights-app-pixel test and move the assets needed for the test into
the tests directory.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1034953003
2015-03-26 13:28:23 -07:00
Adam Barth
d47ecb8bc5 Menu in StocksApp should dismiss when tapping elsewhere
When the StocksApp menu is showing, the user shouldn't be able to interact with
the rest of the app. Instead, taps outside the menu should dismiss the menu.

This CL makes that happen by adding a ModalOverlay on top of the app. We might
want to do something fancier in the future using event delegation, but this
works for now.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/1031093002
2015-03-25 10:43:35 -07:00
Adam Barth
1718f196c0 Remove the |style| parameter to InkWell
There's no reason for InkWell to take a |style| parameter anymore. Clients can
simply use StyleNode instead.

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/1019443003
2015-03-25 10:41:38 -07:00
Adam Barth
08f2a275ad Menu in StocksApp should animate out
This CL teaches PopupMenu how to animate out as well as in. Also, I've changed
the PopupMenuItem animations to be driven from the PopupMenu itself, which
makes it easier to run the animation in reverse when closing the menu.

TBR=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/1033913002
2015-03-25 10:40:29 -07:00
Adam Barth
0abd3c9ef3 Clean up stock_app.dart
This CL cleans up stock_app.dart to better separate concerns now that we have
StyleNode. Also, this CL introduces IconButton, which will grow to include an
ink effect in the future, and makes the background of the search bar white.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1007893005
2015-03-24 18:00:33 -07:00