tor-browser

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

SVGFilterFrame.h (2830B)


      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 #ifndef LAYOUT_SVG_SVGFILTERFRAME_H_
      8 #define LAYOUT_SVG_SVGFILTERFRAME_H_
      9 
     10 #include "mozilla/SVGContainerFrame.h"
     11 #include "nsQueryFrame.h"
     12 
     13 class nsAtom;
     14 class nsIContent;
     15 class nsIFrame;
     16 
     17 struct nsRect;
     18 
     19 namespace mozilla {
     20 class SVGAnimatedLength;
     21 class SVGFilterInstance;
     22 class PresShell;
     23 
     24 namespace dom {
     25 class SVGFilterElement;
     26 }  // namespace dom
     27 }  // namespace mozilla
     28 
     29 nsIFrame* NS_NewSVGFilterFrame(mozilla::PresShell* aPresShell,
     30                               mozilla::ComputedStyle* aStyle);
     31 
     32 namespace mozilla {
     33 
     34 class SVGFilterFrame final : public SVGContainerFrame {
     35  friend nsIFrame* ::NS_NewSVGFilterFrame(mozilla::PresShell* aPresShell,
     36                                          ComputedStyle* aStyle);
     37 
     38 protected:
     39  explicit SVGFilterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
     40      : SVGContainerFrame(aStyle, aPresContext, kClassID),
     41        mLoopFlag(false),
     42        mNoHRefURI(false) {
     43    AddStateBits(NS_FRAME_IS_NONDISPLAY);
     44  }
     45 
     46 public:
     47  NS_DECL_FRAMEARENA_HELPERS(SVGFilterFrame)
     48 
     49  // nsIFrame methods:
     50  void BuildDisplayList(nsDisplayListBuilder* aBuilder,
     51                        const nsDisplayListSet& aLists) override {}
     52 
     53  nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
     54                            AttrModType aModType) override;
     55 
     56 #ifdef DEBUG
     57  void Init(nsIContent* aContent, nsContainerFrame* aParent,
     58            nsIFrame* aPrevInFlow) override;
     59 #endif
     60 
     61 private:
     62  friend class SVGFilterInstance;
     63 
     64  /**
     65   * Parses this frame's href and - if it references another filter - returns
     66   * it.  It also makes this frame a rendering observer of the specified ID.
     67   */
     68  SVGFilterFrame* GetReferencedFilter();
     69 
     70  // Accessors to lookup filter attributes
     71  uint16_t GetEnumValue(uint32_t aIndex, nsIContent* aDefault);
     72  uint16_t GetEnumValue(uint32_t aIndex) {
     73    return GetEnumValue(aIndex, mContent);
     74  }
     75  const mozilla::SVGAnimatedLength* GetLengthValue(uint32_t aIndex,
     76                                                   nsIContent* aDefault);
     77  const mozilla::SVGAnimatedLength* GetLengthValue(uint32_t aIndex) {
     78    return GetLengthValue(aIndex, mContent);
     79  }
     80  const mozilla::dom::SVGFilterElement* GetFilterContent(nsIContent* aDefault);
     81  const mozilla::dom::SVGFilterElement* GetFilterContent() {
     82    return GetFilterContent(mContent);
     83  }
     84 
     85  // This flag is used to detect loops in xlink:href processing
     86  bool mLoopFlag;
     87  bool mNoHRefURI;
     88 };
     89 
     90 }  // namespace mozilla
     91 
     92 #endif  // LAYOUT_SVG_SVGFILTERFRAME_H_