Bug 1081185 - Traverse rect edges when searching for w=0 crossings instead of taking diagonals. r=mattwoodrow, a=lmandel
--- a/gfx/2d/Matrix.cpp
+++ b/gfx/2d/Matrix.cpp
@@ -128,18 +128,18 @@ Point4D ComputePerspectivePlaneIntercept
}
Rect Matrix4x4::ProjectRectBounds(const Rect& aRect) const
{
Point4D points[4];
points[0] = ProjectPoint(aRect.TopLeft());
points[1] = ProjectPoint(aRect.TopRight());
- points[2] = ProjectPoint(aRect.BottomLeft());
- points[3] = ProjectPoint(aRect.BottomRight());
+ points[2] = ProjectPoint(aRect.BottomRight());
+ points[3] = ProjectPoint(aRect.BottomLeft());
Float min_x = std::numeric_limits<Float>::max();
Float min_y = std::numeric_limits<Float>::max();
Float max_x = -std::numeric_limits<Float>::max();
Float max_y = -std::numeric_limits<Float>::max();
bool foundPoint = false;
for (int i=0; i<4; i++) {
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1081185-1-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+ margin-top:100px;
+ opacity:0.5;
+}
+
+.container {
+ width: 120px;
+ height: 120px;
+ perspective: 100px;
+}
+
+.bottom {
+ width: 120px;
+ height: 120px;
+ position: absolute;
+ background-color: rgba(255,0,255,1);
+ transform: translateZ(60px) translateY(120px) rotateX(-90deg);
+ transform-origin: left top;
+}
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="bottom"></div>
+</div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1081185-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+ margin-top:100px;
+ opacity:0.5;
+}
+
+.container {
+ width: 120px;
+ height: 120px;
+ perspective: 100px;
+ transform-style: preserve-3d;
+}
+
+.bottom {
+ width: 120px;
+ height: 120px;
+ position: absolute;
+ background-color: rgba(255,0,255,1);
+ transform: translateZ(60px) translateY(120px) rotateX(-90deg);
+ transform-origin: left top;
+}
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="bottom"></div>
+</div>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1829,8 +1829,9 @@ pref(browser.display.use_document_fonts,
== 1050788-1.html about:blank
== 1053035-1-flex.html 1053035-1-ref.html
test-pref(layout.css.grid.enabled,true) == 1053035-1-grid.html 1053035-1-ref.html
== 1059167-1.html 1059167-1-ref.html
== 1059498-1.html 1059498-1-ref.html
== 1059498-2.html 1059498-1-ref.html
== 1059498-3.html 1059498-1-ref.html
== 1078262-1.html about:blank
+== 1081185-1.html 1081185-1-ref.html