Bumping manifests a=b2g-bump
[gecko.git] / layout / generic / nsSubDocumentFrame.h
blob788e4d8d9b63e683f546bf2cb24c6632f761246a
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/. */
6 #ifndef NSSUBDOCUMENTFRAME_H_
7 #define NSSUBDOCUMENTFRAME_H_
9 #include "mozilla/Attributes.h"
10 #include "nsLeafFrame.h"
11 #include "nsIReflowCallback.h"
12 #include "nsFrameLoader.h"
14 /******************************************************************************
15 * nsSubDocumentFrame
16 *****************************************************************************/
17 class nsSubDocumentFrame : public nsLeafFrame,
18 public nsIReflowCallback
20 public:
21 NS_DECL_QUERYFRAME_TARGET(nsSubDocumentFrame)
22 NS_DECL_FRAMEARENA_HELPERS
24 explicit nsSubDocumentFrame(nsStyleContext* aContext);
26 #ifdef DEBUG_FRAME_DUMP
27 void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const MOZ_OVERRIDE;
28 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
29 #endif
31 NS_DECL_QUERYFRAME
33 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
35 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
37 // nsLeafFrame is already eReplacedContainsBlock, but that's somewhat bogus
38 return nsLeafFrame::IsFrameOfType(aFlags &
39 ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
42 virtual void Init(nsIContent* aContent,
43 nsContainerFrame* aParent,
44 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
46 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
48 virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
49 virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
51 virtual mozilla::IntrinsicSize GetIntrinsicSize() MOZ_OVERRIDE;
52 virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE;
54 virtual mozilla::LogicalSize
55 ComputeAutoSize(nsRenderingContext *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 bool aShrinkWrap) MOZ_OVERRIDE;
64 virtual mozilla::LogicalSize
65 ComputeSize(nsRenderingContext *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) MOZ_OVERRIDE;
74 virtual void Reflow(nsPresContext* aPresContext,
75 nsHTMLReflowMetrics& aDesiredSize,
76 const nsHTMLReflowState& aReflowState,
77 nsReflowStatus& aStatus) MOZ_OVERRIDE;
79 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
80 const nsRect& aDirtyRect,
81 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
83 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
84 nsIAtom* aAttribute,
85 int32_t aModType) MOZ_OVERRIDE;
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 virtual bool SupportsVisibilityHidden() MOZ_OVERRIDE { return false; }
93 #ifdef ACCESSIBILITY
94 virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
95 #endif
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
105 nsIPresShell* GetSubdocumentPresShellForPainting(uint32_t aFlags);
106 nsIntSize GetSubdocumentSize();
108 // nsIReflowCallback
109 virtual bool ReflowFinished() MOZ_OVERRIDE;
110 virtual void ReflowCallbackCanceled() MOZ_OVERRIDE;
112 bool ShouldClipSubdocument()
114 nsFrameLoader* frameLoader = FrameLoader();
115 return !frameLoader || frameLoader->ShouldClipSubdocument();
118 bool ShouldClampScrollPosition()
120 nsFrameLoader* frameLoader = FrameLoader();
121 return !frameLoader || frameLoader->ShouldClampScrollPosition();
125 * Return true if pointer event hit-testing should be allowed to target
126 * content in the subdocument.
128 bool PassPointerEventsToChildren();
130 nsIntPoint GetChromeDisplacement();
132 protected:
133 friend class AsyncFrameInit;
135 // Helper method to look up the HTML marginwidth & marginheight attributes
136 nsIntSize GetMarginAttributes();
138 nsFrameLoader* FrameLoader();
140 bool IsInline() { return mIsInline; }
142 virtual nscoord GetIntrinsicISize() MOZ_OVERRIDE;
143 virtual nscoord GetIntrinsicBSize() MOZ_OVERRIDE;
145 // Show our document viewer. The document viewer is hidden via a script
146 // runner, so that we can save and restore the presentation if we're
147 // being reframed.
148 void ShowViewer();
150 /* Obtains the frame we should use for intrinsic size information if we are
151 * an HTML <object>, <embed> or <applet> (a replaced element - not <iframe>)
152 * and our sub-document has an intrinsic size. The frame returned is the
153 * frame for the document element of the document we're embedding.
155 * Called "Obtain*" and not "Get*" because of comment on GetDocShell that
156 * says it should be called ObtainDocShell because of its side effects.
158 nsIFrame* ObtainIntrinsicSizeFrame();
160 nsRefPtr<nsFrameLoader> mFrameLoader;
161 nsView* mInnerView;
162 bool mIsInline;
163 bool mPostedReflowCallback;
164 bool mDidCreateDoc;
165 bool mCallingShow;
168 #endif /* NSSUBDOCUMENTFRAME_H_ */