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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 ASSERT(this); | 339 ASSERT(this); |
340 ASSERT(!node.isDocumentNode()); | 340 ASSERT(!node.isDocumentNode()); |
341 #if !ENABLE(OILPAN) | 341 #if !ENABLE(OILPAN) |
342 ASSERT_WITH_SECURITY_IMPLICATION(!node.m_deletionHasBegun); | 342 ASSERT_WITH_SECURITY_IMPLICATION(!node.m_deletionHasBegun); |
343 #endif | 343 #endif |
344 TreeScopeAdopter adopter(node, *this); | 344 TreeScopeAdopter adopter(node, *this); |
345 if (adopter.needsScopeChange()) | 345 if (adopter.needsScopeChange()) |
346 adopter.execute(); | 346 adopter.execute(); |
347 } | 347 } |
348 | 348 |
349 static Element* focusedFrameOwnerElement(LocalFrame* focusedFrame, LocalFrame* c
urrentFrame) | 349 static Element* focusedFrameOwnerElement(Frame* focusedFrame, Frame* currentFram
e) |
350 { | 350 { |
351 for (; focusedFrame; focusedFrame = focusedFrame->tree().parent()) { | 351 for (; focusedFrame; focusedFrame = focusedFrame->tree().parent()) { |
352 if (focusedFrame->tree().parent() == currentFrame) { | 352 if (focusedFrame->tree().parent() == currentFrame) { |
353 // FIXME: This won't work for OOPI. | 353 // FIXME: This won't work for OOPI. |
354 return focusedFrame->deprecatedLocalOwner(); | 354 return focusedFrame->deprecatedLocalOwner(); |
355 } | 355 } |
356 } | 356 } |
357 return 0; | 357 return 0; |
358 } | 358 } |
359 | 359 |
360 Element* TreeScope::adjustedFocusedElement() const | 360 Element* TreeScope::adjustedFocusedElement() const |
361 { | 361 { |
362 Document& document = rootNode().document(); | 362 Document& document = rootNode().document(); |
363 Element* element = document.focusedElement(); | 363 Element* element = document.focusedElement(); |
364 // FIXME(kenrb): The toLocalFrame() cast should be removed when RemoteFrames
can have FrameTrees. | |
365 // At that point, focusedFrameOwnerElement should take a Frame instead of a
LocalFrame. | |
366 if (!element && document.page()) | 364 if (!element && document.page()) |
367 element = focusedFrameOwnerElement(toLocalFrameTemporary(document.page()
->focusController().focusedFrame()), document.frame()); | 365 element = focusedFrameOwnerElement(document.page()->focusController().fo
cusedFrame(), document.frame()); |
368 if (!element) | 366 if (!element) |
369 return 0; | 367 return 0; |
370 | 368 |
371 EventPath eventPath(element); | 369 EventPath eventPath(element); |
372 for (size_t i = 0; i < eventPath.size(); ++i) { | 370 for (size_t i = 0; i < eventPath.size(); ++i) { |
373 if (eventPath[i].node() == rootNode()) { | 371 if (eventPath[i].node() == rootNode()) { |
374 // eventPath.at(i).target() is one of the followings: | 372 // eventPath.at(i).target() is one of the followings: |
375 // - InsertionPoint | 373 // - InsertionPoint |
376 // - shadow host | 374 // - shadow host |
377 // - Document::focusedElement() | 375 // - Document::focusedElement() |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 void TreeScope::trace(Visitor* visitor) | 540 void TreeScope::trace(Visitor* visitor) |
543 { | 541 { |
544 visitor->trace(m_rootNode); | 542 visitor->trace(m_rootNode); |
545 visitor->trace(m_document); | 543 visitor->trace(m_document); |
546 visitor->trace(m_parentTreeScope); | 544 visitor->trace(m_parentTreeScope); |
547 visitor->trace(m_idTargetObserverRegistry); | 545 visitor->trace(m_idTargetObserverRegistry); |
548 visitor->trace(m_selection); | 546 visitor->trace(m_selection); |
549 } | 547 } |
550 | 548 |
551 } // namespace WebCore | 549 } // namespace WebCore |
OLD | NEW |