--- a/layout/svg/nsSVGUtils.h
+++ b/layout/svg/nsSVGUtils.h
@@ -262,52 +262,51 @@ public:
length - length to be converted
*/
static float ObjectSpace(const gfxRect &aRect, const nsSVGLength2 *aLength);
/* Computes the input length in terms of user space coordinates.
Input: content - object to be used for determining user space
Input: length - length to be converted
*/
- static float UserSpace(nsSVGElement *aSVGElement, const nsSVGLength2 *aLength);
+ static float UserSpace(nsSVGElement *aSVGElement,
+ const nsSVGLength2 *aLength);
static float UserSpace(nsIFrame *aFrame, const nsSVGLength2 *aLength);
- static float UserSpace(const mozilla::dom::UserSpaceMetrics& aMetrics, const nsSVGLength2 *aLength);
+ static float UserSpace(const mozilla::dom::UserSpaceMetrics& aMetrics,
+ const nsSVGLength2 *aLength);
/* Find the outermost SVG frame of the passed frame */
- static nsSVGOuterSVGFrame *
- GetOuterSVGFrame(nsIFrame *aFrame);
+ static nsSVGOuterSVGFrame* GetOuterSVGFrame(nsIFrame *aFrame);
/**
* Get the covered region for a frame. Return null if it's not an SVG frame.
* @param aRect gets a rectangle in app units
* @return the outer SVG frame which aRect is relative to
*/
- static nsIFrame*
- GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame, nsRect* aRect);
+ static nsIFrame* GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame,
+ nsRect* aRect);
/* Paint SVG frame with SVG effects - aDirtyRect is the area being
* redrawn, in device pixel coordinates relative to the outer svg */
- static DrawResult
- PaintFrameWithEffects(nsIFrame *aFrame,
- gfxContext& aContext,
- const gfxMatrix& aTransform,
- const nsIntRect *aDirtyRect = nullptr);
+ static DrawResult PaintFrameWithEffects(nsIFrame *aFrame,
+ gfxContext& aContext,
+ const gfxMatrix& aTransform,
+ const nsIntRect *aDirtyRect = nullptr);
/* Hit testing - check if point hits the clipPath of indicated
* frame. Returns true if no clipPath set. */
- static bool
- HitTestClip(nsIFrame *aFrame, const gfxPoint &aPoint);
-
+ static bool HitTestClip(nsIFrame *aFrame, const gfxPoint &aPoint);
+
/**
* Hit testing - check if point hits any children of aFrame. aPoint is
* expected to be in the coordinate space established by aFrame for its
* children (e.g. the space established by the 'viewBox' attribute on <svg>).
*/
- static nsIFrame *
- HitTestChildren(nsSVGDisplayContainerFrame *aFrame, const gfxPoint &aPoint);
+ static nsIFrame* HitTestChildren(nsSVGDisplayContainerFrame *aFrame,
+ const gfxPoint &aPoint);
/*
* Returns the CanvasTM of the indicated frame, whether it's a
* child SVG frame, container SVG frame, or a regular frame.
* For regular frames, we just return an identity matrix.
*/
static gfxMatrix GetCanvasTM(nsIFrame* aFrame);
@@ -321,86 +320,80 @@ public:
* by the frame such as x/y offsets and viewBox attributes.
*/
static gfxMatrix GetUserToCanvasTM(nsIFrame* aFrame);
/**
* Notify the descendants of aFrame of a change to one of their ancestors
* that might affect them.
*/
- static void
- NotifyChildrenOfSVGChange(nsIFrame *aFrame, uint32_t aFlags);
+ static void NotifyChildrenOfSVGChange(nsIFrame *aFrame, uint32_t aFlags);
/*
* Get frame's covered region by walking the children and doing union.
*/
- static nsRect
- GetCoveredRegion(const nsFrameList &aFrames);
+ static nsRect GetCoveredRegion(const nsFrameList &aFrames);
- static nsRect
- TransformFrameRectToOuterSVG(const nsRect& aRect,
- const gfxMatrix& aMatrix,
- nsPresContext* aPresContext);
+ static nsRect TransformFrameRectToOuterSVG(const nsRect& aRect,
+ const gfxMatrix& aMatrix,
+ nsPresContext* aPresContext);
/*
* Convert a surface size to an integer for use by thebes
* possibly making it smaller in the process so the surface does not
* use excessive memory.
*
* @param aSize the desired surface size
* @param aResultOverflows true if the desired surface size is too big
* @return the surface size to use
*/
static mozilla::gfx::IntSize ConvertToSurfaceSize(const gfxSize& aSize,
bool *aResultOverflows);
/*
* Hit test a given rectangle/matrix.
*/
- static bool
- HitTestRect(const mozilla::gfx::Matrix &aMatrix,
- float aRX, float aRY, float aRWidth, float aRHeight,
- float aX, float aY);
+ static bool HitTestRect(const mozilla::gfx::Matrix &aMatrix,
+ float aRX, float aRY, float aRWidth, float aRHeight,
+ float aX, float aY);
/**
* Get the clip rect for the given frame, taking into account the CSS 'clip'
* property. See:
* http://www.w3.org/TR/SVG11/masking.html#OverflowAndClipProperties
* The arguments for aX, aY, aWidth and aHeight should be the dimensions of
* the viewport established by aFrame.
*/
- static gfxRect
- GetClipRectForFrame(nsIFrame *aFrame,
- float aX, float aY, float aWidth, float aHeight);
+ static gfxRect GetClipRectForFrame(nsIFrame *aFrame,
+ float aX, float aY, float aWidth,
+ float aHeight);
static void SetClipRect(gfxContext *aContext,
const gfxMatrix &aCTM,
const gfxRect &aRect);
/* Using group opacity instead of fill or stroke opacity on a
* geometry object seems to be a common authoring mistake. If we're
* not applying filters and not both stroking and filling, we can
* generate the same result without going through the overhead of a
* push/pop group. */
- static bool
- CanOptimizeOpacity(nsIFrame *aFrame);
+ static bool CanOptimizeOpacity(nsIFrame *aFrame);
/**
* Take the CTM to userspace for an element, and adjust it to a CTM to its
* object bounding box space if aUnits is SVG_UNIT_TYPE_OBJECTBOUNDINGBOX.
* (I.e. so that [0,0] is at the top left of its bbox, and [1,1] is at the
* bottom right of its bbox).
*
* If the bbox is empty, this will return a singular matrix.
*/
- static gfxMatrix
- AdjustMatrixForUnits(const gfxMatrix &aMatrix,
- nsSVGEnum *aUnits,
- nsIFrame *aFrame);
+ static gfxMatrix AdjustMatrixForUnits(const gfxMatrix &aMatrix,
+ nsSVGEnum *aUnits,
+ nsIFrame *aFrame);
enum BBoxFlags {
eBBoxIncludeFill = 1 << 0,
eBBoxIncludeFillGeometry = 1 << 1,
eBBoxIncludeStroke = 1 << 2,
eBBoxIncludeStrokeGeometry = 1 << 3,
eBBoxIncludeMarkers = 1 << 4,
eBBoxIncludeClipped = 1 << 5,
@@ -434,24 +427,22 @@ public:
*
* @param aXYWH pointer to 4 consecutive nsSVGLength2 objects containing
* the x, y, width and height values in that order
* @param aBBox the bounding box of the object the rect is relative to;
* may be null if aUnits is not SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
* @param aFrame the object in which to interpret user-space units;
* may be null if aUnits is SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
*/
- static gfxRect
- GetRelativeRect(uint16_t aUnits, const nsSVGLength2 *aXYWH,
- const gfxRect& aBBox, nsIFrame *aFrame);
+ static gfxRect GetRelativeRect(uint16_t aUnits, const nsSVGLength2 *aXYWH,
+ const gfxRect& aBBox, nsIFrame *aFrame);
- static gfxRect
- GetRelativeRect(uint16_t aUnits, const nsSVGLength2 *aXYWH,
- const gfxRect& aBBox,
- const mozilla::dom::UserSpaceMetrics& aMetrics);
+ static gfxRect GetRelativeRect(uint16_t aUnits, const nsSVGLength2 *aXYWH,
+ const gfxRect& aBBox,
+ const mozilla::dom::UserSpaceMetrics& aMetrics);
/**
* Find the first frame, starting with aStartFrame and going up its
* parent chain, that is not an svgAFrame.
*/
static nsIFrame* GetFirstNonAAncestorFrame(nsIFrame* aStartFrame);
static bool OuterSVGIsCallingReflowSVG(nsIFrame *aFrame);
@@ -498,21 +489,20 @@ public:
{
return NS_lround(std::max(double(INT32_MIN),
std::min(double(INT32_MAX), aVal)));
}
static nscolor GetFallbackOrPaintColor(nsStyleContext *aStyleContext,
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke);
- static void
- MakeFillPatternFor(nsIFrame *aFrame,
- gfxContext* aContext,
- GeneralPattern* aOutPattern,
- SVGContextPaint* aContextPaint = nullptr);
+ static void MakeFillPatternFor(nsIFrame *aFrame,
+ gfxContext* aContext,
+ GeneralPattern* aOutPattern,
+ SVGContextPaint* aContextPaint = nullptr);
static void
MakeStrokePatternFor(nsIFrame* aFrame,
gfxContext* aContext,
GeneralPattern* aOutPattern,
SVGContextPaint* aContextPaint = nullptr);
static float GetOpacity(nsStyleSVGOpacitySource aOpacityType,
@@ -555,16 +545,17 @@ public:
/**
* Render a SVG glyph.
* @param aElement the SVG glyph element to render
* @param aContext the thebes aContext to draw to
* @return true if rendering succeeded
*/
static bool PaintSVGGlyph(Element* aElement, gfxContext* aContext);
+
/**
* Get the extents of a SVG glyph.
* @param aElement the SVG glyph element
* @param aSVGToAppSpace the matrix mapping the SVG glyph space to the
* target context space
* @param aResult the result (valid when true is returned)
* @return true if calculating the extents succeeded
*/
@@ -572,48 +563,45 @@ public:
const gfxMatrix& aSVGToAppSpace,
gfxRect* aResult);
/**
* Returns the app unit canvas bounds of a userspace rect.
*
* @param aToCanvas Transform from userspace to canvas device space.
*/
- static nsRect
- ToCanvasBounds(const gfxRect &aUserspaceRect,
- const gfxMatrix &aToCanvas,
- const nsPresContext *presContext);
+ static nsRect ToCanvasBounds(const gfxRect &aUserspaceRect,
+ const gfxMatrix &aToCanvas,
+ const nsPresContext *presContext);
struct MaskUsage {
bool shouldGenerateMaskLayer;
bool shouldGenerateClipMaskLayer;
bool shouldApplyClipPath;
bool shouldApplyBasicShape;
float opacity;
MaskUsage()
: shouldGenerateMaskLayer(false), shouldGenerateClipMaskLayer(false),
shouldApplyClipPath(false), shouldApplyBasicShape(false), opacity(0.0)
{ }
};
- static void
- DetermineMaskUsage(nsIFrame* aFrame, bool aHandleOpacity, MaskUsage& aUsage);
+ static void DetermineMaskUsage(nsIFrame* aFrame, bool aHandleOpacity,
+ MaskUsage& aUsage);
- static float
- ComputeOpacity(nsIFrame* aFrame, bool aHandleOpacity);
+ static float ComputeOpacity(nsIFrame* aFrame, bool aHandleOpacity);
/**
* SVG frames expect to paint in SVG user units, which are equal to CSS px
* units. This method provides a transform matrix to multiply onto a
* gfxContext's current transform to convert the context's current units from
* its usual dev pixels to SVG user units/CSS px to keep the SVG code happy.
*/
- static gfxMatrix
- GetCSSPxToDevPxMatrix(nsIFrame* aNonSVGFrame);
+ static gfxMatrix GetCSSPxToDevPxMatrix(nsIFrame* aNonSVGFrame);
static bool IsInSVGTextSubtree(const nsIFrame* aFrame) {
// Returns true if the frame is an SVGTextFrame or one of its descendants.
return aFrame->GetStateBits() & NS_FRAME_IS_SVG_TEXT;
}
};
#endif