From 3236611abaabbcacc30563aed29df5d9e0186f38 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Wed, 10 May 2017 14:20:25 +0200 Subject: [PATCH] Don't optimize display list for projective transforms There are situations where elements are transformed from outside the display list. With projective transforms it's currently difficult to detect these. In those cases we just don't optimize the display list, so that they will always be shown. Fixes #13822. --- components/layout/display_list_builder.rs | 8 +++++ tests/wpt/mozilla/meta/MANIFEST.json | 25 ++++++++++++++ .../transform_3d_from_outside_viewport.html | 33 +++++++++++++++++++ ...ransform_3d_from_outside_viewport_ref.html | 15 +++++++++ 4 files changed, 81 insertions(+) create mode 100644 tests/wpt/mozilla/tests/css/transform_3d_from_outside_viewport.html create mode 100644 tests/wpt/mozilla/tests/css/transform_3d_from_outside_viewport_ref.html diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs index b48bb607ac7..e76afc206fa 100644 --- a/components/layout/display_list_builder.rs +++ b/components/layout/display_list_builder.rs @@ -2222,6 +2222,14 @@ impl BlockFlowDisplayListBuilding for BlockFlow { } match transform { + Some(transform) if transform.m13 != 0.0 || transform.m23 != 0.0 => { + // We cannot properly handle perspective transforms, because there may be a + // situation where an element is transformed from outside the clip into the + // clip region. Here we don't have enough information to detect when that is + // happening. For the moment we just punt on trying to optimize the display + // list for those cases. + max_rect() + } Some(transform) => { let clip = Rect::new(Point2D::new((clip.origin.x - origin.x).to_f32_px(), (clip.origin.y - origin.y).to_f32_px()), diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 1b33db843e9..4a4d4f7a10e 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -5849,6 +5849,18 @@ {} ] ], + "css/transform_3d_from_outside_viewport.html": [ + [ + "/_mozilla/css/transform_3d_from_outside_viewport.html", + [ + [ + "/_mozilla/css/transform_3d_from_outside_viewport_ref.html", + "!=" + ] + ], + {} + ] + ], "css/transform_optimization.html": [ [ "/_mozilla/css/transform_optimization.html", @@ -9259,6 +9271,11 @@ {} ] ], + "css/transform_3d_from_outside_viewport_ref.html": [ + [ + {} + ] + ], "css/transform_3d_ref.html": [ [ {} @@ -24062,6 +24079,14 @@ "1450d169d4c5506fff240adca5c28b0cb6accd9f", "reftest" ], + "css/transform_3d_from_outside_viewport.html": [ + "b59ccc70dec5de8bf55440ef3d4dd35d2ec1493a", + "reftest" + ], + "css/transform_3d_from_outside_viewport_ref.html": [ + "87531bec4e8b60f17d885d6236ec0629f68f6c9a", + "support" + ], "css/transform_3d_ref.html": [ "e59866f74ae9dc10a2220c1bb240862371f3edc9", "support" diff --git a/tests/wpt/mozilla/tests/css/transform_3d_from_outside_viewport.html b/tests/wpt/mozilla/tests/css/transform_3d_from_outside_viewport.html new file mode 100644 index 00000000000..f400968bb85 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/transform_3d_from_outside_viewport.html @@ -0,0 +1,33 @@ + + + + + Ensure that content transformed from outside the viewport is displayed + + + + + +
+
+
+ + diff --git a/tests/wpt/mozilla/tests/css/transform_3d_from_outside_viewport_ref.html b/tests/wpt/mozilla/tests/css/transform_3d_from_outside_viewport_ref.html new file mode 100644 index 00000000000..1cd20131596 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/transform_3d_from_outside_viewport_ref.html @@ -0,0 +1,15 @@ + + + + + Ensure that content transformed from outside the viewport is displayed + + + + + +