610 Commits

Author SHA1 Message Date
Zachary Anderson
d83427c165 Dart: Removes all but native calls and the handle watcher from the snapshot.
The bindings, core, and application libraries are now referred to as, e.g.:

package:mojo/public/dart/core.dart

Since the handle watcher remains in the snapshot, it no
longer refers to types defined in core.dart. References to types defined
in core.dart are also removed from mojo_natives.cc.

In Dart packaged apps, the SDK is zipped up under mojo/public/dart.

For embedder tests, the SDK is copied into the generated source output directory.

A base_dir parameter is added to the 'dart_package' and 'mojom' GN macros so that
consumers of the Mojo SDK can all import using the same URIs regardless of where
the SDK lives in their source trees.

BUG=
R=erg@chromium.org

Review URL: https://codereview.chromium.org/1027603002
2015-03-23 11:04:03 -07:00
Adam Barth
e26810b1de Add more tracing to Sky
This CL adds trace events:

1) Between requesting a frame and begin frame.
2) In the DartLoader see network latency.
3) While executing |main| and |_init|.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1025073003
2015-03-20 16:11:39 -07:00
Adam Barth
43ebba749b Add more trace events to Sky
These will help us better understand what's happening.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1027913002
2015-03-20 15:07:24 -07:00
Adam Barth
f8b3596df6 Use StyleNode in StockMenu
StockMenu was creating a container for the sole purpose of applying style to
PopupMenu. Now we just use a StyleNode.

Also, I've reverted the change to make box-sizing default to border-box. It
turns out that CL wasn't effective because we didn't use the initialBoxSizing
function to initialize box sizing. I've made us use initialBoxSizing but switch
the default back to content-box because actually using border-box breaks a
bunch of stuff.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1024083003
2015-03-20 10:16:24 -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
6a794823bc Remove pauseAnimationsForTesting
This code is unused and it hooks into the DocumentLifecycle in sketchy ways.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1020053002
2015-03-19 19:32:03 -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
97abc0dadd Improve Material ink effects
1) Factors InkWell out of Material so that components can use an ink well
   without needing the shadow/level machinery.

2) Makes the ink effect move at a different velocity once the tap has actually
   occurred, converging with the spec. We don't have the right speeds yet, but
   at least we're approaching the right shape.

3) To support (2), added a primaryPointer attribute to GestureEvents to let
   authors coorelate gesturetapdown events with later gesturetap events.

4) To support (2), modernized SplashAnimation to used AnimatedValue and friends.

5) Added more constants to view-configuration.dart that match Android.

I've also removed the cancelling of the ink effect on scroll. The proper way to
do that is to notice that someone in the event chain is listening for
scrollstart and delay the beginning of the ink effect for some period of time.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1019023003
2015-03-19 11:17:48 -07:00
Adam Barth
953145ba63 Default box-sizing to border-box
content-box is crazy banana-pants.

R=ojan@chromium.org

Review URL: https://codereview.chromium.org/1015253002
2015-03-19 10:55:03 -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
5968e0308a Fix hit-testing in the stocks apps when scrolled.
We were not passing the transformed HitTestLocation when we recursed
into child layers, which meant that we wouldn't take transforms
correctly into account when hit testing.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1019723002
2015-03-18 18:55:54 -07:00
Eric Seidel
8ad5f14611 Currently we use package: to mean "/gen", which is not at all how
Dart actually expects package: to work.  This CL makes package:foo
map to /packages/foo, similar to how Dartium or bin/dart would expect.

This also means overlaying the /gen directory over the actual package
outputs (as consumers of an SDK would expect) as well as adding
an additional /lib indirection for the actual package source as
the Dart pub tool will expect.

This is far from perfect, but it unlocks us actually producing a
sky SDK.

I expect there may be some fallout from this change as I'm sure I
missed some package: uses.  We also don't have a general solution
for all /foo/bar/baz includes which randomly included parts
of mojo's source directory.  Those will need to be updated to use
a package: and deploy_sdk.py taught how to build a package for them.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/990493002
2015-03-13 16:58:53 -07:00
Ojan Vafai
a0c612c89b Fix hit-testing of elements with the same z-index.
hit-testing needs to walk in backwards order from paint.
The previous attempt at reverse sorting by z-index didn't
reverse things with the same z-index. Instead, forward
sort the same way as we do with paint and then reverse
the whole vector.

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

Review URL: https://codereview.chromium.org/986793002
2015-03-06 15:53:02 -08:00
Eric Seidel
e3a8059796 Fix all dartanalyzer errors in dart:sky except the Native ones.
I also fixed all warnings. :)

This is the only error remaining:
[error] Native functions can only be declared in the SDK and code
that is loaded through native extensions

My understanding is that we need to do something similar to:
https://codereview.chromium.org/950063002/
in order to work around the 'native' issue.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/981733009
2015-03-05 13:36:48 -08:00
Ojan Vafai
76f01e9f0e Some minor cleanup to RenderLayerClipper.
-Remove AbsoluteClipRects. It's never used.
-Inline some static functions. In the process,
noticed that the clip rects for CSS clip are broken.
In theory, this patch fixes that, but I didn't test it
since we probably want to just remove the feature anyways.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/964723004
2015-03-02 15:26:47 -08:00
Ojan Vafai
2fa3e52b6d Make removing a transform not crash.
This broke with https://codereview.chromium.org/965013003.
Before that patch, updateTransform was only called on the
RenderLayer itself. Now it's called on the RenderBox,
so we need to null check the RenderLayer.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/969893002
2015-03-02 14:37:12 -08:00
Adam Barth
ff51816b5a Images don't appear when they finish loading
RenderImage needs to notify its base class unconditionally so that it will
schedule a visual update.

This broke in https://codereview.chromium.org/791023006.

R=ojan@chromium.org
BUG=https://github.com/domokit/mojo/issues/55

Review URL: https://codereview.chromium.org/969863002
2015-03-02 13:03:36 -08:00
Ojan Vafai
ece11cc9ed Remove unused foregroundRect argument to RenderLayerClipper::calculateRects.
The only thing that uses it is RenderTreeAsText.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/964023002
2015-03-02 12:10:05 -08:00
Ojan Vafai
f01bea301b Move transforms from RenderLayer to RenderBox.
This is more member data on RenderLayer that is now only
used by RenderBox.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/965013003
2015-02-27 17:18:07 -08:00
Adam Barth
b3b8d8cf1a Implement shake-to-reload
Apps can import this library if they wish to reload on shake.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/963303004
2015-02-27 15:31:11 -08:00
Adam Barth
e8b988e226 Expose Android sensors to via Mojo services
This CL adds a sensor_service to sky/services and wires it into SkyShell
The plan is to eventually use this data to implement shake-to-refresh.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/962043002
2015-02-27 14:37:50 -08:00
Ojan Vafai
ef1b30faf7 Move FilterEffectRenderer out of RenderLayer into RenderBox.
It doesn't do anything RenderLayer specific anymore. This
does mean adding another pointer to RenderBox. We might want
to do something about that eventually, but for now it seems fine
to make forward progress in terms of getting rid of the RenderLayer
tree.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/963253002
2015-02-27 13:42:29 -08: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
f36e7b49db Assorted cleanup of RenderLayer.
-Move perspectiveOrigin to RenderBox. It's only used in
one place and called on a RenderBox.
-Inline some methods that were just calling out to the renderer.
-Inline updateStackingNode() into the constructor and remove
the branch since requiresStackingNode is always true.
-Delete a bunch of dead code.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/961053002
2015-02-26 13:07:20 -08:00
Eric Seidel
a3eeb2263c Fix multi-touch to work in SkyShell.
Before this patch it crashed.

Also updated the touch-demo to support multi-touch.

R=abarth@chromium.org
BUG=

Review URL: https://codereview.chromium.org/961483004
2015-02-26 12:23:18 -08:00
Ojan Vafai
ba092f1cd5 Remove dead code from RenderLayer and inline filter methods.
Inline a couple methods that are only called from one place
and remove a bunch of dead code.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/961553003
2015-02-26 11:04:53 -08:00
Ojan Vafai
cec128f499 Remove some dead RenderLayer code.
-m_hasSelfPaintingLayerDescendant is never read.
-remove showLayerTree. The layer tree is going away. We won't need this.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/952343003
2015-02-25 15:48:59 -08:00
Eric Seidel
3d09314b22 Make WebView::close not crash and start to fix navigation in SkyShell
However WebView::close() no longer crashes.  close() is never called
in MojoShell since mojo can't shutdown yet.

I tried closing the existing WebView and replacing it
but somehow that caused it to only draw red.  After a while
of looking at this with abarth we decided to just load into
the same WebView for now.

Eventually we should do something smarter where we start the
provisional load and only replace the webview once the new one is
ready, but that's a later CL.

R=abarth@chromium.org
BUG=

Review URL: https://codereview.chromium.org/952273003
2015-02-25 15:25:17 -08:00
Zachary Anderson
b3b197fcf8 Dart: Renames dart:mojo_blah -> mojo:blah
This improves consistency with the convention that the dart: scheme is
only for things from the Dart standard library.

BUG=
R=erg@chromium.org

Review URL: https://codereview.chromium.org/951783004
2015-02-25 14:29:41 -08:00
Ojan Vafai
78691e3c21 Inline RenderLayer::beginTransparencyLayers into RenderBox::paintLayerContents.
This is the only remaining caller.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/954913002
2015-02-24 20:59:01 -08:00
Ojan Vafai
82ab56a89b Remove some dead filters related code.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/943333005
2015-02-24 20:45:53 -08:00
Ojan Vafai
5a5460c54e Fix clipping of content outside the bounds of the window.
https://codereview.chromium.org/899753003 incorrectly passed down the
RenderView's clipping rect all the down through transforms instead of
using the one from the LayerPaintingInfo, which is adjusted for transforms
as you recurse down the tree.

TBR=abarth@chromium.org

Review URL: https://codereview.chromium.org/957643002
2015-02-24 20:40:10 -08:00
Ojan Vafai
0be786f62c Simplify and reduce calls to beginTransparencyLayers.
-Consolidate the beginTransparencyLayers calls. The call
on layer()->parent() was just not needed as best I can tell
and the filter one could just be shared with the non-filter
codepath. FWIW, blink has already made a similar set of changes.
-Don't walk up the tree calling beginTransparencyLayer.
We're doing this in a recursive call down, so we've already
created the transparency layer for any transparent ancestors.
-Remove unused TransparencyClipBoxMode argument.
-Inline the paintingExtent method.
-Removed unused REVEAL_TRANSPARENCY_LAYERS #define.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/959543002
2015-02-24 17:29:00 -08:00
Ojan Vafai
c885cea0f7 Cleanup transform-related methods in RenderLayer.
-Get rid of paintsWithTransform.
-Remove currentTransform. It was only ever called with
IncludeTransformOrigin and on non-null transforms.
-Remove renderableTransform. It was only called on
non-null transforms.
-Remove a layer()->parent() branch. The ASSERT had been
added in a previous patch, but the branch wasn't removed.
-Inline makeMatrixRenderable. It was only called in one
place.
-Add a test to make sure that transform origin is corrrectly
excluded from the transform computedStyle.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/958463002
2015-02-24 14:31:48 -08:00
Rafael Weinstein
3ed20172df Fix tracing for Document::updateRenderTree
R=abarth@chromium.org, abarth
BUG=

Review URL: https://codereview.chromium.org/949313002
2015-02-24 12:15:40 -08:00
Rafael Weinstein
e53bba60a5 Add dart_invoke to tonic for calls into App code.
This patch adds utility functions which provide a single choke point for calling into sky application code. For now this is only serving the purpose of having a common trace event for calls into app code.

R=abarth@chromium.org, abarth
BUG=

Review URL: https://codereview.chromium.org/941153003
2015-02-24 12:11:19 -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
Ojan Vafai
c93e7093c1 Never layer-ize RenderInlines.
This removes support for opacity, filters and clip-path
on RenderInlines. If you want inline content that uses
these properties you need to use an inline-block. We
may want to add back support for opacity or filters
on inlines eventually, but we'd implement it differently
and right now they're getting in the way.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/950963003
2015-02-23 16:40:15 -08:00
Scott Violet
15d7cd9b47 Gets HTMLIFrameElement::embedViewManagerClient to work with dart
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/948943002
2015-02-23 15:29:22 -08:00
Adam Barth
b6f511c6a9 Port Sky widgets demo to Dart
This CL updates sky-box, sky-button, sky-checkbox, sky-input, and sky-radio to
work in Dart. We don't have a data binding system yet, so there's a bit more
plumbing in the code.

This CL adds support for sky-element@attributes, which lets you specify which
attributes your element supports. We use this information to synthesize getters
and setters for those attributes and to dispatch to mumbleChanged methods when
the attributes change.

I've also wrapped the widgets demo itself in a sky-scrollable so the whole
thing scrolls.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/946813005
2015-02-23 08:30:36 -08:00
Adam Barth
fe31fd0e4c Port sky-scrollable to Dart
This CL ports sky-scrollable to the new sky-element.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/950603002
2015-02-21 09:56:22 -08:00
Adam Barth
085b988e6a Make it possible for sky-element to register any tag name
... instead of hard-coding "example".

We do this by adding a custom constructor for Element that gets the |tagName|
property off the instance.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/943153002
2015-02-21 08:02:32 -08:00
Adam Barth
16db84fde1 Add a basic sky-element custom element
After this CL, you can use <sky-element> to describe custom elements. The
current iteration is very basic and is hardcoded to "example", but its a start.

This CL renames the |init| function to |_init| to prevent importers from
calling it directly. Also, we now pass the <script> element to |_init| to give
some context.

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

Review URL: https://codereview.chromium.org/950493003
2015-02-20 21:45:36 -08:00
Ojan Vafai
a267c39c01 Remove the concept of staticly positioned absolutes.
On the web, if you set position:absolute, but not
top/right/bottom/left, then the absolute goes where it
would have gone if it wasn't positioned. The use-cases for
this are slim and it introduces a lot of complexity to the
engine.

Also changes behavior in the presence of direction:rtl.
On the web, direction:rtl and top/left:auto would
sometimes set right:0. Instead we always position at
0,0 if the opposing values are auto.

This removes the code for this positioning and allows
simplifying a bunch of dirty bit handling code since
we don't need to setNeedsLayout if lines move around
or wrap differently.

The test cases did change their output, but the new
positioning all looks correct to me.

Review URL: https://codereview.chromium.org/944073006
2015-02-20 20:26:59 -08:00
Ojan Vafai
0c37a8a322 Fix painting of position:absolute inside display: paragraphs.
We only need to walk the immediate children of the paragraph.
The other inline children of the paragraph will get paint called
on them and they will then appropriately add the self painting
layers to the array inside their paint calls.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/945223002
2015-02-20 20:24:57 -08:00
Ojan Vafai
788bb15b3b Address TODOs in the new layer painting and hit testing.
-ASSERT(layer()->parent()) in all the transform codepaths since
the RenderView cannot have a transform.
-Early return if the content rect does not intersect the
damage rect in the painting code. We don't need to do
any of the filter and/or transparency dance if we're
not going to paint anything. This also allowed for
removing the shouldPaintContent bool.
-Remove a random style() null check that can't be hit.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/950553002
2015-02-20 18:19:29 -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