Bug 265894 - Part 5. Implement nsSVGSymbolFrame to layout symbol element.
MozReview-Commit-ID: 6TTVvFgsRsQ
--- a/layout/generic/FrameTypeList.h
+++ b/layout/generic/FrameTypeList.h
@@ -81,16 +81,17 @@ FRAME_TYPE(SVGMask)
FRAME_TYPE(SVGMarker)
FRAME_TYPE(SVGMarkerAnonChild)
FRAME_TYPE(SVGOuterSVG)
FRAME_TYPE(SVGOuterSVGAnonChild)
FRAME_TYPE(SVGPattern)
FRAME_TYPE(SVGRadialGradient)
FRAME_TYPE(SVGStop)
FRAME_TYPE(SVGSwitch)
+FRAME_TYPE(SVGSymbol)
FRAME_TYPE(SVGText)
FRAME_TYPE(SVGUse)
FRAME_TYPE(SVGView)
FRAME_TYPE(Table)
FRAME_TYPE(TableCell)
FRAME_TYPE(TableCol)
FRAME_TYPE(TableColGroup)
FRAME_TYPE(TableRow)
--- a/layout/generic/nsFrameIdList.h
+++ b/layout/generic/nsFrameIdList.h
@@ -119,16 +119,17 @@ FRAME_ID(nsSVGMarkerAnonChildFrame, SVGM
FRAME_ID(nsSVGMaskFrame, SVGMask, NotLeaf)
FRAME_ID(nsSVGOuterSVGFrame, SVGOuterSVG, NotLeaf)
FRAME_ID(nsSVGOuterSVGAnonChildFrame, SVGOuterSVGAnonChild, NotLeaf)
FRAME_ID(SVGGeometryFrame, SVGGeometry, Leaf)
FRAME_ID(nsSVGPatternFrame, SVGPattern, NotLeaf)
FRAME_ID(nsSVGRadialGradientFrame, SVGRadialGradient, NotLeaf)
FRAME_ID(nsSVGStopFrame, SVGStop, Leaf)
FRAME_ID(nsSVGSwitchFrame, SVGSwitch, NotLeaf)
+FRAME_ID(nsSVGSymbolFrame, SVGSymbol, NotLeaf)
FRAME_ID(SVGTextFrame, SVGText, NotLeaf)
FRAME_ID(nsSVGUseFrame, SVGUse, Leaf)
FRAME_ID(SVGViewFrame, SVGView, Leaf)
FRAME_ID(nsTableCellFrame, TableCell, NotLeaf)
FRAME_ID(nsTableColFrame, TableCol, Leaf)
FRAME_ID(nsTableColGroupFrame, TableColGroup, NotLeaf)
FRAME_ID(nsTableFrame, Table, NotLeaf)
FRAME_ID(nsTableWrapperFrame, TableWrapper, NotLeaf)
--- a/layout/svg/moz.build
+++ b/layout/svg/moz.build
@@ -48,16 +48,17 @@ UNIFIED_SOURCES += [
'nsSVGInnerSVGFrame.cpp',
'nsSVGIntegrationUtils.cpp',
'nsSVGMarkerFrame.cpp',
'nsSVGMaskFrame.cpp',
'nsSVGOuterSVGFrame.cpp',
'nsSVGPatternFrame.cpp',
'nsSVGStopFrame.cpp',
'nsSVGSwitchFrame.cpp',
+ 'nsSVGSymbolFrame.cpp',
'nsSVGUseFrame.cpp',
'nsSVGUtils.cpp',
'nsSVGViewportFrame.cpp',
'SVGContextPaint.cpp',
'SVGFEContainerFrame.cpp',
'SVGFEImageFrame.cpp',
'SVGFELeafFrame.cpp',
'SVGFEUnstyledLeafFrame.cpp',
new file mode 100644
--- /dev/null
+++ b/layout/svg/nsSVGSymbolFrame.cpp
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// Main header first:
+#include "nsSVGSymbolFrame.h"
+
+nsIFrame*
+NS_NewSVGSymbolFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
+{
+ return new (aPresShell) nsSVGSymbolFrame(aContext);
+}
+
+NS_IMPL_FRAMEARENA_HELPERS(nsSVGSymbolFrame)
+
+//----------------------------------------------------------------------
+// nsIFrame methods
+
+NS_QUERYFRAME_HEAD(nsSVGSymbolFrame)
+ NS_QUERYFRAME_ENTRY(nsSVGSymbolFrame)
+NS_QUERYFRAME_TAIL_INHERITING(nsSVGViewportFrame)
+
+#ifdef DEBUG
+void
+nsSVGSymbolFrame::Init(nsIContent* aContent,
+ nsContainerFrame* aParent,
+ nsIFrame* aPrevInFlow)
+{
+ NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::symbol),
+ "Content is not an SVG 'symbol' element!");
+
+ nsSVGViewportFrame::Init(aContent, aParent, aPrevInFlow);
+}
+#endif /* DEBUG */
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/layout/svg/nsSVGSymbolFrame.h
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef __NS_SVGISYMBOLFRAME_H__
+#define __NS_SVGISYMBOLFRAME_H__
+
+#include "nsSVGViewportFrame.h"
+
+class nsSVGSymbolFrame
+ : public nsSVGViewportFrame
+{
+ friend nsIFrame*
+ NS_NewSVGSymbolFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
+protected:
+ explicit nsSVGSymbolFrame(nsStyleContext* aContext)
+ : nsSVGViewportFrame(aContext, kClassID)
+ {
+ }
+
+public:
+ NS_DECL_QUERYFRAME
+ NS_DECL_FRAMEARENA_HELPERS(nsSVGSymbolFrame)
+
+#ifdef DEBUG
+ virtual void Init(nsIContent* aContent,
+ nsContainerFrame* aParent,
+ nsIFrame* aPrevInFlow) override;
+#endif
+
+#ifdef DEBUG_FRAME_DUMP
+ virtual nsresult GetFrameName(nsAString& aResult) const override
+ {
+ return MakeFrameName(NS_LITERAL_STRING("SVGSymbol"), aResult);
+ }
+#endif
+
+};
+
+#endif
\ No newline at end of file
--- a/layout/svg/nsSVGViewportFrame.h
+++ b/layout/svg/nsSVGViewportFrame.h
@@ -20,16 +20,17 @@ class nsSVGViewportFrame
, public nsISVGSVGFrame
{
protected:
nsSVGViewportFrame(nsStyleContext* aContext, nsIFrame::ClassID aID)
: nsSVGDisplayContainerFrame(aContext, aID)
{
}
public:
+ NS_DECL_ABSTRACT_FRAME(nsSVGViewportFrame)
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
// nsSVGDisplayableFrame interface:
virtual void PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,