From e86f8777aecad717dbd50346b6ba44bd3d2f81af Mon Sep 17 00:00:00 2001 From: Ojan Vafai Date: Fri, 20 Feb 2015 20:26:59 -0800 Subject: [PATCH] Remove the concept of staticly positioned absolutes. On the web, if you set position:absolute, but not top/right/bottom/left, then the absolute goes where it would have gone if it wasn't positioned. The use-cases for this are slim and it introduces a lot of complexity to the engine. Also changes behavior in the presence of direction:rtl. On the web, direction:rtl and top/left:auto would sometimes set right:0. Instead we always position at 0,0 if the opposing values are auto. This removes the code for this positioning and allows simplifying a bunch of dirty bit handling code since we don't need to setNeedsLayout if lines move around or wrap differently. The test cases did change their output, but the new positioning all looks correct to me. Review URL: https://codereview.chromium.org/944073006 --- .../tests/layout/position-absolute-expected.txt | 12 ++++++------ .../layout/position-absolute-pixels-expected.sky | 2 +- .../src/flutter/tests/lowlevel/layers-expected.sky | 2 +- engine/src/flutter/tests/lowlevel/layers.sky | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engine/src/flutter/tests/layout/position-absolute-expected.txt b/engine/src/flutter/tests/layout/position-absolute-expected.txt index 58658574d3f..8021bc56ca5 100644 --- a/engine/src/flutter/tests/layout/position-absolute-expected.txt +++ b/engine/src/flutter/tests/layout/position-absolute-expected.txt @@ -4,18 +4,18 @@ layer at (0,0) size 100x100 RenderBlock {block} at (0,0) size 100x100 [bgcolor=#FFC0CB] RenderBlock {spacer} at (0,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)] RenderBlock {spacer} at (0,40) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)] -layer at (0,40) size 20x20 - RenderBlock (positioned) {absolute} at (0,40) size 20x20 [bgcolor=#008000] +layer at (0,0) size 20x20 + RenderBlock (positioned) {absolute} at (0,0) size 20x20 [bgcolor=#008000] layer at (0,150) size 100x100 RenderParagraph {paragraph} at (0,150) size 100x100 [bgcolor=#FFA500] RenderBlock (inline-block) {spacer} at (0,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)] RenderBlock (inline-block) {spacer} at (40,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)] -layer at (0,194) size 20x20 - RenderBlock (positioned) {absolute} at (0,44) size 20x20 [bgcolor=#008000] +layer at (0,150) size 20x20 + RenderBlock (positioned) {absolute} at (0,0) size 20x20 [bgcolor=#008000] layer at (0,300) size 100x100 RenderFlexibleBox {flex} at (0,300) size 100x100 [bgcolor=#FA8072] RenderBlock {spacer} at (0,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)] RenderBlock {spacer} at (40,0) size 40x40 [bgcolor=#FFEFD5] [border: (5px solid #800080)] -layer at (40,300) size 20x20 - RenderBlock (positioned) {absolute} at (40,0) size 20x20 [bgcolor=#008000] +layer at (0,300) size 20x20 + RenderBlock (positioned) {absolute} at (0,0) size 20x20 [bgcolor=#008000] diff --git a/engine/src/flutter/tests/layout/position-absolute-pixels-expected.sky b/engine/src/flutter/tests/layout/position-absolute-pixels-expected.sky index 5a7585e2edb..27a2db61342 100644 --- a/engine/src/flutter/tests/layout/position-absolute-pixels-expected.sky +++ b/engine/src/flutter/tests/layout/position-absolute-pixels-expected.sky @@ -1,7 +1,7 @@ - +