layout/generic/nsSubDocumentFrame.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/generic/nsSubDocumentFrame.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,152 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef NSSUBDOCUMENTFRAME_H_
    1.10 +#define NSSUBDOCUMENTFRAME_H_
    1.11 +
    1.12 +#include "mozilla/Attributes.h"
    1.13 +#include "nsLeafFrame.h"
    1.14 +#include "nsIReflowCallback.h"
    1.15 +#include "nsFrameLoader.h"
    1.16 +
    1.17 +/******************************************************************************
    1.18 + * nsSubDocumentFrame
    1.19 + *****************************************************************************/
    1.20 +class nsSubDocumentFrame : public nsLeafFrame,
    1.21 +                           public nsIReflowCallback
    1.22 +{
    1.23 +public:
    1.24 +  NS_DECL_QUERYFRAME_TARGET(nsSubDocumentFrame)
    1.25 +  NS_DECL_FRAMEARENA_HELPERS
    1.26 +
    1.27 +  nsSubDocumentFrame(nsStyleContext* aContext);
    1.28 +
    1.29 +#ifdef DEBUG_FRAME_DUMP
    1.30 +  void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const MOZ_OVERRIDE;
    1.31 +  virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
    1.32 +#endif
    1.33 +
    1.34 +  NS_DECL_QUERYFRAME
    1.35 +
    1.36 +  virtual nsIAtom* GetType() const MOZ_OVERRIDE;
    1.37 +
    1.38 +  virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
    1.39 +  {
    1.40 +    // nsLeafFrame is already eReplacedContainsBlock, but that's somewhat bogus
    1.41 +    return nsLeafFrame::IsFrameOfType(aFlags &
    1.42 +      ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
    1.43 +  }
    1.44 +
    1.45 +  virtual void Init(nsIContent*      aContent,
    1.46 +                    nsIFrame*        aParent,
    1.47 +                    nsIFrame*        aPrevInFlow) MOZ_OVERRIDE;
    1.48 +
    1.49 +  virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
    1.50 +
    1.51 +  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    1.52 +  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    1.53 +
    1.54 +  virtual mozilla::IntrinsicSize GetIntrinsicSize() MOZ_OVERRIDE;
    1.55 +  virtual nsSize  GetIntrinsicRatio() MOZ_OVERRIDE;
    1.56 +
    1.57 +  virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
    1.58 +                                 nsSize aCBSize, nscoord aAvailableWidth,
    1.59 +                                 nsSize aMargin, nsSize aBorder,
    1.60 +                                 nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
    1.61 +
    1.62 +  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
    1.63 +                             nsSize aCBSize, nscoord aAvailableWidth,
    1.64 +                             nsSize aMargin, nsSize aBorder, nsSize aPadding,
    1.65 +                             uint32_t aFlags) MOZ_OVERRIDE;
    1.66 +
    1.67 +  virtual nsresult Reflow(nsPresContext*          aPresContext,
    1.68 +                          nsHTMLReflowMetrics&     aDesiredSize,
    1.69 +                          const nsHTMLReflowState& aReflowState,
    1.70 +                          nsReflowStatus&          aStatus) MOZ_OVERRIDE;
    1.71 +
    1.72 +  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
    1.73 +                                const nsRect&           aDirtyRect,
    1.74 +                                const nsDisplayListSet& aLists) MOZ_OVERRIDE;
    1.75 +
    1.76 +  virtual nsresult AttributeChanged(int32_t aNameSpaceID,
    1.77 +                                    nsIAtom* aAttribute,
    1.78 +                                    int32_t aModType) MOZ_OVERRIDE;
    1.79 +
    1.80 +  // if the content is "visibility:hidden", then just hide the view
    1.81 +  // and all our contents. We don't extend "visibility:hidden" to
    1.82 +  // the child content ourselves, since it belongs to a different
    1.83 +  // document and CSS doesn't inherit in there.
    1.84 +  virtual bool SupportsVisibilityHidden() MOZ_OVERRIDE { return false; }
    1.85 +
    1.86 +#ifdef ACCESSIBILITY
    1.87 +  virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
    1.88 +#endif
    1.89 +
    1.90 +  nsresult GetDocShell(nsIDocShell **aDocShell);
    1.91 +  nsresult BeginSwapDocShells(nsIFrame* aOther);
    1.92 +  void EndSwapDocShells(nsIFrame* aOther);
    1.93 +  nsView* EnsureInnerView();
    1.94 +  nsIFrame* GetSubdocumentRootFrame();
    1.95 +  nsIntSize GetSubdocumentSize();
    1.96 +
    1.97 +  // nsIReflowCallback
    1.98 +  virtual bool ReflowFinished() MOZ_OVERRIDE;
    1.99 +  virtual void ReflowCallbackCanceled() MOZ_OVERRIDE;
   1.100 +
   1.101 +  bool ShouldClipSubdocument()
   1.102 +  {
   1.103 +    nsFrameLoader* frameLoader = FrameLoader();
   1.104 +    return !frameLoader || frameLoader->ShouldClipSubdocument();
   1.105 +  }
   1.106 +
   1.107 +  bool ShouldClampScrollPosition()
   1.108 +  {
   1.109 +    nsFrameLoader* frameLoader = FrameLoader();
   1.110 +    return !frameLoader || frameLoader->ShouldClampScrollPosition();
   1.111 +  }
   1.112 +
   1.113 +  /**
   1.114 +   * Return true if pointer event hit-testing should be allowed to target
   1.115 +   * content in the subdocument.
   1.116 +   */
   1.117 +  bool PassPointerEventsToChildren();
   1.118 +
   1.119 +protected:
   1.120 +  friend class AsyncFrameInit;
   1.121 +
   1.122 +  // Helper method to look up the HTML marginwidth & marginheight attributes
   1.123 +  nsIntSize GetMarginAttributes();
   1.124 +
   1.125 +  nsFrameLoader* FrameLoader();
   1.126 +
   1.127 +  bool IsInline() { return mIsInline; }
   1.128 +
   1.129 +  virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE;
   1.130 +  virtual nscoord GetIntrinsicHeight() MOZ_OVERRIDE;
   1.131 +
   1.132 +  // Show our document viewer. The document viewer is hidden via a script
   1.133 +  // runner, so that we can save and restore the presentation if we're
   1.134 +  // being reframed.
   1.135 +  void ShowViewer();
   1.136 +
   1.137 +  /* Obtains the frame we should use for intrinsic size information if we are
   1.138 +   * an HTML <object>, <embed> or <applet> (a replaced element - not <iframe>)
   1.139 +   * and our sub-document has an intrinsic size. The frame returned is the
   1.140 +   * frame for the document element of the document we're embedding.
   1.141 +   *
   1.142 +   * Called "Obtain*" and not "Get*" because of comment on GetDocShell that
   1.143 +   * says it should be called ObtainDocShell because of it's side effects.
   1.144 +   */
   1.145 +  nsIFrame* ObtainIntrinsicSizeFrame();
   1.146 +
   1.147 +  nsRefPtr<nsFrameLoader> mFrameLoader;
   1.148 +  nsView* mInnerView;
   1.149 +  bool mIsInline;
   1.150 +  bool mPostedReflowCallback;
   1.151 +  bool mDidCreateDoc;
   1.152 +  bool mCallingShow;
   1.153 +};
   1.154 +
   1.155 +#endif /* NSSUBDOCUMENTFRAME_H_ */

mercurial