| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // Strict mode, names need to match exactly. | 363 // Strict mode, names need to match exactly. |
| 364 if (anchor.name() == name) | 364 if (anchor.name() == name) |
| 365 return &anchor; | 365 return &anchor; |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 return nullptr; | 368 return nullptr; |
| 369 } | 369 } |
| 370 | 370 |
| 371 void TreeScope::adoptIfNeeded(Node& node) | 371 void TreeScope::adoptIfNeeded(Node& node) |
| 372 { | 372 { |
| 373 // Script is forbidden to protect against event handlers firing in the middl
e of rescoping |
| 374 // in |didMoveToNewDocument| callbacks. See https://crbug.com/605766 and htt
ps://crbug.com/606651. |
| 375 ScriptForbiddenScope forbidScript; |
| 373 DCHECK(this); | 376 DCHECK(this); |
| 374 DCHECK(!node.isDocumentNode()); | 377 DCHECK(!node.isDocumentNode()); |
| 375 TreeScopeAdopter adopter(node, *this); | 378 TreeScopeAdopter adopter(node, *this); |
| 376 if (adopter.needsScopeChange()) { | 379 if (adopter.needsScopeChange()) |
| 377 ScriptForbiddenScope forbidScript; | |
| 378 adopter.execute(); | 380 adopter.execute(); |
| 379 } | |
| 380 } | 381 } |
| 381 | 382 |
| 382 Element* TreeScope::retarget(const Element& target) const | 383 Element* TreeScope::retarget(const Element& target) const |
| 383 { | 384 { |
| 384 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado
wHost()) { | 385 for (const Element* ancestor = ⌖ ancestor; ancestor = ancestor->shado
wHost()) { |
| 385 if (this == ancestor->treeScope()) | 386 if (this == ancestor->treeScope()) |
| 386 return const_cast<Element*>(ancestor); | 387 return const_cast<Element*>(ancestor); |
| 387 } | 388 } |
| 388 return nullptr; | 389 return nullptr; |
| 389 } | 390 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 visitor->trace(m_idTargetObserverRegistry); | 533 visitor->trace(m_idTargetObserverRegistry); |
| 533 visitor->trace(m_selection); | 534 visitor->trace(m_selection); |
| 534 visitor->trace(m_elementsById); | 535 visitor->trace(m_elementsById); |
| 535 visitor->trace(m_imageMapsByName); | 536 visitor->trace(m_imageMapsByName); |
| 536 visitor->trace(m_labelsByForAttribute); | 537 visitor->trace(m_labelsByForAttribute); |
| 537 visitor->trace(m_scopedStyleResolver); | 538 visitor->trace(m_scopedStyleResolver); |
| 538 visitor->trace(m_radioButtonGroupScope); | 539 visitor->trace(m_radioButtonGroupScope); |
| 539 } | 540 } |
| 540 | 541 |
| 541 } // namespace blink | 542 } // namespace blink |
| OLD | NEW |