2010-08-31 04:46:26 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-08-31 04:46:26 +04:00
|
|
|
|
|
|
|
#ifndef NSSUBDOCUMENTFRAME_H_
|
|
|
|
#define NSSUBDOCUMENTFRAME_H_
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2016-01-28 02:11:00 +03:00
|
|
|
#include "nsAtomicContainerFrame.h"
|
2010-08-31 04:46:26 +04:00
|
|
|
#include "nsIReflowCallback.h"
|
|
|
|
#include "nsFrameLoader.h"
|
2015-03-05 12:13:05 +03:00
|
|
|
#include "Units.h"
|
2010-08-31 04:46:26 +04:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* nsSubDocumentFrame
|
|
|
|
*****************************************************************************/
|
2016-04-18 09:17:58 +03:00
|
|
|
class nsSubDocumentFrame : public nsAtomicContainerFrame,
|
2010-08-31 04:46:26 +04:00
|
|
|
public nsIReflowCallback
|
|
|
|
{
|
|
|
|
public:
|
2010-08-31 04:49:07 +04:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsSubDocumentFrame)
|
2010-08-31 04:46:26 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2014-08-08 03:48:38 +04:00
|
|
|
explicit nsSubDocumentFrame(nsStyleContext* aContext);
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const override;
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetFrameName(nsAString& aResult) const override;
|
2010-08-31 04:46:26 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsIAtom* GetType() const override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
bool IsFrameOfType(uint32_t aFlags) const override
|
2010-08-31 04:46:26 +04:00
|
|
|
{
|
2016-04-18 09:17:58 +03:00
|
|
|
return nsAtomicContainerFrame::IsFrameOfType(aFlags &
|
2016-02-04 01:43:02 +03:00
|
|
|
~(nsIFrame::eReplaced |
|
|
|
|
nsIFrame::eReplacedSizing |
|
|
|
|
nsIFrame::eReplacedContainsBlock));
|
2010-08-31 04:46:26 +04:00
|
|
|
}
|
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::IntrinsicSize GetIntrinsicSize() override;
|
|
|
|
nsSize GetIntrinsicRatio() override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::LogicalSize
|
2016-11-05 04:57:06 +03:00
|
|
|
ComputeAutoSize(nsRenderingContext* aRenderingContext,
|
|
|
|
mozilla::WritingMode aWritingMode,
|
2014-08-24 18:34:51 +04:00
|
|
|
const mozilla::LogicalSize& aCBSize,
|
2016-11-05 04:57:06 +03:00
|
|
|
nscoord aAvailableISize,
|
2014-08-24 18:34:51 +04:00
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2016-11-05 04:57:06 +03:00
|
|
|
ComputeSizeFlags aFlags) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::LogicalSize
|
2016-11-05 04:57:06 +03:00
|
|
|
ComputeSize(nsRenderingContext* aRenderingContext,
|
|
|
|
mozilla::WritingMode aWritingMode,
|
2014-08-24 18:34:44 +04:00
|
|
|
const mozilla::LogicalSize& aCBSize,
|
2016-11-05 04:57:06 +03:00
|
|
|
nscoord aAvailableISize,
|
2014-08-24 18:34:44 +04:00
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2016-11-05 04:57:06 +03:00
|
|
|
ComputeSizeFlags aFlags) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void Reflow(nsPresContext* aPresContext,
|
|
|
|
ReflowOutput& aDesiredSize,
|
|
|
|
const ReflowInput& aReflowInput,
|
|
|
|
nsReflowStatus& aStatus) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult AttributeChanged(int32_t aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
int32_t aModType) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
|
|
|
// if the content is "visibility:hidden", then just hide the view
|
|
|
|
// and all our contents. We don't extend "visibility:hidden" to
|
|
|
|
// the child content ourselves, since it belongs to a different
|
|
|
|
// document and CSS doesn't inherit in there.
|
2017-01-18 03:27:03 +03:00
|
|
|
bool SupportsVisibilityHidden() override { return false; }
|
2010-08-31 04:46:26 +04:00
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::a11y::AccType AccessibleType() override;
|
2010-08-31 04:46:26 +04:00
|
|
|
#endif
|
|
|
|
|
2010-08-31 04:49:11 +04:00
|
|
|
nsresult GetDocShell(nsIDocShell **aDocShell);
|
|
|
|
nsresult BeginSwapDocShells(nsIFrame* aOther);
|
|
|
|
void EndSwapDocShells(nsIFrame* aOther);
|
2013-01-03 17:23:11 +04:00
|
|
|
nsView* EnsureInnerView();
|
2010-08-31 04:49:11 +04:00
|
|
|
nsIFrame* GetSubdocumentRootFrame();
|
2014-06-07 06:23:21 +04:00
|
|
|
enum {
|
|
|
|
IGNORE_PAINT_SUPPRESSION = 0x1
|
|
|
|
};
|
|
|
|
nsIPresShell* GetSubdocumentPresShellForPainting(uint32_t aFlags);
|
2015-03-05 12:13:05 +03:00
|
|
|
mozilla::ScreenIntSize GetSubdocumentSize();
|
2010-08-31 04:46:26 +04:00
|
|
|
|
|
|
|
// nsIReflowCallback
|
2017-01-18 03:27:03 +03:00
|
|
|
bool ReflowFinished() override;
|
|
|
|
void ReflowCallbackCanceled() override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2011-12-05 16:38:46 +04:00
|
|
|
bool ShouldClipSubdocument()
|
|
|
|
{
|
|
|
|
nsFrameLoader* frameLoader = FrameLoader();
|
|
|
|
return !frameLoader || frameLoader->ShouldClipSubdocument();
|
|
|
|
}
|
|
|
|
|
2012-02-18 03:41:13 +04:00
|
|
|
bool ShouldClampScrollPosition()
|
|
|
|
{
|
|
|
|
nsFrameLoader* frameLoader = FrameLoader();
|
|
|
|
return !frameLoader || frameLoader->ShouldClampScrollPosition();
|
|
|
|
}
|
|
|
|
|
2013-08-13 11:56:57 +04:00
|
|
|
/**
|
|
|
|
* Return true if pointer event hit-testing should be allowed to target
|
|
|
|
* content in the subdocument.
|
|
|
|
*/
|
|
|
|
bool PassPointerEventsToChildren();
|
|
|
|
|
2010-08-31 04:46:26 +04:00
|
|
|
protected:
|
|
|
|
friend class AsyncFrameInit;
|
|
|
|
|
2015-04-01 01:09:02 +03:00
|
|
|
// Helper method to look up the HTML marginwidth & marginheight attributes.
|
|
|
|
mozilla::CSSIntSize GetMarginAttributes();
|
2010-08-31 04:46:26 +04:00
|
|
|
|
|
|
|
nsFrameLoader* FrameLoader();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsInline() { return mIsInline; }
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2016-01-28 02:11:00 +03:00
|
|
|
nscoord GetIntrinsicISize();
|
|
|
|
nscoord GetIntrinsicBSize();
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2012-08-14 08:06:44 +04:00
|
|
|
// Show our document viewer. The document viewer is hidden via a script
|
|
|
|
// runner, so that we can save and restore the presentation if we're
|
|
|
|
// being reframed.
|
2010-08-31 04:46:26 +04:00
|
|
|
void ShowViewer();
|
|
|
|
|
|
|
|
/* Obtains the frame we should use for intrinsic size information if we are
|
|
|
|
* an HTML <object>, <embed> or <applet> (a replaced element - not <iframe>)
|
|
|
|
* and our sub-document has an intrinsic size. The frame returned is the
|
|
|
|
* frame for the document element of the document we're embedding.
|
|
|
|
*
|
|
|
|
* Called "Obtain*" and not "Get*" because of comment on GetDocShell that
|
2014-12-13 00:40:00 +03:00
|
|
|
* says it should be called ObtainDocShell because of its side effects.
|
2010-08-31 04:46:26 +04:00
|
|
|
*/
|
|
|
|
nsIFrame* ObtainIntrinsicSizeFrame();
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsFrameLoader> mFrameLoader;
|
2013-01-03 17:23:11 +04:00
|
|
|
nsView* mInnerView;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsInline;
|
|
|
|
bool mPostedReflowCallback;
|
|
|
|
bool mDidCreateDoc;
|
|
|
|
bool mCallingShow;
|
2010-08-31 04:46:26 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* NSSUBDOCUMENTFRAME_H_ */
|