/* -*- 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 * 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/. */
/* Implementation of a self-contained `contain: style` scope which manages its * own counters and quotes. Since the `counters()` function has read access to * other `contain: style` scopes, USE counter nodes may link across `contain:
* style` scopes. */ class ContainStyleScope final { public:
ContainStyleScope(ContainStyleScopeManager* aManager,
ContainStyleScope* aParent, nsIContent* aContent)
: mQuoteList(this),
mCounterManager(this),
mScopeManager(aManager),
mParent(aParent),
mContent(aContent) {
MOZ_ASSERT(aManager); if (mParent) {
mParent->AddChild(this);
}
}
~ContainStyleScope() { if (mParent) {
mParent->RemoveChild(this);
}
}
// Find the element in the given nsGenConList that directly precedes // the mContent node of this ContainStyleScope in the flat tree. Can // return null if no element in the list precedes the content.
nsGenConNode* GetPrecedingElementInGenConList(nsGenConList*);
// We are owned by the |mScopeManager|, so this is guaranteed to be a live // pointer as long as we are alive as well.
ContainStyleScopeManager* mScopeManager;
// Although parent and child relationships are represented as raw pointers // here, |mScopeManager| is responsible for managing creation and deletion of // all these data structures and also that it happens in the correct order.
ContainStyleScope* mParent;
nsTArray<ContainStyleScope*> mChildren;
// |mContent| is guaranteed to outlive this scope because mScopeManager will // delete the scope when the corresponding frame for |mContent| is destroyed.
nsIContent* mContent;
};
/* Management of the tree `contain: style` scopes. This class ensures that * recalculation is done top-down, so that nodes that rely on other nodes in
* ancestor `contain: style` scopes are calculated properly. */ class ContainStyleScopeManager { public:
ContainStyleScopeManager() : mRootScope(this, nullptr, nullptr) {}
ContainStyleScope& GetRootScope() { return mRootScope; }
ContainStyleScope& GetOrCreateScopeForContent(nsIContent*);
ContainStyleScope& GetScopeForContent(nsIContent*);
void Clear();
// If this frame creates a `contain: style` scope, destroy that scope and // all of its child scopes. void DestroyScopesFor(nsIFrame*);
// Destroy this scope and all its children starting from the leaf nodes. void DestroyScope(ContainStyleScope*);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.