Bug 1329411 - Correct wrong alpha value caused by the sixth patch in
bug 1323912, and a test case.
MozReview-Commit-ID: 8iSyUxQ1EnM
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -3207,17 +3207,17 @@ nsCSSRendering::PaintGradient(nsPresCont
ctx->Rectangle(fillRect);
gfxRect dirtyFillRect = fillRect.Intersect(dirtyAreaToFill);
gfxRect fillRectRelativeToTile = dirtyFillRect - tileRect.TopLeft();
Color edgeColor;
if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR && !isRepeat &&
RectIsBeyondLinearGradientEdge(fillRectRelativeToTile, matrix, stops,
gradientStart, gradientEnd, &edgeColor)) {
- edgeColor.a = aOpacity;
+ edgeColor.a *= aOpacity;
ctx->SetColor(edgeColor);
} else {
ctx->SetMatrix(
ctx->CurrentMatrix().Copy().Translate(tileRect.TopLeft()));
ctx->SetPattern(gradientPattern);
}
ctx->Fill();
ctx->SetMatrix(ctm);
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-gradients/mask-gradient-translucent-end-color-1-ref.html
@@ -0,0 +1,17 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>Make sure that gradient masks are painted correctly with translucent end-color</title>
+
+<style>
+
+html {
+ background: rgba(255, 0, 0, 0.5);
+ overflow: hidden;
+}
+
+</style>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/css-gradients/mask-gradient-translucent-end-color-1.html
@@ -0,0 +1,34 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE html>
+<html lang="en" class="reftest-wait">
+<meta charset="utf-8">
+<title>Make sure that gradient masks are painted correctly with translucent end-color</title>
+<!-- See https://bugzilla.mozilla.org/show_bug.cgi?id=1329411 -->
+
+<style>
+
+html {
+ background: white;
+ overflow: hidden;
+}
+
+div {
+ height: 5000px;
+ background-color: red;
+ mask-image: linear-gradient(transparent 0px, rgba(255, 0, 0, 0.5) 2000px);
+}
+
+</style>
+<body style="margin: 0px;">
+ <div></div>
+
+ <script>
+ window.addEventListener("MozReftestInvalidate", function () {
+ document.documentElement.scrollTop = 3000; // > 2000
+ document.documentElement.removeAttribute("class");
+ });
+ </script>
+</body>
--- a/layout/reftests/css-gradients/reftest.list
+++ b/layout/reftests/css-gradients/reftest.list
@@ -147,8 +147,10 @@ fuzzy-if(d2d,47,400) == linear-onestoppo
== repeating-radial-onestopposition-1c.html orange-square.html
== bug-916535-background-repeat-linear.html bug-916535-background-repeat-linear-ref.html
fuzzy(1,800000) == large-gradient-1.html large-gradient-1-ref.html
fuzzy-if(Android,4,1) == large-gradient-2.html large-gradient-2-ref.html # Bug 1182082
fuzzy(1,800000) == large-gradient-3.html large-gradient-3-ref.html
== large-gradient-4.html large-gradient-4-ref.html
fuzzy(2,800000) == large-gradient-5.html large-gradient-5-ref.html
== 1224761-1.html 1224761-1-ref.html
+
+fuzzy(1,800000) == mask-gradient-translucent-end-color-1.html mask-gradient-translucent-end-color-1-ref.html