layout/base/nsFrameManager.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * vim:cindent:ts=2:et:sw=2:
michael@0 3 *
michael@0 4 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 7 *
michael@0 8 * This Original Code has been modified by IBM Corporation. Modifications made
michael@0 9 * by IBM described herein are Copyright (c) International Business Machines
michael@0 10 * Corporation, 2000. Modifications to Mozilla code or documentation identified
michael@0 11 * per MPL Section 3.3
michael@0 12 *
michael@0 13 * Date Modified by Description of modification
michael@0 14 * 04/20/2000 IBM Corp. OS/2 VisualAge build.
michael@0 15 */
michael@0 16
michael@0 17 /* storage of the frame tree and information about it */
michael@0 18
michael@0 19 #ifndef _nsFrameManager_h_
michael@0 20 #define _nsFrameManager_h_
michael@0 21
michael@0 22 #include "nsIFrame.h"
michael@0 23 #include "nsFrameManagerBase.h"
michael@0 24 #include "nsIContent.h"
michael@0 25
michael@0 26 namespace mozilla {
michael@0 27 /**
michael@0 28 * Node in a linked list, containing the style for an element that
michael@0 29 * does not have a frame but whose parent does have a frame.
michael@0 30 */
michael@0 31 struct UndisplayedNode {
michael@0 32 UndisplayedNode(nsIContent* aContent, nsStyleContext* aStyle)
michael@0 33 : mContent(aContent),
michael@0 34 mStyle(aStyle),
michael@0 35 mNext(nullptr)
michael@0 36 {
michael@0 37 MOZ_COUNT_CTOR(mozilla::UndisplayedNode);
michael@0 38 }
michael@0 39
michael@0 40 NS_HIDDEN ~UndisplayedNode()
michael@0 41 {
michael@0 42 MOZ_COUNT_DTOR(mozilla::UndisplayedNode);
michael@0 43
michael@0 44 // Delete mNext iteratively to avoid blowing up the stack (bug 460461).
michael@0 45 UndisplayedNode* cur = mNext;
michael@0 46 while (cur) {
michael@0 47 UndisplayedNode* next = cur->mNext;
michael@0 48 cur->mNext = nullptr;
michael@0 49 delete cur;
michael@0 50 cur = next;
michael@0 51 }
michael@0 52 }
michael@0 53
michael@0 54 nsCOMPtr<nsIContent> mContent;
michael@0 55 nsRefPtr<nsStyleContext> mStyle;
michael@0 56 UndisplayedNode* mNext;
michael@0 57 };
michael@0 58
michael@0 59 } // namespace mozilla
michael@0 60
michael@0 61 /**
michael@0 62 * Frame manager interface. The frame manager serves two purposes:
michael@0 63 * <li>provides a service for mapping from content to frame and from
michael@0 64 * out-of-flow frame to placeholder frame.
michael@0 65 * <li>handles structural modifications to the frame model. If the frame model
michael@0 66 * lock can be acquired, then the changes are processed immediately; otherwise,
michael@0 67 * they're queued and processed later.
michael@0 68 *
michael@0 69 * Do not add virtual methods to this class, or bryner will punish you.
michael@0 70 */
michael@0 71
michael@0 72 class nsFrameManager : public nsFrameManagerBase
michael@0 73 {
michael@0 74 typedef nsIFrame::ChildListID ChildListID;
michael@0 75
michael@0 76 public:
michael@0 77 nsFrameManager(nsIPresShell *aPresShell, nsStyleSet* aStyleSet) NS_HIDDEN {
michael@0 78 mPresShell = aPresShell;
michael@0 79 mStyleSet = aStyleSet;
michael@0 80 MOZ_ASSERT(mPresShell, "need a pres shell");
michael@0 81 MOZ_ASSERT(mStyleSet, "need a style set");
michael@0 82 }
michael@0 83 ~nsFrameManager() NS_HIDDEN;
michael@0 84
michael@0 85 /*
michael@0 86 * After Destroy is called, it is an error to call any FrameManager methods.
michael@0 87 * Destroy should be called when the frame tree managed by the frame
michael@0 88 * manager is no longer being displayed.
michael@0 89 */
michael@0 90 NS_HIDDEN_(void) Destroy();
michael@0 91
michael@0 92 // Placeholder frame functions
michael@0 93 NS_HIDDEN_(nsPlaceholderFrame*) GetPlaceholderFrameFor(const nsIFrame* aFrame);
michael@0 94 NS_HIDDEN_(nsresult)
michael@0 95 RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame);
michael@0 96
michael@0 97 NS_HIDDEN_(void)
michael@0 98 UnregisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame);
michael@0 99
michael@0 100 NS_HIDDEN_(void) ClearPlaceholderFrameMap();
michael@0 101
michael@0 102 // Mapping undisplayed content
michael@0 103 NS_HIDDEN_(nsStyleContext*) GetUndisplayedContent(nsIContent* aContent);
michael@0 104 NS_HIDDEN_(mozilla::UndisplayedNode*)
michael@0 105 GetAllUndisplayedContentIn(nsIContent* aParentContent);
michael@0 106 NS_HIDDEN_(void) SetUndisplayedContent(nsIContent* aContent,
michael@0 107 nsStyleContext* aStyleContext);
michael@0 108 NS_HIDDEN_(void) ChangeUndisplayedContent(nsIContent* aContent,
michael@0 109 nsStyleContext* aStyleContext);
michael@0 110 NS_HIDDEN_(void) ClearUndisplayedContentIn(nsIContent* aContent,
michael@0 111 nsIContent* aParentContent);
michael@0 112 NS_HIDDEN_(void) ClearAllUndisplayedContentIn(nsIContent* aParentContent);
michael@0 113
michael@0 114 // Functions for manipulating the frame model
michael@0 115 NS_HIDDEN_(nsresult) AppendFrames(nsIFrame* aParentFrame,
michael@0 116 ChildListID aListID,
michael@0 117 nsFrameList& aFrameList);
michael@0 118
michael@0 119 NS_HIDDEN_(nsresult) InsertFrames(nsIFrame* aParentFrame,
michael@0 120 ChildListID aListID,
michael@0 121 nsIFrame* aPrevFrame,
michael@0 122 nsFrameList& aFrameList);
michael@0 123
michael@0 124 NS_HIDDEN_(nsresult) RemoveFrame(ChildListID aListID,
michael@0 125 nsIFrame* aOldFrame);
michael@0 126
michael@0 127 /*
michael@0 128 * Notification that a frame is about to be destroyed. This allows any
michael@0 129 * outstanding references to the frame to be cleaned up.
michael@0 130 */
michael@0 131 NS_HIDDEN_(void) NotifyDestroyingFrame(nsIFrame* aFrame);
michael@0 132
michael@0 133 /*
michael@0 134 * Capture/restore frame state for the frame subtree rooted at aFrame.
michael@0 135 * aState is the document state storage object onto which each frame
michael@0 136 * stores its state. Callers of CaptureFrameState are responsible for
michael@0 137 * traversing next continuations of special siblings of aFrame as
michael@0 138 * needed; this method will only work with actual frametree descendants
michael@0 139 * of aFrame.
michael@0 140 */
michael@0 141
michael@0 142 NS_HIDDEN_(void) CaptureFrameState(nsIFrame* aFrame,
michael@0 143 nsILayoutHistoryState* aState);
michael@0 144
michael@0 145 NS_HIDDEN_(void) RestoreFrameState(nsIFrame* aFrame,
michael@0 146 nsILayoutHistoryState* aState);
michael@0 147
michael@0 148 /*
michael@0 149 * Add/restore state for one frame
michael@0 150 */
michael@0 151 NS_HIDDEN_(void) CaptureFrameStateFor(nsIFrame* aFrame,
michael@0 152 nsILayoutHistoryState* aState);
michael@0 153
michael@0 154 NS_HIDDEN_(void) RestoreFrameStateFor(nsIFrame* aFrame,
michael@0 155 nsILayoutHistoryState* aState);
michael@0 156
michael@0 157 NS_HIDDEN_(nsIPresShell*) GetPresShell() const { return mPresShell; }
michael@0 158 NS_HIDDEN_(nsPresContext*) GetPresContext() const {
michael@0 159 return mPresShell->GetPresContext();
michael@0 160 }
michael@0 161 };
michael@0 162
michael@0 163 #endif

mercurial