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
Родитель 3f922dfdea
Коммит 28c94f57f0
7 изменённых файлов: 120 добавлений и 2 удалений

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

После

Ширина:  |  Высота:  |  Размер: 459 B

Просмотреть файл

@ -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>

Просмотреть файл

@ -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>

После

Ширина:  |  Высота:  |  Размер: 774 B

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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);
}