michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef NSSUBDOCUMENTFRAME_H_ michael@0: #define NSSUBDOCUMENTFRAME_H_ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsLeafFrame.h" michael@0: #include "nsIReflowCallback.h" michael@0: #include "nsFrameLoader.h" michael@0: michael@0: /****************************************************************************** michael@0: * nsSubDocumentFrame michael@0: *****************************************************************************/ michael@0: class nsSubDocumentFrame : public nsLeafFrame, michael@0: public nsIReflowCallback michael@0: { michael@0: public: michael@0: NS_DECL_QUERYFRAME_TARGET(nsSubDocumentFrame) michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: nsSubDocumentFrame(nsStyleContext* aContext); michael@0: michael@0: #ifdef DEBUG_FRAME_DUMP michael@0: void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const MOZ_OVERRIDE; michael@0: virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; michael@0: #endif michael@0: michael@0: NS_DECL_QUERYFRAME michael@0: michael@0: virtual nsIAtom* GetType() const MOZ_OVERRIDE; michael@0: michael@0: virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE michael@0: { michael@0: // nsLeafFrame is already eReplacedContainsBlock, but that's somewhat bogus michael@0: return nsLeafFrame::IsFrameOfType(aFlags & michael@0: ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); michael@0: } michael@0: michael@0: virtual void Init(nsIContent* aContent, michael@0: nsIFrame* aParent, michael@0: nsIFrame* aPrevInFlow) MOZ_OVERRIDE; michael@0: michael@0: virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; michael@0: michael@0: virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; michael@0: virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; michael@0: michael@0: virtual mozilla::IntrinsicSize GetIntrinsicSize() MOZ_OVERRIDE; michael@0: virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE; michael@0: michael@0: virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext, michael@0: nsSize aCBSize, nscoord aAvailableWidth, michael@0: nsSize aMargin, nsSize aBorder, michael@0: nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE; michael@0: michael@0: virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext, michael@0: nsSize aCBSize, nscoord aAvailableWidth, michael@0: nsSize aMargin, nsSize aBorder, nsSize aPadding, michael@0: uint32_t aFlags) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult Reflow(nsPresContext* aPresContext, michael@0: nsHTMLReflowMetrics& aDesiredSize, michael@0: const nsHTMLReflowState& aReflowState, michael@0: nsReflowStatus& aStatus) MOZ_OVERRIDE; michael@0: michael@0: virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, michael@0: const nsRect& aDirtyRect, michael@0: const nsDisplayListSet& aLists) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult AttributeChanged(int32_t aNameSpaceID, michael@0: nsIAtom* aAttribute, michael@0: int32_t aModType) MOZ_OVERRIDE; michael@0: michael@0: // if the content is "visibility:hidden", then just hide the view michael@0: // and all our contents. We don't extend "visibility:hidden" to michael@0: // the child content ourselves, since it belongs to a different michael@0: // document and CSS doesn't inherit in there. michael@0: virtual bool SupportsVisibilityHidden() MOZ_OVERRIDE { return false; } michael@0: michael@0: #ifdef ACCESSIBILITY michael@0: virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE; michael@0: #endif michael@0: michael@0: nsresult GetDocShell(nsIDocShell **aDocShell); michael@0: nsresult BeginSwapDocShells(nsIFrame* aOther); michael@0: void EndSwapDocShells(nsIFrame* aOther); michael@0: nsView* EnsureInnerView(); michael@0: nsIFrame* GetSubdocumentRootFrame(); michael@0: nsIntSize GetSubdocumentSize(); michael@0: michael@0: // nsIReflowCallback michael@0: virtual bool ReflowFinished() MOZ_OVERRIDE; michael@0: virtual void ReflowCallbackCanceled() MOZ_OVERRIDE; michael@0: michael@0: bool ShouldClipSubdocument() michael@0: { michael@0: nsFrameLoader* frameLoader = FrameLoader(); michael@0: return !frameLoader || frameLoader->ShouldClipSubdocument(); michael@0: } michael@0: michael@0: bool ShouldClampScrollPosition() michael@0: { michael@0: nsFrameLoader* frameLoader = FrameLoader(); michael@0: return !frameLoader || frameLoader->ShouldClampScrollPosition(); michael@0: } michael@0: michael@0: /** michael@0: * Return true if pointer event hit-testing should be allowed to target michael@0: * content in the subdocument. michael@0: */ michael@0: bool PassPointerEventsToChildren(); michael@0: michael@0: protected: michael@0: friend class AsyncFrameInit; michael@0: michael@0: // Helper method to look up the HTML marginwidth & marginheight attributes michael@0: nsIntSize GetMarginAttributes(); michael@0: michael@0: nsFrameLoader* FrameLoader(); michael@0: michael@0: bool IsInline() { return mIsInline; } michael@0: michael@0: virtual nscoord GetIntrinsicWidth() MOZ_OVERRIDE; michael@0: virtual nscoord GetIntrinsicHeight() MOZ_OVERRIDE; michael@0: michael@0: // Show our document viewer. The document viewer is hidden via a script michael@0: // runner, so that we can save and restore the presentation if we're michael@0: // being reframed. michael@0: void ShowViewer(); michael@0: michael@0: /* Obtains the frame we should use for intrinsic size information if we are michael@0: * an HTML , or (a replaced element - not