зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1374235: style: Remove the for reconstruction traversals. r=bholley
One less hack, a few more to go. MozReview-Commit-ID: 6katL1EGn2U
This commit is contained in:
Родитель
13c2c13b7f
Коммит
fd2d4e8b6f
|
@ -7597,22 +7597,6 @@ nsCSSFrameConstructor::StyleNewChildRange(nsIContent* aStartChild,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSFrameConstructor::StyleChildRangeForReconstruct(nsIContent* aStartChild,
|
||||
nsIContent* aEndChild)
|
||||
{
|
||||
ServoStyleSet* styleSet = mPresShell->StyleSet()->AsServo();
|
||||
|
||||
// We take a parallelism hit here, since we don't have a great API to pass
|
||||
// a range of elements to style to Servo.
|
||||
for (nsIContent* child = aStartChild; child != aEndChild;
|
||||
child = child->GetNextSibling()) {
|
||||
if (child->IsElement()) {
|
||||
styleSet->StyleSubtreeForReconstruct(child->AsElement());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent,
|
||||
|
@ -7702,12 +7686,8 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
|
|||
}
|
||||
|
||||
// We couldn't construct lazily. Make Servo eagerly traverse the new content.
|
||||
if (aContainer->IsStyledByServo()) {
|
||||
if (aForReconstruction) {
|
||||
StyleChildRangeForReconstruct(aFirstNewContent, nullptr);
|
||||
} else {
|
||||
StyleNewChildRange(aFirstNewContent, nullptr);
|
||||
}
|
||||
if (isNewlyAddedContentForServo) {
|
||||
StyleNewChildRange(aFirstNewContent, nullptr);
|
||||
}
|
||||
|
||||
if (isNewShadowTreeContent) {
|
||||
|
@ -8191,12 +8171,8 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
|
|||
}
|
||||
|
||||
// We couldn't construct lazily. Make Servo eagerly traverse the new content.
|
||||
if (aContainer->IsStyledByServo()) {
|
||||
if (aForReconstruction) {
|
||||
StyleChildRangeForReconstruct(aStartChild, aEndChild);
|
||||
} else {
|
||||
StyleNewChildRange(aStartChild, aEndChild);
|
||||
}
|
||||
if (isNewlyAddedContentForServo) {
|
||||
StyleNewChildRange(aStartChild, aEndChild);
|
||||
}
|
||||
|
||||
if (isNewShadowTreeContent) {
|
||||
|
|
|
@ -185,13 +185,6 @@ private:
|
|||
*/
|
||||
void StyleNewChildRange(nsIContent* aStartChild, nsIContent* aEndChild);
|
||||
|
||||
/**
|
||||
* Calls StyleSubtreeForReconstruct on each child in the aStartChild/aEndChild
|
||||
* range. Only used when we are styled by Servo.
|
||||
*/
|
||||
void StyleChildRangeForReconstruct(nsIContent* aStartChild,
|
||||
nsIContent* aEndChild);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Lazy frame construction is controlled by the aAllowLazyConstruction bool
|
||||
|
|
|
@ -1051,47 +1051,6 @@ ServoStyleSet::StyleNewlyBoundElement(Element* aElement)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSet::StyleSubtreeForReconstruct(Element* aRoot)
|
||||
{
|
||||
MOZ_ASSERT(MayTraverseFrom(aRoot));
|
||||
MOZ_ASSERT(aRoot->HasServoData());
|
||||
|
||||
// If the restyle root is beneath |aRoot|, there won't be any descendants bit
|
||||
// leading us to aRoot. In this case, we need to traverse from the restyle
|
||||
// root instead.
|
||||
nsIDocument* doc = mPresContext->Document();
|
||||
nsINode* restyleRoot = doc->GetServoRestyleRoot();
|
||||
if (!restyleRoot) {
|
||||
return;
|
||||
}
|
||||
Element* el = restyleRoot->IsElement() ? restyleRoot->AsElement() : nullptr;
|
||||
if (el && nsContentUtils::ContentIsFlattenedTreeDescendantOf(el, aRoot)) {
|
||||
MOZ_ASSERT(MayTraverseFrom(el));
|
||||
aRoot = el;
|
||||
doc->ClearServoRestyleRoot();
|
||||
}
|
||||
|
||||
auto flags = ServoTraversalFlags::Forgetful |
|
||||
ServoTraversalFlags::AggressivelyForgetful |
|
||||
ServoTraversalFlags::ClearDirtyBits;
|
||||
PreTraverse(flags);
|
||||
|
||||
AutoPrepareTraversal guard(this);
|
||||
|
||||
const SnapshotTable& snapshots = Snapshots();
|
||||
|
||||
DebugOnly<bool> postTraversalRequired =
|
||||
Servo_TraverseSubtree(aRoot, mRawSet.get(), &snapshots, flags);
|
||||
MOZ_ASSERT(!postTraversalRequired);
|
||||
|
||||
if (mPresContext->EffectCompositor()->PreTraverseInSubtree(flags, aRoot)) {
|
||||
postTraversalRequired =
|
||||
Servo_TraverseSubtree(aRoot, mRawSet.get(), &snapshots, flags);
|
||||
MOZ_ASSERT(!postTraversalRequired);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSet::MarkOriginsDirty(OriginFlags aChangedOrigins)
|
||||
{
|
||||
|
|
|
@ -302,16 +302,6 @@ public:
|
|||
*/
|
||||
void StyleNewlyBoundElement(dom::Element* aElement);
|
||||
|
||||
/**
|
||||
* Like StyleNewSubtree, but in response to a request to reconstruct frames
|
||||
* for the given subtree, and so works on elements that already have
|
||||
* styles. This will leave the subtree in a state just like after an initial
|
||||
* styling, i.e. with new styles, no change hints, and with the dirty
|
||||
* descendants bits cleared. No comparison of old and new styles is done,
|
||||
* so no change hints will be processed.
|
||||
*/
|
||||
void StyleSubtreeForReconstruct(dom::Element* aRoot);
|
||||
|
||||
/**
|
||||
* Helper for correctly calling UpdateStylist without paying the cost of an
|
||||
* extra function call in the common no-rebuild-needed case.
|
||||
|
|
|
@ -67,9 +67,6 @@ enum class ServoTraversalFlags : uint32_t {
|
|||
// pre-traversal. A forgetful traversal is usually the right thing if you
|
||||
// aren't going to do a post-traversal.
|
||||
Forgetful = 1 << 3,
|
||||
// Actively seeks out and clears change hints that may have been posted into
|
||||
// the tree. Nonsensical without also passing Forgetful.
|
||||
AggressivelyForgetful = 1 << 4,
|
||||
// Clears all the dirty bits (dirty descendants, animation-only dirty-descendants,
|
||||
// needs frame, descendants need frames) on the elements traversed.
|
||||
// in the subtree.
|
||||
|
|
Загрузка…
Ссылка в новой задаче