Skip to content

Commit

Permalink
Don't optimize display list for projective transforms
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mrobinson committed May 10, 2017
1 parent 0040160 commit 3236611
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/layout/display_list_builder.rs
Expand Up @@ -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()),
Expand Down
25 changes: 25 additions & 0 deletions tests/wpt/mozilla/meta/MANIFEST.json
Expand Up @@ -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",
Expand Down Expand Up @@ -9259,6 +9271,11 @@
{}
]
],
"css/transform_3d_from_outside_viewport_ref.html": [
[
{}
]
],
"css/transform_3d_ref.html": [
[
{}
Expand Down Expand Up @@ -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"
Expand Down
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ensure that content transformed from outside the viewport is displayed</title>
<link rel="match" href="transform_3d_from_outside_viewport_ref.html">
<style>
#container {
left: 0;
top: 0;
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
perspective: 2000px;
perspective-origin: 20% 50%;
background: yellow;
}

#transformed {
height: 200px;
transform: translate3d(0px, 0px, -1300px) rotateY(45deg);
background: green;
}
</style>
</head>

<body>
<div id="container">
<div id="transformed"></div>
</div>
</body>
</html>
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ensure that content transformed from outside the viewport is displayed</title>
<style>
body {
background: yellow;
}
</style>
</head>

<body>
</body>
</html>

0 comments on commit 3236611

Please sign in to comment.