Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef NSSUBDOCUMENTFRAME_H_ |
michael@0 | 7 | #define NSSUBDOCUMENTFRAME_H_ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/Attributes.h" |
michael@0 | 10 | #include "nsLeafFrame.h" |
michael@0 | 11 | #include "nsIReflowCallback.h" |
michael@0 | 12 | #include "nsFrameLoader.h" |
michael@0 | 13 | |
michael@0 | 14 | /****************************************************************************** |
michael@0 | 15 | * nsSubDocumentFrame |
michael@0 | 16 | *****************************************************************************/ |
michael@0 | 17 | class nsSubDocumentFrame : public nsLeafFrame, |
michael@0 | 18 | public nsIReflowCallback |
michael@0 | 19 | { |
michael@0 | 20 | public: |
michael@0 | 21 | NS_DECL_QUERYFRAME_TARGET(nsSubDocumentFrame) |
michael@0 | 22 | NS_DECL_FRAMEARENA_HELPERS |
michael@0 | 23 | |
michael@0 | 24 | nsSubDocumentFrame(nsStyleContext* aContext); |
michael@0 | 25 | |
michael@0 | 26 | #ifdef DEBUG_FRAME_DUMP |
michael@0 | 27 | void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const MOZ_OVERRIDE; |
michael@0 | 28 | virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; |
michael@0 | 29 | #endif |
michael@0 | 30 | |
michael@0 | 31 | NS_DECL_QUERYFRAME |
michael@0 | 32 | |
michael@0 | 33 | virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
michael@0 | 34 | |
michael@0 | 35 | virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE |
michael@0 | 36 | { |
michael@0 | 37 | // nsLeafFrame is already eReplacedContainsBlock, but that's somewhat bogus |
michael@0 | 38 | return nsLeafFrame::IsFrameOfType(aFlags & |
michael@0 | 39 | ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | virtual void Init(nsIContent* aContent, |
michael@0 | 43 | nsIFrame* aParent, |
michael@0 | 44 | nsIFrame* aPrevInFlow) MOZ_OVERRIDE; |
michael@0 | 45 | |
michael@0 | 46 | virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; |
michael@0 | 47 | |
michael@0 | 48 | virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; |
michael@0 | 49 | virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; |
michael@0 | 50 | |
michael@0 | 51 | virtual mozilla::IntrinsicSize GetIntrinsicSize() MOZ_OVERRIDE; |
michael@0 | 52 | virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE; |
michael@0 | 53 | |
michael@0 | 54 | virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext, |
michael@0 | 55 | nsSize aCBSize, nscoord aAvailableWidth, |
michael@0 | 56 | nsSize aMargin, nsSize aBorder, |
michael@0 | 57 | nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE; |
michael@0 | 58 | |
michael@0 | 59 | virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext, |
michael@0 | 60 | nsSize aCBSize, nscoord aAvailableWidth, |
michael@0 | 61 | nsSize aMargin, nsSize aBorder, nsSize aPadding, |
michael@0 | 62 | uint32_t aFlags) MOZ_OVERRIDE; |
michael@0 | 63 | |
michael@0 | 64 | virtual nsresult Reflow(nsPresContext* aPresContext, |
michael@0 | 65 | nsHTMLReflowMetrics& aDesiredSize, |
michael@0 | 66 | const nsHTMLReflowState& aReflowState, |
michael@0 | 67 | nsReflowStatus& aStatus) MOZ_OVERRIDE; |
michael@0 | 68 | |
michael@0 | 69 | virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, |
michael@0 | 70 | const nsRect& aDirtyRect, |
michael@0 | 71 | const nsDisplayListSet& aLists) MOZ_OVERRIDE; |
michael@0 | 72 | |
michael@0 | 73 | virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
michael@0 | 74 | nsIAtom* aAttribute, |
michael@0 | 75 | int32_t aModType) MOZ_OVERRIDE; |
michael@0 | 76 | |
michael@0 | 77 | // if the content is "visibility:hidden", then just hide the view |
michael@0 | 78 | // and all our contents. We don't extend "visibility:hidden" to |
michael@0 | 79 | // the child content ourselves, since it belongs to a different |
michael@0 | 80 | // document and CSS doesn't inherit in there. |
michael@0 | 81 | virtual bool SupportsVisibilityHidden() MOZ_OVERRIDE { return false; } |
michael@0 | 82 | |
michael@0 | 83 | #ifdef ACCESSIBILITY |
michael@0 | 84 | virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE; |
michael@0 | 85 | #endif |
michael@0 | 86 | |
michael@0 | 87 | nsresult GetDocShell(nsIDocShell **aDocShell); |
michael@0 | 88 | nsresult BeginSwapDocShells(nsIFrame* aOther); |
michael@0 | 89 | void EndSwapDocShells(nsIFrame* aOther); |
michael@0 | 90 | nsView* EnsureInnerView(); |
michael@0 | 91 | nsIFrame* GetSubdocumentRootFrame(); |
michael@0 | 92 | nsIntSize GetSubdocumentSize(); |
michael@0 | 93 | |
michael@0 | 94 | // nsIReflowCallback |
michael@0 | 95 | virtual bool ReflowFinished() MOZ_OVERRIDE; |
michael@0 | 96 | virtual void ReflowCallbackCanceled() MOZ_OVERRIDE; |
michael@0 | 97 | |
michael@0 | 98 | bool ShouldClipSubdocument() |
michael@0 | 99 | { |
michael@0 | 100 | nsFrameLoader* frameLoader = FrameLoader(); |
michael@0 | 101 | return !frameLoader || frameLoader->ShouldClipSubdocument(); |
michael@0 | 102 | } |
michael@0 | 103 | |
michael@0 | 104 | bool ShouldClampScrollPosition() |
michael@0 | 105 | { |
michael@0 | 106 | nsFrameLoader* frameLoader = FrameLoader(); |
michael@0 | 107 | return !frameLoader || frameLoader->ShouldClampScrollPosition(); |
michael@0 | 108 | } |
michael@0 | 109 | |
michael@0 | 110 | /** |
michael@0 | 111 | * Return true if pointer event hit-testing should be allowed to target |
michael@0 | 112 | * content in the subdocument. |
michael@0 | 113 | */ |
michael@0 | 114 | bool PassPointerEventsToChildren(); |
michael@0 | 115 | |
michael@0 | 116 | protected: |
michael@0 | 117 | friend class AsyncFrameInit; |
michael@0 | 118 | |
michael@0 | 119 | // Helper method to look up the HTML marginwidth & marginheight attributes |
michael@0 | 120 | nsIntSize GetMarginAttributes(); |
michael@0 | 121 | |
michael@0 | 122 | nsFrameLoader* FrameLoader(); |
michael@0 | 123 | |
michael@0 | 124 | bool IsInline() { return mIsInline; } |
michael@0 | 125 | |
michael@0 | 126 | virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE; |
michael@0 | 127 | virtual nscoord GetIntrinsicHeight() MOZ_OVERRIDE; |
michael@0 | 128 | |
michael@0 | 129 | // Show our document viewer. The document viewer is hidden via a script |
michael@0 | 130 | // runner, so that we can save and restore the presentation if we're |
michael@0 | 131 | // being reframed. |
michael@0 | 132 | void ShowViewer(); |
michael@0 | 133 | |
michael@0 | 134 | /* Obtains the frame we should use for intrinsic size information if we are |
michael@0 | 135 | * an HTML <object>, <embed> or <applet> (a replaced element - not <iframe>) |
michael@0 | 136 | * and our sub-document has an intrinsic size. The frame returned is the |
michael@0 | 137 | * frame for the document element of the document we're embedding. |
michael@0 | 138 | * |
michael@0 | 139 | * Called "Obtain*" and not "Get*" because of comment on GetDocShell that |
michael@0 | 140 | * says it should be called ObtainDocShell because of it's side effects. |
michael@0 | 141 | */ |
michael@0 | 142 | nsIFrame* ObtainIntrinsicSizeFrame(); |
michael@0 | 143 | |
michael@0 | 144 | nsRefPtr<nsFrameLoader> mFrameLoader; |
michael@0 | 145 | nsView* mInnerView; |
michael@0 | 146 | bool mIsInline; |
michael@0 | 147 | bool mPostedReflowCallback; |
michael@0 | 148 | bool mDidCreateDoc; |
michael@0 | 149 | bool mCallingShow; |
michael@0 | 150 | }; |
michael@0 | 151 | |
michael@0 | 152 | #endif /* NSSUBDOCUMENTFRAME_H_ */ |