Bug 1708855 - Give Axis a few more accessor methods. r=tnikkel

Depends on D114160

Differential Revision: https://phabricator.services.mozilla.com/D114161
This commit is contained in:
Botond Ballo 2021-05-03 23:51:28 +00:00
Родитель 33a931df2d
Коммит 7bbe707700
2 изменённых файлов: 75 добавлений и 0 удалений

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

@ -452,6 +452,10 @@ bool Axis::OverscrollBehaviorAllowsOverscrollEffect() const {
AxisX::AxisX(AsyncPanZoomController* aAsyncPanZoomController)
: Axis(aAsyncPanZoomController) {}
CSSCoord AxisX::GetPointOffset(const CSSPoint& aPoint) const {
return aPoint.x;
}
ParentLayerCoord AxisX::GetPointOffset(const ParentLayerPoint& aPoint) const {
return aPoint.x;
}
@ -474,6 +478,26 @@ CSSToParentLayerScale AxisX::GetScaleForAxis(
return CSSToParentLayerScale(aScale.xScale);
}
float AxisX::GetTransformScale(
const AsyncTransformComponentMatrix& aMatrix) const {
return aMatrix._11;
}
ParentLayerCoord AxisX::GetTransformTranslation(
const AsyncTransformComponentMatrix& aMatrix) const {
return aMatrix._41;
}
void AxisX::PostScale(AsyncTransformComponentMatrix& aMatrix,
float aScale) const {
aMatrix.PostScale(aScale, 1.f, 1.f);
}
void AxisX::PostTranslate(AsyncTransformComponentMatrix& aMatrix,
ParentLayerCoord aTranslation) const {
aMatrix.PostTranslate(aTranslation, 0, 0);
}
ScreenPoint AxisX::MakePoint(ScreenCoord aCoord) const {
return ScreenPoint(aCoord, 0);
}
@ -512,6 +536,10 @@ OverscrollBehavior AxisX::GetOverscrollBehavior() const {
AxisY::AxisY(AsyncPanZoomController* aAsyncPanZoomController)
: Axis(aAsyncPanZoomController) {}
CSSCoord AxisY::GetPointOffset(const CSSPoint& aPoint) const {
return aPoint.y;
}
ParentLayerCoord AxisY::GetPointOffset(const ParentLayerPoint& aPoint) const {
return aPoint.y;
}
@ -534,6 +562,26 @@ CSSToParentLayerScale AxisY::GetScaleForAxis(
return CSSToParentLayerScale(aScale.yScale);
}
float AxisY::GetTransformScale(
const AsyncTransformComponentMatrix& aMatrix) const {
return aMatrix._22;
}
ParentLayerCoord AxisY::GetTransformTranslation(
const AsyncTransformComponentMatrix& aMatrix) const {
return aMatrix._42;
}
void AxisY::PostScale(AsyncTransformComponentMatrix& aMatrix,
float aScale) const {
aMatrix.PostScale(1.f, aScale, 1.f);
}
void AxisY::PostTranslate(AsyncTransformComponentMatrix& aMatrix,
ParentLayerCoord aTranslation) const {
aMatrix.PostTranslate(0, aTranslation, 0);
}
ScreenPoint AxisY::MakePoint(ScreenCoord aCoord) const {
return ScreenPoint(0, aCoord);
}

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

@ -287,6 +287,7 @@ class Axis {
virtual CSSToParentLayerScale GetAxisScale(
const CSSToParentLayerScale2D& aScale) const = 0;
virtual CSSCoord GetPointOffset(const CSSPoint& aPoint) const = 0;
virtual ParentLayerCoord GetPointOffset(
const ParentLayerPoint& aPoint) const = 0;
virtual ParentLayerCoord GetRectLength(
@ -295,6 +296,14 @@ class Axis {
const ParentLayerRect& aRect) const = 0;
virtual CSSToParentLayerScale GetScaleForAxis(
const CSSToParentLayerScale2D& aScale) const = 0;
virtual float GetTransformScale(
const AsyncTransformComponentMatrix& aMatrix) const = 0;
virtual ParentLayerCoord GetTransformTranslation(
const AsyncTransformComponentMatrix& aMatrix) const = 0;
virtual void PostScale(AsyncTransformComponentMatrix& aMatrix,
float aScale) const = 0;
virtual void PostTranslate(AsyncTransformComponentMatrix& aMatrix,
ParentLayerCoord aTranslation) const = 0;
virtual ScreenPoint MakePoint(ScreenCoord aCoord) const = 0;
@ -356,12 +365,21 @@ class AxisX : public Axis {
explicit AxisX(AsyncPanZoomController* mAsyncPanZoomController);
CSSToParentLayerScale GetAxisScale(
const CSSToParentLayerScale2D& aScale) const override;
CSSCoord GetPointOffset(const CSSPoint& aPoint) const override;
ParentLayerCoord GetPointOffset(
const ParentLayerPoint& aPoint) const override;
ParentLayerCoord GetRectLength(const ParentLayerRect& aRect) const override;
ParentLayerCoord GetRectOffset(const ParentLayerRect& aRect) const override;
CSSToParentLayerScale GetScaleForAxis(
const CSSToParentLayerScale2D& aScale) const override;
float GetTransformScale(
const AsyncTransformComponentMatrix& aMatrix) const override;
ParentLayerCoord GetTransformTranslation(
const AsyncTransformComponentMatrix& aMatrix) const override;
void PostScale(AsyncTransformComponentMatrix& aMatrix,
float aScale) const override;
void PostTranslate(AsyncTransformComponentMatrix& aMatrix,
ParentLayerCoord aTranslation) const override;
ScreenPoint MakePoint(ScreenCoord aCoord) const override;
const char* Name() const override;
bool CanScrollTo(Side aSide) const;
@ -374,6 +392,7 @@ class AxisX : public Axis {
class AxisY : public Axis {
public:
explicit AxisY(AsyncPanZoomController* mAsyncPanZoomController);
CSSCoord GetPointOffset(const CSSPoint& aPoint) const override;
ParentLayerCoord GetPointOffset(
const ParentLayerPoint& aPoint) const override;
CSSToParentLayerScale GetAxisScale(
@ -382,6 +401,14 @@ class AxisY : public Axis {
ParentLayerCoord GetRectOffset(const ParentLayerRect& aRect) const override;
CSSToParentLayerScale GetScaleForAxis(
const CSSToParentLayerScale2D& aScale) const override;
float GetTransformScale(
const AsyncTransformComponentMatrix& aMatrix) const override;
ParentLayerCoord GetTransformTranslation(
const AsyncTransformComponentMatrix& aMatrix) const override;
void PostScale(AsyncTransformComponentMatrix& aMatrix,
float aScale) const override;
void PostTranslate(AsyncTransformComponentMatrix& aMatrix,
ParentLayerCoord aTranslation) const override;
ScreenPoint MakePoint(ScreenCoord aCoord) const override;
const char* Name() const override;
bool CanScrollTo(Side aSide) const;