layout/svg/nsISVGChildFrame.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef __NS_ISVGCHILDFRAME_H__
michael@0 7 #define __NS_ISVGCHILDFRAME_H__
michael@0 8
michael@0 9 #include "gfxRect.h"
michael@0 10 #include "nsQueryFrame.h"
michael@0 11
michael@0 12 class nsIFrame;
michael@0 13 class nsRenderingContext;
michael@0 14
michael@0 15 struct nsPoint;
michael@0 16 class SVGBBox;
michael@0 17 struct nsRect;
michael@0 18 struct nsIntRect;
michael@0 19
michael@0 20 namespace mozilla {
michael@0 21 class SVGAnimatedLengthList;
michael@0 22 class SVGAnimatedNumberList;
michael@0 23 class SVGLengthList;
michael@0 24 class SVGNumberList;
michael@0 25 class SVGUserUnitList;
michael@0 26
michael@0 27 namespace gfx {
michael@0 28 class Matrix;
michael@0 29 }
michael@0 30 }
michael@0 31
michael@0 32 /**
michael@0 33 * This class is not particularly well named. It is inherited by some, but
michael@0 34 * not all SVG frame classes that can be descendants of an
michael@0 35 * nsSVGOuterSVGFrame in the frame tree. Note specifically that SVG container
michael@0 36 * frames that do not inherit nsSVGDisplayContainerFrame do not inherit this
michael@0 37 * class (so that's classes that only inherit nsSVGContainerFrame).
michael@0 38 */
michael@0 39 class nsISVGChildFrame : public nsQueryFrame
michael@0 40 {
michael@0 41 public:
michael@0 42 typedef mozilla::SVGAnimatedNumberList SVGAnimatedNumberList;
michael@0 43 typedef mozilla::SVGNumberList SVGNumberList;
michael@0 44 typedef mozilla::SVGAnimatedLengthList SVGAnimatedLengthList;
michael@0 45 typedef mozilla::SVGLengthList SVGLengthList;
michael@0 46 typedef mozilla::SVGUserUnitList SVGUserUnitList;
michael@0 47
michael@0 48 NS_DECL_QUERYFRAME_TARGET(nsISVGChildFrame)
michael@0 49
michael@0 50 // Paint this frame.
michael@0 51 // aDirtyRect is the area being redrawn, in frame offset pixel coordinates.
michael@0 52 // aTransformRoot (if non-null) is the frame at which we stop looking up
michael@0 53 // transforms, when painting content that is part of an SVG glyph. (See
michael@0 54 // bug 875329.)
michael@0 55 // For normal SVG graphics using display-list rendering, any transforms on
michael@0 56 // the element or its parents will have already been set up in the context
michael@0 57 // before PaintSVG is called. When painting SVG glyphs, this is not the case,
michael@0 58 // so the element's full transform needs to be applied; but we don't want to
michael@0 59 // apply transforms from outside the actual glyph element, so we need to know
michael@0 60 // how far up the ancestor chain to go.
michael@0 61 virtual nsresult PaintSVG(nsRenderingContext* aContext,
michael@0 62 const nsIntRect *aDirtyRect,
michael@0 63 nsIFrame* aTransformRoot = nullptr) = 0;
michael@0 64
michael@0 65 // Check if this frame or children contain the given point,
michael@0 66 // specified in app units relative to the origin of the outer
michael@0 67 // svg frame (origin ill-defined in the case of borders - bug
michael@0 68 // 290770). See bug 290852 for foreignObject complications.
michael@0 69 virtual nsIFrame* GetFrameForPoint(const nsPoint &aPoint)=0;
michael@0 70
michael@0 71 // Get bounds in our nsSVGOuterSVGFrame's coordinates space (in app units)
michael@0 72 virtual nsRect GetCoveredRegion()=0;
michael@0 73
michael@0 74 // Called on SVG child frames (except NS_FRAME_IS_NONDISPLAY frames)
michael@0 75 // to update and then invalidate their cached bounds. This method is not
michael@0 76 // called until after the nsSVGOuterSVGFrame has had its initial reflow
michael@0 77 // (i.e. once the SVG viewport dimensions are known). It should also only
michael@0 78 // be called by nsSVGOuterSVGFrame during its reflow.
michael@0 79 virtual void ReflowSVG()=0;
michael@0 80
michael@0 81 /**
michael@0 82 * Flags used to specify to GetCanvasTM what it's being called for so that it
michael@0 83 * knows how far up the tree the "canvas" is. When display lists are being
michael@0 84 * used for painting or hit-testing of SVG, the "canvas" is simply user
michael@0 85 * space.
michael@0 86 */
michael@0 87 enum RequestingCanvasTMFor {
michael@0 88 FOR_PAINTING = 1,
michael@0 89 FOR_HIT_TESTING,
michael@0 90 FOR_OUTERSVG_TM
michael@0 91 };
michael@0 92
michael@0 93 // Flags to pass to NotifySVGChange:
michael@0 94 //
michael@0 95 // DO_NOT_NOTIFY_RENDERING_OBSERVERS - this should only be used when
michael@0 96 // updating the descendant frames of a clipPath,
michael@0 97 // mask, pattern or marker frame (or other similar
michael@0 98 // NS_FRAME_IS_NONDISPLAY frame) immediately
michael@0 99 // prior to painting that frame's descendants.
michael@0 100 // TRANSFORM_CHANGED - the current transform matrix for this frame has changed
michael@0 101 // COORD_CONTEXT_CHANGED - the dimensions of this frame's coordinate context has
michael@0 102 // changed (percentage lengths must be reevaluated)
michael@0 103 enum SVGChangedFlags {
michael@0 104 TRANSFORM_CHANGED = 0x01,
michael@0 105 COORD_CONTEXT_CHANGED = 0x02,
michael@0 106 FULL_ZOOM_CHANGED = 0x04
michael@0 107 };
michael@0 108 /**
michael@0 109 * This is called on a frame when there has been a change to one of its
michael@0 110 * ancestors that might affect the frame too. SVGChangedFlags are passed
michael@0 111 * to indicate what changed.
michael@0 112 *
michael@0 113 * Implementations do not need to invalidate, since the caller will
michael@0 114 * invalidate the entire area of the ancestor that changed. However, they
michael@0 115 * may need to update their bounds.
michael@0 116 */
michael@0 117 virtual void NotifySVGChanged(uint32_t aFlags)=0;
michael@0 118
michael@0 119 /**
michael@0 120 * Get this frame's contribution to the rect returned by a GetBBox() call
michael@0 121 * that occurred either on this element, or on one of its ancestors.
michael@0 122 *
michael@0 123 * SVG defines an element's bbox to be the element's fill bounds in the
michael@0 124 * userspace established by that element. By allowing callers to pass in the
michael@0 125 * transform from the userspace established by this element to the userspace
michael@0 126 * established by an an ancestor, this method allows callers to obtain this
michael@0 127 * element's fill bounds in the userspace established by that ancestor
michael@0 128 * instead. In that case, since we return the bounds in a different userspace
michael@0 129 * (the ancestor's), the bounds we return are not this element's bbox, but
michael@0 130 * rather this element's contribution to the bbox of the ancestor.
michael@0 131 *
michael@0 132 * @param aToBBoxUserspace The transform from the userspace established by
michael@0 133 * this element to the userspace established by the ancestor on which
michael@0 134 * getBBox was called. This will be the identity matrix if we are the
michael@0 135 * element on which getBBox was called.
michael@0 136 *
michael@0 137 * @param aFlags Flags indicating whether, stroke, for example, should be
michael@0 138 * included in the bbox calculation.
michael@0 139 */
michael@0 140 virtual SVGBBox GetBBoxContribution(const mozilla::gfx::Matrix &aToBBoxUserspace,
michael@0 141 uint32_t aFlags) = 0;
michael@0 142
michael@0 143 // Are we a container frame?
michael@0 144 virtual bool IsDisplayContainer()=0;
michael@0 145 };
michael@0 146
michael@0 147 #endif // __NS_ISVGCHILDFRAME_H__
michael@0 148

mercurial