зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1306107 - Stop calling ProjectTo2D() for leaf basic layers. r=mattwoodrow
This commit is contained in:
Родитель
9285108ef6
Коммит
63533d005d
|
@ -604,14 +604,13 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
|
|||
}
|
||||
|
||||
Matrix matrix2D;
|
||||
Matrix4x4 result;
|
||||
if (aTransform.CanDraw2D(&matrix2D) &&
|
||||
!matrix2D.HasNonTranslation() &&
|
||||
matrix2D.HasNonIntegerTranslation()) {
|
||||
auto snappedTranslation = IntPoint::Round(matrix2D.GetTranslation());
|
||||
Matrix snappedMatrix = Matrix::Translation(snappedTranslation.x,
|
||||
snappedTranslation.y);
|
||||
result = Matrix4x4::From2D(snappedMatrix);
|
||||
Matrix4x4 result = Matrix4x4::From2D(snappedMatrix);
|
||||
if (aResidualTransform) {
|
||||
// set aResidualTransform so that aResidual * snappedMatrix == matrix2D.
|
||||
// (I.e., appying snappedMatrix after aResidualTransform gives the
|
||||
|
@ -623,6 +622,13 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
|
|||
return result;
|
||||
}
|
||||
|
||||
return SnapTransformTranslation3D(aTransform, aResidualTransform);
|
||||
}
|
||||
|
||||
Matrix4x4
|
||||
Layer::SnapTransformTranslation3D(const Matrix4x4& aTransform,
|
||||
Matrix* aResidualTransform)
|
||||
{
|
||||
if(aTransform.IsSingular() ||
|
||||
aTransform.HasPerspectiveComponent() ||
|
||||
aTransform.HasNonTranslation() ||
|
||||
|
@ -672,7 +678,7 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
|
|||
// Translate transformed origin to transformed snap since the
|
||||
// residual transform would trnslate the snap to the origin.
|
||||
Point3D transformedShift = transformedSnap - transformedOrigin;
|
||||
result = aTransform;
|
||||
Matrix4x4 result = aTransform;
|
||||
result.PostTranslate(transformedShift.x,
|
||||
transformedShift.y,
|
||||
transformedShift.z);
|
||||
|
|
|
@ -1821,6 +1821,8 @@ protected:
|
|||
*/
|
||||
gfx::Matrix4x4 SnapTransformTranslation(const gfx::Matrix4x4& aTransform,
|
||||
gfx::Matrix* aResidualTransform);
|
||||
gfx::Matrix4x4 SnapTransformTranslation3D(const gfx::Matrix4x4& aTransform,
|
||||
gfx::Matrix* aResidualTransform);
|
||||
/**
|
||||
* See comment for SnapTransformTranslation.
|
||||
* This function implements type 2 snapping. If aTransform is a translation
|
||||
|
|
|
@ -37,18 +37,23 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur
|
|||
// are aligned in device space, so it doesn't really matter how we snap
|
||||
// containers.
|
||||
Matrix residual;
|
||||
Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
|
||||
if (!Extend3DContext() && !Is3DContextLeaf()) {
|
||||
// For 3D transform leaked from extended parent layer.
|
||||
Matrix4x4 transformToSurface = aTransformToSurface;
|
||||
bool participate3DCtx = Extend3DContext() || Is3DContextLeaf();
|
||||
if (!participate3DCtx &&
|
||||
GetContentFlags() & CONTENT_BACKFACE_HIDDEN) {
|
||||
// For backface-hidden layers
|
||||
transformToSurface.ProjectTo2D();
|
||||
}
|
||||
Matrix4x4 idealTransform = GetLocalTransform() * transformToSurface;
|
||||
if (!participate3DCtx &&
|
||||
!(GetContentFlags() & CONTENT_BACKFACE_HIDDEN)) {
|
||||
// For non-backface-hidden layers,
|
||||
// 3D components are required to handle CONTENT_BACKFACE_HIDDEN.
|
||||
idealTransform.ProjectTo2D();
|
||||
}
|
||||
|
||||
if (!idealTransform.CanDraw2D()) {
|
||||
if (!Extend3DContext() ||
|
||||
(!idealTransform.Is2D() && Creates3DContextWithExtendingChildren())) {
|
||||
if (!Creates3DContextWithExtendingChildren()) {
|
||||
idealTransform.ProjectTo2D();
|
||||
}
|
||||
if (!Extend3DContext()) {
|
||||
mEffectiveTransform = idealTransform;
|
||||
ComputeEffectiveTransformsForChildren(Matrix4x4());
|
||||
ComputeEffectiveTransformForMaskLayers(Matrix4x4());
|
||||
|
@ -84,12 +89,12 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur
|
|||
(GetMixBlendMode() != CompositionOp::OP_OVER && HasMultipleChildren()) ||
|
||||
(GetEffectiveOpacity() != 1.0 && ((HasMultipleChildren() && !Extend3DContext()) || hasSingleBlendingChild));
|
||||
|
||||
if (!Extend3DContext()) {
|
||||
idealTransform.ProjectTo2D();
|
||||
}
|
||||
mEffectiveTransform =
|
||||
!mUseIntermediateSurface ?
|
||||
idealTransform : SnapTransformTranslation(idealTransform, &residual);
|
||||
idealTransform :
|
||||
(!(GetContentFlags() & CONTENT_BACKFACE_HIDDEN) ?
|
||||
SnapTransformTranslation(idealTransform, &residual) :
|
||||
SnapTransformTranslation3D(idealTransform, &residual));
|
||||
Matrix4x4 childTransformToSurface =
|
||||
(!mUseIntermediateSurface ||
|
||||
(mUseIntermediateSurface && !Extend3DContext() /* 2D */)) ?
|
||||
|
|
Загрузка…
Ссылка в новой задаче