layout/svg/nsSVGForeignObjectFrame.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef NSSVGFOREIGNOBJECTFRAME_H__
     7 #define NSSVGFOREIGNOBJECTFRAME_H__
     9 #include "mozilla/Attributes.h"
    10 #include "nsContainerFrame.h"
    11 #include "nsIPresShell.h"
    12 #include "nsISVGChildFrame.h"
    13 #include "nsRegion.h"
    14 #include "nsSVGUtils.h"
    16 class nsRenderingContext;
    17 class nsSVGOuterSVGFrame;
    19 typedef nsContainerFrame nsSVGForeignObjectFrameBase;
    21 class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase,
    22                                 public nsISVGChildFrame
    23 {
    24   friend nsIFrame*
    25   NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
    26 protected:
    27   nsSVGForeignObjectFrame(nsStyleContext* aContext);
    29 public:
    30   NS_DECL_QUERYFRAME
    31   NS_DECL_FRAMEARENA_HELPERS
    33   // nsIFrame:
    34   virtual void Init(nsIContent* aContent,
    35                     nsIFrame*   aParent,
    36                     nsIFrame*   aPrevInFlow) MOZ_OVERRIDE;
    37   virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
    38   virtual nsresult  AttributeChanged(int32_t         aNameSpaceID,
    39                                      nsIAtom*        aAttribute,
    40                                      int32_t         aModType) MOZ_OVERRIDE;
    42   virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
    43     return GetFirstPrincipalChild()->GetContentInsertionFrame();
    44   }
    46   virtual nsresult Reflow(nsPresContext*           aPresContext,
    47                           nsHTMLReflowMetrics&     aDesiredSize,
    48                           const nsHTMLReflowState& aReflowState,
    49                           nsReflowStatus&          aStatus) MOZ_OVERRIDE;
    51   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
    52                                 const nsRect&           aDirtyRect,
    53                                 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
    55   /**
    56    * Get the "type" of the frame
    57    *
    58    * @see nsGkAtoms::svgForeignObjectFrame
    59    */
    60   virtual nsIAtom* GetType() const MOZ_OVERRIDE;
    62   virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
    63   {
    64     return nsSVGForeignObjectFrameBase::IsFrameOfType(aFlags &
    65       ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
    66   }
    68   virtual bool IsSVGTransformed(Matrix *aOwnTransform,
    69                                 Matrix *aFromParentTransform) const MOZ_OVERRIDE;
    71 #ifdef DEBUG_FRAME_DUMP
    72   virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
    73   {
    74     return MakeFrameName(NS_LITERAL_STRING("SVGForeignObject"), aResult);
    75   }
    76 #endif
    78   // nsISVGChildFrame interface:
    79   virtual nsresult PaintSVG(nsRenderingContext *aContext,
    80                             const nsIntRect *aDirtyRect,
    81                             nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
    82   virtual nsIFrame* GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE;
    83   virtual nsRect GetCoveredRegion() MOZ_OVERRIDE;
    84   virtual void ReflowSVG() MOZ_OVERRIDE;
    85   virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
    86   virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
    87                                       uint32_t aFlags) MOZ_OVERRIDE;
    88   virtual bool IsDisplayContainer() MOZ_OVERRIDE { return true; }
    90   gfxMatrix GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot = nullptr);
    92   nsRect GetInvalidRegion();
    94 protected:
    95   // implementation helpers:
    96   void DoReflow();
    97   void RequestReflow(nsIPresShell::IntrinsicDirty aType);
    99   // If width or height is less than or equal to zero we must disable rendering
   100   bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; }
   102   nsAutoPtr<gfxMatrix> mCanvasTM;
   104   bool mInReflow;
   105 };
   107 #endif

mercurial