2077 Commits

Author SHA1 Message Date
Ian Fischer
c4db2df60f Rename RenderCanvas to PaintingCanvas to avoid confusion with other classes that inherit from RenderObject.
R=ianh@google.com, abarth@google.com

Review URL: https://codereview.chromium.org/1217933002.
2015-06-29 14:19:30 -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
Hixie
6818693903 Fix tests which broke in https://codereview.chromium.org/1216013003.
Actually the tests broke in 136e0d4da5
...but I had reset the results because I had changed all the coordinates, and didn't realise some of the changes were bad.

TBR=abarth

Review URL: https://codereview.chromium.org/1212803003.
2015-06-29 14:04:58 -07:00
Hixie
1d78945cf4 Fix theme changing: turns out we were not reparenting stateful surviving nodes when their parents changed identity
This also makes the optimistic/pessimistic mode switch change the active theme, because why not.

While I was at it I also provided a debug boolean argument to runApp() to make it possible to profile more easily.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1215023002.
2015-06-29 13:56:18 -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
Adam Barth
9062c56136 Make it possible to run a test in sky_shell
This CL makes it possible to run sky/tests/raw/bogus_import.dart in sky_shell
on Linux. We'd eventually like to scale this up to running all the tests.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1218633003.
2015-06-29 10:39:44 -07:00
Eric Seidel
3dd4fc9bb9 Roll Version in preparation for publishing
TBR=abarth@chromium.org

Review URL: https://codereview.chromium.org/1219683005.
2015-06-29 10:32:12 -07:00
Adam Barth
fd9f6f13bf Make rebuilding faster
By profiling mine_digger in a continuous rebuild loop, we observe
Widget#syncChild as being very hot. This CL optimizes this function by making
sure to read each input value exactly once.

Also, the hash operations for _mountedChanged were showing up on the profile,
so this CL makes _mountedChanged into a List, which should work fine.

Together, these changes reduce the amount of time we spend in Navtive code
inside the VM from 29% to 20%.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1217473004.
2015-06-29 10:20:54 -07:00
Hans Muller
ad3fae3931 Add TabNavigator
A simple container for a TabBar. It is defined by a list of
TabNavigatorViews, each of which is just a TabLabel and
the tab's content.

The content of each tab is represented by a function
that produces a Widget called "content". I couldn't
bring myself to call it buildTabContentCallback or something
else more specific.

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

Review URL: https://codereview.chromium.org/1212993003.
2015-06-29 10:03:28 -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
Adam Barth
330f002b9e Update Stocks.apk build tech
Instead of having a one-off //sky/apk/stocks, we now use the |sky_app| GN
template to create Stocks.apk directly from //sky/sdk/example/stocks.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1211883004.
2015-06-27 00:41:27 -07:00
Adam Barth
ce5baf1e9d Move //sky/compositor to //sky/viewer/compositor
This library is logically part of //sky/viewer and shouldn't clutter up the
top-level //sky directory.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1213683004.
2015-06-27 00:26:52 -07:00
Adam Barth
567c659122 Remove sky/benchmarks
These benchmarks are very out-dated. In fact, they're still written in
JavaScript and mostly test the performance of the DOM.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1216823002.
2015-06-27 00:02:10 -07:00
Adam Barth
46363355ba Cleanup sky/sdk/examples
* Remove all the DOM-based examples except for the old stocks app
* Rename stocks2 to stocks
* Promote hello_widgets.dart to a top-level hello_world example

TBR=ianh@google.com

Review URL: https://codereview.chromium.org/1219493003.
2015-06-27 00:00:18 -07:00
Adam Barth
0bc960761a Add MineDigger.apk that works offline
This CL builds an APK for MineDigger that works offline. We use |sky_packager|
to snapshot the Dart code, which we then extract from the APK during startup.
If we succeed in extracting a snapshot, we load it by default.

TBR=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1211253004.
2015-06-26 23:18:13 -07:00
Adam Barth
06adbc9aa6 Move examples to //sky/sdk/example
We're trying to follow the pattern described in https://www.dartlang.org/tools/pub/package-layout.html

TBR=iansf@google.com

Review URL: https://codereview.chromium.org/1210173004.
2015-06-26 22:52:40 -07:00
Hans Muller
dcabb54ad9 Make TabBar conform to the Material spec for icon/text tabs
When both icons and text are specified, the icon goes on top,
10 pixels of margin goes in between, and the TabBar's height
grows to 72.

R=ianh@google.com

Review URL: https://codereview.chromium.org/1213043002.
2015-06-26 16:16:00 -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
Ian Fischer
6ae1de6c46 Move sky/examples to sky/sdk/lib/example, and code changes to support that change. Fixes T277.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1218593002.
2015-06-26 15:06:40 -07:00
Hans Muller
df8f39f2aa Corrected a childCount assert
It's a typo I introduced in https://codereview.chromium.org/1217533002

TBR=ianh

Review URL: https://codereview.chromium.org/1221473002.
2015-06-26 12:57:07 -07:00
Hans Muller
06af2f7d15 Add RenderObject.childCount
R=ianh@google.com

Review URL: https://codereview.chromium.org/1217533002.
2015-06-26 11:17:31 -07:00
Hans Muller
ce7e8260c3 Use Theme to define the colors and TextStyles for Tab, TabBar
Also added a smoke test for examples/widgets/tabs.dart.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1213873002.
2015-06-26 09:30:53 -07:00
Hixie
02d21924c6 Remove the pointless second argument to animate() in AnimatedValue.
- Rename animate() to watch().

- Fix Toggleable to actually be animated (previously, it was
  essentially luck that let it be animated -- it was piggy-backing on
  the splash, I think).

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1216533003.
2015-06-26 09:18:08 -07:00
Hixie
8ad31479da Rename setParentData to setupParentData since it's not a setter per se.
TBR=abarth

Review URL: https://codereview.chromium.org/1208293002.
2015-06-25 17:28:34 -07:00
Hixie
02b651f7d6 Let's hide double.INFINITY a bit more, by providing cleaner APIs for the cases where we're currently trying to use it.
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1209233002.
2015-06-25 17:27:43 -07:00
Hixie
40dc0bdf72 Add a note about sizedByParent's use. One day we should audit our RenderBoxes and see if any of them can have it set; currently only Scaffold uses it.
TBR=abarth

Review URL: https://codereview.chromium.org/1216533002.
2015-06-25 17:17:10 -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
Hixie
54d1cbc0a3 Fix nits in the README.md from abarth's review.
TBR=abarth

Review URL: https://codereview.chromium.org/1204373003.
2015-06-25 15:46:34 -07:00
Hans Muller
0ff3df83ee Version 0 of TabLabel, Tab, and TabBar components
There's is no support for animating the selected tab indicator, there isn't a TabNavigator container yet, overflow layout (tabs don't fit) isn't supported yet, etc.

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

Review URL: https://codereview.chromium.org/1205953002.
2015-06-25 14:25:33 -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
Collin Jackson
6c205c6a67 Implement ClipRRect
R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1206373002.
2015-06-25 13:32:25 -07:00
Viktor Lidholt
75b4ffb1be Adds support for rotated textures
Adds documentation to Texture and SpriteSheet

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1212073002.
2015-06-25 13:13:33 -07:00
Hixie
d40425e838 Fill out some more documentation about building RenderBox subclasses.
TBR=collin,hansmuller

Review URL: https://codereview.chromium.org/1211573003.
2015-06-25 12:25:39 -07:00
Hixie
c4501f2202 Give rationale for style guide, suggest using more concise code when doing so doesn't harm readability.
TBR=abarth

Review URL: https://codereview.chromium.org/1209003002.
2015-06-25 10:13:56 -07:00
Carlos Pizano
81f74478d6 fix minedigger win bug
Win was not being detected.

BUG=none
R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1209823002.
2015-06-24 18:14:51 -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
Viet-Trung Luu
29ae65d27f Don't use base::WorkerPool in the asset_bundle app.
WorkerPools can't be shut down, which means that the app's .so can't be
unloaded (which is bad for single process mode, and which is probably
why the asset bundle tests are flakily crashing on the try bots).

So use a SequencedWorkerPool instead (even though we don't care about
sequencing).

R=eseidel@chromium.org, kulakowski@chromium.org, abarth@chromium.org
BUG=Fixes #268

Review URL: https://codereview.chromium.org/1206673006.
2015-06-24 15:24:01 -07:00
Carlos Pizano
27936d2543 sky home update
-replace UINode for Widget
-add the minedigger demo
-fix spelling of astroids

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

Review URL: https://codereview.chromium.org/1203923006.
2015-06-24 13:43:59 -07:00
Hixie
a2ba25d0ba Add support for line-height in TextStyle.
Also, some minor cleanup in TextStyle to make it more readable.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1203253002.
2015-06-24 13:25:17 -07:00
Hixie
66fd8e7343 Minor optimisations and cleanup to the text rendering stuff.
R=eseidel@chromium.org, eseidel

Review URL: https://codereview.chromium.org/1210653002.
2015-06-24 12:37:07 -07:00
Hixie
1263707b19 Fix baseline example (missed merge with Ian's new graphics APIs).
TBR=iansf

Review URL: https://codereview.chromium.org/1201383005.
2015-06-24 11:33:54 -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
e716cc358c Updating with a link to the iOS build instructions 2015-06-24 10:58:41 -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