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
|
2017-08-17 00:10:56 +03:00
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2004-02-24 00:29:06 +03:00
|
|
|
|
2020-03-13 00:50:18 +03:00
|
|
|
/* Owns the frame tree and provides APIs to manipulate it */
|
2006-03-30 09:56:38 +04:00
|
|
|
|
2004-02-24 00:29:06 +03:00
|
|
|
#ifndef _nsFrameManager_h_
|
|
|
|
#define _nsFrameManager_h_
|
|
|
|
|
2018-03-06 11:45:59 +03:00
|
|
|
#include "nsDebug.h"
|
|
|
|
#include "mozilla/Attributes.h"
|
2014-06-12 21:09:31 +04:00
|
|
|
#include "nsFrameList.h"
|
2004-02-24 03:36:35 +03:00
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
class nsContainerFrame;
|
2018-03-06 11:45:59 +03:00
|
|
|
class nsIFrame;
|
|
|
|
class nsILayoutHistoryState;
|
2014-06-12 21:09:31 +04:00
|
|
|
class nsPlaceholderFrame;
|
2018-02-22 15:19:50 +03:00
|
|
|
class nsWindowSizes;
|
2010-06-18 20:23:05 +04:00
|
|
|
|
2019-04-16 10:24:29 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class PresShell;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2004-02-24 00:29:06 +03:00
|
|
|
/**
|
2020-03-13 00:50:18 +03:00
|
|
|
* Frame manager interface. The frame manager owns the frame tree model, and
|
|
|
|
* handles structural manipulations to it, such as appending and inserting a
|
|
|
|
* list of frames to a parent frame, or removing a child frame from a parent
|
|
|
|
* frame.
|
2004-02-24 00:29:06 +03:00
|
|
|
*/
|
2018-03-06 11:45:59 +03:00
|
|
|
class nsFrameManager {
|
2019-04-16 10:24:29 +03:00
|
|
|
typedef mozilla::PresShell PresShell;
|
2014-06-12 21:09:31 +04:00
|
|
|
typedef mozilla::layout::FrameChildListID ChildListID;
|
2010-06-18 20:23:05 +04:00
|
|
|
|
2004-02-24 00:29:06 +03:00
|
|
|
public:
|
2019-04-16 10:24:29 +03:00
|
|
|
explicit nsFrameManager(PresShell* aPresShell)
|
2018-03-06 11:45:59 +03:00
|
|
|
: mPresShell(aPresShell), mRootFrame(nullptr) {
|
2013-04-01 02:43:04 +04:00
|
|
|
MOZ_ASSERT(mPresShell, "need a pres shell");
|
2004-03-06 07:46:11 +03:00
|
|
|
}
|
2014-06-02 16:08:24 +04:00
|
|
|
~nsFrameManager();
|
2004-03-06 07:46:11 +03:00
|
|
|
|
2018-03-06 11:45:59 +03:00
|
|
|
/*
|
|
|
|
* Gets and sets the root frame (typically the viewport). The lifetime of the
|
|
|
|
* root frame is controlled by the frame manager. When the frame manager is
|
|
|
|
* destroyed, it destroys the entire frame hierarchy.
|
|
|
|
*/
|
|
|
|
nsIFrame* GetRootFrame() const { return mRootFrame; }
|
|
|
|
void SetRootFrame(nsIFrame* aRootFrame) {
|
|
|
|
NS_ASSERTION(!mRootFrame, "already have a root frame");
|
|
|
|
mRootFrame = aRootFrame;
|
|
|
|
}
|
|
|
|
|
2004-02-24 00:29:06 +03:00
|
|
|
/*
|
|
|
|
* After Destroy is called, it is an error to call any FrameManager methods.
|
|
|
|
* Destroy should be called when the frame tree managed by the frame
|
|
|
|
* manager is no longer being displayed.
|
|
|
|
*/
|
2014-06-02 16:08:21 +04:00
|
|
|
void Destroy();
|
2004-02-24 00:29:06 +03:00
|
|
|
|
|
|
|
// Functions for manipulating the frame model
|
2014-06-02 16:08:21 +04:00
|
|
|
void AppendFrames(nsContainerFrame* aParentFrame, ChildListID aListID,
|
2017-03-19 14:11:34 +03:00
|
|
|
nsFrameList& aFrameList);
|
2014-05-25 02:20:40 +04:00
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
void InsertFrames(nsContainerFrame* aParentFrame, ChildListID aListID,
|
2017-03-19 14:11:34 +03:00
|
|
|
nsIFrame* aPrevFrame, nsFrameList& aFrameList);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
2017-03-19 14:11:34 +03:00
|
|
|
void RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Capture/restore frame state for the frame subtree rooted at aFrame.
|
|
|
|
* aState is the document state storage object onto which each frame
|
2012-05-10 05:27:47 +04:00
|
|
|
* stores its state. Callers of CaptureFrameState are responsible for
|
|
|
|
* traversing next continuations of special siblings of aFrame as
|
|
|
|
* needed; this method will only work with actual frametree descendants
|
|
|
|
* of aFrame.
|
2004-02-24 00:29:06 +03:00
|
|
|
*/
|
|
|
|
|
2017-03-19 14:11:34 +03:00
|
|
|
void CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
2017-03-19 14:11:34 +03:00
|
|
|
void RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add/restore state for one frame
|
|
|
|
*/
|
2017-03-19 14:11:34 +03:00
|
|
|
void CaptureFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState);
|
|
|
|
|
|
|
|
void RestoreFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState);
|
2004-02-24 00:29:06 +03:00
|
|
|
|
2018-02-22 15:19:50 +03:00
|
|
|
void AddSizeOfIncludingThis(nsWindowSizes& aSizes) const;
|
|
|
|
|
2014-11-20 21:24:09 +03:00
|
|
|
protected:
|
2018-03-06 11:45:59 +03:00
|
|
|
// weak link, because the pres shell owns us
|
2019-04-16 10:24:29 +03:00
|
|
|
PresShell* MOZ_NON_OWNING_REF mPresShell;
|
2018-03-06 11:45:59 +03:00
|
|
|
nsIFrame* mRootFrame;
|
2004-02-24 00:29:06 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|