LCOV - code coverage report
Current view: top level - layout/generic - nsSubDocumentFrame.h (source / functions) Hit Total Coverage
Test: output.info Lines: 12 15 80.0 %
Date: 2017-07-14 16:53:18 Functions: 8 10 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; 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/. */
       5             : 
       6             : #ifndef NSSUBDOCUMENTFRAME_H_
       7             : #define NSSUBDOCUMENTFRAME_H_
       8             : 
       9             : #include "mozilla/Attributes.h"
      10             : #include "nsAtomicContainerFrame.h"
      11             : #include "nsIReflowCallback.h"
      12             : #include "nsFrameLoader.h"
      13             : #include "Units.h"
      14             : 
      15             : /******************************************************************************
      16             :  * nsSubDocumentFrame
      17             :  *****************************************************************************/
      18           2 : class nsSubDocumentFrame final
      19             :   : public nsAtomicContainerFrame
      20             :   , public nsIReflowCallback
      21             : {
      22             : public:
      23          24 :   NS_DECL_FRAMEARENA_HELPERS(nsSubDocumentFrame)
      24             : 
      25             :   explicit nsSubDocumentFrame(nsStyleContext* aContext);
      26             : 
      27             : #ifdef DEBUG_FRAME_DUMP
      28             :   void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const override;
      29             :   nsresult GetFrameName(nsAString& aResult) const override;
      30             : #endif
      31             : 
      32             :   NS_DECL_QUERYFRAME
      33             : 
      34         172 :   bool IsFrameOfType(uint32_t aFlags) const override
      35             :   {
      36         172 :     return nsAtomicContainerFrame::IsFrameOfType(aFlags &
      37             :       ~(nsIFrame::eReplaced |
      38             :         nsIFrame::eReplacedSizing |
      39         172 :         nsIFrame::eReplacedContainsBlock));
      40             :   }
      41             : 
      42             :   void Init(nsIContent*       aContent,
      43             :             nsContainerFrame* aParent,
      44             :             nsIFrame*         aPrevInFlow) override;
      45             : 
      46             :   void DestroyFrom(nsIFrame* aDestructRoot) override;
      47             : 
      48             :   nscoord GetMinISize(gfxContext *aRenderingContext) override;
      49             :   nscoord GetPrefISize(gfxContext *aRenderingContext) override;
      50             : 
      51             :   mozilla::IntrinsicSize GetIntrinsicSize() override;
      52             :   nsSize  GetIntrinsicRatio() override;
      53             : 
      54             :   mozilla::LogicalSize
      55             :   ComputeAutoSize(gfxContext*                 aRenderingContext,
      56             :                   mozilla::WritingMode        aWritingMode,
      57             :                   const mozilla::LogicalSize& aCBSize,
      58             :                   nscoord                     aAvailableISize,
      59             :                   const mozilla::LogicalSize& aMargin,
      60             :                   const mozilla::LogicalSize& aBorder,
      61             :                   const mozilla::LogicalSize& aPadding,
      62             :                   ComputeSizeFlags            aFlags) override;
      63             : 
      64             :   mozilla::LogicalSize
      65             :   ComputeSize(gfxContext*                 aRenderingContext,
      66             :               mozilla::WritingMode        aWritingMode,
      67             :               const mozilla::LogicalSize& aCBSize,
      68             :               nscoord                     aAvailableISize,
      69             :               const mozilla::LogicalSize& aMargin,
      70             :               const mozilla::LogicalSize& aBorder,
      71             :               const mozilla::LogicalSize& aPadding,
      72             :               ComputeSizeFlags            aFlags) override;
      73             : 
      74             :   void Reflow(nsPresContext*     aPresContext,
      75             :               ReflowOutput&      aDesiredSize,
      76             :               const ReflowInput& aReflowInput,
      77             :               nsReflowStatus&    aStatus) override;
      78             : 
      79             :   void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      80             :                         const nsRect&           aDirtyRect,
      81             :                         const nsDisplayListSet& aLists) override;
      82             : 
      83             :   nsresult AttributeChanged(int32_t aNameSpaceID,
      84             :                             nsIAtom* aAttribute,
      85             :                             int32_t aModType) override;
      86             : 
      87             :   // if the content is "visibility:hidden", then just hide the view
      88             :   // and all our contents. We don't extend "visibility:hidden" to
      89             :   // the child content ourselves, since it belongs to a different
      90             :   // document and CSS doesn't inherit in there.
      91           3 :   bool SupportsVisibilityHidden() override { return false; }
      92             : 
      93             : #ifdef ACCESSIBILITY
      94             :   mozilla::a11y::AccType AccessibleType() override;
      95             : #endif
      96             : 
      97             :   nsresult GetDocShell(nsIDocShell **aDocShell);
      98             :   nsresult BeginSwapDocShells(nsIFrame* aOther);
      99             :   void EndSwapDocShells(nsIFrame* aOther);
     100             :   nsView* EnsureInnerView();
     101             :   nsIFrame* GetSubdocumentRootFrame();
     102             :   enum {
     103             :     IGNORE_PAINT_SUPPRESSION = 0x1
     104             :   };
     105             :   nsIPresShell* GetSubdocumentPresShellForPainting(uint32_t aFlags);
     106             :   mozilla::ScreenIntSize GetSubdocumentSize();
     107             : 
     108             :   // nsIReflowCallback
     109             :   bool ReflowFinished() override;
     110             :   void ReflowCallbackCanceled() override;
     111             : 
     112           4 :   bool ShouldClipSubdocument()
     113             :   {
     114           4 :     nsFrameLoader* frameLoader = FrameLoader();
     115           4 :     return !frameLoader || frameLoader->ShouldClipSubdocument();
     116             :   }
     117             : 
     118           0 :   bool ShouldClampScrollPosition()
     119             :   {
     120           0 :     nsFrameLoader* frameLoader = FrameLoader();
     121           0 :     return !frameLoader || frameLoader->ShouldClampScrollPosition();
     122             :   }
     123             : 
     124             :   /**
     125             :    * Return true if pointer event hit-testing should be allowed to target
     126             :    * content in the subdocument.
     127             :    */
     128             :   bool PassPointerEventsToChildren();
     129             : 
     130             : protected:
     131             :   friend class AsyncFrameInit;
     132             : 
     133             :   // Helper method to look up the HTML marginwidth & marginheight attributes.
     134             :   mozilla::CSSIntSize GetMarginAttributes();
     135             : 
     136             :   nsFrameLoader* FrameLoader();
     137             : 
     138           5 :   bool IsInline() { return mIsInline; }
     139             : 
     140             :   nscoord GetIntrinsicISize();
     141             :   nscoord GetIntrinsicBSize();
     142             : 
     143             :   // Show our document viewer. The document viewer is hidden via a script
     144             :   // runner, so that we can save and restore the presentation if we're
     145             :   // being reframed.
     146             :   void ShowViewer();
     147             : 
     148             :   /* Obtains the frame we should use for intrinsic size information if we are
     149             :    * an HTML <object>, <embed> or <applet> (a replaced element - not <iframe>)
     150             :    * and our sub-document has an intrinsic size. The frame returned is the
     151             :    * frame for the document element of the document we're embedding.
     152             :    *
     153             :    * Called "Obtain*" and not "Get*" because of comment on GetDocShell that
     154             :    * says it should be called ObtainDocShell because of its side effects.
     155             :    */
     156             :   nsIFrame* ObtainIntrinsicSizeFrame();
     157             : 
     158          72 :   nsView* GetViewInternal() const override { return mOuterView; }
     159           3 :   void SetViewInternal(nsView* aView) override { mOuterView = aView; }
     160             : 
     161             :   RefPtr<nsFrameLoader> mFrameLoader;
     162             :   nsView* mOuterView;
     163             :   nsView* mInnerView;
     164             :   bool mIsInline;
     165             :   bool mPostedReflowCallback;
     166             :   bool mDidCreateDoc;
     167             :   bool mCallingShow;
     168             : };
     169             : 
     170             : #endif /* NSSUBDOCUMENTFRAME_H_ */

Generated by: LCOV version 1.13