Bug 1288210 - Improve the use of strongly typed units in AsyncCompositionManager. r=mstange

MozReview-Commit-ID: 1EfGg0MNSBm
This commit is contained in:
Botond Ballo
2016-09-21 17:33:29 -04:00
parent b98d612977
commit a621afb00a
2 changed files with 16 additions and 8 deletions

View File

@@ -904,11 +904,16 @@ public:
aX, aY, aZ, 1.0f); aX, aY, aZ, 1.0f);
} }
static Matrix4x4Typed Translation(const Point3D& aP) static Matrix4x4Typed Translation(const TargetPoint3D& aP)
{ {
return Translation(aP.x, aP.y, aP.z); return Translation(aP.x, aP.y, aP.z);
} }
static Matrix4x4Typed Translation(const TargetPoint& aP)
{
return Translation(aP.x, aP.y, 0);
}
/** /**
* Apply a translation to this matrix. * Apply a translation to this matrix.
* *
@@ -972,10 +977,14 @@ public:
return *this; return *this;
} }
Matrix4x4Typed &PostTranslate(const Point3D& aPoint) { Matrix4x4Typed &PostTranslate(const TargetPoint3D& aPoint) {
return PostTranslate(aPoint.x, aPoint.y, aPoint.z); return PostTranslate(aPoint.x, aPoint.y, aPoint.z);
} }
Matrix4x4Typed &PostTranslate(const TargetPoint& aPoint) {
return PostTranslate(aPoint.x, aPoint.y, 0);
}
static Matrix4x4Typed Scaling(Float aScaleX, Float aScaleY, float aScaleZ) static Matrix4x4Typed Scaling(Float aScaleX, Float aScaleY, float aScaleZ)
{ {
return Matrix4x4Typed(aScaleX, 0.0f, 0.0f, 0.0f, return Matrix4x4Typed(aScaleX, 0.0f, 0.0f, 0.0f,

View File

@@ -259,7 +259,7 @@ SetShadowTransform(Layer* aLayer, LayerToParentLayerMatrix4x4 aTransform)
static void static void
TranslateShadowLayer(Layer* aLayer, TranslateShadowLayer(Layer* aLayer,
const gfxPoint& aTranslation, const ParentLayerPoint& aTranslation,
bool aAdjustClipRect, bool aAdjustClipRect,
AsyncCompositionManager::ClipPartsCache* aClipPartsCache) AsyncCompositionManager::ClipPartsCache* aClipPartsCache)
{ {
@@ -272,13 +272,13 @@ TranslateShadowLayer(Layer* aLayer,
LayerToParentLayerMatrix4x4 layerTransform = aLayer->GetLocalTransformTyped(); LayerToParentLayerMatrix4x4 layerTransform = aLayer->GetLocalTransformTyped();
// Apply the translation to the layer transform. // Apply the translation to the layer transform.
layerTransform.PostTranslate(aTranslation.x, aTranslation.y, 0); layerTransform.PostTranslate(aTranslation);
SetShadowTransform(aLayer, layerTransform); SetShadowTransform(aLayer, layerTransform);
aLayer->AsLayerComposite()->SetShadowTransformSetByAnimation(false); aLayer->AsLayerComposite()->SetShadowTransformSetByAnimation(false);
if (aAdjustClipRect) { if (aAdjustClipRect) {
auto transform = ParentLayerToParentLayerMatrix4x4::Translation(aTranslation.x, aTranslation.y, 0); auto transform = ParentLayerToParentLayerMatrix4x4::Translation(aTranslation);
// If we're passed a clip parts cache, only transform the fixed part of // If we're passed a clip parts cache, only transform the fixed part of
// the clip. // the clip.
if (aClipPartsCache) { if (aClipPartsCache) {
@@ -540,8 +540,7 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aTransformedSubtreeRoo
// clip rect, we need to apply the same translation to said clip rect, so // clip rect, we need to apply the same translation to said clip rect, so
// that the effective transform on the clip rect takes it back to where it was // that the effective transform on the clip rect takes it back to where it was
// originally, had there been no async scroll. // originally, had there been no async scroll.
TranslateShadowLayer(layer, ThebesPoint(translation.ToUnknownPoint()), TranslateShadowLayer(layer, translation, true, aClipPartsCache);
true, aClipPartsCache);
// If we didn't consume the entire translation, continue the traversal // If we didn't consume the entire translation, continue the traversal
// to allow a descendant fixed or sticky layer to consume the rest. // to allow a descendant fixed or sticky layer to consume the rest.
@@ -852,7 +851,7 @@ MoveScrollbarForLayerMargin(Layer* aRoot, FrameMetrics::ViewID aRootScrollId,
// scrollbar a bit to expand into the new space but it's not as noticeable // scrollbar a bit to expand into the new space but it's not as noticeable
// and it would add a lot more complexity, so we're going with the "it's not // and it would add a lot more complexity, so we're going with the "it's not
// worth it" justification. // worth it" justification.
TranslateShadowLayer(scrollbar, gfxPoint(0, -aFixedLayerMargins.bottom), true, nullptr); TranslateShadowLayer(scrollbar, ParentLayerPoint(0, -aFixedLayerMargins.bottom), true, nullptr);
if (scrollbar->GetParent()) { if (scrollbar->GetParent()) {
// The layer that has the HORIZONTAL direction sits inside another // The layer that has the HORIZONTAL direction sits inside another
// ContainerLayer. This ContainerLayer also has a clip rect that causes // ContainerLayer. This ContainerLayer also has a clip rect that causes