47 Commits

Author SHA1 Message Date
Hixie
08b7ea3e3d Rationalise the Key API.
Add a way of having keys based on numeric types or DateTimes by having a ValueKey<T> class.
Remove the redundant ways of declaring things, except for leaving one shorthand -- you can say `new Key(s)` instead of `new ValueKey<String>(s)`.
2015-08-28 13:17:34 -07:00
Hixie
71e6f53a57 Replace Flex to Row and Column in tests and examples.
This still leaves Flex and FlexDirection available. At some point once
people have transitioned to Row/Column we should rename Flex to _Flex
and stop reexporting FlexDirection from basic.dart.
2015-08-26 09:05:14 -07:00
Hans Muller
d6756f1900 Removed unneeded tabs.dart import, updated tests 2015-08-25 10:24:58 -07:00
Ian Hickson
15a113207d Merge pull request #762 from Hixie/flex-bug
Reimplement 'stretch' for flexible items correctly.
2015-08-21 20:05:50 -07:00
Adam Barth
f140ec7aff Rename syncFields to syncConstructorArguments 2015-08-21 17:21:42 -07:00
Hixie
1cdfe25958 Reimplement 'stretch' for flexible items correctly.
Fixes #698 to actually work.
Also, adds some debugging aids around Flex.
And a test to check this fix.
2015-08-21 16:47:44 -07:00
Adam Barth
4c50536198 Migrate RenderBox tests to box_test.dart 2015-08-21 10:18:48 -07:00
Adam Barth
643c636f4b Migrate sky/tests/layout to sky/unit/test
Also, I've organized the tests by the render object they're testing.
2015-08-21 10:01:58 -07:00
Adam Barth
68dc5655f1 Migrate some tests to sky/unit/test 2015-08-21 09:13:52 -07:00
Hixie
b0a1649e48 Rewrite the MultiChildRenderObjectWrapper syncing algorithm.
This also changes the way we insert nodes into a
MultiChildRenderObjectWrapper's renderObject, which fixes issue #626.
Now, instead of the slot being a renderObject, it's the Widget that
currently uses that renderObject. That way when the Widget changes
which renderObject to use, the siblings of that Widget in the same
child list don't have to be notified of the change.

I tested performance of the new algorithm vs the old algorithm using
the stocks demo at idle and the stocks demo scrolling steadily. The
data suggests the algorithms are roughly equivalent in performance.
2015-08-20 14:56:04 -07:00
Hixie
b2520e76c4 Fix typo in display_list.dart: _insertChild was renamed to insertChild 2015-08-20 14:51:27 -07:00
Adam Barth
c16e03429c Key should be const
For great constness.

Fixes #693
2015-08-20 09:50:51 -07:00
Hixie
7d9f52479e Improvements for Layers logic
- Introduce some new Layer classes.
- Introduce paintChildWith* methods.
- Convert paint() methods to use paintChildWith* where appropriate.
- Fix paintBounds logic in Layer world.
- Introduce Layer.replaceWith(), so that it's clearer what's going on.
- Make RenderObjects have a ContainerLayer, not a PictureLayer.
- Introduce a PaintingContext.replacingLayer() constructor to highlight
  where we are creating a layer just to replace an older one.
- Rename some layer-related methods and fields for clarity:
   requiresCompositing -> hasLayer
   hasCompositedDescendant -> needsCompositing
   updateCompositing -> updateCompositingBits
   _needsCompositingUpdate -> _needsCompositingBitsUpdate
   markNeedsCompositingUpdate -> markNeedsCompositingBitsUpdate
- After updating compositing bits, if we find that the bit changed, we
  now call markNeedsPaint().
- Reorder markNeedsPaint() logic for clarity.
- Make flushPaint() start at the deepest node.
- Make _compositeChild() avoid repainting children with hasLayer that
  aren't dirty, instead it just reuses their existing layer.
- Made RenderView reuse the RenderObject layer instead of having its own.
- Made RenderView have hasLayer set to true.
- Add various asserts and comments.
2015-08-20 08:57:22 -07:00
Adam Barth
037e1c7155 Split box.dart into many files
Sadly, box.dart has grown much longer than 1000 lines. This patch splits it up
into several files based on the class hierarchy. Fortunately, many of these
classes are loosely coupled to each other.
2015-08-18 20:55:32 -07:00
Adam Barth
760ac40c68 RenderImage should handle the case of a null image
When given a null image, RenderImage should be as small as possible (isntead of
being NaNxNaN).

Also, plumb ImageFit and ImageRepeat through the various image widgets.
2015-08-18 20:05:52 -07:00
Adam Barth
6d38f01e38 Borders on Containers shouldn't overlap the content
This CL inflates the padding of Container to account for the borders so that
the borders are allocated space in the layout and don't draw behind the
Container's child.
2015-08-18 16:10:40 -07:00
Adam Barth
253366cf3d Improve RenderImage constraint solving
We now fold the width and height properties into the constraints and try to
find a size for the image that perserves the image's intrinsict aspect ratio
while fitting within the given constraints.
2015-08-18 15:23:04 -07:00
Hixie
5ceb52a0e1 Port clipping to the new layer world.
- Add Canvas.getSaveCount()
- Make RenderClipRect call context.paintChildWithClip instead of doing the clipping itself
- Make ClipLayer take a Rect instead of a Size
- Make PaintingContext.canvas read-only
- Add PaintingContext.paintChildWithClip()
- Minor rearrangings of code and style tweaks
2015-08-18 08:34:42 -07:00
Adam Barth
1a062aab4e Add a compositing step to the lifecycle
Now we have the ability to draw multiple PictureLayers. We still squash all the
pictures together into a single SkPicture for simplicity. In the future, we'll
submit them to C++ separately and composite them on the GPU thread.
2015-08-13 16:31:45 -07:00
Adam Barth
1ea911f088 Switch painting over to using PictureLayer
Currently we have a single PictureLayer that everyone draws into. A future
patch will teach the system to use multiple PictureLayers.
2015-08-13 14:24:29 -07:00
Adam Barth
fbe12785cc Add PaintingContext which has-a sky.Canvas instead of is-a sky.Canvas
We'll need this for compositing because we need to switch out the sky.Canvas
when we switch compositing layers.
2015-08-13 10:18:33 -07:00
Adam Barth
a1807a1b17 Remove weak handle from sky.Paint
This patch converts sky.Paint to be a pure Dart object, which means we don't
need to open a weak handle to sky.Paint. Avoiding the weak handle reduces the
amount of weak handle callbacks we need to process at the end of GC and
therefore reduces jank.
2015-08-11 09:37:20 -07:00
Hans Muller
48da2ee5ae The IgnorePointer class enables one to cut a widget subtree off from pointer events. This is useful when a sibling should not shield pointer events from overlapping siblings below it.
Added a ScrollListener listener to Scrollable. The ScrollListener runs each time the Scrollable's scrollOffset changes. This can be used to keep overlay widgets in sync with a Scrollable below them.

Removed the Scrollable ScrollClient API. It was no longer used and was clumsy to use as a ScrollListener.

Added global function findScrollableAncestor() to scrollable.dart.

Added examples/widgets/overlay_geometry.dart. The app's Scaffold is contained by a Stack. The Stack is used to display green overlay "Markers" at the corners of the most recently selected list item and where the corresponding tap occurred. The app uses widget.localToGlobal() to compute the global overlay positions of the markers. The ScrollListener is used to keep the markers' positions up to date.
2015-08-11 08:29:30 -07:00
Adam Barth
501bf578bb Fix tests after examples move 2015-08-10 11:17:46 -07:00
Ian Fischer
3c8291a828 Move example out of sky/packages to //examples 2015-08-07 17:04:50 -07:00
Hans Muller
ae950aaefe Prevent double-dismissing of Dismissables, center card_collection under-text 2015-08-05 13:40:28 -07:00
Adam Barth
ad70779dc7 Merge pull request #451 from abarth/fix_hit_testing
Fix RenderViewport's hit testing
2015-08-04 16:03:49 -07:00
Hans Muller
2f759691b2 done 2015-08-04 15:58:33 -07:00
Adam Barth
414a76519a Fix RenderViewport's hit testing
We were subtracting the scrollOffset when we were supposed to add it.
2015-08-04 15:54:51 -07:00
Adam Barth
e18c698625 Rename widgets/widget.dart to widgets/framework.dart
It was confusing to have both widget.dart and widgets.dart
2015-08-04 11:13:33 -07:00
Adam Barth
5f95865831 Support borders with borderRadius
Currently we support only borders with uniform color and width.
2015-07-31 16:03:09 -07:00
Adam Barth
77bc162f7d Stacked does not repaint when its position changes
We were marking the parent *Widget's* render object as needing layout, but
we actually need to walk up the component tree until we find the parent
*RenderObjectWrapper* so we can mark actually mark the parent render object as
needing layout.

Fixes #408
2015-07-31 10:06:44 -07:00
Adam Barth
ed7f08c3f3 Rebaseline test
The new output seems correct.
2015-07-30 14:47:12 -07:00
John McCutchan
c935a663a9 Fix imports 2015-07-30 14:19:10 -07:00
Adam Barth
fad64bb938 RenderStack should handle top, right, bottom, left all being zero
Previously, we didn't set the width of the child correctly when top and bottom
(or left and right) were both specified.

Fixes #275
2015-07-30 10:08:07 -07:00
Adam Barth
f167c43ef0 Move build() off microtasks
Rather than using a microtask to schedule component build functions, instead
use the scheduler. We now tread building just like layout and painting as a
visual update.
2015-07-28 14:05:21 -07:00
Adam Barth
eb8329455a Move sky package into sky/packages/sky
This patch makes the sky package match the structure we've adopted for the
other Dart packages we produce from this repo.
2015-07-28 08:42:57 -07:00
Hans Muller
c9d284f442 Dismissable animation simplifications; added backgrounds to CardCollection cards 2015-07-24 11:15:37 -07:00
Eric Seidel
b57147684e Add insertBefore test which I wrote from Hixie's fuzzer
R=ianh@google.com
2015-07-23 12:15:44 -07:00
Eric Seidel
4e17ceefdb Add support for Canvas.setMatrix and getTotalMatrix
Part of fixing issue #138.

R=abarth@google.com
2015-07-23 11:21:33 -07:00
Adam Barth
c523468e2e Don't try to access the network in Stocks test
Accessing the network created a race condition that would sometimes cause other
tests to fail.
2015-07-23 08:39:42 -07:00
Hixie
383e504f5a Introduce an explicit Key type.
This fixes some theoretical bugs whereby we were using hashCode to try
to get unique keys for objects, but really we wanted object identity.
It also lays the groundwork for a new GlobalKey concept.

I tried to keep the impact on the code minimal, which is why the "Key"
constructor is actually a factory that returns a StringKey. The code
has this class hierarchy:

```
   KeyBase
    |
   Key--------------+---------------+
    |               |               |
   StringKey    ObjectKey       UniqueKey
```

...where the constructors are Key and Key.stringify (StringKey),
Key.fromObjectIdentity (ObjectKey), and Key.unique (UniqueKey).

We could instead of factory methods use regular constructors with the
following hierarchy:

```
   KeyBase
    |
   LocalKey---------+---------------+
    |               |               |
   Key      ObjectIdentityKey   UniqueKey
```

...with constructors Key, Key.stringify, ObjectIdentityKey, and
UniqueKey, but I felt that that was maybe a more confusing hierarchy.
I don't have a strong opinion on this.
2015-07-22 09:14:06 -07:00
Hans Muller
344ee7ccf4 Make it possible to identify BlockViewport children whose size or type has changed 2015-07-20 15:41:21 -07:00
Hixie
6bcc09dbd0 Remove shadow trees and custom elements from sky/engine/.
Remove all code relating to shadow trees, insertion points, shadow
boundaries, traversing composed trees, distribution, template
documents, custom elements, registering elements, element registries,
element factories, shadow roots, etc.

Remove the following features from the IDLs and from the binding
generators: CustomElementCallbacks, Reflect*, EventHandler.

Remove the CSS custom pseudo-element concept, since we no longer have
a UA style sheet worth talking about, no longer have shadow trees or
custom elements, no longer use pseudo-elements, and generally
therefore don't use this code at all.
2015-07-20 13:31:12 -07:00
Adam Barth
7b0dec4d11 Rebaseline stocks test to account for transitions
Also, turn on testing in Travis.
2015-07-17 15:48:10 -07:00
Adam Barth
d909155d67 Refactor Material animation to use AnimatedContainer
The idea is that AnimatedContainer is a drop-in replacement for Container that
provides implicit animations when its properties change.

R=mpcomplete@google.com
2015-07-17 12:23:46 -07:00
Collin Jackson
a64559ab70 After running filter-branch, move root directory into sky/ 2015-07-16 11:54:25 -07:00