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 |
crashtests |
|
|
CSSClipPathInstance.cpp |
static |
8829 |
CSSClipPathInstance.h |
The frame for the element that is currently being clipped.
|
2705 |
CSSFilterInstance.cpp |
|
12052 |
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 |
DisplaySVGItem.cpp |
|
2234 |
DisplaySVGItem.h |
Hit testing for display lists.
@param aRect the point or rect being tested, relative to aFrame.
If the width and height are both 1 app unit, it indicates we're
hit testing a point, not a rect.
@param aOutFrames each item appends the frame(s) in this display item that
the rect is considered over (if any) to aOutFrames.
|
1488 |
FilterInstance.cpp |
InputIsTainted |
84015 |
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
|
16674 |
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.)
|
6390 |
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 |
moz.build |
|
2354 |
svg.css |
We need to be an absolute and fixed container |
2032 |
SVGAFrame.cpp |
DEBUG |
2284 |
SVGClipPathFrame.cpp |
|
16175 |
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.
|
6614 |
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.
|
16916 |
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 SVGDisplayContainerFrame sub-class.
*** WARNING ***
Do *not* blindly cast to SVG element types in this class's methods (see the
warning comment for SVGDisplayContainerFrame below).
|
5539 |
SVGContextPaint.cpp |
static |
14236 |
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.
|
10231 |
SVGFEContainerFrame.cpp |
This frame is used by filter primitive elements that
have special child elements that provide parameters.
|
3418 |
SVGFEImageFrame.cpp |
virtual |
4902 |
SVGFELeafFrame.cpp |
This frame is used by filter primitive elements that don't
have special child elements that provide parameters.
|
3251 |
SVGFEUnstyledLeafFrame.cpp |
|
2802 |
SVGFilterFrame.cpp |
|
6378 |
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.
|
2858 |
SVGFilterInstance.cpp |
|
14990 |
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)
|
9588 |
SVGForeignObjectFrame.cpp |
|
16752 |
SVGForeignObjectFrame.h |
|
3229 |
SVGGeometryFrame.cpp |
virtual |
30796 |
SVGGeometryFrame.h |
@param aMatrix The transform that must be multiplied onto aContext to
establish this frame's SVG user space.
|
6372 |
SVGGFrame.cpp |
DEBUG |
2030 |
SVGGFrame.h |
|
1717 |
SVGGradientFrame.cpp |
|
23252 |
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.
|
6997 |
SVGImageContext.cpp |
static |
4805 |
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.
|
5394 |
SVGImageFrame.cpp |
virtual |
32762 |
SVGImageFrame.h |
|
6510 |
SVGInnerSVGFrame.cpp |
DEBUG |
1326 |
SVGInnerSVGFrame.h |
|
1433 |
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.
|
48866 |
SVGIntegrationUtils.h |
Whether we're dealing with a backdrop-filter or a filter.
|
11201 |
SVGMarkerFrame.cpp |
DEBUG |
8647 |
SVGMarkerFrame.h |
|
5299 |
SVGMaskFrame.cpp |
aPreserveTransform |
6548 |
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.
|
3300 |
SVGObserverUtils.cpp |
Return a baseURL for resolving a local-ref URL.
@param aContent an element which uses a local-ref property. Here are some
examples:
<rect fill=url(#foo)>
<circle clip-path=url(#foo)>
<use xlink:href="#foo">
|
65858 |
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.
|
17598 |
SVGOuterSVGFrame.cpp |
|
32449 |
SVGOuterSVGFrame.h |
Return true only if the height is unspecified (defaulting to 100%) or else
the height is explicitly set to a percentage value no greater than 100%.
|
7934 |
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.
|
2588 |
SVGPatternFrame.cpp |
DEBUG |
26058 |
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.
|
5184 |
SVGStopFrame.cpp |
DEBUG |
3431 |
SVGSwitchFrame.cpp |
DEBUG |
8492 |
SVGSymbolFrame.cpp |
|
1668 |
SVGSymbolFrame.h |
|
1514 |
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.
|
187505 |
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.
|
21566 |
SVGUseFrame.cpp |
|
4912 |
SVGUseFrame.h |
|
1877 |
SVGUtils.cpp |
static |
55453 |
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.
|
24425 |
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).
|
3749 |
SVGViewportFrame.cpp |
|
9479 |
SVGViewportFrame.h |
Superclass for inner SVG frames and symbol frames.
|
1754 |
tests |
|
|