Name Description Size
AutoReferenceChainGuard.h This helper class helps us to protect against two related issues that can occur in SVG content: reference loops, and reference chains that we deem to be too long. Some SVG effects can reference another effect of the same type to produce a chain of effects to be applied (e.g. clipPath), while in other cases it is possible that while processing an effect of a certain type another effect of the same type may be encountered indirectly (e.g. pattern). In order to avoid stack overflow crashes and performance issues we need to impose an arbitrary limit on the length of the reference chains that SVG content may try to create. (Some SVG authoring tools have been known to create absurdly long reference chains. For example, bug 1253590 details a case where Adobe Illustrator was used to created an SVG with a chain of 5000 clip paths which could cause us to run out of stack space and crash.) This class is intended to be used with the nsIFrame's of SVG effects that may involve reference chains. To use it add a boolean member, something like this: // Flag used to indicate whether a methods that may reenter due to // following a reference to another instance is currently executing. bool mIsBeingProcessed; Make sure to initialize the member to false in the class' constructons. Then add the following to the top of any methods that may be reentered due to following a reference: static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain; AutoReferenceChainGuard refChainGuard(this, &mIsBeingProcessed, &sRefChainLengthCounter); if (MOZ_UNLIKELY(!refChainGuard.Reference())) { return; // Break reference chain } Note that mIsBeingProcessed and sRefChainLengthCounter should never be used by the frame except when it initialize them as indicated above. 6420
CSSClipPathInstance.cpp static 8741
CSSClipPathInstance.h The frame for the element that is currently being clipped. 2293
CSSFilterInstance.cpp 12092
CSSFilterInstance.h This class helps FilterInstance build its filter graph. It turns a CSS filter function (e.g. blur(3px)) from the style system into a FilterPrimitiveDescription connected to the filter graph. 5749
FilterInstance.cpp InputIsTainted 34892
FilterInstance.h This class performs all filter processing. We build a graph of the filter image data flow, essentially converting the filter graph to SSA. This lets us easily propagate analysis data (such as bounding-boxes) over the filter primitive graph. Definition of "filter space": filter space is a coordinate system that is aligned with the user space of the filtered element, with its origin located at the top left of the filter region, and with one unit equal in size to one pixel of the offscreen surface into which the filter output would/will be painted. The definition of "filter region" can be found here: http://www.w3.org/TR/SVG11/filters.html#FilterEffectsRegion 14935
ISVGDisplayableFrame.h This class is used for elements that can be part of a directly displayable section of a document. This includes SVGGeometryFrame and SVGGFrame. (Even though the latter doesn't display anything itself, if it contains SVGGeometryFrame descendants it is can still be part of a displayable section of a document) This class is not used for elements that can never display directly, including SVGGradientFrame and SVGPatternFrame. (The latter may contain displayable content, but it and its content are never *directly* displayed in a document. It can only end up being displayed by means of a reference from other content.) Note specifically that SVG frames that inherit SVGContainerFrame do *not* implement this class (only those that inherit SVGDisplayContainerFrame do.) 6712
ISVGSVGFrame.h Called when non-attribute changes have caused the element's width/height or its for-children transform to change, and to get the element to notify its children appropriately. aFlags must be set to ISVGDisplayableFrame::COORD_CONTEXT_CHANGED and/or ISVGDisplayableFrame::TRANSFORM_CHANGED. 982
SVGAFrame.cpp DEBUG 3724
SVGClipPathFrame.cpp 18121
SVGClipPathFrame.h Applies the clipPath by pushing a clip path onto the DrawTarget. This method must only be used if IsTrivial() returns true, otherwise use GetClipMask. @param aContext The context that the clip path is to be applied to. @param aClippedFrame The/an nsIFrame of the element that references this clipPath that is currently being processed. @param aMatrix The transform from aClippedFrame's user space to aContext's current transform. 6992
SVGContainerFrame.cpp Traverses a frame tree, marking any SVGTextFrame frames as dirty and calling InvalidateRenderingObservers() on it. The reason that this helper exists is because SVGTextFrame is special. None of the other SVG frames ever need to be reflowed when they have the NS_FRAME_IS_NONDISPLAY bit set on them because their PaintSVG methods (and those of any containers that they can validly be contained within) do not make use of mRect or overflow rects. "em" lengths, etc., are resolved as those elements are painted. SVGTextFrame is different because its anonymous block and inline frames need to be reflowed in order to get the correct metrics when things like inherited font-size of an ancestor changes, or a delayed webfont loads and applies. However, we only need to do this work if we were reflowed with NS_FRAME_IS_DIRTY, which implies that all descendants are dirty. When that reflow reaches an NS_FRAME_IS_NONDISPLAY frame it would normally stop, but this helper looks for any SVGTextFrame descendants of such frames and marks them NS_FRAME_IS_DIRTY so that the next time that they are painted their anonymous kid will first get the necessary reflow. 17078
SVGContainerFrame.h Base class for SVG container frames. Frame sub-classes that do not display their contents directly (such as the frames for <marker> or <pattern>) just inherit this class. Frame sub-classes that do or can display their contents directly (such as the frames for inner-<svg> or <g>) inherit our nsDisplayContainerFrame sub-class. *** WARNING *** Do *not* blindly cast to SVG element types in this class's methods (see the warning comment for SVGDisplayContainerFrame below). 6098
SVGContextPaint.cpp static 13362
SVGContextPaint.h This class is used to pass information about a context element through to SVG painting code in order to resolve the 'context-fill' and related keywords. See: https://www.w3.org/TR/SVG2/painting.html#context-paint This feature allows the color in an SVG-in-OpenType glyph to come from the computed style for the text that is being drawn, for example, or for color in an SVG embedded by an <img> element to come from the embedding <img> element. This class is reference counted so that it can be shared among many similar SVGImageContext objects. (SVGImageContext objects are frequently copy-constructed with small modifications, and we'd like for those copies to be able to share their context-paint data cheaply.) However, in most cases, SVGContextPaint instances are stored in a local RefPtr and only last for the duration of a function call. XXX Note: SVGImageContext doesn't actually have a SVGContextPaint member yet, but it will in a later patch in the patch series that added this comment. 10246
SVGFEContainerFrame.cpp This frame is used by filter primitive elements that have special child elements that provide parameters. 3689
SVGFEImageFrame.cpp virtual 6268
SVGFELeafFrame.cpp This frame is used by filter primitive elements that don't have special child elements that provide parameters. 3499
SVGFEUnstyledLeafFrame.cpp 3029
SVGFilterFrame.cpp 6542
SVGFilterFrame.h Parses this frame's href and - if it references another filter - returns it. It also makes this frame a rendering observer of the specified ID. 2906
SVGFilterInstance.cpp 16352
SVGFilterInstance.h This class helps FilterInstance build its filter graph by processing a single SVG reference filter. In BuildPrimitives, this class iterates through the referenced <filter> element's primitive elements, creating a FilterPrimitiveDescription for each one. This class uses several different coordinate spaces, defined as follows: "user space" The filtered SVG element's user space or the filtered HTML element's CSS pixel space. The origin for an HTML element is the top left corner of its border box. "filter space" User space scaled to device pixels. Shares the same origin as user space. This space is the same across chained SVG and CSS filters. To compute the overall filter space for a chain, we first need to build each filter's FilterPrimitiveDescriptions in some common space. That space is filter space. To understand the spaces better, let's take an example filter: <filter id="f">...</filter> And apply the filter to a div element: <div style="filter: url(#f); ...">...</div> And let's say there are 2 device pixels for every 1 CSS pixel. Finally, let's define an arbitrary point in user space: "user space point" = (10, 10) The point will be inset 10 CSS pixels from both the top and left edges of the div element's border box. Now, let's transform the point from user space to filter space: "filter space point" = "user space point" * "device pixels per CSS pixel" "filter space point" = (10, 10) * 2 "filter space point" = (20, 20) 9423
SVGFilterPaintCallback.h Paint the frame contents. SVG frames will have had matrix propagation set to false already. Non-SVG frames have to do their own thing. The caller will do a Save()/Restore() as necessary so feel free to mess with context state. The context will be configured to use the "user space" coordinate system. @param aDirtyRect the dirty rect *in user space pixels* @param aTransformRoot the outermost frame whose transform should be taken into account when painting an SVG glyph 1486
SVGForeignObjectFrame.cpp 20925
SVGForeignObjectFrame.h 3939
SVGGFrame.cpp DEBUG 1994
SVGGFrame.h 1757
SVGGeometryFrame.cpp 31229
SVGGeometryFrame.h This function returns a set of bit flags indicating which parts of the element (fill, stroke, bounds) should intercept pointer events. It takes into account the type of element and the value of the 'pointer-events' property on the element. 7981
SVGGradientFrame.cpp 22946
SVGGradientFrame.h Parses this frame's href and - if it references another gradient - returns it. It also makes this frame a rendering observer of the specified ID. 7181
SVGImageContext.cpp static 2908
SVGImageContext.h Currently it seems that the aViewportSize parameter ends up being used for different things by different pieces of code, and probably in some cases being used incorrectly (specifically in the case of pixel snapping under the nsLayoutUtils::Draw*Image() methods). An unfortunate result of the messy code is that aViewportSize is currently a Maybe<T> since it is difficult to create a utility function that consumers can use up front to get the "correct" viewport size (i.e. which for compatibility with the current code (bugs and all) would mean the size including all the snapping and resizing magic that happens in various places under the nsLayoutUtils::Draw*Image() methods on the way to DrawImageInternal creating |fallbackContext|). Using Maybe<T> allows code to pass Nothing() in order to get the size that's created for |fallbackContext|. At some point we need to clean this code up, make our abstractions clear, create that utility and stop using Maybe for this parameter. 4606
SVGImageFrame.cpp virtual 31291
SVGImageFrame.h 3947
SVGInnerSVGFrame.cpp DEBUG 1326
SVGInnerSVGFrame.h 1457
SVGIntegrationUtils.cpp This class is used to get the pre-effects ink overflow rect of a frame, or, in the case of a frame with continuations, to collect the union of the pre-effects ink overflow rects of all the continuations. The result is relative to the origin (top left corner of the border box) of the frame, or, if the frame has continuations, the origin of the _first_ continuation. 53988
SVGIntegrationUtils.h Integration of SVG effects (clipPath clipping, masking and filters) into regular display list based painting and hit-testing. 10496
SVGMarkerFrame.cpp DEBUG 8282
SVGMarkerFrame.h 5403
SVGMaskFrame.cpp 6725
SVGMaskFrame.h Generate a mask surface for the target frame. The return surface can be null, it's the caller's responsibility to null-check before dereferencing. 3358
SVGObserverUtils.cpp 59732
SVGObserverUtils.h This class contains URL and referrer information (referrer and referrer policy). We use it to pass to svg system instead of nsIURI. The object brings referrer and referrer policy so we can send correct Referer headers. 16290
SVGOuterSVGFrame.cpp 41730
SVGOuterSVGFrame.h 10942
SVGPaintServerFrame.cpp 561
SVGPaintServerFrame.h RAII class used to temporarily set and remove the NS_FRAME_DRAWING_AS_PAINTSERVER frame state bit while a frame is being drawn as a paint server. 2604
SVGPatternFrame.cpp DEBUG 26337
SVGPatternFrame.h Parses this frame's href and - if it references another pattern - returns it. It also makes this frame a rendering observer of the specified ID. 5042
SVGStopFrame.cpp DEBUG 3649
SVGSwitchFrame.cpp DEBUG 10042
SVGSymbolFrame.cpp DEBUG 1278
SVGSymbolFrame.h 1435
SVGTextFrame.cpp Using the specified gfxSkipCharsIterator, converts an offset and length in original char indexes to skipped char indexes. @param aIterator The gfxSkipCharsIterator to use for the conversion. @param aOriginalOffset The original offset. @param aOriginalLength The original length. 188910
SVGTextFrame.h Information about the positioning for a single character in an SVG <text> element. During SVG text layout, we use infinity values to represent positions and rotations that are not explicitly specified with x/y/rotate attributes. 21049
SVGUseFrame.cpp 6008
SVGUseFrame.h 2174
SVGUtils.cpp static 61300
SVGUtils.h Sometimes we need to distinguish between an empty box and a box that contains an element that has no size e.g. a point at the origin. 23553
SVGViewFrame.cpp While views are not directly rendered in SVG they can be linked to and thereby override attributes of an <svg> element via a fragment identifier. The SVGViewFrame class passes on any attribute changes the view receives to the overridden <svg> element (if there is one). 4026
SVGViewportFrame.cpp 10552
SVGViewportFrame.h Superclass for inner SVG frames and symbol frames. 1889
crashtests 243
moz.build 2302
svg.css 2836
tests 22