Bug 1308963 - Part 1. Set initial value of mask-repeat as repeat. r=xidorn

MozReview-Commit-ID: 8VrPiEyKF4n

--HG--
extra : rebase_source : 0203bbfbee0e2622285e4af498553fbec63c4d62
This commit is contained in:
cku 2016-10-13 22:57:10 +08:00
parent e751b9668d
commit 412846baa6
5 changed files with 12 additions and 37 deletions

View File

@ -12246,16 +12246,12 @@ CSSParserImpl::ParseImageLayersItem(
if (eCSSProperty_mask == aTable[nsStyleImageLayers::shorthand]) {
aState.mOrigin->mValue.SetIntValue(NS_STYLE_IMAGELAYER_ORIGIN_BORDER,
eCSSUnit_Enumerated);
aState.mRepeat->mXValue.SetIntValue(NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT,
eCSSUnit_Enumerated);
positionXArr->Item(1).SetPercentValue(0.5f);
positionYArr->Item(1).SetPercentValue(0.5f);
} else {
aState.mOrigin->mValue.SetIntValue(NS_STYLE_IMAGELAYER_ORIGIN_PADDING,
eCSSUnit_Enumerated);
aState.mRepeat->mXValue.SetIntValue(NS_STYLE_IMAGELAYER_REPEAT_REPEAT,
eCSSUnit_Enumerated);
positionXArr->Item(1).SetPercentValue(0.0f);
positionYArr->Item(1).SetPercentValue(0.0f);

View File

@ -6142,7 +6142,7 @@ nsComputedDOMStyle::DoGetMask()
firstLayer.mMaskMode != NS_STYLE_MASK_MODE_MATCH_SOURCE ||
!nsStyleImageLayers::IsInitialPositionForLayerType(
firstLayer.mPosition, nsStyleImageLayers::LayerType::Mask) ||
!firstLayer.mRepeat.IsInitialValue(nsStyleImageLayers::LayerType::Mask) ||
!firstLayer.mRepeat.IsInitialValue() ||
!firstLayer.mSize.IsInitialValue() ||
!(firstLayer.mImage.GetType() == eStyleImageType_Null ||
firstLayer.mImage.GetType() == eStyleImageType_Image)) {

View File

@ -7259,7 +7259,7 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
// background-repeat: enum, inherit, initial [pair list]
nsStyleImageLayers::Repeat initialRepeat;
initialRepeat.SetInitialValues(nsStyleImageLayers::LayerType::Background);
initialRepeat.SetInitialValues();
SetImageLayerPairList(aContext, *aRuleData->ValueForBackgroundRepeat(),
bg->mImage.mLayers,
parentBG->mImage.mLayers,
@ -9960,7 +9960,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
// mask-repeat: enum, inherit, initial [pair list]
nsStyleImageLayers::Repeat initialRepeat;
initialRepeat.SetInitialValues(nsStyleImageLayers::LayerType::Mask);
initialRepeat.SetInitialValues();
SetImageLayerPairList(aContext, *aRuleData->ValueForMaskRepeat(),
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,

View File

@ -2765,33 +2765,6 @@ nsStyleImageLayers::Size::operator==(const Size& aOther) const
(mHeightType != eLengthPercentage || mHeight == aOther.mHeight);
}
bool
nsStyleImageLayers::Repeat::IsInitialValue(LayerType aType) const
{
if (aType == LayerType::Background) {
return mXRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT &&
mYRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT;
} else {
MOZ_ASSERT(aType == LayerType::Mask);
return mXRepeat == NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT &&
mYRepeat == NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT;
}
}
void
nsStyleImageLayers::Repeat::SetInitialValues(LayerType aType)
{
if (aType == LayerType::Background) {
mXRepeat = NS_STYLE_IMAGELAYER_REPEAT_REPEAT;
mYRepeat = NS_STYLE_IMAGELAYER_REPEAT_REPEAT;
} else {
MOZ_ASSERT(aType == LayerType::Mask);
mXRepeat = NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT;
mYRepeat = NS_STYLE_IMAGELAYER_REPEAT_NO_REPEAT;
}
}
nsStyleImageLayers::Layer::Layer()
: mClip(NS_STYLE_IMAGELAYER_CLIP_BORDER)
, mAttachment(NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL)
@ -2810,7 +2783,7 @@ nsStyleImageLayers::Layer::~Layer()
void
nsStyleImageLayers::Layer::Initialize(nsStyleImageLayers::LayerType aType)
{
mRepeat.SetInitialValues(aType);
mRepeat.SetInitialValues();
float initialPositionValue =
nsStyleImageLayers::GetInitialPositionForLayerType(aType);

View File

@ -745,7 +745,10 @@ struct nsStyleImageLayers {
// Initialize nothing
Repeat() {}
bool IsInitialValue(LayerType aType) const;
bool IsInitialValue() const {
return mXRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT &&
mYRepeat == NS_STYLE_IMAGELAYER_REPEAT_REPEAT;
}
bool DependsOnPositioningAreaSize() const {
return mXRepeat == NS_STYLE_IMAGELAYER_REPEAT_SPACE ||
@ -753,7 +756,10 @@ struct nsStyleImageLayers {
}
// Initialize to initial values
void SetInitialValues(LayerType aType);
void SetInitialValues() {
mXRepeat = NS_STYLE_IMAGELAYER_REPEAT_REPEAT;
mYRepeat = NS_STYLE_IMAGELAYER_REPEAT_REPEAT;
}
bool operator==(const Repeat& aOther) const {
return mXRepeat == aOther.mXRepeat &&