Bug 1720986 - Reinstate clipping filters within SVG to the building rect. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D120695
This commit is contained in:
Matt Woodrow 2021-07-25 08:31:25 +00:00
Родитель 0deaad36cf
Коммит 4dd3275fd0
3 изменённых файлов: 23 добавлений и 2 удалений

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

@ -259,6 +259,12 @@ static bool IsContainerLayerItem(nsDisplayItem* aItem) {
static bool DetectContainerLayerPropertiesBoundsChange(
nsDisplayItem* aItem, BlobItemData* aData,
nsDisplayItemGeometry& aGeometry) {
if (aItem->GetType() == DisplayItemType::TYPE_FILTER) {
// Filters get clipped to the BuildingRect since they can
// have huge bounds outside of the visible area.
aGeometry.mBounds = aGeometry.mBounds.Intersect(aItem->GetBuildingRect());
}
return !aGeometry.mBounds.IsEqualEdges(aData->mGeometry->mBounds);
}
@ -1010,8 +1016,10 @@ void Grouper::PaintContainerItem(DIGroup* aGroup, nsDisplayItem* aItem,
// outside the invalid rect.
if (aDirty) {
auto filterItem = static_cast<nsDisplayFilters*>(aItem);
filterItem->SetPaintRect(
filterItem->GetClippedBounds(mDisplayListBuilder));
nsRegion visible(aItem->GetClippedBounds(mDisplayListBuilder));
visible.And(visible, aItem->GetBuildingRect());
aItem->SetPaintRect(visible.GetBounds());
filterItem->Paint(mDisplayListBuilder, aContext);
TakeExternalSurfaces(aRecorder, aData->mExternalSurfaces, aRootManager,

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

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
<defs>
<filter id="dropShadow" x="0" y="0" width="200%" height="200%">
<feOffset result="offOut" in="SourceAlpha" dx="1.5" dy="1.5"/>
<feGaussianBlur result="blurOut" in="offOut" stdDeviation="2"/>
<feBlend in="SourceGraphic" in2="blurOut" mode="normal"/>
</filter>
</defs>
<g filter="url(#dropShadow)">
<rect x="-20000" y="-20000" width="40000" height="40000" fill="lime" />
</g>
</svg>

После

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

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

@ -139,3 +139,4 @@ fuzzy(0-1,0-10000) == feTurbulence-zero-baseFreq-01.svg feTurbulence-zero-baseFr
fails-if(!useDrawSnapshot&&webrender) == outside-sourcegraphic-2.svg outside-sourcegraphic-ref.svg
fails-if(!useDrawSnapshot&&webrender) == outside-sourcegraphic-3.svg outside-sourcegraphic-ref.svg
== nested-filter.html nested-filter-ref.html
== filter-giant.svg pass.svg