Bug 1514384 - Properly make CSS clip property clip filters as well. r=mstange

This fixes a bug that my previous patch uncovers, and that's tested by
css/css-masking/clip/clip-filter-order.html.

We weren't setting up the clips in a way that the clip property clipped filters
and such. This test works in Gecko because Gecko won't draw outside of the
effect bounds, that account for clip().

Differential Revision: https://phabricator.services.mozilla.com/D16232
This commit is contained in:
Emilio Cobos Álvarez 2019-01-10 20:47:36 +01:00
Родитель b7102def68
Коммит ed4a7f2a2a
1 изменённых файлов: 23 добавлений и 16 удалений

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

@ -2926,7 +2926,20 @@ void nsIFrame::BuildDisplayListForStackingContext(
nsDisplayListBuilder::AutoContainerASRTracker contASRTracker(aBuilder);
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
DisplayListClipState::AutoSaveRestore cssClip(aBuilder);
{
// The clip property clips everything, including filters and what not.
if (auto contentClip = GetClipPropClipRect(disp, effects, GetSize())) {
nsPoint offset = isTransformed
? GetOffsetToCrossDoc(
aBuilder->FindReferenceFrameFor(GetParent()))
: aBuilder->GetCurrentFrameOffsetToReferenceFrame();
aBuilder->IntersectDirtyRect(*contentClip);
aBuilder->IntersectVisibleRect(*contentClip);
cssClip.ClipContentDescendants(*contentClip + offset);
}
}
// If there is a current clip, then depending on the container items we
// create, different things can happen to it. Some container items simply
@ -2959,18 +2972,15 @@ void nsIFrame::BuildDisplayListForStackingContext(
clipCapturedBy = ContainerItemType::eFilter;
}
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
if (clipCapturedBy != ContainerItemType::eNone) {
clipState.Clear();
}
Maybe<nsRect> clipForMask;
if (usingMask) {
clipForMask = ComputeClipForMaskItem(aBuilder, this);
}
mozilla::UniquePtr<HitTestInfo> hitTestInfo;
nsDisplayListCollection set(aBuilder);
Maybe<nsRect> clipForMask;
{
DisplayListClipState::AutoSaveRestore nestedClipState(aBuilder);
nsDisplayListBuilder::AutoInTransformSetter inTransformSetter(aBuilder,
@ -2980,17 +2990,14 @@ void nsIFrame::BuildDisplayListForStackingContext(
CheckForApzAwareEventHandlers(aBuilder, this);
Maybe<nsRect> contentClip = GetClipPropClipRect(disp, effects, GetSize());
if (usingMask) {
contentClip = IntersectMaybeRects(contentClip, clipForMask);
}
if (contentClip) {
aBuilder->IntersectDirtyRect(*contentClip);
aBuilder->IntersectVisibleRect(*contentClip);
nestedClipState.ClipContentDescendants(*contentClip +
aBuilder->ToReferenceFrame(this));
clipForMask = ComputeClipForMaskItem(aBuilder, this);
if (clipForMask) {
aBuilder->IntersectDirtyRect(*clipForMask);
aBuilder->IntersectVisibleRect(*clipForMask);
nestedClipState.ClipContentDescendants(
*clipForMask + aBuilder->GetCurrentFrameOffsetToReferenceFrame());
}
}
// extend3DContext also guarantees that applyAbsPosClipping and