void TreeScopeAdopter::moveTreeToNewScope(Node& root) const { ASSERT(needsScopeChange()); #if !ENABLE(OILPAN) oldScope().guardRef(); #endif // If an element is moved from a document and then eventually back again the collection cache for // that element may contain stale data as changes made to it will have updated the DOMTreeVersion // of the document it was moved to. By increasing the DOMTreeVersion of the donating document here // we ensure that the collection cache will be invalidated as needed when the element is moved back. Document& oldDocument = oldScope().document(); Document& newDocument = newScope().document(); bool willMoveToNewDocument = oldDocument != newDocument; AXObjectCache* axObjectCache = oldDocument.existingAXObjectCache(); if (willMoveToNewDocument) oldDocument.incDOMTreeVersion(); for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { updateTreeScope(node); if (willMoveToNewDocument) { if (axObjectCache) axObjectCache->remove(&node); moveNodeToNewDocument(node, oldDocument, newDocument); } else if (node.hasRareData()) { NodeRareData* rareData = node.rareData(); if (rareData->nodeLists()) rareData->nodeLists()->adoptTreeScope(); } if (!node.isElementNode()) continue; if (node.hasSyntheticAttrChildNodes()) { WillBeHeapVector<RefPtrWillBeMember<Attr>>& attrs = *toElement(node).attrNodeList(); for (unsigned i = 0; i < attrs.size(); ++i) moveTreeToNewScope(*attrs[i]); } for (ShadowRoot* shadow = node.youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) { shadow->setParentTreeScope(newScope()); if (willMoveToNewDocument) moveTreeToNewDocument(*shadow, oldDocument, newDocument); } } #if !ENABLE(OILPAN) oldScope().guardDeref(); #endif }
void AccessibilityMenuListPopup::childrenChanged() { AXObjectCache* cache = axObjectCache(); for (size_t i = m_children.size(); i > 0 ; --i) { AccessibilityObject* child = m_children[i - 1].get(); if (child->actionElement() && !child->actionElement()->inRenderedDocument()) { child->detachFromParent(); cache->remove(child->axObjectID()); } } m_children.clear(); m_haveChildren = false; addChildren(); }
void AccessibilitySlider::addChildren() { ASSERT(!m_haveChildren); m_haveChildren = true; AXObjectCache* cache = m_renderer->document()->axObjectCache(); AccessibilitySliderThumb* thumb = static_cast<AccessibilitySliderThumb*>(cache->getOrCreate(SliderThumbRole)); thumb->setParent(this); // Before actually adding the value indicator to the hierarchy, // allow the platform to make a final decision about it. if (thumb->accessibilityIsIgnored()) cache->remove(thumb->axObjectID()); else m_children.append(thumb); }
void AccessibilityMenuList::addChildren() { m_haveChildren = true; AXObjectCache* cache = m_renderer->document().axObjectCache(); AccessibilityObject* list = cache->getOrCreate(MenuListPopupRole); if (!list) return; toAccessibilityMockObject(list)->setParent(this); if (list->accessibilityIsIgnored()) { cache->remove(list->axObjectID()); return; } m_children.append(list); list->addChildren(); }
void AccessibilityMenuList::addChildren() { m_haveChildren = true; AXObjectCache* cache = m_renderer->document()->axObjectCache(); AccessibilityObject* list = cache->getOrCreate(MenuListPopupRole); if (!list) return; if (list->accessibilityPlatformIncludesObject() == IgnoreObject) { cache->remove(list->axObjectID()); return; } static_cast<AccessibilityMenuListPopup*>(list)->setMenuList(this); m_children.append(list); list->addChildren(); }