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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 | 422 |
| 423 Element* TreeScope::adjustedFocusedElement() const | 423 Element* TreeScope::adjustedFocusedElement() const |
| 424 { | 424 { |
| 425 Document& document = rootNode().document(); | 425 Document& document = rootNode().document(); |
| 426 Element* element = document.focusedElement(); | 426 Element* element = document.focusedElement(); |
| 427 if (!element && document.page()) | 427 if (!element && document.page()) |
| 428 element = document.page()->focusController().focusedFrameOwnerElement(*d ocument.frame()); | 428 element = document.page()->focusController().focusedFrameOwnerElement(*d ocument.frame()); |
| 429 if (!element) | 429 if (!element) |
| 430 return nullptr; | 430 return nullptr; |
| 431 | 431 |
| 432 if (rootNode().isInV1ShadowTree()) { | |
| 433 if (Node* retargeted = rootNode().retarget(*element)) { | |
| 434 DCHECK(retargeted-> isElementNode()); | |
|
kochi
2016/04/08 01:23:58
nit: unnecessary space
hayato
2016/04/08 04:46:28
Done
| |
| 435 return this == &retargeted->treeScope() ? toElement(retargeted) : nu llptr; | |
| 436 } | |
| 437 return nullptr; | |
| 438 } | |
| 439 | |
| 432 RawPtr<EventPath> eventPath = new EventPath(*element); | 440 RawPtr<EventPath> eventPath = new EventPath(*element); |
| 433 for (size_t i = 0; i < eventPath->size(); ++i) { | 441 for (size_t i = 0; i < eventPath->size(); ++i) { |
| 434 if (eventPath->at(i).node() == rootNode()) { | 442 if (eventPath->at(i).node() == rootNode()) { |
| 435 // eventPath->at(i).target() is one of the followings: | 443 // eventPath->at(i).target() is one of the followings: |
| 436 // - InsertionPoint | 444 // - InsertionPoint |
| 437 // - shadow host | 445 // - shadow host |
| 438 // - Document::focusedElement() | 446 // - Document::focusedElement() |
| 439 // So, it's safe to do toElement(). | 447 // So, it's safe to do toElement(). |
| 440 return toElement(eventPath->at(i).target()->toNode()); | 448 return toElement(eventPath->at(i).target()->toNode()); |
| 441 } | 449 } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 576 visitor->trace(m_idTargetObserverRegistry); | 584 visitor->trace(m_idTargetObserverRegistry); |
| 577 visitor->trace(m_selection); | 585 visitor->trace(m_selection); |
| 578 visitor->trace(m_elementsById); | 586 visitor->trace(m_elementsById); |
| 579 visitor->trace(m_imageMapsByName); | 587 visitor->trace(m_imageMapsByName); |
| 580 visitor->trace(m_labelsByForAttribute); | 588 visitor->trace(m_labelsByForAttribute); |
| 581 visitor->trace(m_scopedStyleResolver); | 589 visitor->trace(m_scopedStyleResolver); |
| 582 visitor->trace(m_radioButtonGroupScope); | 590 visitor->trace(m_radioButtonGroupScope); |
| 583 } | 591 } |
| 584 | 592 |
| 585 } // namespace blink | 593 } // namespace blink |
| OLD | NEW |