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 .
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 .
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 .
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.
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#257R=ianh@google.com
Review URL: https://codereview.chromium.org/1220353002.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.