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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 adjustedTouches.append(&touchEventContext->touches()); | 305 adjustedTouches.append(&touchEventContext->touches()); |
306 adjustedTargetTouches.append(&touchEventContext->targetTouches()); | 306 adjustedTargetTouches.append(&touchEventContext->targetTouches()); |
307 adjustedChangedTouches.append(&touchEventContext->changedTouches()); | 307 adjustedChangedTouches.append(&touchEventContext->changedTouches()); |
308 treeScopes.append(&m_treeScopeEventContexts[i]->treeScope()); | 308 treeScopes.append(&m_treeScopeEventContexts[i]->treeScope()); |
309 } | 309 } |
310 | 310 |
311 adjustTouchList(node, touchEvent.touches(), adjustedTouches, treeScopes); | 311 adjustTouchList(node, touchEvent.touches(), adjustedTouches, treeScopes); |
312 adjustTouchList(node, touchEvent.targetTouches(), adjustedTargetTouches, tre
eScopes); | 312 adjustTouchList(node, touchEvent.targetTouches(), adjustedTargetTouches, tre
eScopes); |
313 adjustTouchList(node, touchEvent.changedTouches(), adjustedChangedTouches, t
reeScopes); | 313 adjustTouchList(node, touchEvent.changedTouches(), adjustedChangedTouches, t
reeScopes); |
314 | 314 |
315 #ifndef NDEBUG | 315 #if ENABLE(ASSERT) |
316 for (size_t i = 0; i < m_treeScopeEventContexts.size(); ++i) { | 316 for (size_t i = 0; i < m_treeScopeEventContexts.size(); ++i) { |
317 TreeScope& treeScope = m_treeScopeEventContexts[i]->treeScope(); | 317 TreeScope& treeScope = m_treeScopeEventContexts[i]->treeScope(); |
318 TouchEventContext* touchEventContext = m_treeScopeEventContexts[i]->touc
hEventContext(); | 318 TouchEventContext* touchEventContext = m_treeScopeEventContexts[i]->touc
hEventContext(); |
319 checkReachability(treeScope, touchEventContext->touches()); | 319 checkReachability(treeScope, touchEventContext->touches()); |
320 checkReachability(treeScope, touchEventContext->targetTouches()); | 320 checkReachability(treeScope, touchEventContext->targetTouches()); |
321 checkReachability(treeScope, touchEventContext->changedTouches()); | 321 checkReachability(treeScope, touchEventContext->changedTouches()); |
322 } | 322 } |
323 #endif | 323 #endif |
324 } | 324 } |
325 | 325 |
326 void EventPath::adjustTouchList(const Node* node, const TouchList* touchList, Wi
llBeHeapVector<RawPtrWillBeMember<TouchList> > adjustedTouchList, const WillBeHe
apVector<RawPtrWillBeMember<TreeScope> >& treeScopes) | 326 void EventPath::adjustTouchList(const Node* node, const TouchList* touchList, Wi
llBeHeapVector<RawPtrWillBeMember<TouchList> > adjustedTouchList, const WillBeHe
apVector<RawPtrWillBeMember<TreeScope> >& treeScopes) |
327 { | 327 { |
328 if (!touchList) | 328 if (!touchList) |
329 return; | 329 return; |
330 for (size_t i = 0; i < touchList->length(); ++i) { | 330 for (size_t i = 0; i < touchList->length(); ++i) { |
331 const Touch& touch = *touchList->item(i); | 331 const Touch& touch = *touchList->item(i); |
332 RelatedTargetMap relatedNodeMap; | 332 RelatedTargetMap relatedNodeMap; |
333 buildRelatedNodeMap(touch.target()->toNode(), relatedNodeMap); | 333 buildRelatedNodeMap(touch.target()->toNode(), relatedNodeMap); |
334 for (size_t j = 0; j < treeScopes.size(); ++j) { | 334 for (size_t j = 0; j < treeScopes.size(); ++j) { |
335 adjustedTouchList[j]->append(touch.cloneWithNewTarget(findRelatedNod
e(treeScopes[j], relatedNodeMap))); | 335 adjustedTouchList[j]->append(touch.cloneWithNewTarget(findRelatedNod
e(treeScopes[j], relatedNodeMap))); |
336 } | 336 } |
337 } | 337 } |
338 } | 338 } |
339 | 339 |
340 #ifndef NDEBUG | 340 #if ENABLE(ASSERT) |
341 void EventPath::checkReachability(TreeScope& treeScope, TouchList& touchList) | 341 void EventPath::checkReachability(TreeScope& treeScope, TouchList& touchList) |
342 { | 342 { |
343 for (size_t i = 0; i < touchList.length(); ++i) | 343 for (size_t i = 0; i < touchList.length(); ++i) |
344 ASSERT(touchList.item(i)->target()->toNode()->treeScope().isInclusiveOld
erSiblingShadowRootOrAncestorTreeScopeOf(treeScope)); | 344 ASSERT(touchList.item(i)->target()->toNode()->treeScope().isInclusiveOld
erSiblingShadowRootOrAncestorTreeScopeOf(treeScope)); |
345 } | 345 } |
346 #endif | 346 #endif |
347 | 347 |
348 void EventPath::trace(Visitor* visitor) | 348 void EventPath::trace(Visitor* visitor) |
349 { | 349 { |
350 visitor->trace(m_nodeEventContexts); | 350 visitor->trace(m_nodeEventContexts); |
351 visitor->trace(m_node); | 351 visitor->trace(m_node); |
352 visitor->trace(m_event); | 352 visitor->trace(m_event); |
353 visitor->trace(m_treeScopeEventContexts); | 353 visitor->trace(m_treeScopeEventContexts); |
354 } | 354 } |
355 | 355 |
356 } // namespace | 356 } // namespace |
OLD | NEW |