Bug 1497239 - Properly apply inherited scale to filters. r=jrmuizel

I'll file a followup bug to deal with the fallback transition going wrong.

I don't know why it'd be fine to not apply the scale to SVG wrappers, but on my
quick testing I didn't manage to break it, so I'll spend a bit more time trying
to do that...

Differential Revision: https://phabricator.services.mozilla.com/D8013

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2018-10-10 14:49:15 +00:00
Родитель 6793adb6e3
Коммит c1e1ca5fbd
3 изменённых файлов: 43 добавлений и 1 удалений

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

@ -1747,6 +1747,7 @@ PaintItemByDrawTarget(nsDisplayItem* aItem,
break;
case DisplayItemType::TYPE_SVG_WRAPPER:
{
// XXX Why doesn't this need the scaling applied?
context->SetMatrix(context->CurrentMatrix().PreTranslate(-aOffset.x, -aOffset.y));
isInvalidated = PaintByLayer(aItem, aDisplayListBuilder, aManager, context, aScale, [&]() {
aManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer, aDisplayListBuilder);
@ -1756,7 +1757,7 @@ PaintItemByDrawTarget(nsDisplayItem* aItem,
case DisplayItemType::TYPE_FILTER:
{
context->SetMatrix(context->CurrentMatrix().PreTranslate(-aOffset.x, -aOffset.y));
context->SetMatrix(context->CurrentMatrix().PreScale(aScale.width, aScale.height).PreTranslate(-aOffset.x, -aOffset.y));
isInvalidated = PaintByLayer(aItem, aDisplayListBuilder, aManager, context, aScale, [&]() {
static_cast<nsDisplayFilters*>(aItem)->PaintAsLayer(aDisplayListBuilder,
context, aManager);

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

@ -0,0 +1,10 @@
<!doctype html>
<title>CSS Test Reference</title>
<style>
div {
width: 150px;
height: 150px;
background: green;
}
</style>
<div></div>

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

@ -0,0 +1,31 @@
<!doctype html>
<title>CSS Filter Effects test: Scaling is properly accounted for.</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="help" href="https://drafts.fxtf.org/filter-effects/#FilterProperty">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1497239">
<link rel="match" href="filter-scale-001-ref.html">
<style>
#outer {
width: 15px;
height: 15px;
transform: scale(10);
transform-origin: 0 0;
}
#inner {
filter: url(#blur);
width: 15px;
height: 15px;
background: green;
}
</style>
<div id="outer">
<div id="inner"></div>
</div>
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="blur">
<feGaussianBlur in="SourceGraphic" stdDeviation="0,0"></feGaussianBlur>
</filter>
</defs>
</svg>