import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1225237 - Use stable hashing for DOMExpandoSet; r=jonco (4254b32429)
- Bug 1219288 - Store target shapes in module environment object rather than names r=shu (5cb08ce170)
- Bug 1219288 - Add GETIMPORT instruction for accessing module imports that are not namespace imports r=shu (487ccb37d4)
- Bug 1219288 - Optimize GETIMPORT instructions in baseline r=shu (938079be7f)
- Bug 1219288 - Optimize GETIMPORT instructions in Ion r=shu (cfa7b927a4)
- Bug 1224404 - Use stable hashing for WeakMapPtr; r=jonco (59df9ae61c)
- Bug 1223639. Use ForceInside to constrain the displayport rect to the scrollable rect instead of intersect. r=botond (12a978a2fd)
- Bug 1223639. Rename ForceInside to MoveInsideAndClamp so it's clearer what it does. r=botond (562f0a8f53)
- Bug 1212136 - Remove noisy warning that we don't have time to investigate properly. r=tnikkel (4d752f8b1a)
- Bug 1215356. When setting a display port, schedule paint on that frame, not the root frame of the document. r=mattwoodrow (bad289fbb7)
- Bug 1213711 - Initialize Preserves3DContext::mAccumulatedRectLevels. r=thinker. (99dbae372a)
- Bug 1175492 followup: remove extra dashes left over from removing -moz- prefixes. r=longsonr (060368e850)
- Bug 1207143 - Improve GetBounds() to avoid recomputing every time. r=roc (995b9e9d4f)
- Bug 1216386 - Improve AnimatedGeometryRootLookup::Hash. r=roc. (7c84489583)
- Bug 1201327 - Rename mDestRect to mImageLayerDestRect. r=mattwoodrow (fa32340de9)
- Bug 1201327 - Let DLBI detect background-position changes. r=mattwoodrow (de59480f0d)
- Bug 1201327 - Don't repaint the whole frame subtree when background-position changes. r=dbaron (26a085e548)
- Fix wheel events not working on scrollbars of inactive subframes. (bug 1216488, r=tn) (650d70eaf5)
- Bug 1206468 - Remove unused internal appearance value -moz-mac-unified-toolbar. r=mstange (0c56b0fd65)
- Bug 1214212 - Remove clips from separator transform items. r=roc (6f06f60ec9)
- Bug 947062 - Refactor nsDisplayBackgroundImage::GetLayerState. r=mattwoodrow (23d5496afc)
- Bug 1220020. When we turn something into an animated geometry root, clear the cache of animated geometry roots so it's not stale. r=tnikkel (90470c67ae)
- Bug 1156238. Always stop at the root reference frame when looking for an animated geometry root. r=roc,mattwoodrow (b7a41ac2fb)
- Bug 1156238. Fix the computation of animated geometry roots for transform items. r=mattwoodrow (523f062309)
- Bug 1156238. Skip setting async scroll clips if we aren't painting to the window because they are useless then. r=mstange (1d98f27c40)
- Bug 1205087 - Cache the AnimatedGeometryRoot on DisplayItem. r=roc (4f3f5b7e5e)
- Bug 1224209. The animated geometry root of a fixed pos and transformed frame needs to be that frame itself so FrameLayerBuilder can determine it is fixed pos. r=mattwoodrow (974a3ab1e0)
- Bug 1141884 - Handle wheel events on the main thread if the frame has snapping. r=dvander,mstange (3347cdd831)
- Bug 1176775 part 1 - [css-grid] Implement "Implied Minimum Size of Grid Items" (special min-width/height:auto behavior). r=dholbert (c28098d660)
- Bug 1176775 part 2 - [css-grid] Testcases for 'auto' min-sizing and intrinsic 'min-width|height'. (ec70253cc9)
- Bug 1215974. In GetNearestScrollableFrame don't skip the root scroll frame if we are asked to always match the root scroll frame even if it doesn't WantAsyncScroll(). r=botond (97094eb3b1)
- Bug 1215977. Only match the root scroll frame in GetNearestScrollableFrame if we encounter it. r=botond (69569c757c)
- Bug 1215977. Add a flag for GetNearestScrollable that makes fixed pos frames return the root scroll frame of their document. And make APZCCallbackHelper use it to restore previous behaviour. r=botond (c15650e2ba)
- Bug 1190936 - Attempt some graceful handling for an unexpected situation that otherwise crashes the browser. r=botond (61e5fc4b2c)
- Bug 1208780. Set a zero-margin displayport on all scrollable ancestors of frames with displayports if they don't already have a displayport. r=botond (1cb395354a)
- Bug 1221870. Make fixed pos items always find the root scroll frame when looking for the nearest scrollable. r=botond (739da0c2af)
- Bug 1122918 - Part 3 - Use the resolved physical values of 'float' and 'clear' properties during layout. r=heycam (46e77f1e0a)
- Bug 1223479 - Fix displayport size calculation on fennec. r=kats (bd54d7a6c9)
- Bug 1210560 - Part 3: Convert more complex SVG usecases to PushGroupForBlendBack. r=jwatt r=jrmuizel (1a72ef23ba)
- Bug 1210560 - Part 4: Remove code to support non operator-over in nsRenderDocument and move to CanvasRenderingContext2D::DrawWindow. r=roc (a475f22cd2)
- Bug 1210560 - Part 5: Convert BasicLayers usecases to PushGroupForBlendBack and temporary surfaces. r=jrmuizel (5706386aa9)
- Bug 1210560 - Part 6: Convert code to support non-operator OVER in nsCSSRendering to moz2d. r=roc (ba280199c0)
- Bug 1210560 - Part 7: Convert GTK widget code to use Moz2D instead of PushGroup/PopGroup. r=jwatt (d06408ec0a)
- Bug 1210560 - Part 8: Remove unused PushGroup/PopGroup/PopGroupToSource functions. r=jrmuizel (a39ad555c4)
- Bug 1210560 - Followup: Fix function definition prototype. r=bustage on a CLOSED TREE (daa75a342b)
- Bug 1210560 - Followup 2: Fix UniquePtr usage issue. r=bustage on a CLOSED TREE (68ee7667fe)
- Bug 1210560 - Followup 3: Fix an assertion that can occur on mochitest bc4. r=jrmuizel on a CLOSED TREE (6b68389154)
This commit is contained in:
2023-01-06 17:42:55 +08:00
parent 136569692c
commit 61a988a8ac
91 changed files with 3040 additions and 795 deletions
+98 -18
View File
@@ -81,16 +81,51 @@ ClipToContain(gfxContext* aContext, const IntRect& aRect)
return aContext->DeviceToUser(deviceRect).IsEqualInterior(userRect);
}
already_AddRefed<gfxContext>
BasicLayerManager::PushGroupForLayer(gfxContext* aContext, Layer* aLayer,
const nsIntRegion& aRegion,
bool* aNeedsClipToVisibleRegion)
BasicLayerManager::PushedGroup
BasicLayerManager::PushGroupForLayer(gfxContext* aContext, Layer* aLayer, const nsIntRegion& aRegion)
{
PushedGroup group;
group.mVisibleRegion = aRegion;
group.mFinalTarget = aContext;
group.mOperator = GetEffectiveOperator(aLayer);
group.mOpacity = aLayer->GetEffectiveOpacity();
// If we need to call PushGroup, we should clip to the smallest possible
// area first to minimize the size of the temporary surface.
bool didCompleteClip = ClipToContain(aContext, aRegion.GetBounds());
RefPtr<gfxContext> result;
bool canPushGroup = group.mOperator == CompositionOp::OP_OVER ||
(group.mOperator == CompositionOp::OP_SOURCE && (aLayer->CanUseOpaqueSurface() || aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA));
if (!canPushGroup) {
aContext->Save();
gfxUtils::ClipToRegion(group.mFinalTarget, group.mVisibleRegion);
// PushGroup/PopGroup do not support non operator over.
gfxMatrix oldMat = aContext->CurrentMatrix();
aContext->SetMatrix(gfxMatrix());
gfxRect rect = aContext->GetClipExtents();
aContext->SetMatrix(oldMat);
rect.RoundOut();
IntRect surfRect;
ToRect(rect).ToIntRect(&surfRect);
RefPtr<DrawTarget> dt = aContext->GetDrawTarget()->CreateSimilarDrawTarget(surfRect.Size(), SurfaceFormat::B8G8R8A8);
RefPtr<gfxContext> ctx = new gfxContext(dt, ToRect(rect).TopLeft());
ctx->SetMatrix(oldMat);
group.mGroupOffset = surfRect.TopLeft();
group.mGroupTarget = ctx;
group.mMaskSurface = GetMaskForLayer(aLayer, &group.mMaskTransform);
return group;
}
Matrix maskTransform;
RefPtr<SourceSurface> maskSurf = GetMaskForLayer(aLayer, &maskTransform);
if (aLayer->CanUseOpaqueSurface() &&
((didCompleteClip && aRegion.GetNumRects() == 1) ||
!aContext->CurrentMatrix().HasNonIntegerTranslation())) {
@@ -98,19 +133,61 @@ BasicLayerManager::PushGroupForLayer(gfxContext* aContext, Layer* aLayer,
// group. We need to make sure that only pixels inside the layer's visible
// region are copied back to the destination. Remember if we've already
// clipped precisely to the visible region.
*aNeedsClipToVisibleRegion = !didCompleteClip || aRegion.GetNumRects() > 1;
aContext->PushGroup(gfxContentType::COLOR);
result = aContext;
group.mNeedsClipToVisibleRegion = !didCompleteClip || aRegion.GetNumRects() > 1;
if (group.mNeedsClipToVisibleRegion) {
group.mFinalTarget->Save();
gfxUtils::ClipToRegion(group.mFinalTarget, group.mVisibleRegion);
}
aContext->PushGroupForBlendBack(gfxContentType::COLOR, group.mOpacity, maskSurf, maskTransform);
} else {
*aNeedsClipToVisibleRegion = false;
result = aContext;
if (aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) {
aContext->PushGroupAndCopyBackground(gfxContentType::COLOR_ALPHA);
aContext->PushGroupAndCopyBackground(gfxContentType::COLOR_ALPHA, group.mOpacity, maskSurf, maskTransform);
} else {
aContext->PushGroup(gfxContentType::COLOR_ALPHA);
aContext->PushGroupForBlendBack(gfxContentType::COLOR_ALPHA, group.mOpacity, maskSurf, maskTransform);
}
}
return result.forget();
group.mGroupTarget = group.mFinalTarget;
return group;
}
void
BasicLayerManager::PopGroupForLayer(PushedGroup &group)
{
if (group.mFinalTarget == group.mGroupTarget) {
group.mFinalTarget->PopGroupAndBlend();
if (group.mNeedsClipToVisibleRegion) {
group.mFinalTarget->Restore();
}
return;
}
DrawTarget* dt = group.mFinalTarget->GetDrawTarget();
RefPtr<DrawTarget> sourceDT = group.mGroupTarget->GetDrawTarget();
group.mGroupTarget = nullptr;
RefPtr<SourceSurface> src = sourceDT->Snapshot();
if (group.mMaskSurface) {
dt->SetTransform(group.mMaskTransform * Matrix::Translation(-group.mFinalTarget->GetDeviceOffset()));
dt->MaskSurface(SurfacePattern(src, ExtendMode::CLAMP, Matrix::Translation(group.mGroupOffset.x, group.mGroupOffset.y)),
group.mMaskSurface, Point(0, 0), DrawOptions(group.mOpacity, group.mOperator));
} else {
// For now this is required since our group offset is in device space of the final target,
// context but that may still have its own device offset. Once PushGroup/PopGroup logic is
// migrated to DrawTargets this can go as gfxContext::GetDeviceOffset will essentially
// always become null.
dt->SetTransform(Matrix::Translation(-group.mFinalTarget->GetDeviceOffset()));
dt->DrawSurface(src, Rect(group.mGroupOffset.x, group.mGroupOffset.y, src->GetSize().width, src->GetSize().height),
Rect(0, 0, src->GetSize().width, src->GetSize().height), DrawSurfaceOptions(Filter::POINT), DrawOptions(group.mOpacity, group.mOperator));
}
if (group.mNeedsClipToVisibleRegion) {
dt->PopClip();
}
group.mFinalTarget->Restore();
}
static IntRect
@@ -864,6 +941,10 @@ InstallLayerClipPreserves3D(gfxContext* aTarget, Layer* aLayer)
if (!clipRect) {
return;
}
MOZ_ASSERT(!aLayer->Extend3DContext() ||
!aLayer->Combines3DTransformWithAncestors(),
"Layers in a preserve 3D context have no clip"
" except leaves and the estabisher!");
Layer* parent = aLayer->GetParent();
Matrix4x4 transform3d =
@@ -969,11 +1050,10 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
if (is2D) {
if (needsGroup) {
RefPtr<gfxContext> groupTarget = PushGroupForLayer(aTarget, aLayer, aLayer->GetEffectiveVisibleRegion(),
&needsClipToVisibleRegion);
PaintSelfOrChildren(paintLayerContext, groupTarget);
aTarget->PopGroupToSource();
FlushGroup(paintLayerContext, needsClipToVisibleRegion);
PushedGroup pushedGroup =
PushGroupForLayer(aTarget, aLayer, aLayer->GetEffectiveVisibleRegion());
PaintSelfOrChildren(paintLayerContext, pushedGroup.mGroupTarget);
PopGroupForLayer(pushedGroup);
} else {
PaintSelfOrChildren(paintLayerContext, aTarget);
}