2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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_
|
|
|
|
|
2019-06-02 20:00:16 +03:00
|
|
|
#include "Layers.h"
|
|
|
|
#include "LayerState.h"
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2019-06-02 20:00:16 +03:00
|
|
|
#include "mozilla/layers/WebRenderScrollData.h"
|
|
|
|
#include "nsDisplayList.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
|
|
|
|
2018-08-31 22:08:01 +03:00
|
|
|
namespace mozilla {
|
2019-04-16 10:25:10 +03:00
|
|
|
class PresShell;
|
2018-08-31 22:08:01 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2010-08-31 04:46:26 +04:00
|
|
|
/******************************************************************************
|
|
|
|
* nsSubDocumentFrame
|
|
|
|
*****************************************************************************/
|
2017-04-30 18:30:08 +03:00
|
|
|
class nsSubDocumentFrame final : public nsAtomicContainerFrame,
|
|
|
|
public nsIReflowCallback {
|
2010-08-31 04:46:26 +04:00
|
|
|
public:
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsSubDocumentFrame)
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsSubDocumentFrame(ComputedStyle* aStyle,
|
|
|
|
nsPresContext* aPresContext);
|
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
|
|
|
bool IsFrameOfType(uint32_t aFlags) const override {
|
2016-04-18 09:17:58 +03:00
|
|
|
return nsAtomicContainerFrame::IsFrameOfType(
|
2016-02-04 01:43:02 +03:00
|
|
|
aFlags & ~(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-11-07 03:20:33 +03:00
|
|
|
void DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
|
|
|
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::IntrinsicSize GetIntrinsicSize() override;
|
2019-05-03 02:28:21 +03:00
|
|
|
mozilla::AspectRatio GetIntrinsicRatio() override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::LogicalSize ComputeAutoSize(
|
2016-11-05 04:57:06 +03:00
|
|
|
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
|
2014-08-24 18:34:51 +04:00
|
|
|
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
|
|
|
|
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::LogicalSize ComputeSize(
|
2016-11-05 04:57:06 +03:00
|
|
|
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
|
2014-08-24 18:34:44 +04:00
|
|
|
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
|
|
|
|
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;
|
2018-11-30 13:46:48 +03: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 nsDisplayListSet& aLists) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
|
|
|
|
int32_t aModType) override;
|
2010-08-31 04:46:26 +04:00
|
|
|
|
2019-05-10 14:15:43 +03:00
|
|
|
void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) 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
|
|
|
|
|
2018-03-22 05:43:15 +03:00
|
|
|
nsIDocShell* GetDocShell();
|
2010-08-31 04:49:11 +04:00
|
|
|
nsresult BeginSwapDocShells(nsIFrame* aOther);
|
|
|
|
void EndSwapDocShells(nsIFrame* aOther);
|
2013-01-03 17:23:11 +04:00
|
|
|
nsView* EnsureInnerView();
|
2019-07-09 08:34:27 +03:00
|
|
|
nsPoint GetExtraOffset() const;
|
2010-08-31 04:49:11 +04:00
|
|
|
nsIFrame* GetSubdocumentRootFrame();
|
2014-06-07 06:23:21 +04:00
|
|
|
enum { IGNORE_PAINT_SUPPRESSION = 0x1 };
|
2019-04-16 10:25:10 +03:00
|
|
|
mozilla::PresShell* 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
|
|
|
|
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();
|
|
|
|
|
2017-07-21 00:24:40 +03:00
|
|
|
void MaybeShowViewer() {
|
|
|
|
if (!mDidCreateDoc && !mCallingShow) {
|
|
|
|
ShowViewer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-23 20:07:57 +03:00
|
|
|
nsFrameLoader* FrameLoader() const;
|
2019-04-05 22:25:30 +03:00
|
|
|
void ResetFrameLoader();
|
2018-08-31 22:08:01 +03:00
|
|
|
|
2019-05-10 14:15:43 +03:00
|
|
|
void PropagateIsUnderHiddenEmbedderElementToSubView(
|
|
|
|
bool aIsUnderHiddenEmbedderElement);
|
|
|
|
|
2019-05-17 00:14:19 +03:00
|
|
|
void ClearDisplayItems();
|
|
|
|
|
2010-08-31 04:46:26 +04:00
|
|
|
protected:
|
|
|
|
friend class AsyncFrameInit;
|
|
|
|
|
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
|
2017-07-29 02:44:39 +03:00
|
|
|
* an HTML <object> or <embed> (a replaced element - not <iframe>)
|
2010-08-31 04:46:26 +04:00
|
|
|
* 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();
|
|
|
|
|
2017-03-21 03:22:13 +03:00
|
|
|
nsView* GetViewInternal() const override { return mOuterView; }
|
|
|
|
void SetViewInternal(nsView* aView) override { mOuterView = aView; }
|
|
|
|
|
2018-08-31 22:08:01 +03:00
|
|
|
mutable RefPtr<nsFrameLoader> mFrameLoader;
|
|
|
|
|
2017-03-21 03:22:13 +03:00
|
|
|
nsView* mOuterView;
|
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
|
|
|
};
|
|
|
|
|
2019-06-02 20:00:16 +03:00
|
|
|
/**
|
|
|
|
* A nsDisplayRemote will graft a remote frame's shadow layer tree (for a given
|
|
|
|
* nsFrameLoader) into its parent frame's layer tree.
|
|
|
|
*/
|
|
|
|
class nsDisplayRemote final : public nsPaintedDisplayItem {
|
|
|
|
typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
|
|
|
|
typedef mozilla::dom::TabId TabId;
|
|
|
|
typedef mozilla::gfx::Matrix4x4 Matrix4x4;
|
|
|
|
typedef mozilla::layers::EventRegionsOverride EventRegionsOverride;
|
|
|
|
typedef mozilla::layers::Layer Layer;
|
|
|
|
typedef mozilla::layers::LayersId LayersId;
|
|
|
|
typedef mozilla::layers::RefLayer RefLayer;
|
|
|
|
typedef mozilla::layers::StackingContextHelper StackingContextHelper;
|
|
|
|
typedef mozilla::LayerState LayerState;
|
|
|
|
typedef mozilla::LayoutDeviceRect LayoutDeviceRect;
|
|
|
|
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
|
|
|
|
|
|
|
public:
|
|
|
|
nsDisplayRemote(nsDisplayListBuilder* aBuilder, nsSubDocumentFrame* aFrame);
|
|
|
|
|
|
|
|
LayerState GetLayerState(
|
|
|
|
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
|
|
|
const ContainerLayerParameters& aParameters) override;
|
|
|
|
|
|
|
|
already_AddRefed<Layer> BuildLayer(
|
|
|
|
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
|
|
|
const ContainerLayerParameters& aContainerParameters) override;
|
|
|
|
|
|
|
|
void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
|
|
|
|
|
|
|
bool CreateWebRenderCommands(
|
|
|
|
mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
|
const StackingContextHelper& aSc,
|
|
|
|
mozilla::layers::RenderRootStateManager* aManager,
|
|
|
|
nsDisplayListBuilder* aDisplayListBuilder) override;
|
|
|
|
bool UpdateScrollData(
|
|
|
|
mozilla::layers::WebRenderScrollData* aData,
|
|
|
|
mozilla::layers::WebRenderLayerScrollData* aLayerData) override;
|
|
|
|
|
|
|
|
NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE)
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class nsDisplayItemBase;
|
|
|
|
nsFrameLoader* GetFrameLoader() const;
|
|
|
|
|
|
|
|
TabId mTabId;
|
|
|
|
LayersId mLayersId;
|
|
|
|
LayoutDeviceIntPoint mOffset;
|
|
|
|
EventRegionsOverride mEventRegionsOverride;
|
|
|
|
};
|
|
|
|
|
2010-08-31 04:46:26 +04:00
|
|
|
#endif /* NSSUBDOCUMENTFRAME_H_ */
|