SVGSymbolFrame.cpp (1668B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 // Main header first: 8 #include "SVGSymbolFrame.h" 9 10 #include "mozilla/PresShell.h" 11 #include "mozilla/dom/SVGSymbolElement.h" 12 13 nsIFrame* NS_NewSVGSymbolFrame(mozilla::PresShell* aPresShell, 14 mozilla::ComputedStyle* aStyle) { 15 return new (aPresShell) 16 mozilla::SVGSymbolFrame(aStyle, aPresShell->GetPresContext()); 17 } 18 19 namespace mozilla { 20 21 NS_IMPL_FRAMEARENA_HELPERS(SVGSymbolFrame) 22 23 //---------------------------------------------------------------------- 24 // nsIFrame methods 25 26 NS_QUERYFRAME_HEAD(SVGSymbolFrame) 27 NS_QUERYFRAME_ENTRY(SVGSymbolFrame) 28 NS_QUERYFRAME_TAIL_INHERITING(SVGViewportFrame) 29 30 void SVGSymbolFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, 31 nsIFrame* aPrevInFlow) { 32 MOZ_ASSERT(aContent->IsSVGElement(nsGkAtoms::symbol), 33 "Content is not an SVG 'symbol' element!"); 34 35 if (!dom::SVGSymbolElement::FromNode(aContent)->CouldBeRendered()) { 36 AddStateBits(NS_FRAME_IS_NONDISPLAY); 37 } 38 39 SVGViewportFrame::Init(aContent, aParent, aPrevInFlow); 40 } 41 42 void SVGSymbolFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, 43 const nsDisplayListSet& aLists) { 44 if (HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) { 45 return; 46 } 47 SVGViewportFrame::BuildDisplayList(aBuilder, aLists); 48 } 49 50 } // namespace mozilla