зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1207734 - Part 1.d. Carry the computed value of individual transform in nsStyleDisplay. r=emilio
Add three more attributes in nsStyleDisplay 1. mSpecifiedRotate to carry computed value of 'rotate' property. 2. mSpecifiedTranslate to carry computed value of 'translate' property. 3. mSpecifiedScale to carry computed value of 'scale' property. Since each of these tree new property can be an animation target, we have to store them in speparate attributes, instead of putting them all in mSpecifiedTransform. MozReview-Commit-ID: G2dBAxzyBWh --HG-- extra : source : 1a75f7765d854910fbb10b2fd31427ef1d9524c6 extra : histedit_source : fd304f41f0e6856bf5a376e30bb13cb90b2534c5
This commit is contained in:
Родитель
e79ea7c484
Коммит
7429d3275e
|
@ -3664,6 +3664,9 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
|
|||
, mTransformStyle(aSource.mTransformStyle)
|
||||
, mTransformBox(aSource.mTransformBox)
|
||||
, mSpecifiedTransform(aSource.mSpecifiedTransform)
|
||||
, mSpecifiedRotate(aSource.mSpecifiedRotate)
|
||||
, mSpecifiedTranslate(aSource.mSpecifiedTranslate)
|
||||
, mSpecifiedScale(aSource.mSpecifiedScale)
|
||||
, mTransformOrigin{ aSource.mTransformOrigin[0],
|
||||
aSource.mTransformOrigin[1],
|
||||
aSource.mTransformOrigin[2] }
|
||||
|
@ -3721,6 +3724,12 @@ nsStyleDisplay::~nsStyleDisplay()
|
|||
{
|
||||
ReleaseSharedListOnMainThread("nsStyleDisplay::mSpecifiedTransform",
|
||||
mSpecifiedTransform);
|
||||
ReleaseSharedListOnMainThread("nsStyleDisplay::mSpecifiedRotate",
|
||||
mSpecifiedRotate);
|
||||
ReleaseSharedListOnMainThread("nsStyleDisplay::mSpecifiedTranslate",
|
||||
mSpecifiedTranslate);
|
||||
ReleaseSharedListOnMainThread("nsStyleDisplay::mSpecifiedScale",
|
||||
mSpecifiedScale);
|
||||
|
||||
MOZ_COUNT_DTOR(nsStyleDisplay);
|
||||
}
|
||||
|
@ -3739,6 +3748,23 @@ nsStyleDisplay::FinishStyle(nsPresContext* aPresContext)
|
|||
}
|
||||
}
|
||||
|
||||
static inline nsChangeHint
|
||||
CompareTransformValues(const RefPtr<nsCSSValueSharedList>& aList,
|
||||
const RefPtr<nsCSSValueSharedList>& aNewList)
|
||||
{
|
||||
nsChangeHint result = nsChangeHint(0);
|
||||
if (!aList != !aNewList || (aList && *aList != *aNewList)) {
|
||||
result |= nsChangeHint_UpdateTransformLayer;
|
||||
if (aList && aNewList) {
|
||||
result |= nsChangeHint_UpdatePostTransformOverflow;
|
||||
} else {
|
||||
result |= nsChangeHint_UpdateOverflow;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const
|
||||
{
|
||||
|
@ -3867,18 +3893,14 @@ nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const
|
|||
*/
|
||||
nsChangeHint transformHint = nsChangeHint(0);
|
||||
|
||||
if (!mSpecifiedTransform != !aNewData.mSpecifiedTransform ||
|
||||
(mSpecifiedTransform &&
|
||||
*mSpecifiedTransform != *aNewData.mSpecifiedTransform)) {
|
||||
transformHint |= nsChangeHint_UpdateTransformLayer;
|
||||
|
||||
if (mSpecifiedTransform &&
|
||||
aNewData.mSpecifiedTransform) {
|
||||
transformHint |= nsChangeHint_UpdatePostTransformOverflow;
|
||||
} else {
|
||||
transformHint |= nsChangeHint_UpdateOverflow;
|
||||
}
|
||||
}
|
||||
transformHint |= CompareTransformValues(mSpecifiedTransform,
|
||||
aNewData.mSpecifiedTransform);
|
||||
transformHint |= CompareTransformValues(mSpecifiedRotate, aNewData.
|
||||
mSpecifiedRotate);
|
||||
transformHint |= CompareTransformValues(mSpecifiedTranslate,
|
||||
aNewData.mSpecifiedTranslate);
|
||||
transformHint |= CompareTransformValues(mSpecifiedScale,
|
||||
aNewData.mSpecifiedScale);
|
||||
|
||||
const nsChangeHint kUpdateOverflowAndRepaintHint =
|
||||
nsChangeHint_UpdateOverflow | nsChangeHint_RepaintFrame;
|
||||
|
|
|
@ -2590,6 +2590,9 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
|
|||
uint8_t mTransformStyle;
|
||||
StyleGeometryBox mTransformBox; // [reset] see nsStyleConsts.h
|
||||
RefPtr<nsCSSValueSharedList> mSpecifiedTransform; // [reset]
|
||||
RefPtr<nsCSSValueSharedList> mSpecifiedRotate; // [reset]
|
||||
RefPtr<nsCSSValueSharedList> mSpecifiedTranslate; // [reset]
|
||||
RefPtr<nsCSSValueSharedList> mSpecifiedScale; // [reset]
|
||||
nsStyleCoord mTransformOrigin[3]; // [reset] percent, coord, calc, 3rd param is coord, calc only
|
||||
nsStyleCoord mChildPerspective; // [reset] none, coord
|
||||
nsStyleCoord mPerspectiveOrigin[2]; // [reset] percent, coord, calc
|
||||
|
@ -2787,7 +2790,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
|
|||
/* Returns whether the element has the -moz-transform property
|
||||
* or a related property. */
|
||||
bool HasTransformStyle() const {
|
||||
return mSpecifiedTransform ||
|
||||
return mSpecifiedTransform || mSpecifiedRotate || mSpecifiedTranslate ||
|
||||
mSpecifiedScale ||
|
||||
mTransformStyle == NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D ||
|
||||
(mWillChangeBitField & NS_STYLE_WILL_CHANGE_TRANSFORM);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче