summaryrefslogtreecommitdiffstats
path: root/layout/style/nsRuleNode.cpp
diff options
context:
space:
mode:
authoryami <34216515+kn-yami@users.noreply.github.com>2018-12-16 16:17:20 +0100
committeryami <34216515+kn-yami@users.noreply.github.com>2019-02-02 18:06:10 +0100
commitb241a84d884293e1ce49a79c75e362c02c0899f9 (patch)
tree4d1df04790cc8c785141e8dd8ffea9e6da5a0c02 /layout/style/nsRuleNode.cpp
parentfa311a4cae5ea526e848adc4f49c6aa0b700702c (diff)
downloadUXP-b241a84d884293e1ce49a79c75e362c02c0899f9.tar
UXP-b241a84d884293e1ce49a79c75e362c02c0899f9.tar.gz
UXP-b241a84d884293e1ce49a79c75e362c02c0899f9.tar.lz
UXP-b241a84d884293e1ce49a79c75e362c02c0899f9.tar.xz
UXP-b241a84d884293e1ce49a79c75e362c02c0899f9.zip
issue #908 - implement missing parts of CSS mask
Diffstat (limited to 'layout/style/nsRuleNode.cpp')
-rw-r--r--layout/style/nsRuleNode.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
index 9b9fc3948..6bcef02a0 100644
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -22,6 +22,7 @@
#include "mozilla/Unused.h"
#include "mozilla/css/Declaration.h"
+#include "mozilla/TypeTraits.h"
#include "nsAlgorithm.h" // for clamped()
#include "nsRuleNode.h"
@@ -6800,6 +6801,21 @@ struct BackgroundItemComputer<nsCSSValueList, RefPtr<css::URLValueData>>
}
};
+template <typename T>
+struct BackgroundItemComputer<nsCSSValueList, T>
+{
+ typedef typename EnableIf<IsEnum<T>::value, T>::Type ComputedType;
+
+ static void ComputeValue(nsStyleContext* aStyleContext,
+ const nsCSSValueList* aSpecifiedValue,
+ ComputedType& aComputedValue,
+ RuleNodeCacheConditions& aConditions)
+ {
+ aComputedValue =
+ static_cast<T>(aSpecifiedValue->mValue.GetIntValue());
+ }
+};
+
/* Helper function for ComputePositionValue.
* This function computes a single PositionCoord from two nsCSSValue objects,
* which represent an edge and an offset from that edge.
@@ -7353,7 +7369,7 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mClip,
- uint8_t(NS_STYLE_IMAGELAYER_CLIP_BORDER),
+ StyleGeometryBox::Border,
parentBG->mImage.mClipCount,
bg->mImage.mClipCount, maxItemCount, rebuild, conditions);
@@ -7372,7 +7388,7 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
- uint8_t(NS_STYLE_IMAGELAYER_ORIGIN_PADDING),
+ StyleGeometryBox::Padding,
parentBG->mImage.mOriginCount,
bg->mImage.mOriginCount, maxItemCount, rebuild,
conditions);
@@ -10005,7 +10021,6 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
parentSVGReset->mMaskType,
NS_STYLE_MASK_TYPE_LUMINANCE);
-#ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
uint32_t maxItemCount = 1;
bool rebuild = false;
@@ -10043,7 +10058,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mClip,
- uint8_t(NS_STYLE_IMAGELAYER_CLIP_BORDER),
+ StyleGeometryBox::Border,
parentSVGReset->mMask.mClipCount,
svgReset->mMask.mClipCount, maxItemCount, rebuild,
conditions);
@@ -10053,7 +10068,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
- uint8_t(NS_STYLE_IMAGELAYER_ORIGIN_BORDER),
+ StyleGeometryBox::Border,
parentSVGReset->mMask.mOriginCount,
svgReset->mMask.mOriginCount, maxItemCount, rebuild,
conditions);
@@ -10113,21 +10128,6 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
if (rebuild) {
FillAllBackgroundLists(svgReset->mMask, maxItemCount);
}
-#else
- // mask: none | <url>
- const nsCSSValue* maskValue = aRuleData->ValueForMask();
- if (eCSSUnit_URL == maskValue->GetUnit()) {
- svgReset->mMask.mLayers[0].mSourceURI = maskValue->GetURLStructValue();
- } else if (eCSSUnit_None == maskValue->GetUnit() ||
- eCSSUnit_Initial == maskValue->GetUnit() ||
- eCSSUnit_Unset == maskValue->GetUnit()) {
- svgReset->mMask.mLayers[0].mSourceURI = nullptr;
- } else if (eCSSUnit_Inherit == maskValue->GetUnit()) {
- conditions.SetUncacheable();
- svgReset->mMask.mLayers[0].mSourceURI =
- parentSVGReset->mMask.mLayers[0].mSourceURI;
- }
-#endif
COMPUTE_END_RESET(SVGReset, svgReset)
}