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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 { | 217 { |
218 ASSERT(node); | 218 ASSERT(node); |
219 return (node->isElementNode() && toElement(node)->isKeyboardFocusable()) ||
isNonFocusableFocusScopeOwner(node); | 219 return (node->isElementNode() && toElement(node)->isKeyboardFocusable()) ||
isNonFocusableFocusScopeOwner(node); |
220 } | 220 } |
221 | 221 |
222 FocusController::FocusController(Page* page) | 222 FocusController::FocusController(Page* page) |
223 : m_page(page) | 223 : m_page(page) |
224 , m_isActive(false) | 224 , m_isActive(false) |
225 , m_isFocused(false) | 225 , m_isFocused(false) |
226 , m_isChangingFocusedFrame(false) | 226 , m_isChangingFocusedFrame(false) |
227 , m_containingWindowIsVisible(false) | |
228 { | 227 { |
229 } | 228 } |
230 | 229 |
231 PassOwnPtr<FocusController> FocusController::create(Page* page) | 230 PassOwnPtr<FocusController> FocusController::create(Page* page) |
232 { | 231 { |
233 return adoptPtr(new FocusController(page)); | 232 return adoptPtr(new FocusController(page)); |
234 } | 233 } |
235 | 234 |
236 void FocusController::setFocusedFrame(PassRefPtr<Frame> frame) | 235 void FocusController::setFocusedFrame(PassRefPtr<Frame> frame) |
237 { | 236 { |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 return; | 685 return; |
687 | 686 |
688 m_isActive = active; | 687 m_isActive = active; |
689 | 688 |
690 if (FrameView* view = m_page->mainFrame()->view()) | 689 if (FrameView* view = m_page->mainFrame()->view()) |
691 view->updateControlTints(); | 690 view->updateControlTints(); |
692 | 691 |
693 toLocalFrame(focusedOrMainFrame())->selection().pageActivationChanged(); | 692 toLocalFrame(focusedOrMainFrame())->selection().pageActivationChanged(); |
694 } | 693 } |
695 | 694 |
696 static void contentAreaDidShowOrHide(ScrollableArea* scrollableArea, bool didSho
w) | |
697 { | |
698 if (didShow) | |
699 scrollableArea->contentAreaDidShow(); | |
700 else | |
701 scrollableArea->contentAreaDidHide(); | |
702 } | |
703 | |
704 void FocusController::setContainingWindowIsVisible(bool containingWindowIsVisibl
e) | |
705 { | |
706 if (m_containingWindowIsVisible == containingWindowIsVisible) | |
707 return; | |
708 | |
709 m_containingWindowIsVisible = containingWindowIsVisible; | |
710 | |
711 FrameView* view = m_page->mainFrame()->view(); | |
712 if (!view) | |
713 return; | |
714 | |
715 contentAreaDidShowOrHide(view, containingWindowIsVisible); | |
716 | |
717 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().t
raverseNext()) { | |
718 FrameView* frameView = frame->view(); | |
719 if (!frameView) | |
720 continue; | |
721 | |
722 const HashSet<ScrollableArea*>* scrollableAreas = frameView->scrollableA
reas(); | |
723 if (!scrollableAreas) | |
724 continue; | |
725 | |
726 for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begi
n(), end = scrollableAreas->end(); it != end; ++it) { | |
727 ScrollableArea* scrollableArea = *it; | |
728 ASSERT(scrollableArea->scrollbarsCanBeActive()); | |
729 | |
730 contentAreaDidShowOrHide(scrollableArea, containingWindowIsVisible); | |
731 } | |
732 } | |
733 } | |
734 | |
735 static void updateFocusCandidateIfNeeded(FocusType type, const FocusCandidate& c
urrent, FocusCandidate& candidate, FocusCandidate& closest) | 695 static void updateFocusCandidateIfNeeded(FocusType type, const FocusCandidate& c
urrent, FocusCandidate& candidate, FocusCandidate& closest) |
736 { | 696 { |
737 ASSERT(candidate.visibleNode->isElementNode()); | 697 ASSERT(candidate.visibleNode->isElementNode()); |
738 ASSERT(candidate.visibleNode->renderer()); | 698 ASSERT(candidate.visibleNode->renderer()); |
739 | 699 |
740 // Ignore iframes that don't have a src attribute | 700 // Ignore iframes that don't have a src attribute |
741 if (frameOwnerElement(candidate) && (!frameOwnerElement(candidate)->contentF
rame() || candidate.rect.isEmpty())) | 701 if (frameOwnerElement(candidate) && (!frameOwnerElement(candidate)->contentF
rame() || candidate.rect.isEmpty())) |
742 return; | 702 return; |
743 | 703 |
744 // Ignore off screen child nodes of containers that do not scroll (overflow:
hidden) | 704 // Ignore off screen child nodes of containers that do not scroll (overflow:
hidden) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); | 877 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); |
918 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type,
container); | 878 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(type,
container); |
919 if (container && container->isDocumentNode()) | 879 if (container && container->isDocumentNode()) |
920 toDocument(container)->updateLayoutIgnorePendingStylesheets(); | 880 toDocument(container)->updateLayoutIgnorePendingStylesheets(); |
921 } while (!consumed && container); | 881 } while (!consumed && container); |
922 | 882 |
923 return consumed; | 883 return consumed; |
924 } | 884 } |
925 | 885 |
926 } // namespace WebCore | 886 } // namespace WebCore |
OLD | NEW |