Bug 1083241 - Call gfx->Paint in PaintFrameWithEffects when there is blending. r=roc

This commit is contained in:
Max Vujovic 2014-10-17 11:37:54 -07:00
parent 60ce21c548
commit 5d0344aba0
7 changed files with 120 additions and 2 deletions

View File

@ -0,0 +1,41 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<style>
.parent {
position: relative;
width: 100px;
height: 100px;
}
.child {
filter: blur(3px);
background: #0f0;
width: 100px;
height: 100px;
}
.black-rect {
position: absolute;
top: 50px;
width: 100px;
height: 50px;
background: #000;
}
</style>
</head>
<body>
<!--
You should see a blurred green square, with its bottom half mostly
covered by a black rectangle.
-->
<div class="parent">
<div class="child"></div>
<div class="black-rect"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="blur">
<feGaussianBlur stdDeviation="3"/>
</filter>
</defs>
<rect x="0" y="0" width="100" height="50" fill="#fff"/>
<rect x="0" y="0" width="100" height="100" fill="#0f0" filter="url(#blur)"/>
<rect x="0" y="50" width="100" height="50" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 459 B

View File

@ -0,0 +1,37 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<style>
.parent {
/*
With the darken blend mode, green will overwrite white parts of this
background, while black parts of this background will show through.
*/
background: linear-gradient(#fff 0%, #fff 50%, #000 50%, #000 100%);
width: 100px;
height: 100px;
}
.child {
filter: blur(3px);
mix-blend-mode: darken;
background: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<!--
You should see a blurred green square, with its bottom half mostly
covered by a black rectangle.
-->
<div class="parent">
<div class="child"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="blur">
<feGaussianBlur stdDeviation="3"/>
</filter>
</defs>
<!-- Background consists of a white rect and a black rect. -->
<rect x="0" y="0" width="100" height="50" fill="#fff"/>
<rect x="0" y="50" width="100" height="50" fill="#000"/>
<!--
Foreground consists of a blurred green square, blended with the background
using the darken blend mode. Green should overwrite the white rect, while
the black rect should show through.
-->
<rect x="0" y="0" width="100" height="100" fill="#0f0" filter="url(#blur)"
style="mix-blend-mode: darken;"/>
</svg>

After

Width:  |  Height:  |  Size: 774 B

View File

@ -40,6 +40,9 @@ fuzzy-if(azureQuartz,2,40000) fuzzy-if(azureSkia||d2d||gtk2Widget,1,40000) pref(
#fuzzy due to inconsistencies in rounded rect cliping between parent and child; may be related to antialiasing. Between platforms, the max difference is the same, and the number of different pixels is either 36 or 37. (Win, Mac and Lin)
fuzzy(64,37) pref(layout.css.mix-blend-mode.enabled,true) == mix-blend-mode-952051.html mix-blend-mode-952051-ref.html
pref(layout.css.mix-blend-mode.enabled,true) pref(layout.css.filters.enabled,true) == mix-blend-mode-and-filter.html mix-blend-mode-and-filter-ref.html
pref(layout.css.mix-blend-mode.enabled,true) pref(layout.css.filters.enabled,true) == mix-blend-mode-and-filter.svg mix-blend-mode-and-filter-ref.svg
pref(layout.css.mix-blend-mode.enabled,true) == mix-blend-mode-child-of-blended-has-opacity.html mix-blend-mode-child-of-blended-has-opacity-ref.html
pref(layout.css.mix-blend-mode.enabled,true) == mix-blend-mode-nested-976533.html mix-blend-mode-nested-976533-ref.html

View File

@ -589,7 +589,8 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx,
if (maskSurface) {
gfx->Mask(maskSurface, maskTransform);
} else if (opacity != 1.0f) {
} else if (opacity != 1.0f ||
aFrame->StyleDisplay()->mMixBlendMode != NS_STYLE_BLEND_NORMAL) {
gfx->Paint(opacity);
}

View File

@ -670,7 +670,8 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
if (maskSurface) {
gfx->Mask(maskSurface, maskTransform);
} else if (opacity != 1.0f) {
} else if (opacity != 1.0f ||
aFrame->StyleDisplay()->mMixBlendMode != NS_STYLE_BLEND_NORMAL) {
gfx->Paint(opacity);
}