зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1295084 Part 2 - Move two Position methods into nsStyleImageLayers. r=dholbert
--HG-- extra : rebase_source : d6288a2c46a2f7002fc1a6547b0607a811546d58
This commit is contained in:
Родитель
3100ef24af
Коммит
1a6e56ea85
|
@ -6148,7 +6148,8 @@ nsComputedDOMStyle::DoGetMask()
|
|||
firstLayer.mOrigin != NS_STYLE_IMAGELAYER_ORIGIN_BORDER ||
|
||||
firstLayer.mComposite != NS_STYLE_MASK_COMPOSITE_ADD ||
|
||||
firstLayer.mMaskMode != NS_STYLE_MASK_MODE_MATCH_SOURCE ||
|
||||
!firstLayer.mPosition.IsInitialValue(nsStyleImageLayers::LayerType::Mask) ||
|
||||
!nsStyleImageLayers::IsInitialPositionForLayerType(
|
||||
firstLayer.mPosition, nsStyleImageLayers::LayerType::Mask) ||
|
||||
!firstLayer.mRepeat.IsInitialValue(nsStyleImageLayers::LayerType::Mask) ||
|
||||
!firstLayer.mSize.IsInitialValue() ||
|
||||
!(firstLayer.mImage.GetType() == eStyleImageType_Null ||
|
||||
|
|
|
@ -7273,7 +7273,7 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
|
|||
// background-position-x/y: enum, length, percent (flags), inherit [list]
|
||||
nsStyleImageLayers::Position::PositionCoord initialPositionCoord;
|
||||
initialPositionCoord.mPercent =
|
||||
nsStyleImageLayers::Position::GetInitialValue(
|
||||
nsStyleImageLayers::GetInitialPositionForLayerType(
|
||||
nsStyleImageLayers::LayerType::Background);
|
||||
initialPositionCoord.mLength = 0;
|
||||
initialPositionCoord.mHasPercent = true;
|
||||
|
@ -10037,7 +10037,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
|
|||
// mask-position-x/y: enum, length, percent (flags), inherit [list]
|
||||
nsStyleImageLayers::Position::PositionCoord initialPositionCoord;
|
||||
initialPositionCoord.mPercent =
|
||||
nsStyleImageLayers::Position::GetInitialValue(
|
||||
nsStyleImageLayers::GetInitialPositionForLayerType(
|
||||
nsStyleImageLayers::LayerType::Mask);
|
||||
initialPositionCoord.mLength = 0;
|
||||
initialPositionCoord.mHasPercent = true;
|
||||
|
|
|
@ -2490,12 +2490,15 @@ nsStyleImageLayers::HasLayerWithImage() const
|
|||
}
|
||||
|
||||
bool
|
||||
nsStyleImageLayers::Position::IsInitialValue(LayerType aType) const
|
||||
nsStyleImageLayers::IsInitialPositionForLayerType(Position aPosition, LayerType aType)
|
||||
{
|
||||
float intialValue = nsStyleImageLayers::Position::GetInitialValue(aType);
|
||||
if (mXPosition.mPercent == intialValue && mXPosition.mLength == 0 &&
|
||||
mXPosition.mHasPercent && mYPosition.mPercent == intialValue &&
|
||||
mYPosition.mLength == 0 && mYPosition.mHasPercent) {
|
||||
float intialValue = nsStyleImageLayers::GetInitialPositionForLayerType(aType);
|
||||
if (aPosition.mXPosition.mPercent == intialValue &&
|
||||
aPosition.mXPosition.mLength == 0 &&
|
||||
aPosition.mXPosition.mHasPercent &&
|
||||
aPosition.mYPosition.mPercent == intialValue &&
|
||||
aPosition.mYPosition.mLength == 0 &&
|
||||
aPosition.mYPosition.mHasPercent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2675,7 +2678,7 @@ nsStyleImageLayers::Layer::Initialize(nsStyleImageLayers::LayerType aType)
|
|||
mRepeat.SetInitialValues(aType);
|
||||
|
||||
float initialPositionValue =
|
||||
nsStyleImageLayers::Position::GetInitialValue(aType);
|
||||
nsStyleImageLayers::GetInitialPositionForLayerType(aType);
|
||||
mPosition.SetInitialPercentValues(initialPositionValue);
|
||||
|
||||
if (aType == LayerType::Background) {
|
||||
|
|
|
@ -570,12 +570,6 @@ struct nsStyleImageLayers {
|
|||
// Initialize nothing
|
||||
Position() {}
|
||||
|
||||
bool IsInitialValue(LayerType aType) const;
|
||||
|
||||
static float GetInitialValue(LayerType aType) {
|
||||
return (aType == LayerType::Background) ? 0.0f : 0.5f;
|
||||
}
|
||||
|
||||
// Sets both mXPosition and mYPosition to the given percent value for the
|
||||
// initial property-value (e.g. 0.0f for "0% 0%", or 0.5f for "50% 50%")
|
||||
void SetInitialPercentValues(float aPercentVal);
|
||||
|
@ -599,6 +593,12 @@ struct nsStyleImageLayers {
|
|||
}
|
||||
};
|
||||
|
||||
static bool IsInitialPositionForLayerType(Position aPosition, LayerType aType);
|
||||
|
||||
static float GetInitialPositionForLayerType(LayerType aType) {
|
||||
return (aType == LayerType::Background) ? 0.0f : 0.5f;
|
||||
}
|
||||
|
||||
struct Size;
|
||||
friend struct Size;
|
||||
struct Size {
|
||||
|
|
Загрузка…
Ссылка в новой задаче