diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 7c5099f554dd..acb1e41a9565 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -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); diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 7a35741a3ed3..766eea29085f 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -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)) { diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 60bb76fc4fa5..4a1041e26d96 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -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, diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 16d9e80d9a5e..f7ba8625f572 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -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); diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 5a7e85197a30..24ab5e3d14ee 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -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 &&