Issue #2737 - Part 1: Base implementation of SVGGeometryElement.

Mostly mechanical changes to generalize path geometry for all SVG draw
elements. No user-exposed changes.
This commit is contained in:
Moonchild 2025-04-27 18:03:48 +02:00 committed by roytam1
commit fd4a224d1d
45 changed files with 368 additions and 319 deletions

View file

@ -13,10 +13,10 @@
#include "nsLayoutUtils.h"
#include "imgINotificationObserver.h"
#include "nsSVGEffects.h"
#include "nsSVGPathGeometryFrame.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGUtils.h"
#include "SVGContentUtils.h"
#include "SVGGeometryFrame.h"
#include "SVGImageContext.h"
#include "mozilla/dom/SVGImageElement.h"
#include "nsContentUtils.h"
@ -46,7 +46,7 @@ private:
nsSVGImageFrame *mFrame;
};
class nsSVGImageFrame : public nsSVGPathGeometryFrame
class nsSVGImageFrame : public SVGGeometryFrame
, public nsIReflowCallback
{
friend nsIFrame*
@ -54,7 +54,7 @@ class nsSVGImageFrame : public nsSVGPathGeometryFrame
protected:
explicit nsSVGImageFrame(nsStyleContext* aContext)
: nsSVGPathGeometryFrame(aContext)
: SVGGeometryFrame(aContext)
, mReflowCallbackPosted(false)
{
EnableVisibilityTracking();
@ -72,7 +72,7 @@ public:
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
virtual void ReflowSVG() override;
// nsSVGPathGeometryFrame methods:
// SVGGeometryFrame methods:
virtual uint16_t GetHitTestFlags() override;
// nsIFrame interface:
@ -154,7 +154,7 @@ nsSVGImageFrame::Init(nsIContent* aContent,
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::image),
"Content is not an SVG image!");
nsSVGPathGeometryFrame::Init(aContent, aParent, aPrevInFlow);
SVGGeometryFrame::Init(aContent, aParent, aPrevInFlow);
if (GetStateBits() & NS_FRAME_IS_NONDISPLAY) {
// Non-display frames are likely to be patterns, masks or the like.
@ -246,8 +246,8 @@ nsSVGImageFrame::AttributeChanged(int32_t aNameSpaceID,
}
}
return nsSVGPathGeometryFrame::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
return SVGGeometryFrame::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
}
void
@ -256,13 +256,13 @@ nsSVGImageFrame::OnVisibilityChange(Visibility aNewVisibility,
{
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
if (!imageLoader) {
nsSVGPathGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
SVGGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
return;
}
imageLoader->OnVisibilityChange(aNewVisibility, aNonvisibleAction);
nsSVGPathGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
SVGGeometryFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
}
gfx::Matrix
@ -505,7 +505,7 @@ nsSVGImageFrame::GetType() const
}
//----------------------------------------------------------------------
// nsSVGPathGeometryFrame methods:
// SVGGeometryFrame methods:
// Lie about our fill/stroke so that covered region and hit detection work properly