925 Commits

Author SHA1 Message Date
John McCutchan
eb2cef413d Port more String and HashMap usages
BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1237973004 .
2015-07-16 07:30:56 -07:00
Chinmay Garde
93006a03d4 Minor sky/engine updates for Mac target
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1241673004 .
2015-07-15 14:11:58 -07:00
John McCutchan
781413c925 Remove some HashMap
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1228353005 .
2015-07-15 13:01:09 -07:00
John McCutchan
7bef123648 Remove #include of RefPtr in dart_state.h
BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1235063005 .
2015-07-15 09:11:23 -07:00
John McCutchan
c60c99bfcb Remove most usage of Vector
BUG=
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1237973002 .
2015-07-15 09:10:40 -07:00
Hixie
64c5420007 Remove Animations and Transitions.
And all related CSS properties.
And page transitions, whatever those are.
And will-change.
And page visibility.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1229273004 .
2015-07-14 15:07:35 -07:00
Hixie
3394d215c5 Provide some debug-mode time hooks to visually debug painting and layout.
There's four hooks: one draws a teal box around the size, one draws a
green line and an orange line at the alphabetic and ideographic
baselines, and one clips at the paintBounds.

I also implemented Rect.shift() and Rect.inflate() to adjust Rects in
various ways that were helpful while developing this.

The baseline logic now lets you ask for the baseline _without_ the
no-baseline adjustment, in case you only care about the baseline when
there is a real one.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1233623007 .
2015-07-14 10:19:29 -07:00
Adam Barth
7249a7f0cc Remove last use of Platform::networkService()
I forgot to remove the virtual function in Platform.h and missed two clients of
this function. This CL switches those clients to keep their own network service.

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

Review URL: https://codereview.chromium.org/1230113006 .
2015-07-14 09:41:48 -07:00
Adam Barth
1a8304ec9a Delete //sky/services/platform
There's no longer any code to share in this library. Instead, inline the one
trival class into both //sky/shell and //services/sky.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1237043002 .
2015-07-14 00:21:34 -07:00
Adam Barth
1949505fc9 Remove //sky/engine/platform/network
This code is all dead. Instead, we use Mojo directly from Dart to access the
network.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1239633002 .
2015-07-13 23:39:48 -07:00
Adam Barth
7ce0501a7e Remove some unneeded DEPS from //sky
We no longer actually need to depend on this code. It's cleaner if we don't
list these dependencies.

TBR=eseidel@google.com

Review URL: https://codereview.chromium.org/1229113003 .
2015-07-13 22:17:23 -07:00
Adam Barth
c64973deb6 AnimatedType should hit |end|
Some clients of AnimatedType watch for the |end| value to complete their work.
This CL ensures that we actually hit the end when t == 1.0.

Also, add a |distance| property to Offset.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1238573002 .
2015-07-13 16:09:39 -07:00
Adam Barth
b3c618b9d8 Roll Skia to 2ced78866fcadd98895777c8dffe92e229775181
The Skia rolls will continue until morale improves.

New version of SkMemory_new_handler.cpp from Chromium.

TBR=chinmaygarde@google.com

Review URL: https://codereview.chromium.org/1235863004 .
2015-07-13 13:20:23 -07:00
Adam Barth
a68126d95d Roll Skia to 7b971f0152299ae9a924252a9bfd220318497bdd
R=chinmaygarde@google.com

Review URL: https://codereview.chromium.org/1236953002 .
2015-07-13 12:54:08 -07:00
Hixie
442c55b4c4 Make the drawer, popup menus, dialogs, and settings page scrollable.
Also, fixes the stocks list to work properly including hit testing at
the bottom of the screen.

New classes:

RenderViewport: a class that supports positioning a child inside
itself and offsetting it.

Viewport: a RenderObjectWrapper that wraps RenderViewport.

ScrollableViewport: a Component that hooks Viewport up to some
scrolling behaviour.

Code changes:

RenderBlock now only works when it has an unbounded height constraint.
I removed the clipping in there since it's no longer needed.

I made FixedHeightScrollable use Viewport instead of hand-rolling its
clipping with Transform and Clip. This is what fixes the stocks list
hit testing at the bottom of the screen.

I made anywhere that used to use Block now use ScrollableViewport.

RenderFlex now takes a list of children.

Justifications for test changes:

tests/examples/stocks: changing FixedHeightScrollable to use a
RenderViewport instead of a RenderClipRect/RenderTransform combination
removes the use of an actual transform.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1223153004 .
2015-07-10 16:54:19 -07:00
Adam Barth
024a5d3a32 Ban dart:mirrors in Sky
We don't use dart:mirrors and we don't want to start because it prevents some
sorts of static analysis.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1233463002 .
2015-07-09 14:07:51 -07:00
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