void EventPath::calculateAdjustedTargets() { const TreeScope* lastTreeScope = 0; bool useDeprecatedSVGUseTreeEventRules = usesDeprecatedSVGUseTreeEventRules(at(0).node()); TreeScopeEventContextMap treeScopeEventContextMap; TreeScopeEventContext* lastTreeScopeEventContext = 0; for (size_t i = 0; i < size(); ++i) { Node* currentNode = at(i).node(); TreeScope& currentTreeScope = currentNode->treeScope(); if (lastTreeScope != ¤tTreeScope) { if (!useDeprecatedSVGUseTreeEventRules) { lastTreeScopeEventContext = ensureTreeScopeEventContext(currentNode, ¤tTreeScope, treeScopeEventContextMap); } else { TreeScopeEventContextMap::AddResult addResult = treeScopeEventContextMap.add(¤tTreeScope, TreeScopeEventContext::create(currentTreeScope)); lastTreeScopeEventContext = addResult.storedValue->value.get(); if (addResult.isNewEntry) { // Don't adjust an event target for SVG. lastTreeScopeEventContext->setTarget(eventTargetRespectingTargetRules(at(0).node())); } } } ASSERT(lastTreeScopeEventContext); at(i).setTreeScopeEventContext(lastTreeScopeEventContext); lastTreeScope = ¤tTreeScope; } m_treeScopeEventContexts.appendRange(treeScopeEventContextMap.values().begin(), treeScopeEventContextMap.values().end()); }
void EventPath::calculateAdjustedTargets() { const TreeScope* lastTreeScope = 0; TreeScopeEventContextMap treeScopeEventContextMap; TreeScopeEventContext* lastTreeScopeEventContext = 0; for (size_t i = 0; i < size(); ++i) { Node* currentNode = at(i).node(); TreeScope& currentTreeScope = currentNode->treeScope(); if (lastTreeScope != ¤tTreeScope) { lastTreeScopeEventContext = ensureTreeScopeEventContext(currentNode, ¤tTreeScope, treeScopeEventContextMap); } ASSERT(lastTreeScopeEventContext); at(i).setTreeScopeEventContext(lastTreeScopeEventContext); lastTreeScope = ¤tTreeScope; } m_treeScopeEventContexts.appendRange(treeScopeEventContextMap.values().begin(), treeScopeEventContextMap.values().end()); }