Bug 1651289 - Move remaining SVG concrete frame classes to the mozilla namespace r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D82650
This commit is contained in:
longsonr 2020-07-09 01:33:33 +00:00
Родитель 066a872d44
Коммит 6f5803e27f
43 изменённых файлов: 416 добавлений и 383 удалений

Просмотреть файл

@ -72,8 +72,8 @@ class DOMSVGTranslatePoint final : public nsISVGPoint {
typedef SVGViewportElement SVGSVGElementBase;
class SVGSVGElement final : public SVGSVGElementBase {
friend class ::nsSVGOuterSVGFrame;
friend class mozilla::SVGFragmentIdentifier;
friend class mozilla::SVGOuterSVGFrame;
friend class mozilla::AutoSVGViewHandler;
friend class mozilla::AutoPreserveAspectRatioOverride;
friend class mozilla::dom::SVGView;

Просмотреть файл

@ -13,13 +13,12 @@
#include "SVGStringList.h"
#include "mozilla/dom/SVGElement.h"
class nsSVGOuterSVGFrame;
nsresult NS_NewSVGViewElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
namespace mozilla {
class SVGFragmentIdentifier;
class SVGOuterSVGFrame;
namespace dom {
class SVGViewportElement;
@ -29,9 +28,9 @@ typedef SVGElement SVGViewElementBase;
class SVGViewElement : public SVGViewElementBase {
protected:
friend class mozilla::SVGFragmentIdentifier;
friend class mozilla::SVGOuterSVGFrame;
friend class SVGSVGElement;
friend class SVGViewportElement;
friend class ::nsSVGOuterSVGFrame;
explicit SVGViewElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
friend nsresult(::NS_NewSVGViewElement(
nsIContent** aResult,

Просмотреть файл

@ -158,7 +158,7 @@ void SVGViewportElement::ChildrenOnlyTransformChanged(uint32_t aFlags) {
// If we're not reconstructing the frame tree, then we only call
// PostRestyleEvent if we're not being called under reflow to avoid recursing
// to death. See bug 767056 comments 10 and 12. Since our nsSVGOuterSVGFrame
// to death. See bug 767056 comments 10 and 12. Since our SVGOuterSVGFrame
// is being reflowed we're going to invalidate and repaint its entire area
// anyway (which will include our children).
if ((changeHint & nsChangeHint_ReconstructFrame) ||

Просмотреть файл

@ -20,10 +20,9 @@
#include "nsISVGPoint.h"
#include "SVGPreserveAspectRatio.h"
class nsSVGOuterSVGFrame;
namespace mozilla {
class AutoPreserveAspectRatioOverride;
class SVGOuterSVGFrame;
class SVGViewportFrame;
namespace dom {
@ -43,7 +42,7 @@ class svgFloatSize {
};
class SVGViewportElement : public SVGGraphicsElement {
friend class ::nsSVGOuterSVGFrame;
friend class mozilla::SVGOuterSVGFrame;
friend class mozilla::SVGViewportFrame;
protected:

Просмотреть файл

@ -101,7 +101,7 @@ FRAME_CLASSES = [
Frame("nsSubDocumentFrame", "SubDocument", LEAF),
Frame("SVGAFrame", "SVGA", NOT_LEAF),
Frame("SVGClipPathFrame", "SVGClipPath", NOT_LEAF),
Frame("nsSVGContainerFrame", "None", NOT_LEAF),
Frame("SVGContainerFrame", "None", NOT_LEAF),
Frame("SVGFEContainerFrame", "SVGFEContainer", NOT_LEAF),
Frame("SVGFEImageFrame", "SVGFEImage", LEAF),
Frame("SVGFELeafFrame", "SVGFELeaf", LEAF),
@ -117,12 +117,12 @@ FRAME_CLASSES = [
Frame("SVGMarkerFrame", "SVGMarker", NOT_LEAF),
Frame("SVGMarkerAnonChildFrame", "SVGMarkerAnonChild", NOT_LEAF),
Frame("SVGMaskFrame", "SVGMask", NOT_LEAF),
Frame("nsSVGOuterSVGFrame", "SVGOuterSVG", NOT_LEAF),
Frame("nsSVGOuterSVGAnonChildFrame", "SVGOuterSVGAnonChild", NOT_LEAF),
Frame("SVGOuterSVGFrame", "SVGOuterSVG", NOT_LEAF),
Frame("SVGOuterSVGAnonChildFrame", "SVGOuterSVGAnonChild", NOT_LEAF),
Frame("SVGPatternFrame", "SVGPattern", NOT_LEAF),
Frame("SVGRadialGradientFrame", "SVGRadialGradient", NOT_LEAF),
Frame("SVGStopFrame", "SVGStop", LEAF),
Frame("nsSVGSwitchFrame", "SVGSwitch", NOT_LEAF),
Frame("SVGSwitchFrame", "SVGSwitch", NOT_LEAF),
Frame("SVGSymbolFrame", "SVGSymbol", NOT_LEAF),
Frame("SVGTextFrame", "SVGText", NOT_LEAF),
# Not a leaf, though it always has a ShadowRoot, so in practice light DOM
@ -154,7 +154,7 @@ FRAME_CLASSES = [
AbstractFrame("nsMathMLContainerFrame"),
AbstractFrame("nsRubyContentFrame"),
AbstractFrame("nsSplittableFrame"),
AbstractFrame("nsSVGDisplayContainerFrame"),
AbstractFrame("SVGDisplayContainerFrame"),
AbstractFrame("SVGGradientFrame"),
AbstractFrame("SVGPaintServerFrame"),

Просмотреть файл

@ -21,11 +21,11 @@
#include "nsPlaceholderFrame.h"
#include "nsRubyTextFrame.h"
#include "nsRubyTextContainerFrame.h"
#include "nsSVGContainerFrame.h"
#include "nsTableCellFrame.h"
#include "nsTableRowFrame.h"
#include "nsTableRowGroupFrame.h"
#include "nsTextFrame.h"
#include "mozilla/SVGContainerFrame.h"
namespace mozilla {

Просмотреть файл

@ -403,7 +403,7 @@ FRAME_STATE_BIT(GridContainer, 29, NS_STATE_GRID_IS_ROW_MASONRY)
FRAME_STATE_GROUP_NAME(SVG)
FRAME_STATE_GROUP_CLASS(SVG, nsSVGDisplayableFrame)
FRAME_STATE_GROUP_CLASS(SVG, nsSVGContainerFrame)
FRAME_STATE_GROUP_CLASS(SVG, SVGContainerFrame)
// If this bit is set, we are a <clipPath> element or descendant.
FRAME_STATE_BIT(SVG, 20, NS_STATE_SVG_CLIPPATH_CHILD)

Просмотреть файл

@ -44,6 +44,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollbarPreferences.h"
#include "mozilla/SVGOuterSVGFrame.h"
#include "mozilla/ViewportUtils.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/dom/Element.h"
@ -54,7 +55,6 @@
#include "mozilla/Telemetry.h"
#include "FrameLayerBuilder.h"
#include "nsSubDocumentFrame.h"
#include "nsSVGOuterSVGFrame.h"
#include "mozilla/Attributes.h"
#include "ScrollbarActivity.h"
#include "nsRefreshDriver.h"
@ -771,7 +771,7 @@ bool nsHTMLScrollFrame::GuessVScrollbarNeeded(const ScrollReflowInput& aState) {
if (mHelper.mIsRoot) {
nsIFrame* f = mHelper.mScrolledFrame->PrincipalChildList().FirstChild();
if (f && f->IsSVGOuterSVGFrame() &&
static_cast<nsSVGOuterSVGFrame*>(f)->VerticalScrollbarNotNeeded()) {
static_cast<SVGOuterSVGFrame*>(f)->VerticalScrollbarNotNeeded()) {
// Common SVG case - avoid a bad guess.
return false;
}

Просмотреть файл

@ -7,9 +7,9 @@
// Keep in (case-insensitive) order:
#include "gfxMatrix.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGContainerFrame.h"
#include "mozilla/dom/SVGAElement.h"
#include "mozilla/dom/MutationEventBinding.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
#include "SVGLengthList.h"
@ -19,13 +19,13 @@ nsIFrame* NS_NewSVGAFrame(mozilla::PresShell* aPresShell,
namespace mozilla {
class SVGAFrame final : public nsSVGDisplayContainerFrame {
class SVGAFrame final : public SVGDisplayContainerFrame {
friend nsIFrame* ::NS_NewSVGAFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
protected:
explicit SVGAFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
: SVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
public:
NS_DECL_FRAMEARENA_HELPERS(SVGAFrame)
@ -70,7 +70,7 @@ void SVGAFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
"Trying to construct an SVGAFrame for a "
"content element that doesn't support the right interfaces");
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */

Просмотреть файл

@ -394,8 +394,8 @@ nsresult SVGClipPathFrame::AttributeChanged(int32_t aNameSpaceID,
}
}
return nsSVGContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
return SVGContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
}
void SVGClipPathFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
@ -404,7 +404,7 @@ void SVGClipPathFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
"Content is not an SVG clipPath!");
AddStateBits(NS_STATE_SVG_CLIPPATH_CHILD);
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
gfxMatrix SVGClipPathFrame::GetCanvasTM() { return mMatrixForChildren; }

Просмотреть файл

@ -9,7 +9,7 @@
#include "gfxMatrix.h"
#include "mozilla/Attributes.h"
#include "nsSVGContainerFrame.h"
#include "mozilla/SVGContainerFrame.h"
#include "nsSVGUtils.h"
class gfxContext;
@ -24,7 +24,7 @@ nsIFrame* NS_NewSVGClipPathFrame(mozilla::PresShell* aPresShell,
namespace mozilla {
class SVGClipPathFrame final : public nsSVGContainerFrame {
class SVGClipPathFrame final : public SVGContainerFrame {
friend nsIFrame* ::NS_NewSVGClipPathFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
@ -34,7 +34,7 @@ class SVGClipPathFrame final : public nsSVGContainerFrame {
protected:
explicit SVGClipPathFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsSVGContainerFrame(aStyle, aPresContext, kClassID),
: SVGContainerFrame(aStyle, aPresContext, kClassID),
mIsBeingProcessed(false) {
AddStateBits(NS_FRAME_IS_NONDISPLAY);
}
@ -143,7 +143,7 @@ class SVGClipPathFrame final : public nsSVGContainerFrame {
gfxMatrix GetClipPathTransform(nsIFrame* aClippedFrame);
private:
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override;
already_AddRefed<DrawTarget> CreateClipMask(gfxContext& aReferenceContext,

Просмотреть файл

@ -5,36 +5,27 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Main header first:
#include "nsSVGContainerFrame.h"
#include "SVGContainerFrame.h"
// Keep others in (case-insensitive) order:
#include "ImgDrawResult.h"
#include "mozilla/PresShell.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/dom/SVGElement.h"
#include "nsCSSFrameConstructor.h"
#include "SVGObserverUtils.h"
#include "SVGElement.h"
#include "nsSVGUtils.h"
#include "SVGAnimatedTransformList.h"
#include "SVGTextFrame.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::image;
NS_QUERYFRAME_HEAD(nsSVGContainerFrame)
NS_QUERYFRAME_ENTRY(nsSVGContainerFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
NS_QUERYFRAME_HEAD(nsSVGDisplayContainerFrame)
NS_QUERYFRAME_ENTRY(nsSVGDisplayContainerFrame)
NS_QUERYFRAME_ENTRY(nsSVGDisplayableFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsSVGContainerFrame)
nsIFrame* NS_NewSVGContainerFrame(PresShell* aPresShell,
ComputedStyle* aStyle) {
nsIFrame* frame = new (aPresShell) nsSVGContainerFrame(
aStyle, aPresShell->GetPresContext(), nsSVGContainerFrame::kClassID);
nsIFrame* NS_NewSVGContainerFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle) {
nsIFrame* frame = new (aPresShell)
mozilla::SVGContainerFrame(aStyle, aPresShell->GetPresContext(),
mozilla::SVGContainerFrame::kClassID);
// If we were called directly, then the frame is for a <defs> or
// an unknown element type. In both cases we prevent the content
// from displaying directly.
@ -42,16 +33,27 @@ nsIFrame* NS_NewSVGContainerFrame(PresShell* aPresShell,
return frame;
}
NS_IMPL_FRAMEARENA_HELPERS(nsSVGContainerFrame)
namespace mozilla {
void nsSVGContainerFrame::AppendFrames(ChildListID aListID,
nsFrameList& aFrameList) {
NS_QUERYFRAME_HEAD(SVGContainerFrame)
NS_QUERYFRAME_ENTRY(SVGContainerFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
NS_QUERYFRAME_HEAD(SVGDisplayContainerFrame)
NS_QUERYFRAME_ENTRY(SVGDisplayContainerFrame)
NS_QUERYFRAME_ENTRY(nsSVGDisplayableFrame)
NS_QUERYFRAME_TAIL_INHERITING(SVGContainerFrame)
NS_IMPL_FRAMEARENA_HELPERS(SVGContainerFrame)
void SVGContainerFrame::AppendFrames(ChildListID aListID,
nsFrameList& aFrameList) {
InsertFrames(aListID, mFrames.LastChild(), nullptr, aFrameList);
}
void nsSVGContainerFrame::InsertFrames(
ChildListID aListID, nsIFrame* aPrevFrame,
const nsLineList::iterator* aPrevFrameLine, nsFrameList& aFrameList) {
void SVGContainerFrame::InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
const nsLineList::iterator* aPrevFrameLine,
nsFrameList& aFrameList) {
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
"inserting after sibling frame with different parent");
@ -59,15 +61,13 @@ void nsSVGContainerFrame::InsertFrames(
mFrames.InsertFrames(this, aPrevFrame, aFrameList);
}
void nsSVGContainerFrame::RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) {
void SVGContainerFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) {
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
mFrames.DestroyFrame(aOldFrame);
}
bool nsSVGContainerFrame::ComputeCustomOverflow(
nsOverflowAreas& aOverflowAreas) {
bool SVGContainerFrame::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) {
if (mState & NS_FRAME_IS_NONDISPLAY) {
// We don't maintain overflow rects.
// XXX It would have be better if the restyle request hadn't even happened.
@ -100,7 +100,7 @@ bool nsSVGContainerFrame::ComputeCustomOverflow(
* are painted their anonymous kid will first get the necessary reflow.
*/
/* static */
void nsSVGContainerFrame::ReflowSVGNonDisplayText(nsIFrame* aContainer) {
void SVGContainerFrame::ReflowSVGNonDisplayText(nsIFrame* aContainer) {
if (!aContainer->HasAnyStateBits(NS_FRAME_IS_DIRTY)) {
return;
}
@ -122,16 +122,16 @@ void nsSVGContainerFrame::ReflowSVGNonDisplayText(nsIFrame* aContainer) {
}
}
void nsSVGDisplayContainerFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
void SVGDisplayContainerFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
if (!IsSVGOuterSVGFrame()) {
AddStateBits(aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD);
}
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
void nsSVGDisplayContainerFrame::BuildDisplayList(
void SVGDisplayContainerFrame::BuildDisplayList(
nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) {
// mContent could be a XUL element so check for an SVG element before casting
if (mContent->IsSVGElement() &&
@ -142,7 +142,7 @@ void nsSVGDisplayContainerFrame::BuildDisplayList(
return BuildDisplayListForNonBlockChildren(aBuilder, aLists);
}
void nsSVGDisplayContainerFrame::InsertFrames(
void SVGDisplayContainerFrame::InsertFrames(
ChildListID aListID, nsIFrame* aPrevFrame,
const nsLineList::iterator* aPrevFrameLine, nsFrameList& aFrameList) {
// memorize first old frame after insertion point
@ -153,8 +153,8 @@ void nsSVGDisplayContainerFrame::InsertFrames(
nsIFrame* firstNewFrame = aFrameList.FirstChild();
// Insert the new frames
nsSVGContainerFrame::InsertFrames(aListID, aPrevFrame, aPrevFrameLine,
aFrameList);
SVGContainerFrame::InsertFrames(aListID, aPrevFrame, aPrevFrameLine,
aFrameList);
// If we are not a non-display SVG frame and we do not have a bounds update
// pending, then we need to schedule one for our new children:
@ -182,21 +182,21 @@ void nsSVGDisplayContainerFrame::InsertFrames(
}
}
void nsSVGDisplayContainerFrame::RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) {
void SVGDisplayContainerFrame::RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) {
SVGObserverUtils::InvalidateRenderingObservers(aOldFrame);
// nsSVGContainerFrame::RemoveFrame doesn't call down into
// SVGContainerFrame::RemoveFrame doesn't call down into
// nsContainerFrame::RemoveFrame, so it doesn't call FrameNeedsReflow. We
// need to schedule a repaint and schedule an update to our overflow rects.
SchedulePaint();
PresContext()->RestyleManager()->PostRestyleEvent(
mContent->AsElement(), RestyleHint{0}, nsChangeHint_UpdateOverflow);
nsSVGContainerFrame::RemoveFrame(aListID, aOldFrame);
SVGContainerFrame::RemoveFrame(aListID, aOldFrame);
}
bool nsSVGDisplayContainerFrame::IsSVGTransformed(
bool SVGDisplayContainerFrame::IsSVGTransformed(
gfx::Matrix* aOwnTransform, gfx::Matrix* aFromParentTransform) const {
bool foundTransform = false;
@ -205,7 +205,7 @@ bool nsSVGDisplayContainerFrame::IsSVGTransformed(
if (parent &&
parent->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer)) {
foundTransform =
static_cast<nsSVGContainerFrame*>(parent)->HasChildrenOnlyTransform(
static_cast<SVGContainerFrame*>(parent)->HasChildrenOnlyTransform(
aFromParentTransform);
}
@ -229,10 +229,10 @@ bool nsSVGDisplayContainerFrame::IsSVGTransformed(
//----------------------------------------------------------------------
// nsSVGDisplayableFrame methods
void nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
imgDrawingParams& aImgParams,
const nsIntRect* aDirtyRect) {
void SVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
imgDrawingParams& aImgParams,
const nsIntRect* aDirtyRect) {
NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
(mState & NS_FRAME_IS_NONDISPLAY) ||
PresContext()->Document()->IsSVGGlyphsDocument(),
@ -272,7 +272,7 @@ void nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
}
}
nsIFrame* nsSVGDisplayContainerFrame::GetFrameForPoint(const gfxPoint& aPoint) {
nsIFrame* SVGDisplayContainerFrame::GetFrameForPoint(const gfxPoint& aPoint) {
NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() ||
(mState & NS_FRAME_IS_NONDISPLAY),
"If display lists are enabled, only hit-testing of a "
@ -280,7 +280,7 @@ nsIFrame* nsSVGDisplayContainerFrame::GetFrameForPoint(const gfxPoint& aPoint) {
return nsSVGUtils::HitTestChildren(this, aPoint);
}
void nsSVGDisplayContainerFrame::ReflowSVG() {
void SVGDisplayContainerFrame::ReflowSVG() {
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
@ -329,7 +329,7 @@ void nsSVGDisplayContainerFrame::ReflowSVG() {
NS_ASSERTION(kid->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY),
"expected kid to be a NS_FRAME_IS_NONDISPLAY frame");
if (kid->HasAnyStateBits(NS_FRAME_IS_DIRTY)) {
nsSVGContainerFrame* container = do_QueryFrame(kid);
SVGContainerFrame* container = do_QueryFrame(kid);
if (container && container->GetContent()->IsSVGElement()) {
ReflowSVGNonDisplayText(container);
}
@ -365,7 +365,7 @@ void nsSVGDisplayContainerFrame::ReflowSVG() {
NS_FRAME_HAS_DIRTY_CHILDREN);
}
void nsSVGDisplayContainerFrame::NotifySVGChanged(uint32_t aFlags) {
void SVGDisplayContainerFrame::NotifySVGChanged(uint32_t aFlags) {
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
@ -377,7 +377,7 @@ void nsSVGDisplayContainerFrame::NotifySVGChanged(uint32_t aFlags) {
nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags);
}
SVGBBox nsSVGDisplayContainerFrame::GetBBoxContribution(
SVGBBox SVGDisplayContainerFrame::GetBBoxContribution(
const Matrix& aToBBoxUserspace, uint32_t aFlags) {
SVGBBox bboxUnion;
@ -406,13 +406,12 @@ SVGBBox nsSVGDisplayContainerFrame::GetBBoxContribution(
return bboxUnion;
}
gfxMatrix nsSVGDisplayContainerFrame::GetCanvasTM() {
gfxMatrix SVGDisplayContainerFrame::GetCanvasTM() {
if (!mCanvasTM) {
NS_ASSERTION(GetParent(), "null parent");
nsSVGContainerFrame* parent =
static_cast<nsSVGContainerFrame*>(GetParent());
SVGElement* content = static_cast<SVGElement*>(GetContent());
auto* parent = static_cast<SVGContainerFrame*>(GetParent());
auto* content = static_cast<SVGElement*>(GetContent());
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());
@ -421,3 +420,5 @@ gfxMatrix nsSVGDisplayContainerFrame::GetCanvasTM() {
return *mCanvasTM;
}
} // namespace mozilla

Просмотреть файл

@ -11,7 +11,6 @@
#include "mozilla/UniquePtr.h"
#include "nsContainerFrame.h"
#include "nsIFrame.h"
#include "nsIFrame.h"
#include "nsSVGDisplayableFrame.h"
#include "nsQueryFrame.h"
#include "nsRect.h"
@ -27,6 +26,11 @@ namespace mozilla {
class PresShell;
} // namespace mozilla
nsIFrame* NS_NewSVGContainerFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
namespace mozilla {
/**
* Base class for SVG container frames. Frame sub-classes that do not
* display their contents directly (such as the frames for <marker> or
@ -37,22 +41,22 @@ class PresShell;
* *** WARNING ***
*
* Do *not* blindly cast to SVG element types in this class's methods (see the
* warning comment for nsSVGDisplayContainerFrame below).
* warning comment for SVGDisplayContainerFrame below).
*/
class nsSVGContainerFrame : public nsContainerFrame {
friend nsIFrame* NS_NewSVGContainerFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
class SVGContainerFrame : public nsContainerFrame {
friend nsIFrame* ::NS_NewSVGContainerFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
protected:
nsSVGContainerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
ClassID aID)
SVGContainerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
ClassID aID)
: nsContainerFrame(aStyle, aPresContext, aID) {
AddStateBits(NS_FRAME_SVG_LAYOUT);
}
public:
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS(nsSVGContainerFrame)
NS_DECL_FRAMEARENA_HELPERS(SVGContainerFrame)
// Returns the transform to our gfxContext (to device pixels, not CSS px)
virtual gfxMatrix GetCanvasTM() { return gfxMatrix(); }
@ -109,19 +113,19 @@ class nsSVGContainerFrame : public nsContainerFrame {
* nsSVGGenericContainerFrame which is used for unrecognized elements in the
* SVG namespace. Do *not* blindly cast to SVG element types.
*/
class nsSVGDisplayContainerFrame : public nsSVGContainerFrame,
public nsSVGDisplayableFrame {
class SVGDisplayContainerFrame : public SVGContainerFrame,
public nsSVGDisplayableFrame {
protected:
nsSVGDisplayContainerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
nsIFrame::ClassID aID)
: nsSVGContainerFrame(aStyle, aPresContext, aID) {
SVGDisplayContainerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
nsIFrame::ClassID aID)
: SVGContainerFrame(aStyle, aPresContext, aID) {
AddStateBits(NS_FRAME_MAY_BE_TRANSFORMED);
}
public:
NS_DECL_QUERYFRAME
NS_DECL_QUERYFRAME_TARGET(nsSVGDisplayContainerFrame)
NS_DECL_ABSTRACT_FRAME(nsSVGDisplayContainerFrame)
NS_DECL_QUERYFRAME_TARGET(SVGDisplayContainerFrame)
NS_DECL_ABSTRACT_FRAME(SVGDisplayContainerFrame)
// nsIFrame:
virtual void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
@ -154,7 +158,9 @@ class nsSVGDisplayContainerFrame : public nsSVGContainerFrame,
/**
* Cached canvasTM value.
*/
mozilla::UniquePtr<gfxMatrix> mCanvasTM;
UniquePtr<gfxMatrix> mCanvasTM;
};
} // namespace mozilla
#endif

Просмотреть файл

@ -162,8 +162,8 @@ nsresult SVGFilterFrame::AttributeChanged(int32_t aNameSpaceID,
// And update whoever references us
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
return SVGContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
}
#ifdef DEBUG
@ -172,7 +172,7 @@ void SVGFilterFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::filter),
"Content is not an SVG filter");
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */

Просмотреть файл

@ -8,9 +8,9 @@
#define __NS_SVGFILTERFRAME_H__
#include "mozilla/Attributes.h"
#include "mozilla/SVGContainerFrame.h"
#include "nsIFrame.h"
#include "nsQueryFrame.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGUtils.h"
class nsAtom;
@ -34,13 +34,13 @@ nsIFrame* NS_NewSVGFilterFrame(mozilla::PresShell* aPresShell,
namespace mozilla {
class SVGFilterFrame final : public nsSVGContainerFrame {
class SVGFilterFrame final : public SVGContainerFrame {
friend nsIFrame* ::NS_NewSVGFilterFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
protected:
explicit SVGFilterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsSVGContainerFrame(aStyle, aPresContext, kClassID),
: SVGContainerFrame(aStyle, aPresContext, kClassID),
mLoopFlag(false),
mNoHRefURI(false) {
AddStateBits(NS_FRAME_IS_NONDISPLAY);

Просмотреть файл

@ -12,17 +12,17 @@
#include "gfxContext.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGContainerFrame.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGOuterSVGFrame.h"
#include "mozilla/dom/SVGForeignObjectElement.h"
#include "nsDisplayList.h"
#include "nsGkAtoms.h"
#include "nsNameSpaceManager.h"
#include "nsLayoutUtils.h"
#include "nsRegion.h"
#include "nsSVGContainerFrame.h"
#include "SVGGeometryProperty.h"
#include "SVGObserverUtils.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGOuterSVGFrame.h"
#include "nsSVGUtils.h"
using namespace mozilla::dom;
@ -172,7 +172,7 @@ bool SVGForeignObjectFrame::IsSVGTransformed(
if (parent &&
parent->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer)) {
foundTransform =
static_cast<nsSVGContainerFrame*>(parent)->HasChildrenOnlyTransform(
static_cast<SVGContainerFrame*>(parent)->HasChildrenOnlyTransform(
aFromParentTransform);
}
@ -424,10 +424,10 @@ void SVGForeignObjectFrame::NotifySVGChanged(uint32_t aFlags) {
// If we're called while the PresShell is handling reflow events then we
// must have been called as a result of the NotifyViewportChange() call in
// our nsSVGOuterSVGFrame's Reflow() method. We must not call RequestReflow
// our SVGOuterSVGFrame's Reflow() method. We must not call RequestReflow
// at this point (i.e. during reflow) because it could confuse the
// PresShell and prevent it from reflowing us properly in future. Besides
// that, nsSVGOuterSVGFrame::DidReflow will take care of reflowing us
// that, SVGOuterSVGFrame::DidReflow will take care of reflowing us
// synchronously, so there's no need.
if (needReflow && !PresShell()->IsReflowLocked()) {
RequestReflow(IntrinsicDirty::Resize);
@ -465,10 +465,8 @@ gfxMatrix SVGForeignObjectFrame::GetCanvasTM() {
if (!mCanvasTM) {
NS_ASSERTION(GetParent(), "null parent");
nsSVGContainerFrame* parent =
static_cast<nsSVGContainerFrame*>(GetParent());
SVGForeignObjectElement* content =
static_cast<SVGForeignObjectElement*>(GetContent());
auto* parent = static_cast<SVGContainerFrame*>(GetParent());
auto* content = static_cast<SVGForeignObjectElement*>(GetContent());
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());

Просмотреть файл

@ -38,7 +38,7 @@ void SVGGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
static_cast<SVGElement*>(aContent)->IsTransformable(),
"The element is not transformable");
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */

Просмотреть файл

@ -8,8 +8,8 @@
#define NSSVGGFRAME_H
#include "mozilla/Attributes.h"
#include "mozilla/SVGContainerFrame.h"
#include "gfxMatrix.h"
#include "nsSVGContainerFrame.h"
namespace mozilla {
class PresShell;
@ -20,7 +20,7 @@ nsIFrame* NS_NewSVGGFrame(mozilla::PresShell* aPresShell,
namespace mozilla {
class SVGGFrame : public nsSVGDisplayContainerFrame {
class SVGGFrame : public SVGDisplayContainerFrame {
friend nsIFrame* ::NS_NewSVGGFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
explicit SVGGFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
@ -29,7 +29,7 @@ class SVGGFrame : public nsSVGDisplayContainerFrame {
protected:
SVGGFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
nsIFrame::ClassID aID)
: nsSVGDisplayContainerFrame(aStyle, aPresContext, aID) {}
: SVGDisplayContainerFrame(aStyle, aPresContext, aID) {}
public:
NS_DECL_FRAMEARENA_HELPERS(SVGGFrame)

Просмотреть файл

@ -40,12 +40,12 @@ nsresult SVGGenericContainerFrame::AttributeChanged(int32_t aNameSpaceID,
}
//----------------------------------------------------------------------
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
gfxMatrix SVGGenericContainerFrame::GetCanvasTM() {
NS_ASSERTION(GetParent(), "null parent");
return static_cast<nsSVGContainerFrame*>(GetParent())->GetCanvasTM();
return static_cast<SVGContainerFrame*>(GetParent())->GetCanvasTM();
}
} // namespace mozilla

Просмотреть файл

@ -8,11 +8,11 @@
#define __NS_SVGGENERICCONTAINERFRAME_H__
#include "mozilla/Attributes.h"
#include "mozilla/SVGContainerFrame.h"
#include "gfxMatrix.h"
#include "nsIFrame.h"
#include "nsLiteralString.h"
#include "nsQueryFrame.h"
#include "nsSVGContainerFrame.h"
class nsAtom;
class nsIFrame;
@ -26,14 +26,14 @@ nsIFrame* NS_NewSVGGenericContainerFrame(mozilla::PresShell* aPresShell,
namespace mozilla {
class SVGGenericContainerFrame final : public nsSVGDisplayContainerFrame {
class SVGGenericContainerFrame final : public SVGDisplayContainerFrame {
friend nsIFrame* ::NS_NewSVGGenericContainerFrame(
mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
protected:
explicit SVGGenericContainerFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
: nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
: SVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
public:
NS_DECL_FRAMEARENA_HELPERS(SVGGenericContainerFrame)
@ -48,7 +48,7 @@ class SVGGenericContainerFrame final : public nsSVGDisplayContainerFrame {
}
#endif
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override;
};

Просмотреть файл

@ -180,7 +180,7 @@ bool SVGGeometryFrame::IsSVGTransformed(
if (parent &&
parent->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer)) {
foundTransform =
static_cast<nsSVGContainerFrame*>(parent)->HasChildrenOnlyTransform(
static_cast<SVGContainerFrame*>(parent)->HasChildrenOnlyTransform(
aFromParentTransform);
}
@ -601,8 +601,8 @@ SVGBBox SVGGeometryFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
gfxMatrix SVGGeometryFrame::GetCanvasTM() {
NS_ASSERTION(GetParent(), "null parent");
nsSVGContainerFrame* parent = static_cast<nsSVGContainerFrame*>(GetParent());
SVGGraphicsElement* content = static_cast<SVGGraphicsElement*>(GetContent());
auto* parent = static_cast<SVGContainerFrame*>(GetParent());
auto* content = static_cast<SVGGraphicsElement*>(GetContent());
return content->PrependLocalTransformsTo(parent->GetCanvasTM());
}

Просмотреть файл

@ -28,6 +28,10 @@ namespace gfx {
class DrawTarget;
} // namespace gfx
namespace image {
struct imgDrawingParams;
} // namespace image
} // namespace mozilla
class gfxContext;
@ -43,7 +47,7 @@ nsIFrame* NS_NewSVGGeometryFrame(mozilla::PresShell* aPresShell,
namespace mozilla {
class SVGGeometryFrame : public nsIFrame, public nsSVGDisplayableFrame {
typedef mozilla::gfx::DrawTarget DrawTarget;
typedef gfx::DrawTarget DrawTarget;
friend nsIFrame* ::NS_NewSVGGeometryFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
@ -141,7 +145,7 @@ class SVGGeometryFrame : public nsIFrame, public nsSVGDisplayableFrame {
// Display list item:
class DisplaySVGGeometry final : public nsPaintedDisplayItem {
typedef mozilla::image::imgDrawingParams imgDrawingParams;
typedef image::imgDrawingParams imgDrawingParams;
public:
DisplaySVGGeometry(nsDisplayListBuilder* aBuilder, SVGGeometryFrame* aFrame)

Просмотреть файл

@ -45,8 +45,8 @@ nsresult SVGMarkerFrame::AttributeChanged(int32_t aNameSpaceID,
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
return SVGContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
}
#ifdef DEBUG
@ -55,12 +55,12 @@ void SVGMarkerFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::marker),
"Content is not an SVG marker");
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
//----------------------------------------------------------------------
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
gfxMatrix SVGMarkerFrame::GetCanvasTM() {
NS_ASSERTION(mMarkedFrame, "null SVGGeometry frame");
@ -234,7 +234,7 @@ void SVGMarkerAnonChildFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
MOZ_ASSERT(aParent->IsSVGMarkerFrame(), "Unexpected parent");
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif

Просмотреть файл

@ -8,12 +8,12 @@
#define __NS_SVGMARKERFRAME_H__
#include "mozilla/Attributes.h"
#include "mozilla/SVGContainerFrame.h"
#include "gfxMatrix.h"
#include "gfxRect.h"
#include "nsIFrame.h"
#include "nsLiteralString.h"
#include "nsQueryFrame.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGUtils.h"
class gfxContext;
@ -37,7 +37,7 @@ nsContainerFrame* NS_NewSVGMarkerAnonChildFrame(mozilla::PresShell* aPresShell,
namespace mozilla {
class SVGMarkerFrame final : public nsSVGContainerFrame {
class SVGMarkerFrame final : public SVGContainerFrame {
typedef image::imgDrawingParams imgDrawingParams;
friend class SVGMarkerAnonChildFrame;
@ -46,7 +46,7 @@ class SVGMarkerFrame final : public nsSVGContainerFrame {
protected:
explicit SVGMarkerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsSVGContainerFrame(aStyle, aPresContext, kClassID),
: SVGContainerFrame(aStyle, aPresContext, kClassID),
mMarkedFrame(nullptr),
mInUse(false),
mInUse2(false) {
@ -101,7 +101,7 @@ class SVGMarkerFrame final : public nsSVGContainerFrame {
SVGGeometryFrame* mMarkedFrame;
Matrix mMarkerTM;
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override;
// A helper class to allow us to paint markers safely. The helper
@ -134,13 +134,13 @@ class SVGMarkerFrame final : public nsSVGContainerFrame {
////////////////////////////////////////////////////////////////////////
// nsMarkerAnonChildFrame class
class SVGMarkerAnonChildFrame final : public nsSVGDisplayContainerFrame {
class SVGMarkerAnonChildFrame final : public SVGDisplayContainerFrame {
friend nsContainerFrame* ::NS_NewSVGMarkerAnonChildFrame(
mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
explicit SVGMarkerAnonChildFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
: nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
: SVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
public:
NS_DECL_FRAMEARENA_HELPERS(SVGMarkerAnonChildFrame)
@ -156,7 +156,7 @@ class SVGMarkerAnonChildFrame final : public nsSVGDisplayContainerFrame {
}
#endif
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override {
return static_cast<SVGMarkerFrame*>(GetParent())->GetCanvasTM();
}

Просмотреть файл

@ -155,8 +155,8 @@ nsresult SVGMaskFrame::AttributeChanged(int32_t aNameSpaceID,
SVGObserverUtils::InvalidateDirectRenderingObservers(this);
}
return nsSVGContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
return SVGContainerFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
}
#ifdef DEBUG
@ -165,7 +165,7 @@ void SVGMaskFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::mask),
"Content is not an SVG mask");
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */

Просмотреть файл

@ -8,11 +8,11 @@
#define __NS_SVGMASKFRAME_H__
#include "mozilla/Attributes.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SVGContainerFrame.h"
#include "mozilla/gfx/2D.h"
#include "gfxPattern.h"
#include "gfxMatrix.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGUtils.h"
class gfxContext;
@ -26,7 +26,7 @@ nsIFrame* NS_NewSVGMaskFrame(mozilla::PresShell* aPresShell,
namespace mozilla {
class SVGMaskFrame final : public nsSVGContainerFrame {
class SVGMaskFrame final : public SVGContainerFrame {
friend nsIFrame* ::NS_NewSVGMaskFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
@ -36,7 +36,7 @@ class SVGMaskFrame final : public nsSVGContainerFrame {
protected:
explicit SVGMaskFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsSVGContainerFrame(aStyle, aPresContext, kClassID), mInUse(false) {
: SVGContainerFrame(aStyle, aPresContext, kClassID), mInUse(false) {
AddStateBits(NS_FRAME_IS_NONDISPLAY);
}
@ -103,7 +103,7 @@ class SVGMaskFrame final : public nsSVGContainerFrame {
// recursion prevention flag
bool mInUse;
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override;
};

Просмотреть файл

@ -996,7 +996,7 @@ void SVGTemplateElementObserver::OnRenderingChange() {
*
* InvalidateAll must be called before this object is destroyed, i.e.
* before the referenced frame is destroyed. This should normally happen
* via nsSVGContainerFrame::RemoveFrame, since only frames in the frame
* via SVGContainerFrame::RemoveFrame, since only frames in the frame
* tree should be referenced.
*/
class SVGRenderingObserverSet {

Просмотреть файл

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Main header first:
#include "nsSVGOuterSVGFrame.h"
#include "SVGOuterSVGFrame.h"
// Keep others in (case-insensitive) order:
#include "gfxContext.h"
@ -21,15 +21,16 @@
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/dom/SVGViewElement.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::gfx;
using namespace mozilla::image;
namespace mozilla {
//----------------------------------------------------------------------
// Implementation helpers
void nsSVGOuterSVGFrame::RegisterForeignObject(SVGForeignObjectFrame* aFrame) {
void SVGOuterSVGFrame::RegisterForeignObject(SVGForeignObjectFrame* aFrame) {
NS_ASSERTION(aFrame, "Who on earth is calling us?!");
if (!mForeignObjectHash) {
@ -46,28 +47,31 @@ void nsSVGOuterSVGFrame::RegisterForeignObject(SVGForeignObjectFrame* aFrame) {
"Failed to register SVGForeignObjectFrame!");
}
void nsSVGOuterSVGFrame::UnregisterForeignObject(
SVGForeignObjectFrame* aFrame) {
void SVGOuterSVGFrame::UnregisterForeignObject(SVGForeignObjectFrame* aFrame) {
NS_ASSERTION(aFrame, "Who on earth is calling us?!");
NS_ASSERTION(mForeignObjectHash && mForeignObjectHash->GetEntry(aFrame),
"SVGForeignObjectFrame not in registry!");
return mForeignObjectHash->RemoveEntry(aFrame);
}
} // namespace mozilla
//----------------------------------------------------------------------
// Implementation
nsContainerFrame* NS_NewSVGOuterSVGFrame(PresShell* aPresShell,
ComputedStyle* aStyle) {
nsContainerFrame* NS_NewSVGOuterSVGFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle) {
return new (aPresShell)
nsSVGOuterSVGFrame(aStyle, aPresShell->GetPresContext());
mozilla::SVGOuterSVGFrame(aStyle, aPresShell->GetPresContext());
}
NS_IMPL_FRAMEARENA_HELPERS(nsSVGOuterSVGFrame)
namespace mozilla {
nsSVGOuterSVGFrame::nsSVGOuterSVGFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
: nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID),
NS_IMPL_FRAMEARENA_HELPERS(SVGOuterSVGFrame)
SVGOuterSVGFrame::SVGOuterSVGFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
: SVGDisplayContainerFrame(aStyle, aPresContext, kClassID),
mCallingReflowSVG(false),
mFullZoom(PresContext()->GetFullZoom()),
mViewportInitialized(false),
@ -92,13 +96,13 @@ static inline bool DependsOnIntrinsicSize(const nsIFrame* aEmbeddingFrame) {
// they're not really "replaced", and there's no outer context to contain sizes
// from leaking into). Hence, we check for a parent element before we bother
// testing for 'contain:size'.
static inline bool IsReplacedAndContainSize(const nsSVGOuterSVGFrame* aFrame) {
static inline bool IsReplacedAndContainSize(const SVGOuterSVGFrame* aFrame) {
return aFrame->GetContent()->GetParent() &&
aFrame->StyleDisplay()->IsContainSize();
}
void nsSVGOuterSVGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
void SVGOuterSVGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svg),
"Content is not an SVG 'svg' element!");
@ -107,9 +111,9 @@ void nsSVGOuterSVGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
// Check for conditional processing attributes here rather than in
// nsCSSFrameConstructor::FindSVGData because we want to avoid
// simply giving failing outer <svg> elements an nsSVGContainerFrame.
// simply giving failing outer <svg> elements an SVGContainerFrame.
// We don't create other SVG frames if PassesConditionalProcessingTests
// returns false, but since we do create nsSVGOuterSVGFrame frames we
// returns false, but since we do create SVGOuterSVGFrame frames we
// prevent them from painting by [ab]use NS_FRAME_IS_NONDISPLAY. The
// frame will be recreated via an nsChangeHint_ReconstructFrame restyle if
// the value returned by PassesConditionalProcessingTests changes.
@ -118,7 +122,7 @@ void nsSVGOuterSVGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
AddStateBits(NS_FRAME_IS_NONDISPLAY);
}
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
Document* doc = mContent->GetUncomposedDoc();
if (doc) {
@ -154,9 +158,9 @@ void nsSVGOuterSVGFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
//----------------------------------------------------------------------
// nsQueryFrame methods
NS_QUERYFRAME_HEAD(nsSVGOuterSVGFrame)
NS_QUERYFRAME_HEAD(SVGOuterSVGFrame)
NS_QUERYFRAME_ENTRY(nsISVGSVGFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame)
NS_QUERYFRAME_TAIL_INHERITING(SVGDisplayContainerFrame)
//----------------------------------------------------------------------
// nsIFrame methods
@ -164,7 +168,7 @@ NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame)
// reflowing
/* virtual */
nscoord nsSVGOuterSVGFrame::GetMinISize(gfxContext* aRenderingContext) {
nscoord SVGOuterSVGFrame::GetMinISize(gfxContext* aRenderingContext) {
nscoord result;
DISPLAY_MIN_INLINE_SIZE(this, result);
@ -174,7 +178,7 @@ nscoord nsSVGOuterSVGFrame::GetMinISize(gfxContext* aRenderingContext) {
}
/* virtual */
nscoord nsSVGOuterSVGFrame::GetPrefISize(gfxContext* aRenderingContext) {
nscoord SVGOuterSVGFrame::GetPrefISize(gfxContext* aRenderingContext) {
nscoord result;
DISPLAY_PREF_INLINE_SIZE(this, result);
@ -217,7 +221,7 @@ nscoord nsSVGOuterSVGFrame::GetPrefISize(gfxContext* aRenderingContext) {
}
/* virtual */
IntrinsicSize nsSVGOuterSVGFrame::GetIntrinsicSize() {
IntrinsicSize SVGOuterSVGFrame::GetIntrinsicSize() {
// XXXjwatt Note that here we want to return the CSS width/height if they're
// specified and we're embedded inside an nsIObjectLoadingContent.
@ -250,7 +254,7 @@ IntrinsicSize nsSVGOuterSVGFrame::GetIntrinsicSize() {
}
/* virtual */
AspectRatio nsSVGOuterSVGFrame::GetIntrinsicRatio() {
AspectRatio SVGOuterSVGFrame::GetIntrinsicRatio() {
if (IsReplacedAndContainSize(this)) {
return AspectRatio();
}
@ -287,11 +291,11 @@ AspectRatio nsSVGOuterSVGFrame::GetIntrinsicRatio() {
return AspectRatio::FromSize(viewbox->width, viewbox->height);
}
return nsSVGDisplayContainerFrame::GetIntrinsicRatio();
return SVGDisplayContainerFrame::GetIntrinsicRatio();
}
/* virtual */
LogicalSize nsSVGOuterSVGFrame::ComputeSize(
LogicalSize SVGOuterSVGFrame::ComputeSize(
gfxContext* aRenderingContext, WritingMode aWritingMode,
const LogicalSize& aCBSize, nscoord aAvailableISize,
const LogicalSize& aMargin, const LogicalSize& aBorder,
@ -360,17 +364,17 @@ LogicalSize nsSVGOuterSVGFrame::ComputeSize(
cbSize, aMargin, aBorder, aPadding, aFlags);
}
void nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) {
void SVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsSVGOuterSVGFrame");
DO_GLOBAL_REFLOW_COUNT("SVGOuterSVGFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
NS_FRAME_TRACE(
NS_FRAME_TRACE_CALLS,
("enter nsSVGOuterSVGFrame::Reflow: availSize=%d,%d",
("enter SVGOuterSVGFrame::Reflow: availSize=%d,%d",
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
MOZ_ASSERT(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
@ -386,9 +390,8 @@ void nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
SVGSVGElement* svgElem = static_cast<SVGSVGElement*>(GetContent());
nsSVGOuterSVGAnonChildFrame* anonKid =
static_cast<nsSVGOuterSVGAnonChildFrame*>(
PrincipalChildList().FirstChild());
auto* anonKid = static_cast<SVGOuterSVGAnonChildFrame*>(
PrincipalChildList().FirstChild());
if (mState & NS_FRAME_FIRST_REFLOW) {
// Initialize
@ -508,14 +511,14 @@ void nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
}
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsSVGOuterSVGFrame::Reflow: size=%d,%d",
("exit SVGOuterSVGFrame::Reflow: size=%d,%d",
aDesiredSize.Width(), aDesiredSize.Height()));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
void nsSVGOuterSVGFrame::DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowInput) {
nsSVGDisplayContainerFrame::DidReflow(aPresContext, aReflowInput);
void SVGOuterSVGFrame::DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowInput) {
SVGDisplayContainerFrame::DidReflow(aPresContext, aReflowInput);
// Make sure elements styled by :hover get updated if script/animation moves
// them under or out from under the pointer:
@ -523,7 +526,7 @@ void nsSVGOuterSVGFrame::DidReflow(nsPresContext* aPresContext,
}
/* virtual */
void nsSVGOuterSVGFrame::UnionChildOverflow(nsOverflowAreas& aOverflowAreas) {
void SVGOuterSVGFrame::UnionChildOverflow(nsOverflowAreas& aOverflowAreas) {
// See the comments in Reflow above.
// WARNING!! Keep this in sync with Reflow above!
@ -544,7 +547,7 @@ void nsSVGOuterSVGFrame::UnionChildOverflow(nsOverflowAreas& aOverflowAreas) {
*/
class nsDisplayOuterSVG final : public nsPaintedDisplayItem {
public:
nsDisplayOuterSVG(nsDisplayListBuilder* aBuilder, nsSVGOuterSVGFrame* aFrame)
nsDisplayOuterSVG(nsDisplayListBuilder* aBuilder, SVGOuterSVGFrame* aFrame)
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayOuterSVG);
}
@ -571,7 +574,7 @@ class nsDisplayOuterSVG final : public nsPaintedDisplayItem {
void nsDisplayOuterSVG::HitTest(nsDisplayListBuilder* aBuilder,
const nsRect& aRect, HitTestState* aState,
nsTArray<nsIFrame*>* aOutFrames) {
nsSVGOuterSVGFrame* outerSVGFrame = static_cast<nsSVGOuterSVGFrame*>(mFrame);
SVGOuterSVGFrame* outerSVGFrame = static_cast<SVGOuterSVGFrame*>(mFrame);
nsPoint refFrameToContentBox =
ToReferenceFrame() +
@ -585,9 +588,8 @@ void nsDisplayOuterSVG::HitTest(nsDisplayListBuilder* aBuilder,
gfxPoint(pointRelativeToContentBox.x, pointRelativeToContentBox.y) /
AppUnitsPerCSSPixel();
nsSVGOuterSVGAnonChildFrame* anonKid =
static_cast<nsSVGOuterSVGAnonChildFrame*>(
outerSVGFrame->PrincipalChildList().FirstChild());
auto* anonKid = static_cast<SVGOuterSVGAnonChildFrame*>(
outerSVGFrame->PrincipalChildList().FirstChild());
nsIFrame* frame =
nsSVGUtils::HitTestChildren(anonKid, svgViewportRelativePoint);
@ -639,7 +641,7 @@ void nsDisplayOuterSVG::Paint(nsDisplayListBuilder* aBuilder,
#endif
}
nsRegion nsSVGOuterSVGFrame::FindInvalidatedForeignObjectFrameChildren(
nsRegion SVGOuterSVGFrame::FindInvalidatedForeignObjectFrameChildren(
nsIFrame* aFrame) {
nsRegion result;
if (mForeignObjectHash && mForeignObjectHash->Count()) {
@ -653,7 +655,7 @@ nsRegion nsSVGOuterSVGFrame::FindInvalidatedForeignObjectFrameChildren(
void nsDisplayOuterSVG::ComputeInvalidationRegion(
nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion) const {
nsSVGOuterSVGFrame* frame = static_cast<nsSVGOuterSVGFrame*>(mFrame);
auto* frame = static_cast<SVGOuterSVGFrame*>(mFrame);
frame->InvalidateSVG(frame->FindInvalidatedForeignObjectFrameChildren(frame));
nsRegion result = frame->GetInvalidRegion();
@ -673,9 +675,9 @@ void nsDisplayOuterSVG::ComputeInvalidationRegion(
}
}
nsresult nsSVGOuterSVGFrame::AttributeChanged(int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
nsresult SVGOuterSVGFrame::AttributeChanged(int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType) {
if (aNameSpaceID == kNameSpaceID_None &&
!HasAnyStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_NONDISPLAY)) {
if (aAttribute == nsGkAtoms::viewBox ||
@ -728,8 +730,8 @@ nsresult nsSVGOuterSVGFrame::AttributeChanged(int32_t aNameSpaceID,
return NS_OK;
}
bool nsSVGOuterSVGFrame::IsSVGTransformed(Matrix* aOwnTransform,
Matrix* aFromParentTransform) const {
bool SVGOuterSVGFrame::IsSVGTransformed(Matrix* aOwnTransform,
Matrix* aFromParentTransform) const {
// Our anonymous child's HasChildrenOnlyTransform() implementation makes sure
// our children-only transforms are applied to our children. We only care
// about transforms that transform our own frame here.
@ -753,8 +755,8 @@ bool nsSVGOuterSVGFrame::IsSVGTransformed(Matrix* aOwnTransform,
//----------------------------------------------------------------------
// painting
void nsSVGOuterSVGFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) {
void SVGOuterSVGFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) {
if (HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
return;
}
@ -791,7 +793,7 @@ void nsSVGOuterSVGFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
//----------------------------------------------------------------------
// nsISVGSVGFrame methods:
void nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags) {
void SVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags) {
MOZ_ASSERT(aFlags && !(aFlags & ~(COORD_CONTEXT_CHANGED | TRANSFORM_CHANGED |
FULL_ZOOM_CHANGED)),
"Unexpected aFlags value");
@ -848,21 +850,20 @@ void nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags) {
//----------------------------------------------------------------------
// nsSVGDisplayableFrame methods:
void nsSVGOuterSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
imgDrawingParams& aImgParams,
const nsIntRect* aDirtyRect) {
void SVGOuterSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
imgDrawingParams& aImgParams,
const nsIntRect* aDirtyRect) {
NS_ASSERTION(
PrincipalChildList().FirstChild()->IsSVGOuterSVGAnonChildFrame() &&
!PrincipalChildList().FirstChild()->GetNextSibling(),
"We should have a single, anonymous, child");
nsSVGOuterSVGAnonChildFrame* anonKid =
static_cast<nsSVGOuterSVGAnonChildFrame*>(
PrincipalChildList().FirstChild());
auto* anonKid = static_cast<SVGOuterSVGAnonChildFrame*>(
PrincipalChildList().FirstChild());
anonKid->PaintSVG(aContext, aTransform, aImgParams, aDirtyRect);
}
SVGBBox nsSVGOuterSVGFrame::GetBBoxContribution(
SVGBBox SVGOuterSVGFrame::GetBBoxContribution(
const gfx::Matrix& aToBBoxUserspace, uint32_t aFlags) {
NS_ASSERTION(
PrincipalChildList().FirstChild()->IsSVGOuterSVGAnonChildFrame() &&
@ -870,16 +871,15 @@ SVGBBox nsSVGOuterSVGFrame::GetBBoxContribution(
"We should have a single, anonymous, child");
// We must defer to our child so that we don't include our
// content->PrependLocalTransformsTo() transforms.
nsSVGOuterSVGAnonChildFrame* anonKid =
static_cast<nsSVGOuterSVGAnonChildFrame*>(
PrincipalChildList().FirstChild());
auto* anonKid = static_cast<SVGOuterSVGAnonChildFrame*>(
PrincipalChildList().FirstChild());
return anonKid->GetBBoxContribution(aToBBoxUserspace, aFlags);
}
//----------------------------------------------------------------------
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
gfxMatrix nsSVGOuterSVGFrame::GetCanvasTM() {
gfxMatrix SVGOuterSVGFrame::GetCanvasTM() {
if (!mCanvasTM) {
SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());
@ -897,7 +897,7 @@ gfxMatrix nsSVGOuterSVGFrame::GetCanvasTM() {
// Implementation helpers
template <typename... Args>
bool nsSVGOuterSVGFrame::IsContainingWindowElementOfType(
bool SVGOuterSVGFrame::IsContainingWindowElementOfType(
nsIFrame** aContainingWindowFrame, Args... aArgs) const {
if (!mContent->GetParent()) {
// Our content is the document element
@ -922,13 +922,13 @@ bool nsSVGOuterSVGFrame::IsContainingWindowElementOfType(
return false;
}
bool nsSVGOuterSVGFrame::IsRootOfReplacedElementSubDoc(
bool SVGOuterSVGFrame::IsRootOfReplacedElementSubDoc(
nsIFrame** aEmbeddingFrame) {
return IsContainingWindowElementOfType(aEmbeddingFrame, nsGkAtoms::object,
nsGkAtoms::embed);
}
bool nsSVGOuterSVGFrame::IsRootOfImage() {
bool SVGOuterSVGFrame::IsRootOfImage() {
if (!mContent->GetParent()) {
// Our content is the document element
Document* doc = mContent->GetUncomposedDoc();
@ -941,44 +941,48 @@ bool nsSVGOuterSVGFrame::IsRootOfImage() {
return false;
}
bool nsSVGOuterSVGFrame::VerticalScrollbarNotNeeded() const {
bool SVGOuterSVGFrame::VerticalScrollbarNotNeeded() const {
const SVGAnimatedLength& height =
static_cast<SVGSVGElement*>(GetContent())
->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
return height.IsPercentage() && height.GetBaseValInSpecifiedUnits() <= 100;
}
void nsSVGOuterSVGFrame::AppendDirectlyOwnedAnonBoxes(
void SVGOuterSVGFrame::AppendDirectlyOwnedAnonBoxes(
nsTArray<OwnedAnonBox>& aResult) {
nsIFrame* anonKid = PrincipalChildList().FirstChild();
MOZ_ASSERT(anonKid->IsSVGOuterSVGAnonChildFrame());
aResult.AppendElement(OwnedAnonBox(anonKid));
}
//----------------------------------------------------------------------
// Implementation of nsSVGOuterSVGAnonChildFrame
} // namespace mozilla
nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(PresShell* aPresShell,
ComputedStyle* aStyle) {
//----------------------------------------------------------------------
// Implementation of SVGOuterSVGAnonChildFrame
nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(
mozilla::PresShell* aPresShell, mozilla::ComputedStyle* aStyle) {
return new (aPresShell)
nsSVGOuterSVGAnonChildFrame(aStyle, aPresShell->GetPresContext());
mozilla::SVGOuterSVGAnonChildFrame(aStyle, aPresShell->GetPresContext());
}
NS_IMPL_FRAMEARENA_HELPERS(nsSVGOuterSVGAnonChildFrame)
namespace mozilla {
NS_IMPL_FRAMEARENA_HELPERS(SVGOuterSVGAnonChildFrame)
#ifdef DEBUG
void nsSVGOuterSVGAnonChildFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
void SVGOuterSVGAnonChildFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
MOZ_ASSERT(aParent->IsSVGOuterSVGFrame(), "Unexpected parent");
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif
void nsSVGOuterSVGAnonChildFrame::BuildDisplayList(
void SVGOuterSVGAnonChildFrame::BuildDisplayList(
nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) {
// Wrap our contents into an nsDisplaySVGWrapper.
// We wrap this frame instead of the nsSVGOuterSVGFrame so that the wrapper
// We wrap this frame instead of the SVGOuterSVGFrame so that the wrapper
// doesn't contain the <svg> element's CSS styles, like backgrounds or
// borders. Creating the nsDisplaySVGWrapper here also means that it'll be
// inside the nsDisplayTransform for our viewbox transform. The
@ -993,8 +997,8 @@ void nsSVGOuterSVGAnonChildFrame::BuildDisplayList(
}
static Matrix ComputeOuterSVGAnonChildFrameTransform(
const nsSVGOuterSVGAnonChildFrame* aFrame) {
// Our elements 'transform' attribute is applied to our nsSVGOuterSVGFrame
const SVGOuterSVGAnonChildFrame* aFrame) {
// Our elements 'transform' attribute is applied to our SVGOuterSVGFrame
// parent, and the element's children-only transforms are applied to us, the
// anonymous child frame. Since we are the child frame, we apply the
// children-only transforms as if they are our own transform.
@ -1035,7 +1039,7 @@ static Matrix ComputeOuterSVGAnonChildFrameTransform(
// not affect our descendants' transforms. Consequently, if the <svg> element
// moves, e.g. during scrolling, the transform matrices of our contents are
// unaffected. This simplifies invalidation.
bool nsSVGOuterSVGAnonChildFrame::IsSVGTransformed(
bool SVGOuterSVGAnonChildFrame::IsSVGTransformed(
Matrix* aOwnTransform, Matrix* aFromParentTransform) const {
if (aOwnTransform) {
*aOwnTransform = ComputeOuterSVGAnonChildFrameTransform(this);
@ -1049,3 +1053,5 @@ bool IsAnyAtomEqual(const nsAString& aString, nsAtom* aFirst, Atoms... aArgs) {
return aFirst->Equals(aString) || IsAnyAtomEqual(aString, aArgs...);
}
bool IsAnyAtomEqual(const nsAString& aString) { return false; }
} // namespace mozilla

Просмотреть файл

@ -8,9 +8,9 @@
#define __NS_SVGOUTERSVGFRAME_H__
#include "mozilla/Attributes.h"
#include "mozilla/SVGContainerFrame.h"
#include "mozilla/UniquePtr.h"
#include "nsISVGSVGFrame.h"
#include "nsSVGContainerFrame.h"
#include "nsRegion.h"
class gfxContext;
@ -20,26 +20,32 @@ class SVGForeignObjectFrame;
class PresShell;
} // namespace mozilla
nsContainerFrame* NS_NewSVGOuterSVGFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(
mozilla::PresShell* aPresShell, mozilla::ComputedStyle* aStyle);
namespace mozilla {
////////////////////////////////////////////////////////////////////////
// nsSVGOuterSVGFrame class
// SVGOuterSVGFrame class
class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame,
public nsISVGSVGFrame {
typedef mozilla::image::imgDrawingParams imgDrawingParams;
class SVGOuterSVGFrame final : public SVGDisplayContainerFrame,
public nsISVGSVGFrame {
typedef image::imgDrawingParams imgDrawingParams;
friend nsContainerFrame* NS_NewSVGOuterSVGFrame(
friend nsContainerFrame* ::NS_NewSVGOuterSVGFrame(
mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
protected:
explicit nsSVGOuterSVGFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext);
explicit SVGOuterSVGFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
public:
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS(nsSVGOuterSVGFrame)
NS_DECL_FRAMEARENA_HELPERS(SVGOuterSVGFrame)
#ifdef DEBUG
~nsSVGOuterSVGFrame() {
~SVGOuterSVGFrame() {
NS_ASSERTION(!mForeignObjectHash || mForeignObjectHash->Count() == 0,
"foreignObject(s) still registered!");
}
@ -49,14 +55,14 @@ class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame,
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
virtual mozilla::IntrinsicSize GetIntrinsicSize() override;
virtual mozilla::AspectRatio GetIntrinsicRatio() override;
virtual IntrinsicSize GetIntrinsicSize() override;
virtual AspectRatio GetIntrinsicRatio() override;
virtual mozilla::LogicalSize ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;
virtual LogicalSize ComputeSize(
gfxContext* aRenderingContext, WritingMode aWritingMode,
const LogicalSize& aCBSize, nscoord aAvailableISize,
const LogicalSize& aMargin, const LogicalSize& aBorder,
const LogicalSize& aPadding, ComputeSizeFlags aFlags) override;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
@ -74,7 +80,7 @@ class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame,
nsIFrame* aPrevInFlow) override;
bool IsFrameOfType(uint32_t aFlags) const override {
return nsSVGDisplayContainerFrame::IsFrameOfType(
return SVGDisplayContainerFrame::IsFrameOfType(
aFlags &
~(eSupportsContainLayoutAndPaint | eReplaced | eReplacedSizing));
}
@ -113,11 +119,11 @@ class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame,
virtual SVGBBox GetBBoxContribution(const Matrix& aToBBoxUserspace,
uint32_t aFlags) override;
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override;
/* Methods to allow descendant SVGForeignObjectFrame frames to register and
* unregister themselves with their nearest nsSVGOuterSVGFrame ancestor. This
* unregister themselves with their nearest SVGOuterSVGFrame ancestor. This
* is temporary until display list based invalidation is impleented for SVG.
* Maintaining a list of our foreignObject descendants allows us to search
* them for areas that need to be invalidated, without having to also search
@ -125,8 +131,8 @@ class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame,
* does not slow down SVG in general (only foreignObjects, until bug 614732 is
* fixed).
*/
void RegisterForeignObject(mozilla::SVGForeignObjectFrame* aFrame);
void UnregisterForeignObject(mozilla::SVGForeignObjectFrame* aFrame);
void RegisterForeignObject(SVGForeignObjectFrame* aFrame);
void UnregisterForeignObject(SVGForeignObjectFrame* aFrame);
virtual bool HasChildrenOnlyTransform(Matrix* aTransform) const override {
// Our anonymous wrapper child must claim our children-only transforms as
@ -182,7 +188,7 @@ class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame,
// A hash-set containing our SVGForeignObjectFrame descendants. Note we use
// a hash-set to avoid the O(N^2) behavior we'd get tearing down an SVG frame
// subtree if we were to use a list (see bug 381285 comment 20).
mozilla::UniquePtr<nsTHashtable<nsPtrHashKey<mozilla::SVGForeignObjectFrame>>>
UniquePtr<nsTHashtable<nsPtrHashKey<SVGForeignObjectFrame>>>
mForeignObjectHash;
nsRegion mInvalidRegion;
@ -199,41 +205,41 @@ class nsSVGOuterSVGFrame final : public nsSVGDisplayContainerFrame,
};
////////////////////////////////////////////////////////////////////////
// nsSVGOuterSVGAnonChildFrame class
// SVGOuterSVGAnonChildFrame class
/**
* nsSVGOuterSVGFrames have a single direct child that is an instance of this
* SVGOuterSVGFrames have a single direct child that is an instance of this
* class, and which is used to wrap their real child frames. Such anonymous
* wrapper frames created from this class exist because SVG frames need their
* GetPosition() offset to be their offset relative to "user space" (in app
* units) so that they can play nicely with nsDisplayTransform. This is fine
* for all SVG frames except for direct children of an nsSVGOuterSVGFrame,
* since an nsSVGOuterSVGFrame can have CSS border and padding (unlike other
* for all SVG frames except for direct children of an SVGOuterSVGFrame,
* since an SVGOuterSVGFrame can have CSS border and padding (unlike other
* SVG frames). The direct children can't include the offsets due to any such
* border/padding in their mRects since that would break nsDisplayTransform,
* but not including these offsets would break other parts of the Mozilla code
* that assume a frame's mRect contains its border-box-to-parent-border-box
* offset, in particular nsIFrame::GetOffsetTo and the functions that depend on
* it. Wrapping an nsSVGOuterSVGFrame's children in an instance of this class
* with its GetPosition() set to its nsSVGOuterSVGFrame's border/padding offset
* it. Wrapping an SVGOuterSVGFrame's children in an instance of this class
* with its GetPosition() set to its SVGOuterSVGFrame's border/padding offset
* keeps both nsDisplayTransform and nsIFrame::GetOffsetTo happy.
*
* The reason that this class inherit from nsSVGDisplayContainerFrame rather
* The reason that this class inherit from SVGDisplayContainerFrame rather
* than simply from nsContainerFrame is so that we can avoid having special
* handling for these inner wrappers in multiple parts of the SVG code. For
* example, the implementations of IsSVGTransformed and GetCanvasTM assume
* nsSVGContainerFrame instances all the way up to the nsSVGOuterSVGFrame.
* SVGContainerFrame instances all the way up to the SVGOuterSVGFrame.
*/
class nsSVGOuterSVGAnonChildFrame final : public nsSVGDisplayContainerFrame {
friend nsContainerFrame* NS_NewSVGOuterSVGAnonChildFrame(
class SVGOuterSVGAnonChildFrame final : public SVGDisplayContainerFrame {
friend nsContainerFrame* ::NS_NewSVGOuterSVGAnonChildFrame(
mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
explicit nsSVGOuterSVGAnonChildFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
: nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
explicit SVGOuterSVGAnonChildFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
: SVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
public:
NS_DECL_FRAMEARENA_HELPERS(nsSVGOuterSVGAnonChildFrame)
NS_DECL_FRAMEARENA_HELPERS(SVGOuterSVGAnonChildFrame)
#ifdef DEBUG
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
@ -252,12 +258,12 @@ class nsSVGOuterSVGAnonChildFrame final : public nsSVGDisplayContainerFrame {
bool IsSVGTransformed(Matrix* aOwnTransform,
Matrix* aFromParentTransform) const override;
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override {
// GetCanvasTM returns the transform from an SVG frame to the frame's
// nsSVGOuterSVGFrame's content box, so we do not include any x/y offset
// set on us for any CSS border or padding on our nsSVGOuterSVGFrame.
return static_cast<nsSVGOuterSVGFrame*>(GetParent())->GetCanvasTM();
// SVGOuterSVGFrame's content box, so we do not include any x/y offset
// set on us for any CSS border or padding on our SVGOuterSVGFrame.
return static_cast<SVGOuterSVGFrame*>(GetParent())->GetCanvasTM();
}
};
@ -268,4 +274,6 @@ template <typename... Atoms>
bool IsAnyAtomEqual(const nsAString& aString, nsAtom* aFirst, Atoms... aArgs);
bool IsAnyAtomEqual(const nsAString& aString);
} // namespace mozilla
#endif

Просмотреть файл

@ -9,11 +9,11 @@
#include "gfxRect.h"
#include "mozilla/Attributes.h"
#include "mozilla/SVGContainerFrame.h"
#include "nsCOMPtr.h"
#include "nsIFrame.h"
#include "nsIFrame.h"
#include "nsQueryFrame.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGUtils.h"
class gfxContext;
@ -46,13 +46,13 @@ class MOZ_RAII AutoSetRestorePaintServerState {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class SVGPaintServerFrame : public nsSVGContainerFrame {
class SVGPaintServerFrame : public SVGContainerFrame {
protected:
typedef gfx::DrawTarget DrawTarget;
SVGPaintServerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
ClassID aID)
: nsSVGContainerFrame(aStyle, aPresContext, aID) {
: SVGContainerFrame(aStyle, aPresContext, aID) {
AddStateBits(NS_FRAME_IS_NONDISPLAY);
}
@ -80,8 +80,8 @@ class SVGPaintServerFrame : public nsSVGContainerFrame {
const nsDisplayListSet& aLists) override {}
virtual bool IsFrameOfType(uint32_t aFlags) const override {
return nsSVGContainerFrame::IsFrameOfType(aFlags &
~nsIFrame::eSVGPaintServer);
return SVGContainerFrame::IsFrameOfType(aFlags &
~nsIFrame::eSVGPaintServer);
}
};

Просмотреть файл

@ -16,17 +16,17 @@
#include "gfxPlatform.h"
#include "mozilla/ComputedStyle.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/SVGGeometryFrame.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/dom/SVGPatternElement.h"
#include "mozilla/dom/SVGUnitTypesBinding.h"
#include "mozilla/gfx/2D.h"
#include "nsGkAtoms.h"
#include "nsIFrameInlines.h"
#include "nsSVGDisplayableFrame.h"
#include "SVGObserverUtils.h"
#include "SVGGeometryFrame.h"
#include "nsSVGUtils.h"
#include "SVGAnimatedTransformList.h"
#include "SVGContentUtils.h"
using namespace mozilla::dom;
using namespace mozilla::dom::SVGUnitTypes_Binding;
@ -89,7 +89,7 @@ void SVGPatternFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
#endif /* DEBUG */
//----------------------------------------------------------------------
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
// If our GetCanvasTM is getting called, we
// need to return *our current* transformation

Просмотреть файл

@ -49,7 +49,7 @@ class SVGPatternFrame final : public SVGPaintServerFrame {
const gfxRect* aOverrideBounds) override;
public:
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override;
// nsIFrame interface:

Просмотреть файл

@ -6,29 +6,33 @@
// Keep in (case-insensitive) order:
#include "gfxRect.h"
#include "SVGObserverUtils.h"
#include "SVGGFrame.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGContainerFrame.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/dom/SVGSwitchElement.h"
#include "nsSVGUtils.h"
#include "SVGTextFrame.h"
#include "nsSVGContainerFrame.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::gfx;
using namespace mozilla::image;
class nsSVGSwitchFrame final : public SVGGFrame {
friend nsIFrame* NS_NewSVGSwitchFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
nsIFrame* NS_NewSVGSwitchFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
namespace mozilla {
class SVGSwitchFrame final : public SVGGFrame {
friend nsIFrame* ::NS_NewSVGSwitchFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
protected:
explicit nsSVGSwitchFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
explicit SVGSwitchFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: SVGGFrame(aStyle, aPresContext, kClassID) {}
public:
NS_DECL_FRAMEARENA_HELPERS(nsSVGSwitchFrame)
NS_DECL_FRAMEARENA_HELPERS(SVGSwitchFrame)
#ifdef DEBUG
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
@ -59,19 +63,23 @@ class nsSVGSwitchFrame final : public SVGGFrame {
static void AlwaysReflowSVGTextFrameDoForOneKid(nsIFrame* aKid);
};
} // namespace mozilla
//----------------------------------------------------------------------
// Implementation
nsIFrame* NS_NewSVGSwitchFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
return new (aPresShell)
nsSVGSwitchFrame(aStyle, aPresShell->GetPresContext());
mozilla::SVGSwitchFrame(aStyle, aPresShell->GetPresContext());
}
NS_IMPL_FRAMEARENA_HELPERS(nsSVGSwitchFrame)
namespace mozilla {
NS_IMPL_FRAMEARENA_HELPERS(SVGSwitchFrame)
#ifdef DEBUG
void nsSVGSwitchFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
void SVGSwitchFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svgSwitch),
"Content is not an SVG switch");
@ -79,18 +87,17 @@ void nsSVGSwitchFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
}
#endif /* DEBUG */
void nsSVGSwitchFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) {
void SVGSwitchFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) {
nsIFrame* kid = GetActiveChildFrame();
if (kid) {
BuildDisplayListForChild(aBuilder, kid, aLists);
}
}
void nsSVGSwitchFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
imgDrawingParams& aImgParams,
const nsIntRect* aDirtyRect) {
void SVGSwitchFrame::PaintSVG(gfxContext& aContext, const gfxMatrix& aTransform,
imgDrawingParams& aImgParams,
const nsIntRect* aDirtyRect) {
NS_ASSERTION(
!NS_SVGDisplayListPaintingEnabled() || (mState & NS_FRAME_IS_NONDISPLAY),
"If display lists are enabled, only painting of non-display "
@ -111,7 +118,7 @@ void nsSVGSwitchFrame::PaintSVG(gfxContext& aContext,
}
}
nsIFrame* nsSVGSwitchFrame::GetFrameForPoint(const gfxPoint& aPoint) {
nsIFrame* SVGSwitchFrame::GetFrameForPoint(const gfxPoint& aPoint) {
NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() ||
(mState & NS_FRAME_IS_NONDISPLAY),
"If display lists are enabled, only hit-testing of non-display "
@ -145,7 +152,7 @@ static bool shouldReflowSVGTextFrameInside(nsIFrame* aFrame) {
!aFrame->IsFrameOfType(nsIFrame::eSVG);
}
void nsSVGSwitchFrame::AlwaysReflowSVGTextFrameDoForOneKid(nsIFrame* aKid) {
void SVGSwitchFrame::AlwaysReflowSVGTextFrameDoForOneKid(nsIFrame* aKid) {
if (!NS_SUBTREE_DIRTY(aKid)) {
return;
}
@ -167,12 +174,12 @@ void nsSVGSwitchFrame::AlwaysReflowSVGTextFrameDoForOneKid(nsIFrame* aKid) {
// <g><mask><text></text></mask></g>
// </switch>
// We should not call ReflowSVG on it.
nsSVGContainerFrame::ReflowSVGNonDisplayText(aKid);
SVGContainerFrame::ReflowSVGNonDisplayText(aKid);
}
}
}
void nsSVGSwitchFrame::ReflowAllSVGTextFramesInsideNonActiveChildren(
void SVGSwitchFrame::ReflowAllSVGTextFramesInsideNonActiveChildren(
nsIFrame* aActiveChild) {
for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) {
if (aActiveChild == kid) {
@ -183,7 +190,7 @@ void nsSVGSwitchFrame::ReflowAllSVGTextFramesInsideNonActiveChildren(
}
}
void nsSVGSwitchFrame::ReflowSVG() {
void SVGSwitchFrame::ReflowSVG() {
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
@ -246,8 +253,8 @@ void nsSVGSwitchFrame::ReflowSVG() {
NS_FRAME_HAS_DIRTY_CHILDREN);
}
SVGBBox nsSVGSwitchFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
uint32_t aFlags) {
SVGBBox SVGSwitchFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
uint32_t aFlags) {
nsIFrame* kid = GetActiveChildFrame();
nsSVGDisplayableFrame* svgKid = do_QueryFrame(kid);
if (svgKid) {
@ -263,10 +270,9 @@ SVGBBox nsSVGSwitchFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
return SVGBBox();
}
nsIFrame* nsSVGSwitchFrame::GetActiveChildFrame() {
nsIFrame* SVGSwitchFrame::GetActiveChildFrame() {
nsIContent* activeChild =
static_cast<mozilla::dom::SVGSwitchElement*>(GetContent())
->GetActiveChild();
static_cast<dom::SVGSwitchElement*>(GetContent())->GetActiveChild();
if (activeChild) {
for (nsIFrame* kid = mFrames.FirstChild(); kid;
@ -278,3 +284,5 @@ nsIFrame* nsSVGSwitchFrame::GetActiveChildFrame() {
}
return nullptr;
}
} // namespace mozilla

Просмотреть файл

@ -23,8 +23,6 @@
#include "nsContentUtils.h"
#include "nsGkAtoms.h"
#include "nsQuickSort.h"
#include "SVGObserverUtils.h"
#include "nsSVGOuterSVGFrame.h"
#include "SVGPaintServerFrame.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
@ -35,17 +33,19 @@
#include "SVGContextPaint.h"
#include "SVGLengthList.h"
#include "SVGNumberList.h"
#include "SVGGeometryElement.h"
#include "SVGTextPathElement.h"
#include "nsLayoutUtils.h"
#include "nsFrameSelection.h"
#include "nsStyleStructInlines.h"
#include "mozilla/Likely.h"
#include "mozilla/PresShell.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGOuterSVGFrame.h"
#include "mozilla/dom/DOMPointBinding.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/SVGGeometryElement.h"
#include "mozilla/dom/SVGRect.h"
#include "mozilla/dom/SVGTextContentElementBinding.h"
#include "mozilla/dom/SVGTextPathElement.h"
#include "mozilla/dom/Text.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/PatternHelpers.h"
@ -2756,7 +2756,7 @@ void DisplaySVGText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
NS_QUERYFRAME_HEAD(SVGTextFrame)
NS_QUERYFRAME_ENTRY(SVGTextFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame)
NS_QUERYFRAME_TAIL_INHERITING(SVGDisplayContainerFrame)
} // namespace mozilla
@ -2781,7 +2781,7 @@ void SVGTextFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::text),
"Content is not an SVG text");
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
SVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
AddStateBits((aParent->GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) |
NS_FRAME_SVG_LAYOUT | NS_FRAME_IS_SVG_TEXT);
@ -2875,9 +2875,9 @@ void SVGTextFrame::ScheduleReflowSVGNonDisplayText(IntrinsicDirty aReason) {
// a root to reflow. We choose the closest ancestor frame that is not
// NS_FRAME_IS_NONDISPLAY and which is either an outer SVG frame or a
// non-SVG frame. (We don't consider displayed SVG frame ancestors toerh
// than nsSVGOuterSVGFrame, since calling FrameNeedsReflow on those other
// than SVGOuterSVGFrame, since calling FrameNeedsReflow on those other
// SVG frames would do a bunch of unnecessary work on the SVG frames up to
// the nsSVGOuterSVGFrame.)
// the SVGOuterSVGFrame.)
nsIFrame* f = this;
while (f) {
@ -3371,10 +3371,10 @@ void SVGTextFrame::ReflowSVG() {
nsOverflowAreas overflowAreas(overflow, overflow);
FinishAndStoreOverflow(overflowAreas, mRect.Size());
// XXX nsSVGContainerFrame::ReflowSVG only looks at its nsSVGDisplayableFrame
// XXX SVGContainerFrame::ReflowSVG only looks at its nsSVGDisplayableFrame
// children, and calls ConsiderChildOverflow on them. Does it matter
// that ConsiderChildOverflow won't be called on our children?
nsSVGDisplayContainerFrame::ReflowSVG();
SVGDisplayContainerFrame::ReflowSVG();
}
/**
@ -5052,7 +5052,7 @@ void SVGTextFrame::MaybeReflowAnonymousBlockChild() {
// If we require a full reflow, ensure our kid is marked fully dirty.
// (Note that our anonymous nsBlockFrame is not an nsSVGDisplayableFrame,
// so even when we are called via our ReflowSVG this will not be done for
// us by nsSVGDisplayContainerFrame::ReflowSVG.)
// us by SVGDisplayContainerFrame::ReflowSVG.)
kid->MarkSubtreeDirty();
}

Просмотреть файл

@ -10,13 +10,13 @@
#include "mozilla/Attributes.h"
#include "mozilla/PresShellForwards.h"
#include "mozilla/RefPtr.h"
#include "mozilla/SVGContainerFrame.h"
#include "mozilla/gfx/2D.h"
#include "gfxMatrix.h"
#include "gfxRect.h"
#include "gfxTextRun.h"
#include "nsIContent.h" // for GetContent
#include "nsStubMutationObserver.h"
#include "nsSVGContainerFrame.h"
#include "nsTextFrame.h"
class gfxContext;
@ -162,7 +162,7 @@ class GlyphMetricsUpdater : public Runnable {
* itself do the painting. Otherwise, a DrawPathCallback is passed to
* PaintText so that we can fill the text geometry with SVG paint servers.
*/
class SVGTextFrame final : public nsSVGDisplayContainerFrame {
class SVGTextFrame final : public SVGDisplayContainerFrame {
friend nsIFrame* ::NS_NewSVGTextFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
@ -182,7 +182,7 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
protected:
explicit SVGTextFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsSVGDisplayContainerFrame(aStyle, aPresContext, kClassID),
: SVGDisplayContainerFrame(aStyle, aPresContext, kClassID),
mTrailingUndisplayedCharacters(0),
mFontSizeScaleFactor(1.0f),
mLastContextScale(1.0f),
@ -280,7 +280,7 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
/**
* Reflows the anonymous block frame of this non-display SVGTextFrame.
*
* When we are under nsSVGDisplayContainerFrame::ReflowSVG, we need to
* When we are under SVGDisplayContainerFrame::ReflowSVG, we need to
* reflow any SVGTextFrame frames in the subtree in case they are
* being observed (by being for example in a <mask>) and the change
* that caused the reflow would not already have caused a reflow.
@ -293,10 +293,10 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame {
/**
* This is a function that behaves similarly to nsSVGUtils::ScheduleReflowSVG,
* but which will skip over any ancestor non-display container frames on the
* way to the nsSVGOuterSVGFrame. It exists for the situation where a
* way to the SVGOuterSVGFrame. It exists for the situation where a
* non-display <text> element has changed and needs to ensure ReflowSVG will
* be called on its closest display container frame, so that
* nsSVGDisplayContainerFrame::ReflowSVG will call ReflowSVGNonDisplayText on
* SVGDisplayContainerFrame::ReflowSVG will call ReflowSVGNonDisplayText on
* it.
*
* We have to do this in two cases: in response to a style change on a

Просмотреть файл

@ -88,7 +88,7 @@ void SVGUseFrame::HrefChanged() {
void SVGUseFrame::ReflowSVG() {
// We only handle x/y offset here, since any width/height that is in force is
// handled by the nsSVGOuterSVGFrame for the anonymous <svg> that will be
// handled by the SVGOuterSVGFrame for the anonymous <svg> that will be
// created for that purpose.
float x, y;
static_cast<SVGUseElement*>(GetContent())

Просмотреть файл

@ -6,11 +6,11 @@
// Keep in (case-insensitive) order:
#include "mozilla/PresShell.h"
#include "mozilla/SVGOuterSVGFrame.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/dom/SVGViewElement.h"
#include "nsIFrame.h"
#include "nsGkAtoms.h"
#include "nsSVGOuterSVGFrame.h"
using namespace mozilla::dom;
@ -95,7 +95,7 @@ nsresult SVGViewFrame::AttributeChanged(int32_t aNameSpaceID,
if (aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::preserveAspectRatio ||
aAttribute == nsGkAtoms::viewBox)) {
nsSVGOuterSVGFrame* outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(this);
SVGOuterSVGFrame* outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(this);
NS_ASSERTION(outerSVGFrame->GetContent()->IsSVGElement(nsGkAtoms::svg),
"Expecting an <svg> element");

Просмотреть файл

@ -11,8 +11,8 @@
#include "gfx2DGlue.h"
#include "gfxContext.h"
#include "nsIFrame.h"
#include "mozilla/SVGContainerFrame.h"
#include "nsSVGDisplayableFrame.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGIntegrationUtils.h"
#include "mozilla/dom/SVGViewportElement.h"
@ -51,8 +51,8 @@ void SVGViewportFrame::PaintSVG(gfxContext& aContext,
nsSVGUtils::SetClipRect(&aContext, aTransform, clipRect);
}
nsSVGDisplayContainerFrame::PaintSVG(aContext, aTransform, aImgParams,
aDirtyRect);
SVGDisplayContainerFrame::PaintSVG(aContext, aTransform, aImgParams,
aDirtyRect);
}
void SVGViewportFrame::ReflowSVG() {
@ -70,7 +70,7 @@ void SVGViewportFrame::ReflowSVG() {
InvalidateFrame();
}
nsSVGDisplayContainerFrame::ReflowSVG();
SVGDisplayContainerFrame::ReflowSVG();
}
void SVGViewportFrame::NotifySVGChanged(uint32_t aFlags) {
@ -119,7 +119,7 @@ void SVGViewportFrame::NotifySVGChanged(uint32_t aFlags) {
}
}
nsSVGDisplayContainerFrame::NotifySVGChanged(aFlags);
SVGDisplayContainerFrame::NotifySVGChanged(aFlags);
}
SVGBBox SVGViewportFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
@ -152,7 +152,7 @@ SVGBBox SVGViewportFrame::GetBBoxContribution(const Matrix& aToBBoxUserspace,
}
SVGBBox descendantsBbox =
nsSVGDisplayContainerFrame::GetBBoxContribution(aToBBoxUserspace, aFlags);
SVGDisplayContainerFrame::GetBBoxContribution(aToBBoxUserspace, aFlags);
bbox.UnionEdges(descendantsBbox);
@ -240,7 +240,7 @@ nsIFrame* SVGViewportFrame::GetFrameForPoint(const gfxPoint& aPoint) {
}
}
return nsSVGDisplayContainerFrame::GetFrameForPoint(aPoint);
return SVGDisplayContainerFrame::GetFrameForPoint(aPoint);
}
//----------------------------------------------------------------------
@ -256,7 +256,7 @@ void SVGViewportFrame::NotifyViewportOrTransformChanged(uint32_t aFlags) {
}
//----------------------------------------------------------------------
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
bool SVGViewportFrame::HasChildrenOnlyTransform(gfx::Matrix* aTransform) const {
SVGViewportElement* content = static_cast<SVGViewportElement*>(GetContent());

Просмотреть файл

@ -8,7 +8,7 @@
#define __NS_SVGVIEWPORTFRAME_H__
#include "mozilla/Attributes.h"
#include "nsSVGContainerFrame.h"
#include "mozilla/SVGContainerFrame.h"
#include "nsISVGSVGFrame.h"
class gfxContext;
@ -18,12 +18,12 @@ namespace mozilla {
/**
* Superclass for inner SVG frames and symbol frames.
*/
class SVGViewportFrame : public nsSVGDisplayContainerFrame,
class SVGViewportFrame : public SVGDisplayContainerFrame,
public nsISVGSVGFrame {
protected:
SVGViewportFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
nsIFrame::ClassID aID)
: nsSVGDisplayContainerFrame(aStyle, aPresContext, aID) {}
: SVGDisplayContainerFrame(aStyle, aPresContext, aID) {}
public:
NS_DECL_ABSTRACT_FRAME(SVGViewportFrame)
@ -41,7 +41,7 @@ class SVGViewportFrame : public nsSVGDisplayContainerFrame,
uint32_t aFlags) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
// nsSVGContainerFrame methods:
// SVGContainerFrame methods:
virtual bool HasChildrenOnlyTransform(Matrix* aTransform) const override;
// nsISVGSVGFrame interface:

Просмотреть файл

@ -25,6 +25,7 @@ EXPORTS.mozilla += [
'CSSClipPathInstance.h',
'FilterInstance.h',
'SVGClipPathFrame.h',
'SVGContainerFrame.h',
'SVGContextPaint.h',
'SVGFilterInstance.h',
'SVGForeignObjectFrame.h',
@ -33,6 +34,7 @@ EXPORTS.mozilla += [
'SVGImageFrame.h',
'SVGMaskFrame.h',
'SVGObserverUtils.h',
'SVGOuterSVGFrame.h',
'SVGTextFrame.h',
'SVGUseFrame.h'
]
@ -41,13 +43,11 @@ UNIFIED_SOURCES += [
'CSSClipPathInstance.cpp',
'CSSFilterInstance.cpp',
'FilterInstance.cpp',
'nsSVGContainerFrame.cpp',
'nsSVGIntegrationUtils.cpp',
'nsSVGOuterSVGFrame.cpp',
'nsSVGSwitchFrame.cpp',
'nsSVGUtils.cpp',
'SVGAFrame.cpp',
'SVGClipPathFrame.cpp',
'SVGContainerFrame.cpp',
'SVGContextPaint.cpp',
'SVGFEContainerFrame.cpp',
'SVGFEImageFrame.cpp',
@ -66,8 +66,10 @@ UNIFIED_SOURCES += [
'SVGMarkerFrame.cpp',
'SVGMaskFrame.cpp',
'SVGObserverUtils.cpp',
'SVGOuterSVGFrame.cpp',
'SVGPatternFrame.cpp',
'SVGStopFrame.cpp',
'SVGSwitchFrame.cpp',
'SVGSymbolFrame.cpp',
'SVGTextFrame.cpp',
'SVGUseFrame.cpp',

Просмотреть файл

@ -193,7 +193,7 @@ bool nsSVGIntegrationUtils::UsingSimpleClipPathForFrame(
nsPoint nsSVGIntegrationUtils::GetOffsetToBoundingBox(nsIFrame* aFrame) {
if (aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT)) {
// Do NOT call GetAllInFlowRectsUnion for SVG - it will get the
// covered region relative to the nsSVGOuterSVGFrame, which is absolutely
// covered region relative to the SVGOuterSVGFrame, which is absolutely
// not what we want. SVG frames are always in user space, so they have
// no offset adjustment to make.
return nsPoint();
@ -227,7 +227,7 @@ nsSize nsSVGIntegrationUtils::GetContinuationUnionSize(nsIFrame* aNonSVGFrame) {
gfxRect nsSVGIntegrationUtils::GetSVGBBoxForNonSVGFrame(
nsIFrame* aNonSVGFrame, bool aUnionContinuations) {
// Except for nsSVGOuterSVGFrame, we shouldn't be getting here with SVG
// Except for SVGOuterSVGFrame, we shouldn't be getting here with SVG
// frames at all. This function is for elements that are laid out using the
// CSS box model rules.
NS_ASSERTION(!aNonSVGFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT),

Просмотреть файл

@ -28,11 +28,9 @@
#include "nsStyleStruct.h"
#include "nsStyleTransformMatrix.h"
#include "SVGAnimatedLength.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGDisplayableFrame.h"
#include "SVGFilterPaintCallback.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGOuterSVGFrame.h"
#include "SVGPaintServerFrame.h"
#include "nsTextFrame.h"
#include "mozilla/CSSClipPathInstance.h"
@ -40,12 +38,14 @@
#include "mozilla/Preferences.h"
#include "mozilla/StaticPrefs_svg.h"
#include "mozilla/SVGClipPathFrame.h"
#include "mozilla/SVGContainerFrame.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/SVGContextPaint.h"
#include "mozilla/SVGForeignObjectFrame.h"
#include "mozilla/SVGGeometryFrame.h"
#include "mozilla/SVGMaskFrame.h"
#include "mozilla/SVGObserverUtils.h"
#include "mozilla/SVGOuterSVGFrame.h"
#include "mozilla/SVGTextFrame.h"
#include "mozilla/Unused.h"
#include "mozilla/gfx/2D.h"
@ -137,7 +137,7 @@ bool nsSVGUtils::OuterSVGIsCallingReflowSVG(nsIFrame* aFrame) {
}
bool nsSVGUtils::AnyOuterSVGIsCallingReflowSVG(nsIFrame* aFrame) {
nsSVGOuterSVGFrame* outer = GetOuterSVGFrame(aFrame);
SVGOuterSVGFrame* outer = GetOuterSVGFrame(aFrame);
do {
if (outer->IsCallingReflowSVG()) {
return true;
@ -158,7 +158,7 @@ void nsSVGUtils::ScheduleReflowSVG(nsIFrame* aFrame) {
// We don't call SVGObserverUtils::InvalidateRenderingObservers here because
// we should only be called under InvalidateAndScheduleReflowSVG (which
// calls InvalidateBounds) or nsSVGDisplayContainerFrame::InsertFrames
// calls InvalidateBounds) or SVGDisplayContainerFrame::InsertFrames
// (at which point the frame has no observers).
if (aFrame->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
@ -171,12 +171,12 @@ void nsSVGUtils::ScheduleReflowSVG(nsIFrame* aFrame) {
return;
}
nsSVGOuterSVGFrame* outerSVGFrame = nullptr;
SVGOuterSVGFrame* outerSVGFrame = nullptr;
// We must not add dirty bits to the nsSVGOuterSVGFrame or else
// We must not add dirty bits to the SVGOuterSVGFrame or else
// PresShell::FrameNeedsReflow won't work when we pass it in below.
if (aFrame->IsSVGOuterSVGFrame()) {
outerSVGFrame = static_cast<nsSVGOuterSVGFrame*>(aFrame);
outerSVGFrame = static_cast<SVGOuterSVGFrame*>(aFrame);
} else {
aFrame->MarkSubtreeDirty();
@ -191,16 +191,16 @@ void nsSVGUtils::ScheduleReflowSVG(nsIFrame* aFrame) {
"IsSVGOuterSVGFrame check above not valid!");
}
outerSVGFrame = static_cast<nsSVGOuterSVGFrame*>(f);
outerSVGFrame = static_cast<SVGOuterSVGFrame*>(f);
MOZ_ASSERT(outerSVGFrame && outerSVGFrame->IsSVGOuterSVGFrame(),
"Did not find nsSVGOuterSVGFrame!");
"Did not find SVGOuterSVGFrame!");
}
if (outerSVGFrame->HasAnyStateBits(NS_FRAME_IN_REFLOW)) {
// We're currently under an nsSVGOuterSVGFrame::Reflow call so there is no
// We're currently under an SVGOuterSVGFrame::Reflow call so there is no
// need to call PresShell::FrameNeedsReflow, since we have an
// nsSVGOuterSVGFrame::DidReflow call pending.
// SVGOuterSVGFrame::DidReflow call pending.
return;
}
@ -278,10 +278,10 @@ float nsSVGUtils::UserSpace(const UserSpaceMetrics& aMetrics,
return aLength->GetAnimValue(aMetrics);
}
nsSVGOuterSVGFrame* nsSVGUtils::GetOuterSVGFrame(nsIFrame* aFrame) {
SVGOuterSVGFrame* nsSVGUtils::GetOuterSVGFrame(nsIFrame* aFrame) {
while (aFrame) {
if (aFrame->IsSVGOuterSVGFrame()) {
return static_cast<nsSVGOuterSVGFrame*>(aFrame);
return static_cast<SVGOuterSVGFrame*>(aFrame);
}
aFrame = aFrame->GetParent();
}
@ -295,7 +295,7 @@ nsIFrame* nsSVGUtils::GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame,
if (!svg) {
return nullptr;
}
nsSVGOuterSVGFrame* outer = GetOuterSVGFrame(aFrame);
SVGOuterSVGFrame* outer = GetOuterSVGFrame(aFrame);
if (outer == svg) {
return nullptr;
}
@ -355,7 +355,7 @@ gfxMatrix nsSVGUtils::GetCanvasTM(nsIFrame* aFrame) {
return GetCSSPxToDevPxMatrix(aFrame);
}
nsSVGContainerFrame* containerFrame = do_QueryFrame(aFrame);
SVGContainerFrame* containerFrame = do_QueryFrame(aFrame);
if (containerFrame) {
return containerFrame->GetCanvasTM();
}
@ -614,7 +614,7 @@ void nsSVGUtils::PaintFrameWithEffects(nsIFrame* aFrame, gfxContext& aContext,
gfxMatrix tm = aTransform;
if (aFrame->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer)) {
gfx::Matrix childrenOnlyTM;
if (static_cast<nsSVGContainerFrame*>(aFrame)->HasChildrenOnlyTransform(
if (static_cast<SVGContainerFrame*>(aFrame)->HasChildrenOnlyTransform(
&childrenOnlyTM)) {
// Undo the children-only transform:
if (!childrenOnlyTM.Invert()) {
@ -826,7 +826,7 @@ bool nsSVGUtils::HitTestClip(nsIFrame* aFrame, const gfxPoint& aPoint) {
return true;
}
nsIFrame* nsSVGUtils::HitTestChildren(nsSVGDisplayContainerFrame* aFrame,
nsIFrame* nsSVGUtils::HitTestChildren(SVGDisplayContainerFrame* aFrame,
const gfxPoint& aPoint) {
// First we transform aPoint into the coordinate space established by aFrame
// for its children (e.g. take account of any 'viewBox' attribute):

Просмотреть файл

@ -34,8 +34,6 @@ class nsIContent;
class nsIFrame;
class nsPresContext;
class nsSVGDisplayContainerFrame;
class nsSVGOuterSVGFrame;
class nsTextFrame;
struct nsStyleSVG;
@ -46,7 +44,9 @@ class SVGAnimatedEnumeration;
class SVGAnimatedLength;
class SVGContextPaint;
struct SVGContextPaintImpl;
class SVGDisplayContainerFrame;
class SVGGeometryFrame;
class SVGOuterSVGFrame;
namespace dom {
class Element;
class SVGElement;
@ -162,7 +162,9 @@ class nsSVGUtils {
typedef mozilla::SVGAnimatedLength SVGAnimatedLength;
typedef mozilla::SVGContextPaint SVGContextPaint;
typedef mozilla::SVGContextPaintImpl SVGContextPaintImpl;
typedef mozilla::SVGDisplayContainerFrame SVGDisplayContainerFrame;
typedef mozilla::SVGGeometryFrame SVGGeometryFrame;
typedef mozilla::SVGOuterSVGFrame SVGOuterSVGFrame;
typedef mozilla::image::imgDrawingParams imgDrawingParams;
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ObjectBoundingBoxProperty, gfxRect)
@ -187,12 +189,12 @@ class nsSVGUtils {
*
* This is very similar to PresShell::FrameNeedsReflow. The main reason that
* we have this function instead of using FrameNeedsReflow is because we need
* to be able to call it under nsSVGOuterSVGFrame::NotifyViewportChange when
* that function is called by nsSVGOuterSVGFrame::Reflow. FrameNeedsReflow
* to be able to call it under SVGOuterSVGFrame::NotifyViewportChange when
* that function is called by SVGOuterSVGFrame::Reflow. FrameNeedsReflow
* is not suitable for calling during reflow though, and it asserts as much.
* The reason that we want to be callable under NotifyViewportChange is
* because we want to synchronously notify and dirty the nsSVGOuterSVGFrame's
* children so that when nsSVGOuterSVGFrame::DidReflow is called its children
* because we want to synchronously notify and dirty the SVGOuterSVGFrame's
* children so that when SVGOuterSVGFrame::DidReflow is called its children
* will be updated for the new size as appropriate. Otherwise we'd have to
* post an event to the event loop to mark dirty flags and request an update.
*
@ -238,7 +240,7 @@ class nsSVGUtils {
const SVGAnimatedLength* aLength);
/* Find the outermost SVG frame of the passed frame */
static nsSVGOuterSVGFrame* GetOuterSVGFrame(nsIFrame* aFrame);
static SVGOuterSVGFrame* GetOuterSVGFrame(nsIFrame* aFrame);
/**
* Get the covered region for a frame. Return null if it's not an SVG frame.
@ -264,7 +266,7 @@ class nsSVGUtils {
* 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,
static nsIFrame* HitTestChildren(SVGDisplayContainerFrame* aFrame,
const gfxPoint& aPoint);
/*
@ -381,7 +383,7 @@ class nsSVGUtils {
* @param aToBoundsSpace If not specified the returned rect is in aFrame's
* element's "user space". A matrix can optionally be pass to specify a
* transform from aFrame's user space to the bounds space of interest
* (typically this will be the ancestor nsSVGOuterSVGFrame, but it could be
* (typically this will be the ancestor SVGOuterSVGFrame, but it could be
* to any other coordinate space).
*/
static gfxRect GetBBox(nsIFrame* aFrame,