909 Commits

Author SHA1 Message Date
Hixie
9bf06b6c1b Add a function to Offset to get a new offset that is the old offset translated by some given values.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1229783002 .
2015-07-08 17:55:10 -07:00
Ian Fischer
b286f72509 Make rendering use PaintingNodes for increased efficiency.
WIP -- need to update some tests at the least.

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

Review URL: https://codereview.chromium.org/1216833003 .
2015-07-08 15:08:20 -07:00
Adam Barth
c9edc0acb3 Remove GC prolog and epilog
We don't need these anymore.

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

Review URL: https://codereview.chromium.org/1226773009 .
2015-07-07 15:41:13 -07:00
Eric Seidel
63cefd8bc1 Use sky_shell instead of mojo_shell for testing.
This does way more than a single CL should do, sorry.
- Fixed a bunch of logging/error reporting during loads.
- Made it possible for --package-root to be absolute.
- Fixed (hypothetically) parts of iOS build to be clang-plugin-compliant.
- Made all tests pass in sky_shell
- Removed a bunch of layout_tests including windows support.

I'll remove all the mojo test harness stuff in a follow-up patch.

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

Review URL: https://codereview.chromium.org/1215953006.
2015-07-06 17:45:49 -07:00
Adam Barth
749bd906db Set the default whitespace mode to pre-wrap
This CL makes it easier to insert line breaks into text runs.

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

Review URL: https://codereview.chromium.org/1221913003.
2015-07-06 15:44:54 -07:00
Adam Barth
8031ab6bd7 Add padding values to View.idl
Rather than hardcoding the size and presence of the notification area in Dart,
we now expose padding values on the view. These values are set to non-zero
values when there are UI elements that overlap the view. We currently respect
only the top padding, but this CL paves the way to respect padding in other
directions.

We still hardcode the size of the notification area in Java. A future CL will
retrieve this value from the Android framework.

Fixes #257

R=ianh@google.com

Review URL: https://codereview.chromium.org/1220353002.
2015-07-06 10:56:02 -07:00
Adam Barth
a090303909 Rename scheduleFrame/setBeginFrameCallback
These are now scheduleFrame/setFrameCallback. Also, update schduler.dart to not
poke at sky.window, which is now always null.

Fixes #178

R=ianh@google.com

Review URL: https://codereview.chromium.org/1214943005.
2015-07-06 09:56:56 -07:00
Adam Barth
2aaf77dc2e Remove sky/engine/platform/clipboard
No one references this code anymore.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1219833007.
2015-07-05 21:49:17 -07:00
Adam Barth
0e12b4d42c Delete sky/engine/core/fetch
No one references this code anymore.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1223793006.
2015-07-05 21:00:45 -07:00
Adam Barth
0e7ec746f9 Remove references into sky/engine/core/fetch
This CL removes all references to sky/engine/core/fetch from outside that
directory. All these references appear to be dead code. Also, remove a few
"loader" classes that were also dead code.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1214513003.
2015-07-05 20:03:45 -07:00
Adam Barth
df78625631 Remove support for loading remote font faces
This CL removes the ability to load remote font faces using CSS. This CL is
part of a series to remove the network dependency from Sky engine. We'll likely
add the ability to load custom fonts in the future, but we'll base the API on
mojo::DataPipe, similar to how we load images over mojo::DataPipes today.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1223843003.
2015-07-05 16:03:18 -07:00
Adam Barth
3dcd43c615 Remove RenderImage
This CL removes RenderImage and all the other remaining uses of ImageResource
from sky/engine/core/rendering.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1228463002.
2015-07-05 14:35:40 -07:00
Adam Barth
1a42846ab6 Remove CSS clients of ImageResource
This CL is part of a series to remove the network dependency from Sky Engine.
This CL removes the clients of ImageResource in sky/engine/core/css.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1214633005.
2015-07-05 13:19:32 -07:00
Adam Barth
05c71d86aa Remove sky/engine/core/app
This code is unused.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1223783002.
2015-07-05 13:19:03 -07:00
Adam Barth
ec1f327121 Stocks.apk should have icons when run offline
This CL adds the concept of a root asset bundle to Sky. If the Sky app was
launched from a bundle, the root bundle is that bundle.

This CL teaches icon.dart to default to loading icons out of the root bundle,
if a root bundle exists. The next result is that Stocks has icons when run
offline because the icons are present in stock's skyx bundle.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1208273003.
2015-07-02 13:47:13 -07:00
Adam Barth
36930f7ab7 Remove two unused functions from dart:sky.internals
These functions used to support testing, but they're no longer used by any
tests now that we've deleted the DOM-based world.

Really we should merge dart:sky.internals into dart:sky, but that's a CL for
another day.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1221163002.
2015-07-02 13:09:41 -07:00
Matt Perry
08fce0e905 Baby steps towards an odeon-like animation system. First victim: Drawer.
This introduces an AnimationPerformance class, which is intended to manage an
animation (or its reverse), with the ability to manually control the timeline
or to apply a force to advance the animation with a diminishing speed.

I'm having trouble fitting the odeon model to Sky. Odeon has a lot of nice
properties, but fundamentally operates on UINodes, which contain all the
properties to be animated. Sky, on the other hand, has no such universal
properties. Instead, each Widget assembles itself how it sees fit.

So my current plan is to let AnimationPerformance own a generic set of
AnimatedVariables. You pass it a bag of things, say position and opacity, as
AnimatedVariables. It updates them based on the animation, and they each have
a way to build a widget based on their current state.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1211603003.
2015-07-01 16:38:20 -04:00
Adam Barth
f3410b4f51 Factor dart_init.cc out of dart_controller.cc
Also, remove the non-SkyView client of DartController to simplify the code
further.

R=chinmaygarde@google.com

Review URL: https://codereview.chromium.org/1210253005.
2015-07-01 10:54:03 -07:00
Adam Barth
c4dfe5c4ba Remove dead code from DartController
This code existed to service WebView, which no longer exists.

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

Review URL: https://codereview.chromium.org/1209033016.
2015-07-01 09:34:19 -07:00
Adam Barth
bcf33bc66b Add missing build dependencies
These dependencies will trigger a "gn check" violation in a future version of
gn.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1218173003.
2015-07-01 08:28:52 -07:00
Adam Barth
141b20d8a7 Remove remaining HTML elements
This CL also removes the HTML parser and the HTML import system.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1215103007.
2015-06-30 21:30:46 -07:00
Adam Barth
e4f70d536a Remove (almost all of) //sky/engine/web
This layer is no longer needed now that the new world is gone.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1210153009.
2015-06-30 20:14:20 -07:00
Adam Barth
826956d14d Remove the ability to load ".sky" files
Please use ".dart" files instead.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1222483002.
2015-06-30 14:48:32 -07:00
Hixie
998895d9b8 Random cleanup of various Dart things in our tree.
I ran this and fixed some of the warnings flagged:
cd ~/dev/mojo/src/sky && find engine/core/painting sdk/example sdk/lib -type f -name '*.dart' | perl -nE 'chomp; local $/ = undef; open(FILE, $_); my $file = <FILE>; print $file; next if $file =~ /^part of/om; say "import \"$_\";"' > all.dart && shelldb analyze all.dart 2>&1 | grep -v 'sky/all.dart'

Then I loaded the affected examples and fixed any bugs I found from running them.

Major change to SDK:

- Fix RenderPadding to get a valid size when it has no child (it was
  previously sizing itself too small by the padding amount).

Minor changes, mostly to examples:

- Fix the 'part of' lines in sky_shell_dart_controller_service_isolate
  to match the library name given in main.dart.

- Remove unused imports in various places.

- Fix example/game/lib/texture.dart to use the new Rect creation APIs.

- Remove unused code in example/mine_digger/lib/main.dart.

- Fix example/raw/hello_world.dart to use the new Size.center API.

- Fix example/rendering/baseline.dart and
  example/rendering/justify_content.dart to have readable text.

- Fix compile error in example/rendering/transform.dart.

- Extend the debugDoesMeetConstraints() method to print useful
  information when it will be used to fire an assert.

- Remove a warning about abstract methods on RenderView that would for
  some reason only sometimes get flagged by the analyzer.

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

Review URL: https://codereview.chromium.org/1215163003.
2015-06-30 12:03:50 -07:00
Ian Fischer
8dd65afbdf Add APIs for dynamic display lists, using SkDrawable and SkPictureRecorder::endRecordingAsDrawable.
R=abarth@chromium.org, abarth@google.com, ianh@google.com

Review URL: https://codereview.chromium.org/1221583003.
2015-06-29 17:23:51 -07:00
Collin Jackson
ef6ebb7e76 Support for background images on cards, style demo home
R=ianh@google.com, abarth, hixie

Review URL: https://codereview.chromium.org/1217623002.
2015-06-29 16:22:22 -07:00
Adam Barth
8633179599 Don't crash when decoding an invalid handle
We shouldn't try to drain a data pipe when we have an invalid handle. Instead,
we should just call the callback with |null|, like we do for decoding failures.

R=jackson@google.com, jackson@chromium.org

Review URL: https://codereview.chromium.org/1213313002.
2015-06-29 14:07:06 -07:00
Ian Fischer
de574c7442 Set the default text color to white
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1215893002.
2015-06-29 13:33:43 -07:00
Hixie
4919c94b4e Fix the floating action button.
Turns out I had misimplemented Rect.center.

While I was here, I also implemented Rect.width and Rect.height (to
help avoid making that mistake again), and copied shortestSide from
Side to Rect so that we can avoid having to allocate a Size to get the
shortest side from a Rect.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1216013003.
2015-06-29 13:07:10 -07:00
Hixie
6ed5b43877 Instead of applying a transform for every RenderObject, pass down an Offset for where to paint.
This should be a perf win, but I haven't tested it.

Also adds an operator overloading such that Offset + Size -> Rect.
Also adds Rect.fromLTWH().

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1209413004.
2015-06-29 09:07:13 -07:00
Hixie
fa70eb0982 Split Size into Size and Offset.
Added a OffsetBase class that Size now inherits from, and added a new
Offset class that also inherits from OffsetBase.

Offset has:
 - dx and dy members
 - zero and infinite static constants
 - a method that returns a new Offset that's the existing one scaled
   by a scalar
 - a unary minus operator
 - operators overloads such that subtracting or adding two Offsets
   gives another Offset
 - a toPoint() method

Added Offset and Size to the dart bindings, so they can be used from C++.

Changed the Canvas API to use Point, Size, and Offset where appropriate:
 - drawLine uses Points now
 - drawCircle uses a Point now
 - drawImage uses a Paint now
 - the constructor uses a Size

Changed Point as follows:
 - added a unary minus
 - Point difference now gives an Offset rather than a Size
 - You can add an Offset to a Point to get a new Point
 - toSize() has been replaced by toOffset()

Changed Rect as follows:
 - renamed upperLeft and lowerRight to topLeft and bottomRight for
   consistency with our other APIs
 - added bottomLeft and topRight for completeness

Changed Size as follows:
 - now inherits from OffsetBase
 - added *, /, ~/, and % operators for scaling sizes
 - subtracting a Size from a Size gives an Offset
 - subtracting an Offset from a Size gives a Size
 - changed the + operator to take an Offset instead of a Size
 - added topLeft, bottomLeft, topRight, bottomRight to match Rect
 - added center for the same reason
 - added shortestSide getter since that was a common pattern
 - removed toPoint()

Changed DrawLooperLayerInfo as follows:
 - setOffset member takes an Offset instead of a Point

Changed BoxConstraints as follows:
 - added biggest getter since it was a common pattern
 - added smallest getter for symmetry

Changed BoxShadow as follows:
 - offset member is an Offset rather than a Size

Changed ViewConstraints as follows:
 - replaced height and width members by a single size member

I did some minor code cleanup in nearby files while I was there,
including sorting sky/engine/core/core.gni alphabetically, and fixing
some warnings in the examples.

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

Review URL: https://codereview.chromium.org/1214833004.
2015-06-26 15:21:29 -07:00
Adam Barth
570cfb6299 Support snapshots in sky_shell (again)
Unbreak support for snapshots now that we have our offline Dart loader. Also,
wire up support for snapshots in sky_shell on Linux.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1212623002.
2015-06-25 17:10:35 -07:00
Hixie
28643e2cf4 Add asserts to catch potential misuses of the rendering framework.
New asserts:
- verify that after layout, the size fits the constraints
- verify that after layout, the size isn't infinite
- verify that you don't set the size in performLayout() if you have
  sizedByParent set
- verify that nobody reads your size during layout except you, or your
  parent if they said parentUsesSize:true

Fixes some bugs found by those asserts:
- RenderBlock, RenderStack, and RenderScaffold were not always setting
  parentUsesSize correctly
- RenderScaffold was setting its slot entries to null rather than
  removing them when the slot went away, which led to null derefs in
  certain circumstances

Also, rename a local variable in RenderStack.performLayout() because
it was shadowing a variable on the object itself, which was really
confusing when I first tried to debug this function...

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1213473003.
2015-06-25 17:08:06 -07:00
Adam Barth
1a1ef489ee Make it possible to run Sky apps offline
This CL makes it possible to run Sky apps offline by introducing new
DartLibraryProvider subclasses, specifically one that can load directly from
the file system. A future CL will expand this functionality to work with asset
bundles as well.

Currently, the only platform that uses this functionality is Linux, which can
now load a simple Sky app without even loading a network stack. Making this
work on other platforms is work for future CLs.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1203143004.
2015-06-25 13:59:22 -07:00
Hixie
41c3e58e27 Use the baseline information exposed by C++ to pipe baseline data through RenderBox.
This also fixes the C++ side to give the right baseline information.
Previously it was giving the baseline distance for the font, but not
for the actual laid-out text.

I considered also providing a "defaultBaseline" accessor that returns
the distance for the actual dominant baseline, but it turns out right
now we never decide the baseline is ideographic. We always use the
alphabetic baseline. We should probably fix that...

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1200233002.
2015-06-24 17:01:14 -07:00
Hixie
dca45e1890 Expose baseline information in the Sky API.
R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1208483002.
2015-06-24 11:24:45 -07:00
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
d8d7db82a0 Really remove config.h
This CL generated by |sed -i '/sky\/engine\/config.h/d'| and a manual sweep to
catch some oddballs.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1206763002.
2015-06-23 23:15:28 -07:00
Adam Barth
3843749afc Remove config.h
This CL removes all the content from config.h. It doesn't actually delete the
file. I'll make that change in a separate CL.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1205793002.
2015-06-23 22:53:38 -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
Viktor Lidholt
c89c751937 Adds basic sprite sheet support to sprites
Adds drawImageRect to Canvas bindings

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1204783003.
2015-06-23 16:38:28 -07:00
Adam Barth
d0f60bc3f5 Move internals.dart out of Sky SDK
This file doesn't belong in the SDK because it is an implementation detail of
the Sky engine. Instead, this CL moves the code for dart:sky.internals into the
snapshot. This CL is a step towards merging dart:sky.internals with dart:sky,
which also resides in the snapshot.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1200953007.
2015-06-23 07:44:28 -07:00
Adam Barth
50a92ad78a Remove support for "mojo:" libraries
We ended up using "dart:" instead. This change shouldn't have any observable
effects.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1192743011.
2015-06-23 07:42:28 -07:00
Hixie
203c588b5e Make wavy underlines go all the way to the end of the inline.
Previously, the wavy underline code only knew how to draw a complete
period.

This change adds the ability to draw a partial period of the wave.

Previously, the code tried, but failed, for reasons I cannot
determine, to fit the width of the inline by extending the period to
be an integral factor of the width.

This is bad because as you type text, the underline wave of earlier
characters would jiggle.

This fixes that by not changing the period of the wave when the length changes.

It's interesting to compare this to the previous code. Here's a test
that shows this in Safari/Chrome:

   http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=3543

Notice how as you type "i"s, the underline changes how far it extends
(obviously a bug) but also what the period of the wave is (which looks
especially ugly when typing).

Firefox, on the other hand, renders something that isn't actually a
wave; it's a saw-tooth pattern with straight lines between each
direction change. This works for small font sizes at low densities,
but is not great on modern screens.

This CL addresses this issue by computing the bezier curve control
points for the curve that consists of just the remaining fraction of
the period. To do this, however, it allocates an object and solves a
bezier for x (which includes a numerical integration), which is
certainly a performance concern. Apps that try to wavy-underline an
entire UI are going to maybe suffer. Since this is typically going to
be used for spelling checkers, it means people who spell better will
have better performance.

(I haven't tested this to see what the perf impact actually is. If
it's actually bad, we can probably cache the results of the
integration pretty trivially.)

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1189403005.
2015-06-22 15:43:06 -07:00
Hixie
d91c808341 Placeholder for sky/engine/README.md.
TBR=eseidel

Review URL: https://codereview.chromium.org/1198323003.
2015-06-22 13:36:43 -07:00
John McCutchan
e855c0e1bc Add Observatory mojo_shell hearbeat test
Fix HTTP requests

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1191253005.
2015-06-22 13:27:35 -07:00
Hixie
a12d43dc58 Turn on wavy underlines. The waves aren't very pretty yet (they are too short somehow), I'll fix that in a subsequent CL.
I abstracted out the wavy underline code so that it doesn't duplicate the code for horizontal and vertical lines.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1201503003.
2015-06-19 16:11:18 -07:00
John McCutchan
0043e2abf8 Roll dart forward
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1199483004.
2015-06-19 13:23:29 -07:00
Adam Barth
fd4527dd4a Don't crash if you call document.createText(null)
Fixes #165.

R=jackson@google.com, jackson@chromium.org

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