| 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 ASSERT(this); | 407 ASSERT(this); |
| 408 ASSERT(!node.isDocumentNode()); | 408 ASSERT(!node.isDocumentNode()); |
| 409 #if !ENABLE(OILPAN) | 409 #if !ENABLE(OILPAN) |
| 410 ASSERT_WITH_SECURITY_IMPLICATION(!node.m_deletionHasBegun); | 410 ASSERT_WITH_SECURITY_IMPLICATION(!node.m_deletionHasBegun); |
| 411 #endif | 411 #endif |
| 412 TreeScopeAdopter adopter(node, *this); | 412 TreeScopeAdopter adopter(node, *this); |
| 413 if (adopter.needsScopeChange()) | 413 if (adopter.needsScopeChange()) |
| 414 adopter.execute(); | 414 adopter.execute(); |
| 415 } | 415 } |
| 416 | 416 |
| 417 static Element* focusedFrameOwnerElement(Frame* focusedFrame, Frame* currentFram
e) | |
| 418 { | |
| 419 for (; focusedFrame; focusedFrame = focusedFrame->tree().parent()) { | |
| 420 if (focusedFrame->tree().parent() == currentFrame) { | |
| 421 // FIXME: This won't work for OOPI. | |
| 422 return focusedFrame->deprecatedLocalOwner(); | |
| 423 } | |
| 424 } | |
| 425 return 0; | |
| 426 } | |
| 427 | |
| 428 Element* TreeScope::adjustedFocusedElement() const | 417 Element* TreeScope::adjustedFocusedElement() const |
| 429 { | 418 { |
| 430 Document& document = rootNode().document(); | 419 Document& document = rootNode().document(); |
| 431 Element* element = document.focusedElement(); | 420 Element* element = document.focusedElement(); |
| 432 if (!element && document.page()) | 421 if (!element && document.page()) |
| 433 element = focusedFrameOwnerElement(document.page()->focusController().fo
cusedFrame(), document.frame()); | 422 element = document.page()->focusController().focusedFrameOwnerElement(*d
ocument.frame()); |
| 434 if (!element) | 423 if (!element) |
| 435 return 0; | 424 return 0; |
| 436 | 425 |
| 437 OwnPtrWillBeRawPtr<EventPath> eventPath = adoptPtrWillBeNoop(new EventPath(*
element)); | 426 OwnPtrWillBeRawPtr<EventPath> eventPath = adoptPtrWillBeNoop(new EventPath(*
element)); |
| 438 for (size_t i = 0; i < eventPath->size(); ++i) { | 427 for (size_t i = 0; i < eventPath->size(); ++i) { |
| 439 if (eventPath->at(i).node() == rootNode()) { | 428 if (eventPath->at(i).node() == rootNode()) { |
| 440 // eventPath->at(i).target() is one of the followings: | 429 // eventPath->at(i).target() is one of the followings: |
| 441 // - InsertionPoint | 430 // - InsertionPoint |
| 442 // - shadow host | 431 // - shadow host |
| 443 // - Document::focusedElement() | 432 // - Document::focusedElement() |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 visitor->trace(m_parentTreeScope); | 569 visitor->trace(m_parentTreeScope); |
| 581 visitor->trace(m_idTargetObserverRegistry); | 570 visitor->trace(m_idTargetObserverRegistry); |
| 582 visitor->trace(m_selection); | 571 visitor->trace(m_selection); |
| 583 visitor->trace(m_elementsById); | 572 visitor->trace(m_elementsById); |
| 584 visitor->trace(m_imageMapsByName); | 573 visitor->trace(m_imageMapsByName); |
| 585 visitor->trace(m_labelsByForAttribute); | 574 visitor->trace(m_labelsByForAttribute); |
| 586 visitor->trace(m_scopedStyleResolver); | 575 visitor->trace(m_scopedStyleResolver); |
| 587 } | 576 } |
| 588 | 577 |
| 589 } // namespace blink | 578 } // namespace blink |
| OLD | NEW |