From 730a49b98d8ad10d1506e91efcc7c6fccdcec0aa Mon Sep 17 00:00:00 2001 From: Hixie Date: Fri, 10 Jul 2015 16:54:19 -0700 Subject: [PATCH] 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 . --- .../tests/examples/stocks-expected.txt | 20 ++------ .../flutter/tests/widgets/dialog-expected.txt | 46 ++++++++++++------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/engine/src/flutter/tests/examples/stocks-expected.txt b/engine/src/flutter/tests/examples/stocks-expected.txt index cd1b989590..f3c4e70f73 100644 --- a/engine/src/flutter/tests/examples/stocks-expected.txt +++ b/engine/src/flutter/tests/examples/stocks-expected.txt @@ -60,18 +60,12 @@ PAINT FOR FRAME #2 ---------------------------------------------- 2 | | | | | drawRect(Rect.fromLTRB(0.0, 104.0, 800.0, 600.0), Paint(color:Color(0xfffafafa))) 2 | | | | | paintChild RenderSizeObserver at Point(0.0, 104.0) 2 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | paintChild RenderClipRect at Point(0.0, 104.0) +2 | | | | | | paintChild RenderViewport at Point(0.0, 104.0) 2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 2 | | | | | | | save 2 | | | | | | | clipRect(Rect.fromLTRB(0.0, 104.0, 800.0, 600.0)) -2 | | | | | | | paintChild RenderTransform at Point(0.0, 104.0) +2 | | | | | | | paintChild RenderBlock at Point(0.0, 104.0) 2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | save -2 | | | | | | | | translate(0.0, 104.0) -2 | | | | | | | | concat([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]) -2 | | | | | | | | paintChild RenderBlock at Point(0.0, 0.0) -2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | restore 2 | | | | | | | restore 2 | | | paintChild RenderDecoratedBox at Point(0.0, 0.0) 2 | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 @@ -176,18 +170,12 @@ PAINT FOR FRAME #3 ---------------------------------------------- 3 | | | | | drawRect(Rect.fromLTRB(0.0, 104.0, 800.0, 600.0), Paint(color:Color(0xfffafafa))) 3 | | | | | paintChild RenderSizeObserver at Point(0.0, 104.0) 3 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -3 | | | | | | paintChild RenderClipRect at Point(0.0, 104.0) +3 | | | | | | paintChild RenderViewport at Point(0.0, 104.0) 3 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 3 | | | | | | | save 3 | | | | | | | clipRect(Rect.fromLTRB(0.0, 104.0, 800.0, 600.0)) -3 | | | | | | | paintChild RenderTransform at Point(0.0, 104.0) +3 | | | | | | | paintChild RenderBlock at Point(0.0, 104.0) 3 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -3 | | | | | | | | save -3 | | | | | | | | translate(0.0, 104.0) -3 | | | | | | | | concat([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]) -3 | | | | | | | | paintChild RenderBlock at Point(0.0, 0.0) -3 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -3 | | | | | | | | restore 3 | | | | | | | restore 3 | | | paintChild RenderDecoratedBox at Point(0.0, 0.0) 3 | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 diff --git a/engine/src/flutter/tests/widgets/dialog-expected.txt b/engine/src/flutter/tests/widgets/dialog-expected.txt index 6c9fa1fc25..b2a7d73c83 100644 --- a/engine/src/flutter/tests/widgets/dialog-expected.txt +++ b/engine/src/flutter/tests/widgets/dialog-expected.txt @@ -24,25 +24,37 @@ PAINT FOR FRAME #2 ---------------------------------------------- 2 | | | | | | drawRRect(Instance of 'RRect', Paint(color:Color(0xffffffff), drawLooper:true)) 2 | | | | | | paintChild RenderShrinkWrapWidth at Point(260.0, 218.0) 2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | paintChild RenderBlock at Point(260.0, 218.0) +2 | | | | | | | paintChild RenderDecoratedBox at Point(260.0, 218.0) 2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | paintChild RenderPadding at Point(260.0, 218.0) +2 | | | | | | | | drawRect(Rect.fromLTRB(260.0, 218.0, 540.0, 382.0), Paint(color:Color(0xfffafafa))) +2 | | | | | | | | paintChild RenderSizeObserver at Point(260.0, 218.0) 2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | paintChild RenderParagraph at Point(284.0, 242.0) +2 | | | | | | | | | paintChild RenderViewport at Point(260.0, 218.0) 2 | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | | translate(284.0, 242.0) -2 | | | | | | | | | | translate(-284.0, -242.0) -2 | | | | | | | | paintChild RenderPadding at Point(260.0, 270.0) -2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | paintChild RenderParagraph at Point(284.0, 290.0) -2 | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | | translate(284.0, 290.0) -2 | | | | | | | | | | translate(-284.0, -290.0) -2 | | | | | | | | paintChild RenderFlex at Point(260.0, 362.0) -2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | paintChild RenderParagraph at Point(411.0, 362.0) -2 | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | | translate(411.0, 362.0) -2 | | | | | | | | | | translate(-411.0, -362.0) +2 | | | | | | | | | | save +2 | | | | | | | | | | clipRect(Rect.fromLTRB(260.0, 218.0, 540.0, 382.0)) +2 | | | | | | | | | | paintChild RenderSizeObserver at Point(260.0, 218.0) +2 | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | paintChild RenderBlock at Point(260.0, 218.0) +2 | | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | | paintChild RenderPadding at Point(260.0, 218.0) +2 | | | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | | | paintChild RenderParagraph at Point(284.0, 242.0) +2 | | | | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | | | | translate(284.0, 242.0) +2 | | | | | | | | | | | | | | translate(-284.0, -242.0) +2 | | | | | | | | | | | | paintChild RenderPadding at Point(260.0, 270.0) +2 | | | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | | | paintChild RenderParagraph at Point(284.0, 290.0) +2 | | | | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | | | | translate(284.0, 290.0) +2 | | | | | | | | | | | | | | translate(-284.0, -290.0) +2 | | | | | | | | | | | | paintChild RenderFlex at Point(260.0, 362.0) +2 | | | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | | | paintChild RenderParagraph at Point(411.0, 362.0) +2 | | | | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | | | | translate(411.0, 362.0) +2 | | | | | | | | | | | | | | translate(-411.0, -362.0) +2 | | | | | | | | | | restore ------------------------------------------------------------------------ PAINTED 2 FRAMES