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) | 417 static Element* focusedFrameOwnerElement(Frame* focusedFrame, LocalFrame* curren
tFrame) |
418 { | 418 { |
419 for (; focusedFrame; focusedFrame = focusedFrame->tree().parent()) { | 419 for (; focusedFrame; focusedFrame = focusedFrame->tree().parent()) { |
420 if (focusedFrame->tree().parent() == currentFrame) { | 420 if (focusedFrame->tree().parent() == currentFrame) { |
421 // FIXME: This won't work for OOPI. | 421 ASSERT(focusedFrame->owner()->isLocal()); |
422 return focusedFrame->deprecatedLocalOwner(); | 422 return focusedFrame->deprecatedLocalOwner(); |
423 } | 423 } |
424 } | 424 } |
425 return 0; | 425 return 0; |
426 } | 426 } |
427 | 427 |
428 Element* TreeScope::adjustedFocusedElement() const | 428 Element* TreeScope::adjustedFocusedElement() const |
429 { | 429 { |
430 Document& document = rootNode().document(); | 430 Document& document = rootNode().document(); |
431 Element* element = document.focusedElement(); | 431 Element* element = document.focusedElement(); |
432 if (!element && document.page()) | 432 if (!element && document.page()) |
433 element = focusedFrameOwnerElement(document.page()->focusController().fo
cusedFrame(), document.frame()); | 433 element = focusedFrameOwnerElement(document.page()->focusController().fo
cusedFrameEvenIfRemote(), document.frame()); |
434 if (!element) | 434 if (!element) |
435 return 0; | 435 return 0; |
436 | 436 |
437 OwnPtrWillBeRawPtr<EventPath> eventPath = adoptPtrWillBeNoop(new EventPath(*
element)); | 437 OwnPtrWillBeRawPtr<EventPath> eventPath = adoptPtrWillBeNoop(new EventPath(*
element)); |
438 for (size_t i = 0; i < eventPath->size(); ++i) { | 438 for (size_t i = 0; i < eventPath->size(); ++i) { |
439 if (eventPath->at(i).node() == rootNode()) { | 439 if (eventPath->at(i).node() == rootNode()) { |
440 // eventPath->at(i).target() is one of the followings: | 440 // eventPath->at(i).target() is one of the followings: |
441 // - InsertionPoint | 441 // - InsertionPoint |
442 // - shadow host | 442 // - shadow host |
443 // - Document::focusedElement() | 443 // - Document::focusedElement() |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 visitor->trace(m_parentTreeScope); | 580 visitor->trace(m_parentTreeScope); |
581 visitor->trace(m_idTargetObserverRegistry); | 581 visitor->trace(m_idTargetObserverRegistry); |
582 visitor->trace(m_selection); | 582 visitor->trace(m_selection); |
583 visitor->trace(m_elementsById); | 583 visitor->trace(m_elementsById); |
584 visitor->trace(m_imageMapsByName); | 584 visitor->trace(m_imageMapsByName); |
585 visitor->trace(m_labelsByForAttribute); | 585 visitor->trace(m_labelsByForAttribute); |
586 visitor->trace(m_scopedStyleResolver); | 586 visitor->trace(m_scopedStyleResolver); |
587 } | 587 } |
588 | 588 |
589 } // namespace blink | 589 } // namespace blink |
OLD | NEW |