If there are no other gestures in the arena, we should kick off the scroll
gesture right away. This change pulled a refactoring of how we dispatch events
to Widgets. Now we dispatch events to Widgets interleaved with their associated
RenderObjects. (Previously we dispatched to all of the RenderObjects first.)
Previously, if you used a layout callback, you could not have a parent
that did parentUsesSize, or if you did, you had to be marked
sizedByParent. With this patch, we allow the parent to depend on your
layout, even if you modify your child list during your layout using a
layout callback, by checking that the parent is still actively being
laid out in this scenario.
This patch is the first step towards implementing gestures. The pointer router
allows the gesture detectors to hook in at the end of the pointer event
propagation chain.
Related to #145
The core of MultiChildRenderObjectWrapper.syncRenderObject() could
apply to any subclass that uses a flat child list, so this abstracts
it out into the superclass.
(Also, instead of requiring the callbacks of RenderBlockViewport to
constrain their results, we just constrain it for them. Makes things a
bit easier for users of that class.)
- add debugDescribeSettings to a few classes that were missing it
- fix some minor bugs in RenderShrinkWrapWidth and ShrinkWrapWidth
- introduce RenderShrinkWrapHeight and ShrinkWrapHeight
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.
When we start, we might not have initialized the devicePixelRatio value. The
value will be initialized by the time we paint, so now we update the value
every time we paint.
We still use SkPicture as our rasterization backend, but now we're uploading
our layer tree to C++. A future patch will push the layer tree deeper into the
system and we'll eventually switch backends.
- Catch exceptions closer to the source.
- Factor out exception printing code.
- Have widget library hand the rendering library some context when syncing RenderObjectWrappers to aid with debugging.
- Fix a bug in flex.dart whereby _overflow was compared when null.
When laying out positioned children inside a stack, we should give them
unbounded constraints because if they draw outside of the stack, we'll just
clip them.
- 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.
Similar to widgets.dart, rendering.dart exports the entire rendering layer.
Also, update the examples to use rendering.dart and widgets.dart. Also clean up
some exports so that the examples have more sensible imports.
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.
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.
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.
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.
These properties should apply to foreground images as well as background
images. Also, rename these types from BackgroundFit and BackgroundRepeat
because they apply to things other than backgrounds.
- 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
Widgets that want to receive drops should include a DropTarget in their build.
Currently there's no widget for initiating a drag. Components can use the
DragController directly. In the future, we'll probably want to add a Draggable
that knows how to do some of this work automatically.
Fixes#612
We need to compute whether a RenderObject has a composited descendant so that
we can decide whether to use canvas.saveLayer or to create a new composited
layer while walking down the tree during painting.
The compositing update walks the tree from the root only to places where the
tree's structure has been mutated. In the common case during an animation loop,
we won't need to visit any render object beyond the root.
Separating these notions makes them easier to work with because offset is
relative to the parent layer whereas size is intrinsic to the layer itself.
This patch fixes the underpainting bugs when compositing the stocks example.
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.