Bug 1869202 - taint filter if input is currentColor r=emilio
See https://www.w3.org/TR/filter-effects-1/#tainted-filter-primitives Differential Revision: https://phabricator.services.mozilla.com/D195996
This commit is contained in:
@@ -88,8 +88,7 @@ FilterPrimitiveDescription SVGFEDropShadowElement::GetPrimitiveDescription(
|
|||||||
atts.mStdDeviation = Size(stdX, stdY);
|
atts.mStdDeviation = Size(stdX, stdY);
|
||||||
atts.mOffset = offset;
|
atts.mOffset = offset;
|
||||||
|
|
||||||
nsIFrame* frame = GetPrimaryFrame();
|
if (const auto* frame = GetPrimaryFrame()) {
|
||||||
if (frame) {
|
|
||||||
const nsStyleSVGReset* styleSVGReset = frame->Style()->StyleSVGReset();
|
const nsStyleSVGReset* styleSVGReset = frame->Style()->StyleSVGReset();
|
||||||
sRGBColor color(
|
sRGBColor color(
|
||||||
sRGBColor::FromABGR(styleSVGReset->mFloodColor.CalcColor(frame)));
|
sRGBColor::FromABGR(styleSVGReset->mFloodColor.CalcColor(frame)));
|
||||||
@@ -101,6 +100,19 @@ FilterPrimitiveDescription SVGFEDropShadowElement::GetPrimitiveDescription(
|
|||||||
return FilterPrimitiveDescription(AsVariant(std::move(atts)));
|
return FilterPrimitiveDescription(AsVariant(std::move(atts)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SVGFEDropShadowElement::OutputIsTainted(
|
||||||
|
const nsTArray<bool>& aInputsAreTainted,
|
||||||
|
nsIPrincipal* aReferencePrincipal) {
|
||||||
|
if (const auto* frame = GetPrimaryFrame()) {
|
||||||
|
if (frame->Style()->StyleSVGReset()->mFloodColor.IsCurrentColor()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SVGFEDropShadowElementBase::OutputIsTainted(aInputsAreTainted,
|
||||||
|
aReferencePrincipal);
|
||||||
|
}
|
||||||
|
|
||||||
bool SVGFEDropShadowElement::AttributeAffectsRendering(
|
bool SVGFEDropShadowElement::AttributeAffectsRendering(
|
||||||
int32_t aNameSpaceID, nsAtom* aAttribute) const {
|
int32_t aNameSpaceID, nsAtom* aAttribute) const {
|
||||||
return SVGFEDropShadowElementBase::AttributeAffectsRendering(aNameSpaceID,
|
return SVGFEDropShadowElementBase::AttributeAffectsRendering(aNameSpaceID,
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ class SVGFEDropShadowElement final : public SVGFEDropShadowElementBase {
|
|||||||
SVGAnimatedString& GetResultImageName() override {
|
SVGAnimatedString& GetResultImageName() override {
|
||||||
return mStringAttributes[RESULT];
|
return mStringAttributes[RESULT];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
|
||||||
|
nsIPrincipal* aReferencePrincipal) override;
|
||||||
|
|
||||||
void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override;
|
void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override;
|
||||||
|
|
||||||
// nsIContent interface
|
// nsIContent interface
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ FilterPrimitiveDescription SVGFEFloodElement::GetPrimitiveDescription(
|
|||||||
const nsTArray<bool>& aInputsAreTainted,
|
const nsTArray<bool>& aInputsAreTainted,
|
||||||
nsTArray<RefPtr<SourceSurface>>& aInputImages) {
|
nsTArray<RefPtr<SourceSurface>>& aInputImages) {
|
||||||
FloodAttributes atts;
|
FloodAttributes atts;
|
||||||
nsIFrame* frame = GetPrimaryFrame();
|
if (const auto* frame = GetPrimaryFrame()) {
|
||||||
if (frame) {
|
|
||||||
const nsStyleSVGReset* styleSVGReset = frame->Style()->StyleSVGReset();
|
const nsStyleSVGReset* styleSVGReset = frame->Style()->StyleSVGReset();
|
||||||
sRGBColor color(
|
sRGBColor color(
|
||||||
sRGBColor::FromABGR(styleSVGReset->mFloodColor.CalcColor(frame)));
|
sRGBColor::FromABGR(styleSVGReset->mFloodColor.CalcColor(frame)));
|
||||||
@@ -50,6 +49,18 @@ FilterPrimitiveDescription SVGFEFloodElement::GetPrimitiveDescription(
|
|||||||
return FilterPrimitiveDescription(AsVariant(std::move(atts)));
|
return FilterPrimitiveDescription(AsVariant(std::move(atts)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SVGFEFloodElement::OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
|
||||||
|
nsIPrincipal* aReferencePrincipal) {
|
||||||
|
if (const auto* frame = GetPrimaryFrame()) {
|
||||||
|
if (frame->Style()->StyleSVGReset()->mFloodColor.IsCurrentColor()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SVGFEFloodElementBase::OutputIsTainted(aInputsAreTainted,
|
||||||
|
aReferencePrincipal);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsIContent methods
|
// nsIContent methods
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ class SVGFEFloodElement final : public SVGFEFloodElementBase {
|
|||||||
return mStringAttributes[RESULT];
|
return mStringAttributes[RESULT];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
|
||||||
|
nsIPrincipal* aReferencePrincipal) override;
|
||||||
|
|
||||||
// nsIContent interface
|
// nsIContent interface
|
||||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||||
|
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ LightType SVGFELightingElement::ComputeLightAttributes(
|
|||||||
bool SVGFELightingElement::AddLightingAttributes(
|
bool SVGFELightingElement::AddLightingAttributes(
|
||||||
mozilla::gfx::DiffuseLightingAttributes* aAttributes,
|
mozilla::gfx::DiffuseLightingAttributes* aAttributes,
|
||||||
SVGFilterInstance* aInstance) {
|
SVGFilterInstance* aInstance) {
|
||||||
nsIFrame* frame = GetPrimaryFrame();
|
const auto* frame = GetPrimaryFrame();
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -394,6 +394,19 @@ bool SVGFELightingElement::AddLightingAttributes(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SVGFELightingElement::OutputIsTainted(
|
||||||
|
const nsTArray<bool>& aInputsAreTainted,
|
||||||
|
nsIPrincipal* aReferencePrincipal) {
|
||||||
|
if (const auto* frame = GetPrimaryFrame()) {
|
||||||
|
if (frame->Style()->StyleSVGReset()->mLightingColor.IsCurrentColor()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return SVGFELightingElementBase::OutputIsTainted(aInputsAreTainted,
|
||||||
|
aReferencePrincipal);
|
||||||
|
}
|
||||||
|
|
||||||
bool SVGFELightingElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
bool SVGFELightingElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
||||||
nsAtom* aAttribute) const {
|
nsAtom* aAttribute) const {
|
||||||
return SVGFELightingElementBase::AttributeAffectsRendering(aNameSpaceID,
|
return SVGFELightingElementBase::AttributeAffectsRendering(aNameSpaceID,
|
||||||
|
|||||||
@@ -184,6 +184,10 @@ class SVGFELightingElement : public SVGFELightingElementBase {
|
|||||||
SVGAnimatedString& GetResultImageName() override {
|
SVGAnimatedString& GetResultImageName() override {
|
||||||
return mStringAttributes[RESULT];
|
return mStringAttributes[RESULT];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
|
||||||
|
nsIPrincipal* aReferencePrincipal) override;
|
||||||
|
|
||||||
void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override;
|
void GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-feblend-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fecomponenttransfer-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fecomposite-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-feconvolvematrix-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fediffuselighting-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fediffuselighting-003.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fediffuselighting-dynamic.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fedisplacementmap-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fedropshadow-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fedropshadow-003.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-feflood-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-feflood-dynamic.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fegaussianblur-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-femorphology-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-feoffset-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fespecularlighting-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fespecularlighting-003.html]
|
|
||||||
expected: FAIL
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[tainting-fetile-002.html]
|
|
||||||
expected: FAIL
|
|
||||||
Reference in New Issue
Block a user