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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "core/page/Settings.h" | 56 #include "core/page/Settings.h" |
57 #include "core/page/SpatialNavigation.h" | 57 #include "core/page/SpatialNavigation.h" |
58 #include "core/rendering/HitTestResult.h" | 58 #include "core/rendering/HitTestResult.h" |
59 | 59 |
60 namespace WebCore { | 60 namespace WebCore { |
61 | 61 |
62 using namespace HTMLNames; | 62 using namespace HTMLNames; |
63 | 63 |
64 // FIXME: Some of Node* return values and Node* arguments should be Element*. | 64 // FIXME: Some of Node* return values and Node* arguments should be Element*. |
65 | 65 |
66 FocusNavigationScope::FocusNavigationScope(TreeScope* treeScope) | 66 FocusNavigationScope::FocusNavigationScope(NonNullPtr<TreeScope> treeScope) |
67 : m_rootTreeScope(treeScope) | 67 : m_rootTreeScope(treeScope) |
68 { | 68 { |
69 ASSERT(treeScope); | |
70 } | 69 } |
71 | 70 |
72 Node* FocusNavigationScope::rootNode() const | 71 Node* FocusNavigationScope::rootNode() const |
73 { | 72 { |
74 return m_rootTreeScope->rootNode(); | 73 return m_rootTreeScope->rootNode(); |
75 } | 74 } |
76 | 75 |
77 Element* FocusNavigationScope::owner() const | 76 Element* FocusNavigationScope::owner() const |
78 { | 77 { |
79 Node* root = rootNode(); | 78 Node* root = rootNode(); |
80 if (root->isShadowRoot()) { | 79 if (root->isShadowRoot()) { |
81 ShadowRoot* shadowRoot = toShadowRoot(root); | 80 ShadowRoot* shadowRoot = toShadowRoot(root); |
82 return shadowRoot->isYoungest() ? shadowRoot->host() : shadowRoot->inser
tionPoint(); | 81 return shadowRoot->isYoungest() ? shadowRoot->host() : shadowRoot->inser
tionPoint(); |
83 } | 82 } |
84 if (Frame* frame = root->document().frame()) | 83 if (Frame* frame = root->document().frame()) |
85 return frame->ownerElement(); | 84 return frame->ownerElement(); |
86 return 0; | 85 return 0; |
87 } | 86 } |
88 | 87 |
89 FocusNavigationScope FocusNavigationScope::focusNavigationScopeOf(Node* node) | 88 FocusNavigationScope FocusNavigationScope::focusNavigationScopeOf(Node* node) |
90 { | 89 { |
91 ASSERT(node); | 90 ASSERT(node); |
92 Node* root = node; | 91 Node* root = node; |
93 for (Node* n = node; n; n = n->parentNode()) | 92 for (Node* n = node; n; n = n->parentNode()) |
94 root = n; | 93 root = n; |
95 // The result is not always a ShadowRoot nor a DocumentNode since | 94 // The result is not always a ShadowRoot nor a DocumentNode since |
96 // a starting node is in an orphaned tree in composed shadow tree. | 95 // a starting node is in an orphaned tree in composed shadow tree. |
97 return FocusNavigationScope(&root->treeScope()); | 96 return FocusNavigationScope(root->treeScope()); |
98 } | 97 } |
99 | 98 |
100 FocusNavigationScope FocusNavigationScope::ownedByNonFocusableFocusScopeOwner(No
de* node) | 99 FocusNavigationScope FocusNavigationScope::ownedByNonFocusableFocusScopeOwner(No
de* node) |
101 { | 100 { |
102 if (isShadowHost(node)) | 101 if (isShadowHost(node)) |
103 return FocusNavigationScope::ownedByShadowHost(node); | 102 return FocusNavigationScope::ownedByShadowHost(node); |
104 ASSERT(isActiveShadowInsertionPoint(node)); | 103 ASSERT(isActiveShadowInsertionPoint(node)); |
105 return FocusNavigationScope::ownedByShadowInsertionPoint(toHTMLShadowElement
(node)); | 104 return FocusNavigationScope::ownedByShadowInsertionPoint(toHTMLShadowElement
(node)); |
106 } | 105 } |
107 | 106 |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); | 888 startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore b
order */); |
890 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direct
ion, container); | 889 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direct
ion, container); |
891 if (container && container->isDocumentNode()) | 890 if (container && container->isDocumentNode()) |
892 toDocument(container)->updateLayoutIgnorePendingStylesheets(); | 891 toDocument(container)->updateLayoutIgnorePendingStylesheets(); |
893 } while (!consumed && container); | 892 } while (!consumed && container); |
894 | 893 |
895 return consumed; | 894 return consumed; |
896 } | 895 } |
897 | 896 |
898 } // namespace WebCore | 897 } // namespace WebCore |
OLD | NEW |