167 Commits

Author SHA1 Message Date
Ian Fischer
1799eacef5 Decouple Canvas from DisplayList and map Picture and PictureRecorder more directly to their Skia counterparts.
Also changes the framework dart code to use the
refactored APIs and fixes the various examples and
tests.

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

Review URL: https://codereview.chromium.org/1190123003.
2015-06-24 10:21:45 -07:00
Adam Barth
fa627b4b0e Factor DartLibraryProvider out of DartLoader
This CL factors the network interactions out of DartLoader into a
DartLibraryProvider interface, paving the way for other library providers
(e.g., offline).

As part of this CL, I've renamed DartLoader to DartLibraryLoader and moved the
class into tonic, where it can't have any direct network dependencies.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1202283004.
2015-06-24 09:32:22 -07:00
Adam Barth
1f258f383e Add support for snapshot loading to Sky
This CL adds the ability to load Dart snapshot files created by sky_packager in
Sky. Using a snapshot lets us transmit all the code for an app in a single blob
and should improve startup time. Later CLs will make this codepath easier to
use and evaluate performance.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1197133004.
2015-06-23 18:40:01 -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
Matt Perry
d745bd3d47 Sky: Add a DartConverterEnum and use that for all our enum needs.
R=abarth@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/1170963003.
2015-06-09 15:58:54 -04: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
Matt Perry
aa80a91279 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
Matt Perry
7382a261aa Change the way we provide custom dart code for IDL bindings.
Rather than appending the custom Foo.dart code to the end of the generated
interface, we now copy it to a CustomFoo.dart file in the output directory.
This allows us to declare it as a proper dependency.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1171743002
2015-06-08 17:26:51 -04:00
Matt Perry
edd0d6e16a 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
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
Collin Jackson
18ab61e1ee Use an enum for Dart bindings for Skia Paint style
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1171543002
2015-06-05 10:12:45 -07:00
Matt Perry
485523560f 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
Matt Perry
e68fe5d33e 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
4f2d78a5bb 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
2ff84ffe5f 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
ffed692545 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
326e2324c9 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
5afac54a8b 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
Matt Perry
fb8596730c 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
Matt Perry
eaba0b981f Add DartHandleCache and use it to cache strings used when converting Rect and
Point classes.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1145103005
2015-05-28 13:39:33 -04:00
Adam Barth
ae7e807f61 Flesh out Rect/Point/Size classes in dart:sky
R=mpcomplete@chromium.org

Review URL: https://codereview.chromium.org/1152213003
2015-05-28 09:42:17 -07:00
Matt Perry
1a07d29d7e 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
Matt Perry
4139325e2c 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
922ea790b8 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
2f510d9f8c 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
Adam Barth
b7c3f545f0 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
Matt Perry
4c5aee62cd Sky: different tack for custom Rect type in the Canvas API.
Rect is now a dart-only type, defined in its own .dart file. I use
DartConverter when passing a Rect into C++. I also special-cased Rect in the
IDL compiler so that it's passed by value, instead of allocating a new
Rect object on the heap.

This also adds a mechanism to add custom .dart files to dart_sky.dart - used by
Rect.dart.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1151673002
2015-05-20 17:58:38 -04:00
Adam Barth
67109ce3e1 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
Adam Barth
9f8b9bb96d 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
Eric Seidel
1eb17996fb 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
John McCutchan
76da439f44 Add Observatory to sky dart_controller
- Bump Dart and Observatory DEPS to 45576 and 45565 respectively.
- Include 'dart:io' in snapshot
- Add 'dart:io' native bindings to sky bindings.
- Initialize 'dart:io' in sky dart_controller.
- Include Observatory and service isolate resources in build.
- Bring up service isolate.
- Start handle watcher isolate from service isolate (hides handle watcher isolate from debugger and Observatory).
- Hook up debugger.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1107803002
2015-05-06 15:36:12 -07:00
Eric Seidel
9cdf9ad09f remove CSS quotes property
The support was gone, this is just dead code.

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

Review URL: https://codereview.chromium.org/1070263002
2015-04-09 14:22:29 -07:00
Eric Seidel
afaac6ec79 Remove our impressive amount of CSS Cursor code.
With this gone, cursors will no longer change
on hover when running Sky on a desktop.

Then again the iGeneration doesn't
probably even know what a mouse is, let alone
have a burning desire to set a CSS3 custom-cursor.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1076623002
2015-04-08 14:23:13 -07:00
Ojan Vafai
b9df2edb7d Delete RenderBlockFlow.
We only ever create RenderParagraphs now. The only non-trivial change here
is making RenderView a RenderFlexibleBox. This required changing custom.sky.
That test was written in a fragile way that behaved differently if we
did multiple layouts. Instead, having it be less racy and only change
values during the test itself.

This also throws a wrench in moving all the layout code to dart
because we can't set the layout manager on the RenderView. Maybe
we need to explicitly let you do so.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1068683002
2015-04-07 16:59:36 -07:00
Ojan Vafai
ef34102c3b Revert "Revert "First iteration on custom layout.""
This reverts commit 44cf3b689cda2632fa649e2cd3fdbfcb7174f352.
https://codereview.chromium.org/1060443002 fixes the cause
of the test breakage.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1055243002
2015-04-02 15:17:10 -07:00
Benjamin Lerman
f1ee3cc379 Revert "First iteration on custom layout."
This reverts commit 4223122b79f5f7740bb2957138d14a63a2cea8d2.

This breaks sky tests.

TBR=ojan@chromium.org

Review URL: https://codereview.chromium.org/1051713007
2015-04-02 10:38:03 +02:00
Ojan Vafai
aecc73f1f5 First iteration on custom layout.
This allows setting x/y/width/height directly on an element
during a synchronous layout callback. At the moment, you can do
dangerous things (e.g. change tree structure). In a followup patch
we'll make that impossible via an IDL guard.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1023753007
2015-04-01 19:16:29 -07:00
Adam Barth
0dd797975c Remove <canvas>
Folks should use custom paint instead (see sky/engine/core/painting for a
sketch).

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1001913003
2015-03-25 16:15:05 -07:00
Adam Barth
f3df64fa3d Let Dart code running in Sky add events to the trace timeline
This will let us form a wholistic picture of work done in the framework and in
the engine.

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

Review URL: https://codereview.chromium.org/1028243003
2015-03-23 14:48:06 -07:00
Adam Barth
510cddef63 Integrate custom paint with the DocumentLifecycle
Instead of running paint requests during microtasks, we run them after updating
layout for the current frame. After draining all the paint requests, we then
drain whatever commits are available.

It's still possible that requestPaint callbacks can dirty style and layout
information, so we need to clean that information after servicing the requests.
Ideally we'd block these callbacks from dirtying style or layout information.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1027563002
2015-03-19 21:58:14 -07:00
Adam Barth
81233b6df9 Add a basic custom painting facility to Sky
This CL adds just enough custom painting to Sky to make
sky/examples/painting/circle.sky draw a circle. Over time, we should be able to
elaborate this system into something interesting and to make it actually work
in a reasonable way.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1017593005
2015-03-19 16:00:21 -07:00
Adam Barth
4d43305993 Introduce PaintingContext, which will be used for custom painting
This CL is a first step towards custom paint. It introduces a class that can
draw a circle into an SkPicture. Future CLs will wire the SkPicture into the
render tree and expose this object to script.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1017373003
2015-03-19 10:54:43 -07:00
Ojan Vafai
4b60c28783 Simplify RenderLayer's handling of filters.
-Remove RenderLayerFilterInfo. It was just a static map for
FilterEffectRenderers. Instead, put the FilterEffectRenderer
directly on RenderLayer.
-Make FilterEffectRenderer not be RefCounted. This involved
deleting a ton of dead code around ReferenceFilters since they
were the other subclass of Filter. As best I can tell,
reference filters are already don't parse in Sky, so this should
just be removing dead code.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/962543003
2015-02-26 15:38:14 -08:00
Ojan Vafai
920920310e Delete RenderLayerModelObject.
Merge most of it into RenderBox. Only RenderBoxes can have
layers now. This also meant a bit of code could be cleaned up
since some virtuals (e.g. updateFromStyle) are no longer needed
since they're only called on RenderBoxes.

collectSelfPaintingLayers is the only bit that's moved into
RenderBoxModelObject instead of RenderBox. That's because we
need to be able to recurse down into RenderInlines since they
may contain RenderBoxes that have selfPaintingLayers.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/953673002
2015-02-23 17:24:38 -08:00
Adam Barth
73b76dcca9 Rename Sky's custom2 to custom
We've removed the old implementation of custom elements. We can move the new
implementation into the proper place and give the classes their proper name.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/946083003
2015-02-20 17:35:47 -08:00
Adam Barth
dd5a9c9831 Delete sky/engine/core/dom/custom
This code is unused now that we have sky/engine/core/dom/custom2 working.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/950523002
2015-02-20 17:12:54 -08:00
Adam Barth
7d00bd5e06 Implement Custom Elements
This CL implements custom elements. The design is as follows:

1) Authors subclass Element and call registerElement.
2) When we create C++ elements for custom elements, we call the author's
   constructor synchronously.
3) The attach/detach/attributeChanged callbacks are called either:
   a) when exiting the current custom element callback scoped (e.g., before
      returning from appendChild), or
   b) when draining the microtask queue.

The implementation in this CL is a bit fragile because we don't detect name
registration conflicts and we let you create custom elements with the same name
as built-in elements. Also, not every part of the engine is prepared to execute
script synchronously below createElement. We'll need to iron out these issues
over time, but this CL is a start.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/943013002
2015-02-20 16:15:42 -08:00
Ojan Vafai
8ba8641a1d Remove LayoutState.
The only bit that was still used was the
containingBlockLogicalWidthChanged check in
RenderBlock::widthAvailableToChildrenHasChanged.
a4f1e657ff
is the patch that added that code. I added a
test to confirm we still pass the test case
that code was added for.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/945003002
2015-02-20 14:02:42 -08:00
Adam Barth
e89f321945 Remove CustomEvent from Sky
There's no point in CustomEvent anymore because authors can just subclass Event
themselves.

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

Review URL: https://codereview.chromium.org/941243002
2015-02-19 23:24:05 -08:00
Adam Barth
dff66fb1b7 Remove the concept of document.documentElement
Now documents can have many element children, all created equal.

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

Review URL: https://codereview.chromium.org/928393003
2015-02-17 16:20:07 -08:00