Bug 1169331 - Always clip rotated buffer quadrant drawing to the fill rect. r=jrmuizel
☠☠ backed out by 99d6da0042f3 ☠ ☠
authorMarkus Stange <mstange@themasta.com>
Fri, 05 Jun 2015 13:34:54 -0400
changeset 248332 67527d8c06880c1af9832bb7414520648869393c
parent 248331 9718bc90b5c2dfe1edc035b58985ab6e02683155
child 248333 59e52c9cff43230e3fd0a681a4e965921e3c8972
push id28893
push userkwierso@gmail.com
push dateFri, 12 Jun 2015 00:02:58 +0000
treeherderautoland@8cf9d3e497f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1169331
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1169331 - Always clip rotated buffer quadrant drawing to the fill rect. r=jrmuizel
gfx/layers/RotatedBuffer.cpp
layout/reftests/bugs/1169331-1-ref.html
layout/reftests/bugs/1169331-1.html
layout/reftests/bugs/reftest.list
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -108,23 +108,23 @@ RotatedBuffer::DrawBufferQuadrant(gfx::D
        aTarget->GetBackendType() == BackendType::DIRECT2D1_1) &&
       aOperator == CompositionOp::OP_SOURCE) {
     aOperator = CompositionOp::OP_OVER;
     if (snapshot->GetFormat() == SurfaceFormat::B8G8R8A8) {
       aTarget->ClearRect(ToRect(fillRect));
     }
   }
 
-  if (aOperator == CompositionOp::OP_SOURCE) {
-    // OP_SOURCE is unbounded in Azure, and we really don't want that behaviour here.
-    // We also can't do a ClearRect+FillRect since we need the drawing to happen
-    // as an atomic operation (to prevent flickering).
-    aTarget->PushClipRect(gfx::Rect(fillRect.x, fillRect.y,
-                                    fillRect.width, fillRect.height));
-  }
+  // OP_SOURCE is unbounded in Azure, and we really don't want that behaviour here.
+  // We also can't do a ClearRect+FillRect since we need the drawing to happen
+  // as an atomic operation (to prevent flickering).
+  // We also need this clip in the case where we have a mask, since the mask surface
+  // might cover more than fillRect, but we only want to touch the pixels inside
+  // fillRect.
+  aTarget->PushClipRect(gfx::ToRect(fillRect));
 
   if (aMask) {
     Matrix oldTransform = aTarget->GetTransform();
 
     // Transform from user -> buffer space.
     Matrix transform =
       Matrix::Translation(quadrantTranslation.x, quadrantTranslation.y);
 
@@ -150,19 +150,17 @@ RotatedBuffer::DrawBufferQuadrant(gfx::D
     DrawSurfaceOptions options;
 #endif
     aTarget->DrawSurface(snapshot, ToRect(fillRect),
                          GetSourceRectangle(aXSide, aYSide),
                          options,
                          DrawOptions(aOpacity, aOperator));
   }
 
-  if (aOperator == CompositionOp::OP_SOURCE) {
-    aTarget->PopClip();
-  }
+  aTarget->PopClip();
 }
 
 void
 RotatedBuffer::DrawBufferWithRotation(gfx::DrawTarget *aTarget, ContextSource aSource,
                                       float aOpacity,
                                       gfx::CompositionOp aOperator,
                                       gfx::SourceSurface* aMask,
                                       const gfx::Matrix* aMaskTransform) const
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1169331-1-ref.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>Rotated buffer with mask</title>
+
+<style>
+
+body {
+  margin: 0;
+}
+
+.outer {
+  padding: 50px;
+}
+
+.scrollbox {
+  width: 200px;
+  height: 200px;
+  overflow: auto;
+}
+
+.scrolled {
+  box-sizing: border-box;
+  border: 1px solid transparent;
+  height: 200px;
+}
+
+</style>
+
+<div class="outer">
+
+  <div class="scrollbox">
+    <div class="scrolled" style="background-color: blue;"></div>
+    <div class="scrolled" style="background-color: lime;"></div>
+  </div>
+
+</div>
+
+<script>
+
+var scrollbox = document.querySelector(".scrollbox");
+
+scrollbox.scrollTop = 199;
+
+</script>
+
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1169331-1.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html lang="en" class="reftest-wait">
+<meta charset="utf-8">
+<title>Rotated buffer with mask</title>
+
+<style>
+
+body {
+  margin: 0;
+}
+
+.outer {
+  overflow: hidden;
+  border-radius: 10px;
+  padding: 50px;
+}
+
+.scrollbox {
+  width: 200px;
+  height: 200px;
+  overflow: auto;
+}
+
+.scrolled {
+  box-sizing: border-box;
+  border: 1px solid transparent;
+  height: 200px;
+}
+
+</style>
+
+<div class="outer">
+
+  <div class="scrollbox">
+    <div class="scrolled" style="background-color: blue;"></div>
+    <div class="scrolled" style="background-color: lime;"></div>
+  </div>
+
+</div>
+
+<script>
+
+var scrollbox = document.querySelector(".scrollbox");
+
+scrollbox.scrollTop = 1;
+scrollbox.scrollTop = 0;
+
+window.addEventListener("MozReftestInvalidate", function (e) {
+  scrollbox.scrollTop = 199;
+  document.documentElement.removeAttribute("class");
+});
+
+</script>
+
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1920,8 +1920,9 @@ skip-if(!asyncPanZoom) fuzzy-if(B2G,23,1
 skip-if(!asyncPanZoom) == 1133905-4-vh-rtl.html 1133905-ref-vh-rtl.html
 skip-if(!asyncPanZoom) fuzzy-if(B2G,102,577) == 1133905-5-vh-rtl.html 1133905-ref-vh-rtl.html
 skip-if(!asyncPanZoom) fuzzy-if(B2G,101,887) == 1133905-6-vh-rtl.html 1133905-ref-vh-rtl.html
 skip-if(B2G||Mulet) == 1150021-1.xul 1150021-1-ref.xul
 == 1151145-1.html 1151145-1-ref.html
 == 1151306-1.html 1151306-1-ref.html
 == 1153845-1.html 1153845-1-ref.html
 == 1156129-1.html 1156129-1-ref.html
+== 1169331-1.html 1169331-1-ref.html