diff options
author | Moonchild <mcwerewolf@wolfbeast.com> | 2019-03-13 07:49:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-13 07:49:07 +0100 |
commit | bf0413359245579e9509146d42cd5547e35da695 (patch) | |
tree | 8218d4f60d9eccacbf42df8cb88094a082d401b4 /layout/style/nsComputedDOMStyle.cpp | |
parent | 51b821b3fdc5a7eab2369cb6a6680598a6264b08 (diff) | |
parent | 709bc24e9110eba12f94cfcb8db00a8338ac4098 (diff) | |
download | UXP-bf0413359245579e9509146d42cd5547e35da695.tar UXP-bf0413359245579e9509146d42cd5547e35da695.tar.gz UXP-bf0413359245579e9509146d42cd5547e35da695.tar.lz UXP-bf0413359245579e9509146d42cd5547e35da695.tar.xz UXP-bf0413359245579e9509146d42cd5547e35da695.zip |
Merge pull request #998 from MoonchildProductions/master
Merge master into Sync-weave
Diffstat (limited to 'layout/style/nsComputedDOMStyle.cpp')
-rw-r--r-- | layout/style/nsComputedDOMStyle.cpp | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 4f8d3edf6..65c1d698c 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -74,6 +74,30 @@ NS_NewComputedDOMStyle(dom::Element* aElement, const nsAString& aPseudoElt, return computedStyle.forget(); } +static nsDOMCSSValueList* +GetROCSSValueList(bool aCommaDelimited) +{ + return new nsDOMCSSValueList(aCommaDelimited, true); +} + +template<typename T> +already_AddRefed<CSSValue> +GetBackgroundList(T nsStyleImageLayers::Layer::* aMember, + uint32_t nsStyleImageLayers::* aCount, + const nsStyleImageLayers& aLayers, + const KTableEntry aTable[]) +{ + RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true); + + for (uint32_t i = 0, i_end = aLayers.*aCount; i < i_end; ++i) { + RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue; + val->SetIdent(nsCSSProps::ValueToKeywordEnum(aLayers.mLayers[i].*aMember, aTable)); + valueList->AppendCSSValue(val.forget()); + } + + return valueList.forget(); +} + /** * An object that represents the ordered set of properties that are exposed on * an nsComputedDOMStyle object and how their computed values can be obtained. @@ -280,7 +304,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsComputedDOMStyle) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContent) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsComputedDOMStyle) @@ -1803,24 +1826,6 @@ nsComputedDOMStyle::DoGetFontVariantPosition() } already_AddRefed<CSSValue> -nsComputedDOMStyle::GetBackgroundList(uint8_t nsStyleImageLayers::Layer::* aMember, - uint32_t nsStyleImageLayers::* aCount, - const nsStyleImageLayers& aLayers, - const KTableEntry aTable[]) -{ - RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true); - - for (uint32_t i = 0, i_end = aLayers.*aCount; i < i_end; ++i) { - RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue; - val->SetIdent(nsCSSProps::ValueToKeywordEnum(aLayers.mLayers[i].*aMember, - aTable)); - valueList->AppendCSSValue(val.forget()); - } - - return valueList.forget(); -} - -already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetBackgroundAttachment() { return GetBackgroundList(&nsStyleImageLayers::Layer::mAttachment, @@ -2367,7 +2372,7 @@ nsComputedDOMStyle::DoGetBackgroundOrigin() return GetBackgroundList(&nsStyleImageLayers::Layer::mOrigin, &nsStyleImageLayers::mOriginCount, StyleBackground()->mImage, - nsCSSProps::kImageLayerOriginKTable); + nsCSSProps::kBackgroundOriginKTable); } void @@ -5013,12 +5018,6 @@ nsComputedDOMStyle::DoGetTop() return GetOffsetWidthFor(NS_SIDE_TOP); } -nsDOMCSSValueList* -nsComputedDOMStyle::GetROCSSValueList(bool aCommaDelimited) -{ - return new nsDOMCSSValueList(aCommaDelimited, true); -} - already_AddRefed<CSSValue> nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide) { @@ -6180,8 +6179,8 @@ nsComputedDOMStyle::DoGetMask() // need to support computed style for the cases where it used to be // a longhand. if (svg->mMask.mImageCount > 1 || - firstLayer.mClip != NS_STYLE_IMAGELAYER_CLIP_BORDER || - firstLayer.mOrigin != NS_STYLE_IMAGELAYER_ORIGIN_BORDER || + firstLayer.mClip != StyleGeometryBox::Border || + firstLayer.mOrigin != StyleGeometryBox::Border || firstLayer.mComposite != NS_STYLE_MASK_COMPOSITE_ADD || firstLayer.mMaskMode != NS_STYLE_MASK_MODE_MATCH_SOURCE || !nsStyleImageLayers::IsInitialPositionForLayerType( @@ -6200,14 +6199,13 @@ nsComputedDOMStyle::DoGetMask() return val.forget(); } -#ifdef MOZ_ENABLE_MASK_AS_SHORTHAND already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetMaskClip() { return GetBackgroundList(&nsStyleImageLayers::Layer::mClip, &nsStyleImageLayers::mClipCount, StyleSVGReset()->mMask, - nsCSSProps::kImageLayerOriginKTable); + nsCSSProps::kMaskClipKTable); } already_AddRefed<CSSValue> @@ -6241,7 +6239,7 @@ nsComputedDOMStyle::DoGetMaskOrigin() return GetBackgroundList(&nsStyleImageLayers::Layer::mOrigin, &nsStyleImageLayers::mOriginCount, StyleSVGReset()->mMask, - nsCSSProps::kImageLayerOriginKTable); + nsCSSProps::kMaskOriginKTable); } already_AddRefed<CSSValue> @@ -6278,7 +6276,6 @@ nsComputedDOMStyle::DoGetMaskSize() const nsStyleImageLayers& layers = StyleSVGReset()->mMask; return DoGetImageLayerSize(layers); } -#endif already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetMaskType() |