зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1584935 - Clean up a tiny bit more now that lazyfc is infallible. r=tnikkel
Fairly minor clean-up. Differential Revision: https://phabricator.services.mozilla.com/D74751
This commit is contained in:
Родитель
d173bb7e8b
Коммит
58aecd7daa
|
@ -6379,8 +6379,8 @@ void nsCSSFrameConstructor::CheckBitsForLazyFrameConstruction(
|
|||
// FIXME(emilio, bug 1410020): This function assumes that the flattened tree
|
||||
// parent of all the appended children is the same, which, afaict, is not
|
||||
// necessarily true.
|
||||
bool nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
|
||||
nsIContent* aChild) {
|
||||
void nsCSSFrameConstructor::ConstructLazily(Operation aOperation,
|
||||
nsIContent* aChild) {
|
||||
MOZ_ASSERT(aChild->GetParent());
|
||||
|
||||
// We can construct lazily; just need to set suitable bits in the content
|
||||
|
@ -6388,7 +6388,7 @@ bool nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
|
|||
Element* parent = aChild->GetFlattenedTreeParentElement();
|
||||
if (!parent) {
|
||||
// Not part of the flat tree, nothing to do.
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Servo_Element_IsDisplayNone(parent)) {
|
||||
|
@ -6397,7 +6397,7 @@ bool nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
|
|||
// FIXME(emilio): This should be an assert, except for weird <frameset>
|
||||
// stuff that does its own frame construction. Such an assert would fire in
|
||||
// layout/style/crashtests/1411478.html, for example.
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set NODE_NEEDS_FRAME on the new nodes.
|
||||
|
@ -6423,8 +6423,6 @@ bool nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
|
|||
|
||||
CheckBitsForLazyFrameConstruction(parent);
|
||||
parent->NoteDescendantsNeedFramesForServo();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void nsCSSFrameConstructor::IssueSingleInsertNofications(
|
||||
|
@ -6627,14 +6625,9 @@ void nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent,
|
|||
}
|
||||
|
||||
if (aInsertionKind == InsertionKind::Async) {
|
||||
if (MaybeConstructLazily(CONTENTAPPEND, aFirstNewContent)) {
|
||||
LazilyStyleNewChildRange(aFirstNewContent, nullptr);
|
||||
return;
|
||||
}
|
||||
// We couldn't construct lazily. Make Servo eagerly traverse the new content
|
||||
// if needed (when aInsertionKind == InsertionKind::Sync, we know that the
|
||||
// styles are up-to-date already).
|
||||
StyleNewChildRange(aFirstNewContent, nullptr);
|
||||
ConstructLazily(CONTENTAPPEND, aFirstNewContent);
|
||||
LazilyStyleNewChildRange(aFirstNewContent, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
LAYOUT_PHASE_TEMP_EXIT();
|
||||
|
@ -6985,14 +6978,9 @@ void nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aStartChild,
|
|||
}
|
||||
|
||||
if (aInsertionKind == InsertionKind::Async) {
|
||||
if (MaybeConstructLazily(CONTENTINSERT, aStartChild)) {
|
||||
LazilyStyleNewChildRange(aStartChild, aEndChild);
|
||||
return;
|
||||
}
|
||||
// We couldn't construct lazily. Make Servo eagerly traverse the new content
|
||||
// if needed (when aInsertionKind == InsertionKind::Sync, we know that the
|
||||
// styles are up-to-date already).
|
||||
StyleNewChildRange(aStartChild, aEndChild);
|
||||
ConstructLazily(CONTENTINSERT, aStartChild);
|
||||
LazilyStyleNewChildRange(aStartChild, aEndChild);
|
||||
return;
|
||||
}
|
||||
|
||||
bool isAppend, isRangeInsertSafe;
|
||||
|
|
|
@ -109,7 +109,7 @@ class nsCSSFrameConstructor final : public nsFrameManager {
|
|||
|
||||
// aChild is the child being inserted for inserts, and the first
|
||||
// child being appended for appends.
|
||||
bool MaybeConstructLazily(Operation aOperation, nsIContent* aChild);
|
||||
void ConstructLazily(Operation aOperation, nsIContent* aChild);
|
||||
|
||||
#ifdef DEBUG
|
||||
void CheckBitsForLazyFrameConstruction(nsIContent* aParent);
|
||||
|
@ -198,40 +198,22 @@ class nsCSSFrameConstructor final : public nsFrameManager {
|
|||
* inserts/appends as passed from the presshell, except for the insert of the
|
||||
* root element, which is always non-lazy.
|
||||
*
|
||||
* Even if the aInsertionKind passed to ContentAppended/Inserted is
|
||||
* Async we still may not be able to construct lazily, so we call
|
||||
* MaybeConstructLazily. MaybeConstructLazily does not allow lazy
|
||||
* construction if any of the following are true:
|
||||
* -we are in chrome
|
||||
* -the container is in a native anonymous subtree
|
||||
* -the container is XUL
|
||||
* -is any of the appended/inserted nodes are XUL or editable
|
||||
* -(for inserts) the child is anonymous. In the append case this function
|
||||
* must not be called with anonymous children.
|
||||
* The XUL and chrome checks are because XBL bindings only get applied at
|
||||
* frame construction time and some things depend on the bindings getting
|
||||
* attached synchronously.
|
||||
*
|
||||
* If MaybeConstructLazily returns false we construct as usual, but if it
|
||||
* returns true then it adds NODE_NEEDS_FRAME bits to the newly
|
||||
* If we construct lazily, then we add NODE_NEEDS_FRAME bits to the newly
|
||||
* inserted/appended nodes and adds NODE_DESCENDANTS_NEED_FRAMES bits to the
|
||||
* container and up along the parent chain until it hits the root or another
|
||||
* node with that bit set. Then it posts a restyle event to ensure that a
|
||||
* flush happens to construct those frames.
|
||||
*
|
||||
* When the flush happens the presshell calls
|
||||
* nsCSSFrameConstructor::CreateNeededFrames. CreateNeededFrames follows any
|
||||
* nodes with NODE_DESCENDANTS_NEED_FRAMES set down the content tree looking
|
||||
* for nodes with NODE_NEEDS_FRAME set. It calls ContentAppended for any runs
|
||||
* of nodes with NODE_NEEDS_FRAME set that are at the end of their childlist,
|
||||
* and ContentRangeInserted for any other runs that aren't.
|
||||
* When the flush happens the RestyleManager walks the dirty nodes during
|
||||
* ProcessPostTraversal, and ends up calling Content{Appended,Inserted} with
|
||||
* InsertionKind::Sync in ProcessRestyledFrames.
|
||||
*
|
||||
* If a node is removed from the document then we don't bother unsetting any
|
||||
* of the lazy bits that might be set on it, its descendants, or any of its
|
||||
* ancestor nodes because that is a slow operation, the work might be wasted
|
||||
* if another node gets inserted in its place, and we can clear the bits
|
||||
* quicker by processing the content tree from top down the next time we call
|
||||
* CreateNeededFrames. (We do clear the bits when BindToTree is called on any
|
||||
* quicker by processing the content tree from top down the next time we
|
||||
* reconstruct frames. (We do clear the bits when BindToTree is called on any
|
||||
* nsIContent; so any nodes added to the document will not have any lazy bits
|
||||
* set.)
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче