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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 | 156 |
157 Node* TreeScope::ancestorInThisScope(Node* node) const | 157 Node* TreeScope::ancestorInThisScope(Node* node) const |
158 { | 158 { |
159 while (node) { | 159 while (node) { |
160 if (node->treeScope() == this) | 160 if (node->treeScope() == this) |
161 return node; | 161 return node; |
162 if (!node->isInShadowTree()) | 162 if (!node->isInShadowTree()) |
163 return nullptr; | 163 return nullptr; |
164 | 164 |
165 node = node->shadowHost(); | 165 node = node->ownerShadowHost(); |
166 } | 166 } |
167 | 167 |
168 return nullptr; | 168 return nullptr; |
169 } | 169 } |
170 | 170 |
171 void TreeScope::addImageMap(HTMLMapElement* imageMap) | 171 void TreeScope::addImageMap(HTMLMapElement* imageMap) |
172 { | 172 { |
173 const AtomicString& name = imageMap->getName(); | 173 const AtomicString& name = imageMap->getName(); |
174 if (!name) | 174 if (!name) |
175 return; | 175 return; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 ScriptForbiddenScope forbidScript; | 362 ScriptForbiddenScope forbidScript; |
363 DCHECK(this); | 363 DCHECK(this); |
364 DCHECK(!node.isDocumentNode()); | 364 DCHECK(!node.isDocumentNode()); |
365 TreeScopeAdopter adopter(node, *this); | 365 TreeScopeAdopter adopter(node, *this); |
366 if (adopter.needsScopeChange()) | 366 if (adopter.needsScopeChange()) |
367 adopter.execute(); | 367 adopter.execute(); |
368 } | 368 } |
369 | 369 |
370 Element* TreeScope::retarget(const Element& target) const | 370 Element* TreeScope::retarget(const Element& target) const |
371 { | 371 { |
372 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado
wHost()) { | 372 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->owner
ShadowHost()) { |
373 if (this == ancestor->treeScope()) | 373 if (this == ancestor->treeScope()) |
374 return const_cast<Element*>(ancestor); | 374 return const_cast<Element*>(ancestor); |
375 } | 375 } |
376 return nullptr; | 376 return nullptr; |
377 } | 377 } |
378 | 378 |
379 Element* TreeScope::adjustedFocusedElement() const | 379 Element* TreeScope::adjustedFocusedElement() const |
380 { | 380 { |
381 Document& document = rootNode().document(); | 381 Document& document = rootNode().document(); |
382 Element* element = document.focusedElement(); | 382 Element* element = document.focusedElement(); |
(...skipping 19 matching lines...) Expand all Loading... |
402 // So, it's safe to do toElement(). | 402 // So, it's safe to do toElement(). |
403 return toElement(eventPath->at(i).target()->toNode()); | 403 return toElement(eventPath->at(i).target()->toNode()); |
404 } | 404 } |
405 } | 405 } |
406 return nullptr; | 406 return nullptr; |
407 } | 407 } |
408 | 408 |
409 Element* TreeScope::adjustedElement(const Element& target) const | 409 Element* TreeScope::adjustedElement(const Element& target) const |
410 { | 410 { |
411 const Element* adjustedTarget = ⌖ | 411 const Element* adjustedTarget = ⌖ |
412 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado
wHost()) { | 412 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->owner
ShadowHost()) { |
413 // This adjustment is done only for V1 shadows, and is skipped for V0 or
UA shadows, | 413 // This adjustment is done only for V1 shadows, and is skipped for V0 or
UA shadows, |
414 // because .pointerLockElement and .(webkit)fullscreenElement is not ava
ilable for | 414 // because .pointerLockElement and .(webkit)fullscreenElement is not ava
ilable for |
415 // non-V1 shadow roots. | 415 // non-V1 shadow roots. |
416 // TODO(kochi): Once V0 code is removed, use the same logic as .activeEl
ement for V1. | 416 // TODO(kochi): Once V0 code is removed, use the same logic as .activeEl
ement for V1. |
417 if (ancestor->shadowRootIfV1()) | 417 if (ancestor->shadowRootIfV1()) |
418 adjustedTarget = ancestor; | 418 adjustedTarget = ancestor; |
419 if (this == ancestor->treeScope()) | 419 if (this == ancestor->treeScope()) |
420 return const_cast<Element*>(adjustedTarget); | 420 return const_cast<Element*>(adjustedTarget); |
421 } | 421 } |
422 return nullptr; | 422 return nullptr; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 visitor->trace(m_parentTreeScope); | 535 visitor->trace(m_parentTreeScope); |
536 visitor->trace(m_idTargetObserverRegistry); | 536 visitor->trace(m_idTargetObserverRegistry); |
537 visitor->trace(m_selection); | 537 visitor->trace(m_selection); |
538 visitor->trace(m_elementsById); | 538 visitor->trace(m_elementsById); |
539 visitor->trace(m_imageMapsByName); | 539 visitor->trace(m_imageMapsByName); |
540 visitor->trace(m_scopedStyleResolver); | 540 visitor->trace(m_scopedStyleResolver); |
541 visitor->trace(m_radioButtonGroupScope); | 541 visitor->trace(m_radioButtonGroupScope); |
542 } | 542 } |
543 | 543 |
544 } // namespace blink | 544 } // namespace blink |
OLD | NEW |