From e9138bc20cdb4daed1b25f8a0378a12e9a9c655d Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Mon, 6 Jul 2015 10:23:31 -0700 Subject: [PATCH] Scrollable TabBar Version 0 TODO: - Make fling-scrolling work - Tune scrolling performance - When a tab is selected, snap it to the center if possible R=abarth@chromium.org Review URL: https://codereview.chromium.org/1221673006. --- .../tests/examples/stocks-expected.txt | 70 +++++---- .../flutter/tests/examples/tabs-expected.txt | 140 +++++++++++------- 2 files changed, 132 insertions(+), 78 deletions(-) diff --git a/engine/src/flutter/tests/examples/stocks-expected.txt b/engine/src/flutter/tests/examples/stocks-expected.txt index 52d64de6b1..9787c1b1d0 100644 --- a/engine/src/flutter/tests/examples/stocks-expected.txt +++ b/engine/src/flutter/tests/examples/stocks-expected.txt @@ -12,24 +12,33 @@ PAINT FOR FRAME #2 ---------------------------------------------- 2 | | | TestPaintingCanvas() constructor: 800.0 x 600.0 2 | | | paintChild RenderFlex at Point(0.0, 81.0) 2 | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | paintChild RenderTabBar at Point(0.0, 81.0) +2 | | | | paintChild RenderDecoratedBox at Point(0.0, 81.0) 2 | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | drawRect(Rect.fromLTRB(0.0, 81.0, 800.0, 129.0), Paint(color:Color(0xff9c27b0))) -2 | | | | | paintChild RenderInkWell at Point(0.0, 81.0) +2 | | | | | drawRect(Rect.fromLTRB(0.0, 81.0, 800.0, 129.0), Paint(color:Color(0xfffafafa))) +2 | | | | | save +2 | | | | | translate(0.0, 81.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 | | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 800.0, 48.0), Paint(color:Color(0xff9c27b0))) +2 | | | | | paintChild RenderInkWell at Point(0.0, 0.0) 2 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | paintChild RenderOpacity at Point(174.5, 97.0) +2 | | | | | | paintChild RenderPositionedBox at Point(12.0, 0.0) 2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | translate(174.5, 97.0) -2 | | | | | | | translate(-174.5, -97.0) -2 | | | | | drawRect(Rect.fromLTRB(0.0, 127.0, 400.0, 129.0), Paint(color:Color(0xffff5252))) -2 | | | | | paintChild RenderInkWell at Point(400.0, 81.0) +2 | | | | | | | paintChild RenderOpacity at Point(171.0, 14.0) +2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | translate(171.0, 14.0) +2 | | | | | | | | translate(-171.0, -14.0) +2 | | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 400.0, 48.0), Paint(color:Color(0xffff5252))) +2 | | | | | paintChild RenderInkWell at Point(400.0, 0.0) 2 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | paintChild RenderOpacity at Point(562.0, 97.0) +2 | | | | | | paintChild RenderPositionedBox at Point(412.0, 0.0) 2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) -2 | | | | | | | translate(562.0, 97.0) -2 | | | | | | | translate(-562.0, -97.0) -2 | | | | | | | restore +2 | | | | | | | paintChild RenderOpacity at Point(560.0, 14.0) +2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) +2 | | | | | | | | translate(560.0, 14.0) +2 | | | | | | | | translate(-560.0, -14.0) +2 | | | | | | | | restore +2 | | | | | restore 2 | | | | paintChild RenderDecoratedBox at Point(0.0, 129.0) 2 | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 2 | | | | | drawRect(Rect.fromLTRB(0.0, 129.0, 800.0, 600.0), Paint(color:Color(0xfffafafa))) @@ -83,24 +92,33 @@ PAINT FOR FRAME #3 ---------------------------------------------- 3 | | | TestPaintingCanvas() constructor: 800.0 x 600.0 3 | | | paintChild RenderFlex at Point(0.0, 81.0) 3 | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -3 | | | | paintChild RenderTabBar at Point(0.0, 81.0) +3 | | | | paintChild RenderDecoratedBox at Point(0.0, 81.0) 3 | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -3 | | | | | drawRect(Rect.fromLTRB(0.0, 81.0, 800.0, 129.0), Paint(color:Color(0xff9c27b0))) -3 | | | | | paintChild RenderInkWell at Point(0.0, 81.0) +3 | | | | | drawRect(Rect.fromLTRB(0.0, 81.0, 800.0, 129.0), Paint(color:Color(0xfffafafa))) +3 | | | | | save +3 | | | | | translate(0.0, 81.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 | | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 800.0, 48.0), Paint(color:Color(0xff9c27b0))) +3 | | | | | paintChild RenderInkWell at Point(0.0, 0.0) 3 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -3 | | | | | | paintChild RenderOpacity at Point(174.5, 97.0) +3 | | | | | | paintChild RenderPositionedBox at Point(12.0, 0.0) 3 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -3 | | | | | | | translate(174.5, 97.0) -3 | | | | | | | translate(-174.5, -97.0) -3 | | | | | drawRect(Rect.fromLTRB(0.0, 127.0, 400.0, 129.0), Paint(color:Color(0xffff5252))) -3 | | | | | paintChild RenderInkWell at Point(400.0, 81.0) +3 | | | | | | | paintChild RenderOpacity at Point(171.0, 14.0) +3 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +3 | | | | | | | | translate(171.0, 14.0) +3 | | | | | | | | translate(-171.0, -14.0) +3 | | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 400.0, 48.0), Paint(color:Color(0xffff5252))) +3 | | | | | paintChild RenderInkWell at Point(400.0, 0.0) 3 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -3 | | | | | | paintChild RenderOpacity at Point(562.0, 97.0) +3 | | | | | | paintChild RenderPositionedBox at Point(412.0, 0.0) 3 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -3 | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) -3 | | | | | | | translate(562.0, 97.0) -3 | | | | | | | translate(-562.0, -97.0) -3 | | | | | | | restore +3 | | | | | | | paintChild RenderOpacity at Point(560.0, 14.0) +3 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +3 | | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) +3 | | | | | | | | translate(560.0, 14.0) +3 | | | | | | | | translate(-560.0, -14.0) +3 | | | | | | | | restore +3 | | | | | restore 3 | | | | paintChild RenderDecoratedBox at Point(0.0, 129.0) 3 | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 3 | | | | | drawRect(Rect.fromLTRB(0.0, 129.0, 800.0, 600.0), Paint(color:Color(0xfffafafa))) diff --git a/engine/src/flutter/tests/examples/tabs-expected.txt b/engine/src/flutter/tests/examples/tabs-expected.txt index f8b71d62b6..f53969a27d 100644 --- a/engine/src/flutter/tests/examples/tabs-expected.txt +++ b/engine/src/flutter/tests/examples/tabs-expected.txt @@ -10,32 +10,53 @@ PAINT FOR FRAME #2 ---------------------------------------------- 2 | | TestPaintingCanvas() constructor: 800.0 x 600.0 2 | | paintChild RenderFlex at Point(0.0, 81.0) 2 | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | paintChild RenderTabBar at Point(0.0, 81.0) +2 | | | paintChild RenderDecoratedBox at Point(0.0, 81.0) 2 | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | drawRect(Rect.fromLTRB(0.0, 81.0, 800.0, 129.0), Paint(color:Color(0xff2196f3))) -2 | | | | paintChild RenderInkWell at Point(0.0, 81.0) +2 | | | | drawRect(Rect.fromLTRB(0.0, 81.0, 800.0, 129.0), Paint(color:Color(0xfffafafa))) +2 | | | | save +2 | | | | translate(0.0, 81.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 | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 800.0, 48.0), Paint(color:Color(0xff2196f3))) +2 | | | | paintChild RenderInkWell at Point(0.0, 0.0) 2 | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | paintChild RenderOpacity at Point(115.33333333333334, 97.0) +2 | | | | | paintChild RenderPositionedBox at Point(12.0, 0.0) 2 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | translate(115.33333333333334, 97.0) -2 | | | | | | translate(-115.33333333333334, -97.0) -2 | | | | drawRect(Rect.fromLTRB(0.0, 127.0, 266.6666564941406, 129.0), Paint(color:Color(0xff2196f3))) -2 | | | | paintChild RenderInkWell at Point(266.6666666666667, 81.0) +2 | | | | | | paintChild RenderOpacity at Point(82.0, 14.0) +2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | translate(82.0, 14.0) +2 | | | | | | | translate(-82.0, -14.0) +2 | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 200.0, 48.0), Paint(color:Color(0xff2196f3))) +2 | | | | paintChild RenderInkWell at Point(200.0, 0.0) 2 | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | paintChild RenderOpacity at Point(377.5, 97.0) +2 | | | | | paintChild RenderPositionedBox at Point(212.0, 0.0) 2 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) -2 | | | | | | translate(377.5, 97.0) -2 | | | | | | translate(-377.5, -97.0) -2 | | | | | | restore -2 | | | | paintChild RenderInkWell at Point(533.3333333333334, 81.0) +2 | | | | | | paintChild RenderOpacity at Point(277.5, 14.0) +2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) +2 | | | | | | | translate(277.5, 14.0) +2 | | | | | | | translate(-277.5, -14.0) +2 | | | | | | | restore +2 | | | | paintChild RenderInkWell at Point(400.0, 0.0) 2 | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | paintChild RenderOpacity at Point(646.6666666666667, 97.0) +2 | | | | | paintChild RenderPositionedBox at Point(412.0, 0.0) 2 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) -2 | | | | | | translate(646.6666666666667, 97.0) -2 | | | | | | translate(-646.6666666666667, -97.0) -2 | | | | | | restore +2 | | | | | | paintChild RenderOpacity at Point(480.0, 14.0) +2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) +2 | | | | | | | translate(480.0, 14.0) +2 | | | | | | | translate(-480.0, -14.0) +2 | | | | | | | restore +2 | | | | paintChild RenderInkWell at Point(600.0, 0.0) +2 | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | paintChild RenderPositionedBox at Point(612.0, 0.0) +2 | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | paintChild RenderOpacity at Point(672.0, 14.0) +2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) +2 | | | | | | | translate(672.0, 14.0) +2 | | | | | | | translate(-672.0, -14.0) +2 | | | | | | | restore +2 | | | | restore 2 | | | paintChild RenderDecoratedBox at Point(0.0, 129.0) 2 | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 2 | | | | drawRect(Rect.fromLTRB(0.0, 129.0, 800.0, 600.0), Paint(color:Color(0xffe3f2fd))) @@ -46,46 +67,61 @@ PAINT FOR FRAME #2 ---------------------------------------------- 2 | | | | | | drawRRect(Instance of 'RRect', Paint(color:Color(0xffffffff), drawLooper:true)) 2 | | | | | | saveLayer(Rect.fromLTRB(16.0, 145.0, 784.0, 584.0), Paint(color:Color(0xff000000))) 2 | | | | | | clipRRect() -2 | | | | | | paintChild RenderTabBar at Point(16.0, 145.0) +2 | | | | | | paintChild RenderFlex at Point(24.0, 153.0) 2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | drawRect(Rect.fromLTRB(16.0, 145.0, 784.0, 193.0), Paint(color:Color(0xff2196f3))) -2 | | | | | | | paintChild RenderInkWell at Point(16.0, 145.0) +2 | | | | | | | paintChild RenderDecoratedBox at Point(24.0, 153.0) 2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | paintChild RenderOpacity at Point(96.5, 159.0) +2 | | | | | | | | drawRect(Rect.fromLTRB(24.0, 153.0, 776.0, 201.0), Paint(color:Color(0xfffafafa))) +2 | | | | | | | | save +2 | | | | | | | | translate(24.0, 153.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 | | | | | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 752.0, 48.0), Paint(color:Color(0xff2196f3))) +2 | | | | | | | | paintChild RenderInkWell at Point(0.0, 0.0) 2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | translate(96.5, 159.0) -2 | | | | | | | | | translate(-96.5, -159.0) -2 | | | | | | | drawRect(Rect.fromLTRB(16.0, 191.0, 208.0, 193.0), Paint(color:Color(0xff2196f3))) -2 | | | | | | | paintChild RenderInkWell at Point(208.0, 145.0) -2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | paintChild RenderOpacity at Point(287.0, 159.0) +2 | | | | | | | | | paintChild RenderPositionedBox at Point(12.0, 0.0) +2 | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | paintChild RenderOpacity at Point(78.5, 14.0) +2 | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | translate(78.5, 14.0) +2 | | | | | | | | | | | translate(-78.5, -14.0) +2 | | | | | | | | drawRect(Rect.fromLTRB(0.0, 46.0, 188.0, 48.0), Paint(color:Color(0xff2196f3))) +2 | | | | | | | | paintChild RenderInkWell at Point(188.0, 0.0) 2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) -2 | | | | | | | | | translate(287.0, 159.0) -2 | | | | | | | | | translate(-287.0, -159.0) -2 | | | | | | | | | restore -2 | | | | | | | paintChild RenderInkWell at Point(400.0, 145.0) -2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | paintChild RenderOpacity at Point(478.0, 159.0) +2 | | | | | | | | | paintChild RenderPositionedBox at Point(200.0, 0.0) +2 | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | paintChild RenderOpacity at Point(265.0, 14.0) +2 | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) +2 | | | | | | | | | | | translate(265.0, 14.0) +2 | | | | | | | | | | | translate(-265.0, -14.0) +2 | | | | | | | | | | | restore +2 | | | | | | | | paintChild RenderInkWell at Point(376.0, 0.0) 2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) -2 | | | | | | | | | translate(478.0, 159.0) -2 | | | | | | | | | translate(-478.0, -159.0) -2 | | | | | | | | | restore -2 | | | | | | | paintChild RenderInkWell at Point(592.0, 145.0) -2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | paintChild RenderOpacity at Point(668.0, 159.0) +2 | | | | | | | | | paintChild RenderPositionedBox at Point(388.0, 0.0) +2 | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | paintChild RenderOpacity at Point(452.0, 14.0) +2 | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) +2 | | | | | | | | | | | translate(452.0, 14.0) +2 | | | | | | | | | | | translate(-452.0, -14.0) +2 | | | | | | | | | | | restore +2 | | | | | | | | paintChild RenderInkWell at Point(564.0, 0.0) 2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) -2 | | | | | | | | | translate(668.0, 159.0) -2 | | | | | | | | | translate(-668.0, -159.0) -2 | | | | | | | | | restore -2 | | | | | | paintChild RenderPositionedBox at Point(343.0, 193.0) -2 | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | paintChild RenderParagraph at Point(343.0, 354.5) +2 | | | | | | | | | paintChild RenderPositionedBox at Point(576.0, 0.0) +2 | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | paintChild RenderOpacity at Point(638.0, 14.0) +2 | | | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | | | saveLayer(null, Paint(color:Color(0xb3000000))) +2 | | | | | | | | | | | translate(638.0, 14.0) +2 | | | | | | | | | | | translate(-638.0, -14.0) +2 | | | | | | | | | | | restore +2 | | | | | | | | restore +2 | | | | | | | paintChild RenderPositionedBox at Point(343.0, 201.0) 2 | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 -2 | | | | | | | | translate(343.0, 354.5) -2 | | | | | | | | translate(-343.0, -354.5) +2 | | | | | | | | paintChild RenderParagraph at Point(343.0, 354.5) +2 | | | | | | | | | TestPaintingCanvas() constructor: 800.0 x 600.0 +2 | | | | | | | | | translate(343.0, 354.5) +2 | | | | | | | | | translate(-343.0, -354.5) 2 | | | | | | restore 2 | | paintChild RenderDecoratedBox at Point(0.0, 0.0) 2 | | | TestPaintingCanvas() constructor: 800.0 x 600.0