| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 { | 159 { |
| 160 // Precondition: | 160 // Precondition: |
| 161 // - TreeScopes in m_treeScopeEventContexts must be *connected* in the sam
e tree of trees. | 161 // - TreeScopes in m_treeScopeEventContexts must be *connected* in the sam
e tree of trees. |
| 162 // - The root tree must be included. | 162 // - The root tree must be included. |
| 163 WillBeHeapHashMap<RawPtrWillBeMember<const TreeScope>, RawPtrWillBeMember<Tr
eeScopeEventContext>> treeScopeEventContextMap; | 163 WillBeHeapHashMap<RawPtrWillBeMember<const TreeScope>, RawPtrWillBeMember<Tr
eeScopeEventContext>> treeScopeEventContextMap; |
| 164 for (const auto& treeScopeEventContext : m_treeScopeEventContexts) | 164 for (const auto& treeScopeEventContext : m_treeScopeEventContexts) |
| 165 treeScopeEventContextMap.add(&treeScopeEventContext->treeScope(), treeSc
opeEventContext.get()); | 165 treeScopeEventContextMap.add(&treeScopeEventContext->treeScope(), treeSc
opeEventContext.get()); |
| 166 TreeScopeEventContext* rootTree = 0; | 166 TreeScopeEventContext* rootTree = 0; |
| 167 for (const auto& treeScopeEventContext : m_treeScopeEventContexts) { | 167 for (const auto& treeScopeEventContext : m_treeScopeEventContexts) { |
| 168 // Use olderShadowRootOrParentTreeScope here for parent-child relationsh
ips. | 168 // Use olderShadowRootOrParentTreeScope here for parent-child relationsh
ips. |
| 169 // See the definition of trees of trees in the Shado DOM spec: http://w3
c.github.io/webcomponents/spec/shadow/ | 169 // See the definition of trees of trees in the Shadow DOM spec: |
| 170 // http://w3c.github.io/webcomponents/spec/shadow/ |
| 170 TreeScope* parent = treeScopeEventContext.get()->treeScope().olderShadow
RootOrParentTreeScope(); | 171 TreeScope* parent = treeScopeEventContext.get()->treeScope().olderShadow
RootOrParentTreeScope(); |
| 171 if (!parent) { | 172 if (!parent) { |
| 172 ASSERT(!rootTree); | 173 ASSERT(!rootTree); |
| 173 rootTree = treeScopeEventContext.get(); | 174 rootTree = treeScopeEventContext.get(); |
| 174 continue; | 175 continue; |
| 175 } | 176 } |
| 176 ASSERT(treeScopeEventContextMap.find(parent) != treeScopeEventContextMap
.end()); | 177 ASSERT(treeScopeEventContextMap.find(parent) != treeScopeEventContextMap
.end()); |
| 177 treeScopeEventContextMap.find(parent)->value->addChild(*treeScopeEventCo
ntext.get()); | 178 treeScopeEventContextMap.find(parent)->value->addChild(*treeScopeEventCo
ntext.get()); |
| 178 } | 179 } |
| 179 ASSERT(rootTree); | 180 ASSERT(rootTree); |
| 180 rootTree->calculatePrePostOrderNumber(0); | 181 rootTree->calculateTreeOrderAndFindClosedTrees(0, nullptr); |
| 181 } | 182 } |
| 182 | 183 |
| 183 TreeScopeEventContext* EventPath::ensureTreeScopeEventContext(Node* currentTarge
t, TreeScope* treeScope, TreeScopeEventContextMap& treeScopeEventContextMap) | 184 TreeScopeEventContext* EventPath::ensureTreeScopeEventContext(Node* currentTarge
t, TreeScope* treeScope, TreeScopeEventContextMap& treeScopeEventContextMap) |
| 184 { | 185 { |
| 185 if (!treeScope) | 186 if (!treeScope) |
| 186 return 0; | 187 return 0; |
| 187 TreeScopeEventContext* treeScopeEventContext; | 188 TreeScopeEventContext* treeScopeEventContext; |
| 188 bool isNewEntry; | 189 bool isNewEntry; |
| 189 { | 190 { |
| 190 TreeScopeEventContextMap::AddResult addResult = treeScopeEventContextMap
.add(treeScope, nullptr); | 191 TreeScopeEventContextMap::AddResult addResult = treeScopeEventContextMap
.add(treeScope, nullptr); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 #if ENABLE(OILPAN) | 379 #if ENABLE(OILPAN) |
| 379 visitor->trace(m_nodeEventContexts); | 380 visitor->trace(m_nodeEventContexts); |
| 380 visitor->trace(m_node); | 381 visitor->trace(m_node); |
| 381 visitor->trace(m_event); | 382 visitor->trace(m_event); |
| 382 visitor->trace(m_treeScopeEventContexts); | 383 visitor->trace(m_treeScopeEventContexts); |
| 383 visitor->trace(m_windowEventContext); | 384 visitor->trace(m_windowEventContext); |
| 384 #endif | 385 #endif |
| 385 } | 386 } |
| 386 | 387 |
| 387 } // namespace | 388 } // namespace |
| OLD | NEW |