mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 686400 - Filter content insertions in DocAccessible. r=Jamie
It seems a bit more sensible to me that if any filtering needs to happen from content insertions, it should happen in the doc and not the notification controller. Differential Revision: https://phabricator.services.mozilla.com/D40132 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
aeb736599d
commit
6d094c687d
@ -413,35 +413,9 @@ void NotificationController::ScheduleChildDocBinding(DocAccessible* aDocument) {
|
||||
}
|
||||
|
||||
void NotificationController::ScheduleContentInsertion(
|
||||
nsIContent* aStartChildNode, nsIContent* aEndChildNode) {
|
||||
// The frame constructor guarantees that only ranges with the same parent
|
||||
// arrive here in presence of dynamic changes to the page, see
|
||||
// nsCSSFrameConstructor::IssueSingleInsertNotifications' callers.
|
||||
nsINode* parent = aStartChildNode->GetFlattenedTreeParentNode();
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
|
||||
Accessible* container = mDocument->AccessibleOrTrueContainer(parent);
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoTArray<nsCOMPtr<nsIContent>, 10> list;
|
||||
for (nsIContent* node = aStartChildNode; node != aEndChildNode;
|
||||
node = node->GetNextSibling()) {
|
||||
MOZ_ASSERT(parent == node->GetFlattenedTreeParentNode());
|
||||
// Notification triggers for content insertion even if no content was
|
||||
// actually inserted (like if the content is display: none). Try to catch
|
||||
// this case early.
|
||||
if (node->GetPrimaryFrame() ||
|
||||
(node->IsElement() && node->AsElement()->IsDisplayContents())) {
|
||||
list.AppendElement(node);
|
||||
}
|
||||
}
|
||||
|
||||
if (!list.IsEmpty()) {
|
||||
mContentInsertions.LookupOrAdd(container)->AppendElements(list);
|
||||
Accessible* aContainer, nsTArray<nsCOMPtr<nsIContent>>& aInsertions) {
|
||||
if (!aInsertions.IsEmpty()) {
|
||||
mContentInsertions.LookupOrAdd(aContainer)->AppendElements(aInsertions);
|
||||
ScheduleProcessing();
|
||||
}
|
||||
}
|
||||
|
@ -191,8 +191,8 @@ class NotificationController final : public EventQueue,
|
||||
/**
|
||||
* Pend accessible tree update for content insertion.
|
||||
*/
|
||||
void ScheduleContentInsertion(nsIContent* aStartChildNode,
|
||||
nsIContent* aEndChildNode);
|
||||
void ScheduleContentInsertion(Accessible* aContainer,
|
||||
nsTArray<nsCOMPtr<nsIContent>>& aInsertions);
|
||||
|
||||
/**
|
||||
* Pend an accessible subtree relocation.
|
||||
|
@ -1266,12 +1266,36 @@ void DocAccessible::ContentInserted(nsIContent* aStartChildNode,
|
||||
nsIContent* aEndChildNode) {
|
||||
// Ignore content insertions until we constructed accessible tree. Otherwise
|
||||
// schedule tree update on content insertion after layout.
|
||||
if (mNotificationController && HasLoadState(eTreeConstructed)) {
|
||||
// Update the whole tree of this document accessible when the container is
|
||||
// null (document element is inserted or removed).
|
||||
mNotificationController->ScheduleContentInsertion(aStartChildNode,
|
||||
aEndChildNode);
|
||||
if (!mNotificationController || !HasLoadState(eTreeConstructed)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The frame constructor guarantees that only ranges with the same parent
|
||||
// arrive here in presence of dynamic changes to the page, see
|
||||
// nsCSSFrameConstructor::IssueSingleInsertNotifications' callers.
|
||||
nsINode* parent = aStartChildNode->GetFlattenedTreeParentNode();
|
||||
if (!parent) {
|
||||
return;
|
||||
}
|
||||
|
||||
Accessible* container = AccessibleOrTrueContainer(parent);
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutoTArray<nsCOMPtr<nsIContent>, 10> list;
|
||||
for (nsIContent* node = aStartChildNode; node != aEndChildNode;
|
||||
node = node->GetNextSibling()) {
|
||||
MOZ_ASSERT(parent == node->GetFlattenedTreeParentNode());
|
||||
// Notification triggers for content insertion even if no content was
|
||||
// actually inserted (like if the content is display: none). Try to catch
|
||||
// this case early.
|
||||
if (node->GetPrimaryFrame() || nsCoreUtils::IsDisplayContents(node)) {
|
||||
list.AppendElement(node);
|
||||
}
|
||||
}
|
||||
|
||||
mNotificationController->ScheduleContentInsertion(container, list);
|
||||
}
|
||||
|
||||
void DocAccessible::RecreateAccessible(nsIContent* aContent) {
|
||||
|
Loading…
Reference in New Issue
Block a user