mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 686281 - Remove nsStyleSVGReset::mMask; r=dbaron
This commit is contained in:
parent
2372884d57
commit
aa422109eb
@ -6044,10 +6044,11 @@ nsComputedDOMStyle::DoGetMask()
|
||||
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
|
||||
if (svg->mMask)
|
||||
val->SetURI(svg->mMask);
|
||||
else
|
||||
if (firstLayer.mSourceURI) {
|
||||
val->SetURI(firstLayer.mSourceURI);
|
||||
} else {
|
||||
val->SetIdent(eCSSKeyword_none);
|
||||
}
|
||||
|
||||
return val.forget();
|
||||
}
|
||||
|
@ -6465,6 +6465,22 @@ struct BackgroundItemComputer<nsCSSValueList, nsStyleImage>
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct BackgroundItemComputer<nsCSSValueList, nsCOMPtr<nsIURI> >
|
||||
{
|
||||
static void ComputeValue(nsStyleContext* aStyleContext,
|
||||
const nsCSSValueList* aSpecifiedValue,
|
||||
nsCOMPtr<nsIURI>& aComputedValue,
|
||||
RuleNodeCacheConditions& aConditions)
|
||||
{
|
||||
if (eCSSUnit_Image == aSpecifiedValue->mValue.GetUnit()) {
|
||||
aComputedValue = aSpecifiedValue->mValue.GetURLValue();
|
||||
} else if (eCSSUnit_Null != aSpecifiedValue->mValue.GetUnit()) {
|
||||
aComputedValue = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Helper function for ComputePositionValue.
|
||||
* This function computes a single PositionCoord from two nsCSSValue objects,
|
||||
* which represent an edge and an offset from that edge.
|
||||
@ -9731,24 +9747,6 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
|
||||
NS_NOTREACHED("unexpected unit");
|
||||
}
|
||||
|
||||
// mask: url, none, inherit
|
||||
const nsCSSValue* maskValue = aRuleData->ValueForMaskImage();
|
||||
if (eCSSUnit_List == maskValue->GetUnit() ||
|
||||
eCSSUnit_ListDep == maskValue->GetUnit()) {
|
||||
const nsCSSValue& item = maskValue->GetListValue()->mValue;
|
||||
if (eCSSUnit_URL == item.GetUnit() ||
|
||||
eCSSUnit_Image == item.GetUnit()) {
|
||||
svgReset->mMask = item.GetURLValue();
|
||||
}
|
||||
} else if (eCSSUnit_None == maskValue->GetUnit() ||
|
||||
eCSSUnit_Initial == maskValue->GetUnit() ||
|
||||
eCSSUnit_Unset == maskValue->GetUnit()) {
|
||||
svgReset->mMask = nullptr;
|
||||
} else if (eCSSUnit_Inherit == maskValue->GetUnit()) {
|
||||
conditions.SetUncacheable();
|
||||
svgReset->mMask = parentSVGReset->mMask;
|
||||
}
|
||||
|
||||
// mask-type: enum, inherit, initial
|
||||
SetDiscrete(*aRuleData->ValueForMaskType(),
|
||||
svgReset->mMaskType,
|
||||
@ -9769,6 +9767,13 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
|
||||
initialImage, parentSVGReset->mLayers.mImageCount,
|
||||
svgReset->mLayers.mImageCount,
|
||||
maxItemCount, rebuild, conditions);
|
||||
SetImageLayerList(aContext, *aRuleData->ValueForMaskImage(),
|
||||
svgReset->mLayers.mLayers,
|
||||
parentSVGReset->mLayers.mLayers,
|
||||
&nsStyleImageLayers::Layer::mSourceURI,
|
||||
nsCOMPtr<nsIURI>(), parentSVGReset->mLayers.mImageCount,
|
||||
svgReset->mLayers.mImageCount,
|
||||
maxItemCount, rebuild, conditions);
|
||||
|
||||
// mask-repeat: enum, inherit, initial [pair list]
|
||||
nsStyleImageLayers::Repeat initialRepeat;
|
||||
@ -9851,6 +9856,9 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
|
||||
FillBackgroundList(svgReset->mLayers.mLayers,
|
||||
&nsStyleImageLayers::Layer::mImage,
|
||||
svgReset->mLayers.mImageCount, fillCount);
|
||||
FillBackgroundList(svgReset->mLayers.mLayers,
|
||||
&nsStyleImageLayers::Layer::mSourceURI,
|
||||
svgReset->mLayers.mImageCount, fillCount);
|
||||
FillBackgroundList(svgReset->mLayers.mLayers,
|
||||
&nsStyleImageLayers::Layer::mRepeat,
|
||||
svgReset->mLayers.mRepeatCount, fillCount);
|
||||
|
@ -1246,7 +1246,6 @@ nsStyleSVGReset::nsStyleSVGReset()
|
||||
mStopColor = NS_RGB(0,0,0);
|
||||
mFloodColor = NS_RGB(0,0,0);
|
||||
mLightingColor = NS_RGB(255,255,255);
|
||||
mMask = nullptr;
|
||||
mStopOpacity = 1.0f;
|
||||
mFloodOpacity = 1.0f;
|
||||
mDominantBaseline = NS_STYLE_DOMINANT_BASELINE_AUTO;
|
||||
@ -1268,7 +1267,6 @@ nsStyleSVGReset::nsStyleSVGReset(const nsStyleSVGReset& aSource)
|
||||
mLightingColor = aSource.mLightingColor;
|
||||
mClipPath = aSource.mClipPath;
|
||||
mFilters = aSource.mFilters;
|
||||
mMask = aSource.mMask;
|
||||
mStopOpacity = aSource.mStopOpacity;
|
||||
mFloodOpacity = aSource.mFloodOpacity;
|
||||
mDominantBaseline = aSource.mDominantBaseline;
|
||||
@ -1289,13 +1287,12 @@ nsChangeHint nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aOther) cons
|
||||
nsChangeHint hint = nsChangeHint(0);
|
||||
|
||||
if (mClipPath != aOther.mClipPath ||
|
||||
!EqualURIs(mMask, aOther.mMask) ||
|
||||
mFilters != aOther.mFilters) {
|
||||
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
|
||||
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
|
||||
// We only actually need to update the overflow area for filter
|
||||
// changes. However, mask and clip-path changes require that we
|
||||
// update the PreEffectsBBoxProperty, which is done during overflow
|
||||
// changes. However, clip-path changes require that we update
|
||||
// the PreEffectsBBoxProperty, which is done during overflow
|
||||
// computation.
|
||||
NS_UpdateHint(hint, nsChangeHint_UpdateOverflow);
|
||||
}
|
||||
@ -2342,7 +2339,7 @@ bool
|
||||
nsStyleImageLayers::HasLayerWithImage() const
|
||||
{
|
||||
for (uint32_t i = 0; i < mImageCount; i++) {
|
||||
if (!mLayers[i].mImage.IsEmpty()) {
|
||||
if (mLayers[i].mSourceURI) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -2536,27 +2533,36 @@ nsStyleImageLayers::Layer::operator==(const Layer& aOther) const
|
||||
mSize == aOther.mSize &&
|
||||
mImage == aOther.mImage &&
|
||||
mMaskMode == aOther.mMaskMode &&
|
||||
mComposite == aOther.mComposite;
|
||||
mComposite == aOther.mComposite &&
|
||||
EqualURIs(mSourceURI, aOther.mSourceURI);
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aOther) const
|
||||
{
|
||||
nsChangeHint hint = nsChangeHint(0);
|
||||
if (mAttachment != aOther.mAttachment ||
|
||||
mClip != aOther.mClip ||
|
||||
mOrigin != aOther.mOrigin ||
|
||||
mRepeat != aOther.mRepeat ||
|
||||
mBlendMode != aOther.mBlendMode ||
|
||||
mSize != aOther.mSize ||
|
||||
mImage != aOther.mImage ||
|
||||
mMaskMode != aOther.mMaskMode ||
|
||||
mComposite != aOther.mComposite) {
|
||||
if (!EqualURIs(mSourceURI, aOther.mSourceURI)) {
|
||||
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
|
||||
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
|
||||
// Mask changes require that we update the PreEffectsBBoxProperty,
|
||||
// which is done during overflow computation.
|
||||
NS_UpdateHint(hint, nsChangeHint_UpdateOverflow);
|
||||
} else if (mAttachment != aOther.mAttachment ||
|
||||
mClip != aOther.mClip ||
|
||||
mOrigin != aOther.mOrigin ||
|
||||
mRepeat != aOther.mRepeat ||
|
||||
mBlendMode != aOther.mBlendMode ||
|
||||
mSize != aOther.mSize ||
|
||||
mImage != aOther.mImage ||
|
||||
mMaskMode != aOther.mMaskMode ||
|
||||
mComposite != aOther.mComposite) {
|
||||
hint |= nsChangeHint_RepaintFrame;
|
||||
}
|
||||
|
||||
if (mPosition != aOther.mPosition) {
|
||||
hint |= nsChangeHint_SchedulePaint;
|
||||
}
|
||||
|
||||
return hint;
|
||||
}
|
||||
|
||||
|
@ -547,6 +547,13 @@ struct nsStyleImageLayers {
|
||||
friend struct Layer;
|
||||
struct Layer {
|
||||
nsStyleImage mImage; // [reset]
|
||||
nsCOMPtr<nsIURI> mSourceURI; // [reset]
|
||||
// mask-only property
|
||||
// This property is used for mask layer only.
|
||||
// For a background layer, it should always
|
||||
// be the initial value, which is nullptr.
|
||||
// Store mask-image URI so that we can resolve
|
||||
// SVG mask path later.
|
||||
Position mPosition; // [reset] See nsStyleConsts.h
|
||||
Size mSize; // [reset]
|
||||
uint8_t mClip; // [reset] See nsStyleConsts.h
|
||||
@ -3479,7 +3486,6 @@ struct nsStyleSVGReset
|
||||
nsStyleImageLayers mLayers;
|
||||
nsStyleClipPath mClipPath; // [reset]
|
||||
nsTArray<nsStyleFilter> mFilters; // [reset]
|
||||
nsCOMPtr<nsIURI> mMask; // [reset]
|
||||
nscolor mStopColor; // [reset]
|
||||
nscolor mFloodColor; // [reset]
|
||||
nscolor mLightingColor; // [reset]
|
||||
|
@ -559,8 +559,14 @@ nsSVGEffects::GetEffectProperties(nsIFrame *aFrame)
|
||||
} else {
|
||||
result.mClipPath = nullptr;
|
||||
}
|
||||
result.mMask =
|
||||
GetPaintingProperty(style->mMask, aFrame, MaskProperty());
|
||||
|
||||
// FIXME: Bug 1228280.
|
||||
// Before fixing bug 1228280, we support only single svg mask as before.
|
||||
MOZ_ASSERT(style->mLayers.mImageCount > 0);
|
||||
nsCOMPtr<nsIURI> uri = style->mLayers.mLayers[0].mSourceURI;
|
||||
result.mMask = uri ? GetPaintingProperty(uri, aFrame, MaskProperty()) :
|
||||
nullptr;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -155,9 +155,8 @@ nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame)
|
||||
const nsStyleSVGReset *style = aFrame->StyleSVGReset();
|
||||
bool hasValidLayers = style->mLayers.HasLayerWithImage();
|
||||
|
||||
return (style->HasFilters() || style->mMask ||
|
||||
(style->mClipPath.GetType() != NS_STYLE_CLIP_PATH_NONE) ||
|
||||
hasValidLayers);
|
||||
return (style->HasFilters() || hasValidLayers ||
|
||||
(style->mClipPath.GetType() != NS_STYLE_CLIP_PATH_NONE));
|
||||
}
|
||||
|
||||
// For non-SVG frames, this gives the offset to the frame's "user space".
|
||||
|
Loading…
Reference in New Issue
Block a user