tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SVGAFrame.cpp (2238B)


      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 // Keep in (case-insensitive) order:
      8 #include "SVGLengthList.h"
      9 #include "gfxMatrix.h"
     10 #include "mozilla/PresShell.h"
     11 #include "mozilla/SVGContainerFrame.h"
     12 #include "mozilla/dom/SVGAElement.h"
     13 
     14 nsIFrame* NS_NewSVGAFrame(mozilla::PresShell* aPresShell,
     15                          mozilla::ComputedStyle* aStyle);
     16 
     17 namespace mozilla {
     18 
     19 class SVGAFrame final : public SVGDisplayContainerFrame {
     20  friend nsIFrame* ::NS_NewSVGAFrame(mozilla::PresShell* aPresShell,
     21                                     ComputedStyle* aStyle);
     22 
     23 protected:
     24  explicit SVGAFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
     25      : SVGDisplayContainerFrame(aStyle, aPresContext, kClassID) {}
     26 
     27 public:
     28  NS_DECL_FRAMEARENA_HELPERS(SVGAFrame)
     29 
     30 #ifdef DEBUG
     31  void Init(nsIContent* aContent, nsContainerFrame* aParent,
     32            nsIFrame* aPrevInFlow) override;
     33 #endif
     34 
     35 #ifdef DEBUG_FRAME_DUMP
     36  nsresult GetFrameName(nsAString& aResult) const override {
     37    return MakeFrameName(u"SVGA"_ns, aResult);
     38  }
     39 #endif
     40 };
     41 
     42 }  // namespace mozilla
     43 
     44 //----------------------------------------------------------------------
     45 // Implementation
     46 
     47 nsIFrame* NS_NewSVGAFrame(mozilla::PresShell* aPresShell,
     48                          mozilla::ComputedStyle* aStyle) {
     49  return new (aPresShell)
     50      mozilla::SVGAFrame(aStyle, aPresShell->GetPresContext());
     51 }
     52 
     53 namespace mozilla {
     54 
     55 NS_IMPL_FRAMEARENA_HELPERS(SVGAFrame)
     56 
     57 //----------------------------------------------------------------------
     58 // nsIFrame methods
     59 #ifdef DEBUG
     60 void SVGAFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
     61                     nsIFrame* aPrevInFlow) {
     62  NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::a),
     63               "Trying to construct an SVGAFrame for a "
     64               "content element that doesn't support the right interfaces");
     65 
     66  SVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
     67 }
     68 #endif /* DEBUG */
     69 
     70 }  // namespace mozilla