forked from mirrors/gecko-dev
Bug 1856213 - remove some queryinterface calls r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D190022
This commit is contained in:
parent
22622ef99d
commit
c25d6d1667
13 changed files with 37 additions and 50 deletions
|
|
@ -868,7 +868,9 @@ class nsINode : public mozilla::dom::EventTarget {
|
|||
}
|
||||
|
||||
virtual bool IsSVGAnimationElement() const { return false; }
|
||||
virtual bool IsSVGComponentTransferFunctionElement() const { return false; }
|
||||
virtual bool IsSVGFilterPrimitiveElement() const { return false; }
|
||||
virtual bool IsSVGFilterPrimitiveChildElement() const { return false; }
|
||||
virtual bool IsSVGGeometryElement() const { return false; }
|
||||
virtual bool IsSVGGraphicsElement() const { return false; }
|
||||
|
||||
|
|
@ -909,6 +911,14 @@ class nsINode : public mozilla::dom::EventTarget {
|
|||
nsGkAtoms::h4, nsGkAtoms::h5, nsGkAtoms::h6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the conditional processing attributes other than
|
||||
* systemLanguage "return true" if they apply to and are specified
|
||||
* on the given SVG element. Returns true if this element should be
|
||||
* rendered, false if it should not.
|
||||
*/
|
||||
virtual bool PassesConditionalProcessingTests() const { return true; }
|
||||
|
||||
/**
|
||||
* Insert a content node before another or at the end.
|
||||
* This method handles calling BindToTree on the child appropriately.
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ class SVGAnimationElement : public SVGAnimationElementBase, public SVGTests {
|
|||
SVGAnimationElementBase)
|
||||
|
||||
bool IsSVGAnimationElement() const final { return true; }
|
||||
bool PassesConditionalProcessingTests() const final {
|
||||
return SVGTests::PassesConditionalProcessingTests();
|
||||
}
|
||||
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override = 0;
|
||||
|
||||
// nsIContent specializations
|
||||
|
|
|
|||
|
|
@ -12,13 +12,6 @@
|
|||
#include "SVGAnimatedNumberList.h"
|
||||
#include "mozilla/dom/SVGFilters.h"
|
||||
|
||||
#define NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID \
|
||||
{ \
|
||||
0xafab106d, 0xbc18, 0x4f7f, { \
|
||||
0x9e, 0x29, 0xfe, 0xb4, 0xb0, 0x16, 0x5f, 0xf4 \
|
||||
} \
|
||||
}
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
||||
class DOMSVGAnimatedNumberList;
|
||||
|
|
@ -37,11 +30,10 @@ class SVGComponentTransferFunctionElement
|
|||
public:
|
||||
using ComponentTransferAttributes = gfx::ComponentTransferAttributes;
|
||||
|
||||
// interfaces:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(
|
||||
NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID)
|
||||
NS_IMPL_FROMNODE_HELPER(SVGComponentTransferFunctionElement,
|
||||
IsSVGComponentTransferFunctionElement())
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
bool IsSVGComponentTransferFunctionElement() const final { return true; }
|
||||
|
||||
bool AttributeAffectsRendering(int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute) const override;
|
||||
|
|
@ -81,9 +73,6 @@ class SVGComponentTransferFunctionElement
|
|||
static EnumInfo sEnumInfo[1];
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(SVGComponentTransferFunctionElement,
|
||||
NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID)
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
||||
nsresult NS_NewSVGFEFuncRElement(
|
||||
|
|
|
|||
|
|
@ -57,11 +57,8 @@ SVGFEComponentTransferElement::GetPrimitiveDescription(
|
|||
|
||||
for (nsIContent* childContent = nsINode::GetFirstChild(); childContent;
|
||||
childContent = childContent->GetNextSibling()) {
|
||||
RefPtr<SVGComponentTransferFunctionElement> child;
|
||||
CallQueryInterface(
|
||||
childContent,
|
||||
(SVGComponentTransferFunctionElement**)getter_AddRefs(child));
|
||||
if (child) {
|
||||
if (auto* child =
|
||||
SVGComponentTransferFunctionElement::FromNode(childContent)) {
|
||||
childForChannel[child->GetChannel()] = child;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ SVGElement::NumberInfo SVGFEDistantLightElement::sNumberInfo[2] = {
|
|||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDistantLightElement)
|
||||
|
||||
// nsFEUnstyledElement methods
|
||||
// SVGFilterPrimitiveChildElement methods
|
||||
|
||||
bool SVGFEDistantLightElement::AttributeAffectsRendering(
|
||||
int32_t aNameSpaceID, nsAtom* aAttribute) const {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ SVGElement::StringInfo SVGFEMergeNodeElement::sStringInfo[1] = {
|
|||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMergeNodeElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
// SVGFilterPrimitiveChildElement methods
|
||||
|
||||
bool SVGFEMergeNodeElement::AttributeAffectsRendering(
|
||||
int32_t aNameSpaceID, nsAtom* aAttribute) const {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ SVGElement::NumberInfo SVGFEPointLightElement::sNumberInfo[3] = {
|
|||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEPointLightElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
// SVGFilterPrimitiveChildElement methods
|
||||
|
||||
bool SVGFEPointLightElement::AttributeAffectsRendering(
|
||||
int32_t aNameSpaceID, nsAtom* aAttribute) const {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ SVGElement::NumberInfo SVGFESpotLightElement::sNumberInfo[8] = {
|
|||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFESpotLightElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
// SVGFilterPrimitiveChildElement methods
|
||||
|
||||
bool SVGFESpotLightElement::AttributeAffectsRendering(
|
||||
int32_t aNameSpaceID, nsAtom* aAttribute) const {
|
||||
|
|
|
|||
|
|
@ -162,19 +162,7 @@ SVGElement::EnumInfo SVGComponentTransferFunctionElement::sEnumInfo[1] = {
|
|||
{nsGkAtoms::type, sTypeMap, SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY}};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGComponentTransferFunctionElement,
|
||||
SVGComponentTransferFunctionElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGComponentTransferFunctionElement,
|
||||
SVGComponentTransferFunctionElementBase)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(SVGComponentTransferFunctionElement)
|
||||
NS_INTERFACE_MAP_ENTRY_CONCRETE(SVGComponentTransferFunctionElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGComponentTransferFunctionElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
// nsSVGFilterPrimitiveChildElement methods
|
||||
|
||||
bool SVGComponentTransferFunctionElement::AttributeAffectsRendering(
|
||||
int32_t aNameSpaceID, nsAtom* aAttribute) const {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,11 @@ class SVGFilterPrimitiveChildElement
|
|||
: SVGFilterPrimitiveChildElementBase(std::move(aNodeInfo)) {}
|
||||
|
||||
public:
|
||||
NS_IMPL_FROMNODE_HELPER(SVGFilterPrimitiveChildElement,
|
||||
IsSVGFilterPrimitiveChildElement())
|
||||
|
||||
bool IsSVGFilterPrimitiveChildElement() const final { return true; }
|
||||
|
||||
nsresult Clone(mozilla::dom::NodeInfo*, nsINode** aResult) const override = 0;
|
||||
|
||||
// returns true if changes to the attribute should cause us to
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ class SVGGraphicsElement : public SVGGraphicsElementBase, public SVGTests {
|
|||
|
||||
using nsINode::Clone;
|
||||
// Overrides SVGTests.
|
||||
bool PassesConditionalProcessingTests() const final {
|
||||
return SVGTests::PassesConditionalProcessingTests();
|
||||
}
|
||||
SVGElement* AsSVGElement() final { return this; }
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -32,8 +32,7 @@ nsChangeHint SVGTransformableElement::GetAttributeChangeHint(
|
|||
SVGElement::GetAttributeChangeHint(aAttribute, aModType);
|
||||
if (aAttribute == nsGkAtoms::transform ||
|
||||
aAttribute == nsGkAtoms::mozAnimateMotionDummyAttr) {
|
||||
nsIFrame* frame =
|
||||
const_cast<SVGTransformableElement*>(this)->GetPrimaryFrame();
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
retval |= nsChangeHint_InvalidateRenderingObservers;
|
||||
if (!frame || frame->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@
|
|||
#undef NOISY_FIRST_LETTER
|
||||
|
||||
#include "nsMathMLParts.h"
|
||||
#include "mozilla/dom/SVGTests.h"
|
||||
#include "mozilla/SVGGradientFrame.h"
|
||||
|
||||
#include "nsRefreshDriver.h"
|
||||
|
|
@ -4844,13 +4843,6 @@ nsIFrame* nsCSSFrameConstructor::ConstructMarker(
|
|||
#define SIMPLE_SVG_CREATE(_tag, _func) \
|
||||
{ nsGkAtoms::_tag, SIMPLE_SVG_FCDATA(_func) }
|
||||
|
||||
static bool IsFilterPrimitiveChildTag(const nsAtom* aTag) {
|
||||
return aTag == nsGkAtoms::feDistantLight || aTag == nsGkAtoms::fePointLight ||
|
||||
aTag == nsGkAtoms::feSpotLight || aTag == nsGkAtoms::feFuncR ||
|
||||
aTag == nsGkAtoms::feFuncG || aTag == nsGkAtoms::feFuncB ||
|
||||
aTag == nsGkAtoms::feFuncA || aTag == nsGkAtoms::feMergeNode;
|
||||
}
|
||||
|
||||
/* static */
|
||||
const nsCSSFrameConstructor::FrameConstructionData*
|
||||
nsCSSFrameConstructor::FindSVGData(const Element& aElement,
|
||||
|
|
@ -4923,8 +4915,7 @@ nsCSSFrameConstructor::FindSVGData(const Element& aElement,
|
|||
return &sMarkerSVGData;
|
||||
}
|
||||
|
||||
nsCOMPtr<SVGTests> tests = do_QueryInterface(const_cast<Element*>(&aElement));
|
||||
if (tests && !tests->PassesConditionalProcessingTests()) {
|
||||
if (!aElement.PassesConditionalProcessingTests()) {
|
||||
// Elements with failing conditional processing attributes never get
|
||||
// rendered. Note that this is not where we select which frame in a
|
||||
// <switch> to render! That happens in SVGSwitchFrame::PaintSVG.
|
||||
|
|
@ -4966,8 +4957,10 @@ nsCSSFrameConstructor::FindSVGData(const Element& aElement,
|
|||
// primitive.
|
||||
bool parentIsFEContainerFrame =
|
||||
aParentFrame && aParentFrame->IsSVGFEContainerFrame();
|
||||
if ((parentIsFEContainerFrame && !IsFilterPrimitiveChildTag(tag)) ||
|
||||
(!parentIsFEContainerFrame && IsFilterPrimitiveChildTag(tag))) {
|
||||
if ((parentIsFEContainerFrame &&
|
||||
!aElement.IsSVGFilterPrimitiveChildElement()) ||
|
||||
(!parentIsFEContainerFrame &&
|
||||
aElement.IsSVGFilterPrimitiveChildElement())) {
|
||||
return &sSuppressData;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue