Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nuanti Ltd. | 3 * Copyright (C) 2008 Nuanti Ltd. |
| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 | 299 |
| 300 setFocusedFrame(frame); | 300 setFocusedFrame(frame); |
| 301 } | 301 } |
| 302 | 302 |
| 303 Frame* FocusController::focusedOrMainFrame() const | 303 Frame* FocusController::focusedOrMainFrame() const |
| 304 { | 304 { |
| 305 if (Frame* frame = focusedFrame()) | 305 if (Frame* frame = focusedFrame()) |
| 306 return frame; | 306 return frame; |
| 307 | |
| 308 for (Frame* frame = m_page->mainFrame()->tree().top(); frame; frame = frame- >tree().traverseNext()) { | |
|
dcheng
2014/07/16 21:09:08
Can we somehow annotate this as a horrible hack? P
kenrb
2014/07/17 14:57:02
I have added a comment. I don't think it is worth
| |
| 309 if (frame->isLocalRoot()) | |
| 310 return frame; | |
| 311 } | |
| 312 | |
| 307 return m_page->mainFrame(); | 313 return m_page->mainFrame(); |
| 308 } | 314 } |
| 309 | 315 |
| 310 void FocusController::setFocused(bool focused) | 316 void FocusController::setFocused(bool focused) |
| 311 { | 317 { |
| 312 if (isFocused() == focused) | 318 if (isFocused() == focused) |
| 313 return; | 319 return; |
| 314 | 320 |
| 315 m_isFocused = focused; | 321 m_isFocused = focused; |
| 316 | 322 |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 723 if (m_isActive == active) | 729 if (m_isActive == active) |
| 724 return; | 730 return; |
| 725 | 731 |
| 726 m_isActive = active; | 732 m_isActive = active; |
| 727 | 733 |
| 728 if (m_page->mainFrame()->isLocalFrame()) { | 734 if (m_page->mainFrame()->isLocalFrame()) { |
| 729 if (FrameView* view = m_page->deprecatedLocalMainFrame()->view()) | 735 if (FrameView* view = m_page->deprecatedLocalMainFrame()->view()) |
| 730 view->updateControlTints(); | 736 view->updateControlTints(); |
| 731 } | 737 } |
| 732 | 738 |
| 733 toLocalFrame(focusedOrMainFrame())->selection().pageActivationChanged(); | 739 Frame* frame = focusedOrMainFrame(); |
| 740 if (frame->isLocalFrame()) | |
| 741 toLocalFrame(frame)->selection().pageActivationChanged(); | |
| 734 } | 742 } |
| 735 | 743 |
| 736 static void updateFocusCandidateIfNeeded(FocusType type, const FocusCandidate& c urrent, FocusCandidate& candidate, FocusCandidate& closest) | 744 static void updateFocusCandidateIfNeeded(FocusType type, const FocusCandidate& c urrent, FocusCandidate& candidate, FocusCandidate& closest) |
| 737 { | 745 { |
| 738 ASSERT(candidate.visibleNode->isElementNode()); | 746 ASSERT(candidate.visibleNode->isElementNode()); |
| 739 ASSERT(candidate.visibleNode->renderer()); | 747 ASSERT(candidate.visibleNode->renderer()); |
| 740 | 748 |
| 741 // Ignore iframes that don't have a src attribute | 749 // Ignore iframes that don't have a src attribute |
| 742 if (frameOwnerElement(candidate) && (!frameOwnerElement(candidate)->contentF rame() || candidate.rect.isEmpty())) | 750 if (frameOwnerElement(candidate) && (!frameOwnerElement(candidate)->contentF rame() || candidate.rect.isEmpty())) |
| 743 return; | 751 return; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 920 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); | 928 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b order */); |
| 921 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); | 929 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container); |
| 922 if (container && container->isDocumentNode()) | 930 if (container && container->isDocumentNode()) |
| 923 toDocument(container)->updateLayoutIgnorePendingStylesheets(); | 931 toDocument(container)->updateLayoutIgnorePendingStylesheets(); |
| 924 } while (!consumed && container); | 932 } while (!consumed && container); |
| 925 | 933 |
| 926 return consumed; | 934 return consumed; |
| 927 } | 935 } |
| 928 | 936 |
| 929 } // namespace WebCore | 937 } // namespace WebCore |
| OLD | NEW |