Backed out 2 changesets (bug 1584935) for accessibility failures on e.g. accessible/tests/mochitest/tree/test_tabbrowser.xhtml CLOSED TREE

Backed out changeset 91e7137acba3 (bug 1584935)
Backed out changeset 28e2781f3026 (bug 1584935)
This commit is contained in:
Csoregi Natalia 2020-05-13 09:41:36 +03:00
Родитель 8ee8d24231
Коммит e1467af8c0
2 изменённых файлов: 66 добавлений и 17 удалений

Просмотреть файл

@ -6379,16 +6379,35 @@ 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.
void nsCSSFrameConstructor::ConstructLazily(Operation aOperation,
nsIContent* aChild) {
//
// NOTE(emilio): The IsXULElement checks are pretty unfortunate, but there's
// tons of browser chrome code that rely on XBL bindings getting synchronously
// loaded as soon as the elements get inserted in the DOM.
bool nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
nsIContent* aChild) {
MOZ_ASSERT(aChild->GetParent());
if (aOperation == CONTENTINSERT) {
MOZ_ASSERT(!aChild->IsRootOfAnonymousSubtree());
if (aChild->IsXULElement()) {
return false;
}
} else { // CONTENTAPPEND
MOZ_ASSERT(aOperation == CONTENTAPPEND,
"operation should be either insert or append");
for (nsIContent* child = aChild; child; child = child->GetNextSibling()) {
MOZ_ASSERT(!child->IsRootOfAnonymousSubtree());
if (child->IsXULElement()) {
return false;
}
}
}
// We can construct lazily; just need to set suitable bits in the content
// tree.
Element* parent = aChild->GetFlattenedTreeParentElement();
if (!parent) {
// Not part of the flat tree, nothing to do.
return;
return true;
}
if (Servo_Element_IsDisplayNone(parent)) {
@ -6397,7 +6416,7 @@ void nsCSSFrameConstructor::ConstructLazily(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;
return true;
}
// Set NODE_NEEDS_FRAME on the new nodes.
@ -6423,6 +6442,8 @@ void nsCSSFrameConstructor::ConstructLazily(Operation aOperation,
CheckBitsForLazyFrameConstruction(parent);
parent->NoteDescendantsNeedFramesForServo();
return true;
}
void nsCSSFrameConstructor::IssueSingleInsertNofications(
@ -6625,9 +6646,14 @@ void nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent,
}
if (aInsertionKind == InsertionKind::Async) {
ConstructLazily(CONTENTAPPEND, aFirstNewContent);
LazilyStyleNewChildRange(aFirstNewContent, nullptr);
return;
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);
}
LAYOUT_PHASE_TEMP_EXIT();
@ -6978,9 +7004,14 @@ void nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aStartChild,
}
if (aInsertionKind == InsertionKind::Async) {
ConstructLazily(CONTENTINSERT, aStartChild);
LazilyStyleNewChildRange(aStartChild, aEndChild);
return;
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);
}
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.
void ConstructLazily(Operation aOperation, nsIContent* aChild);
bool MaybeConstructLazily(Operation aOperation, nsIContent* aChild);
#ifdef DEBUG
void CheckBitsForLazyFrameConstruction(nsIContent* aParent);
@ -198,22 +198,40 @@ 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.
*
* If we construct lazily, then we add NODE_NEEDS_FRAME bits to the newly
* 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
* 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 RestyleManager walks the dirty nodes during
* ProcessPostTraversal, and ends up calling Content{Appended,Inserted} with
* InsertionKind::Sync in ProcessRestyledFrames.
* 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.
*
* 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
* reconstruct frames. (We do clear the bits when BindToTree is called on any
* 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
* nsIContent; so any nodes added to the document will not have any lazy bits
* set.)
*/