Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 3 * Copyright (C) 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 // - InsertionPoint | 381 // - InsertionPoint |
| 382 // - shadow host | 382 // - shadow host |
| 383 // - Document::focusedElement() | 383 // - Document::focusedElement() |
| 384 // So, it's safe to do toElement(). | 384 // So, it's safe to do toElement(). |
| 385 return toElement(eventPath->at(i).target()->toNode()); | 385 return toElement(eventPath->at(i).target()->toNode()); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 return nullptr; | 388 return nullptr; |
| 389 } | 389 } |
| 390 | 390 |
| 391 Element* TreeScope::adjustedPointerLockElement(const Element& target) const | 391 Element* TreeScope::retargetElementIfInSameTreeScope(const Element& target) cons t |
| 392 { | 392 { |
| 393 const Element* adjustedTarget = ⌖ | 393 const Element* adjustedTarget = ⌖ |
| 394 // Unless the target is in the same TreeScope as |scope|, traverse up shadow trees to | 394 // Unless the target is in the same TreeScope as |scope|, traverse up shadow trees to |
| 395 // find a shadow host that is in the same TreeScope as |scope|. | 395 // find a shadow host that is in the same TreeScope as |scope|. |
|
kochi
2016/07/15 05:35:11
(although I wrote this comment) it seems weird as
| |
| 396 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado wHost()) { | 396 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado wHost()) { |
| 397 // Exception is that if the host has V0 or UA shadow, skip the adjustmen t because | 397 // Exception is that if the host has V0 or UA shadow, skip the adjustmen t because |
| 398 // .pointerLockElement is not available for non-V1 shadows. | 398 // .pointerLockElement is not available for non-V1 shadows. |
| 399 // TODO(kochi): Once V0 code is removed, use the same logic as .activeEl ement for | 399 // TODO(kochi): Once V0 code is removed, use the same logic as .activeEl ement for |
| 400 // Shadow DOM V1. | 400 // Shadow DOM V1. |
| 401 if (ancestor->shadowRootIfV1()) | 401 if (ancestor->shadowRootIfV1()) |
| 402 adjustedTarget = ancestor; | 402 adjustedTarget = ancestor; |
| 403 if (this == ancestor->treeScope()) | 403 if (this == ancestor->treeScope()) |
| 404 return const_cast<Element*>(adjustedTarget); | 404 return const_cast<Element*>(adjustedTarget); |
| 405 } | 405 } |
| 406 return nullptr; | 406 return nullptr; |
| 407 } | 407 } |
| 408 | |
| 408 unsigned short TreeScope::comparePosition(const TreeScope& otherScope) const | 409 unsigned short TreeScope::comparePosition(const TreeScope& otherScope) const |
| 409 { | 410 { |
| 410 if (otherScope == this) | 411 if (otherScope == this) |
| 411 return Node::DOCUMENT_POSITION_EQUIVALENT; | 412 return Node::DOCUMENT_POSITION_EQUIVALENT; |
| 412 | 413 |
| 413 HeapVector<Member<const TreeScope>, 16> chain1; | 414 HeapVector<Member<const TreeScope>, 16> chain1; |
| 414 HeapVector<Member<const TreeScope>, 16> chain2; | 415 HeapVector<Member<const TreeScope>, 16> chain2; |
| 415 const TreeScope* current; | 416 const TreeScope* current; |
| 416 for (current = this; current; current = current->parentTreeScope()) | 417 for (current = this; current; current = current->parentTreeScope()) |
| 417 chain1.append(current); | 418 chain1.append(current); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 518 visitor->trace(m_parentTreeScope); | 519 visitor->trace(m_parentTreeScope); |
| 519 visitor->trace(m_idTargetObserverRegistry); | 520 visitor->trace(m_idTargetObserverRegistry); |
| 520 visitor->trace(m_selection); | 521 visitor->trace(m_selection); |
| 521 visitor->trace(m_elementsById); | 522 visitor->trace(m_elementsById); |
| 522 visitor->trace(m_imageMapsByName); | 523 visitor->trace(m_imageMapsByName); |
| 523 visitor->trace(m_scopedStyleResolver); | 524 visitor->trace(m_scopedStyleResolver); |
| 524 visitor->trace(m_radioButtonGroupScope); | 525 visitor->trace(m_radioButtonGroupScope); |
| 525 } | 526 } |
| 526 | 527 |
| 527 } // namespace blink | 528 } // namespace blink |
| OLD | NEW |