OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) |
3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org> | 3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 Partial, | 96 Partial, |
97 Full | 97 Full |
98 }; | 98 }; |
99 | 99 |
100 struct FocusCandidate { | 100 struct FocusCandidate { |
101 FocusCandidate() | 101 FocusCandidate() |
102 : visibleNode(0) | 102 : visibleNode(0) |
103 , focusableNode(0) | 103 , focusableNode(0) |
104 , enclosingScrollableBox(0) | 104 , enclosingScrollableBox(0) |
105 , distance(maxDistance()) | 105 , distance(maxDistance()) |
106 , parentDistance(maxDistance()) | |
107 , alignment(None) | 106 , alignment(None) |
108 , parentAlignment(None) | |
109 , isOffscreen(true) | 107 , isOffscreen(true) |
110 , isOffscreenAfterScrolling(true) | 108 , isOffscreenAfterScrolling(true) |
111 { | 109 { |
112 } | 110 } |
113 | 111 |
114 FocusCandidate(Node*, FocusType); | 112 FocusCandidate(Node*, FocusType); |
115 explicit FocusCandidate(HTMLAreaElement*, FocusType); | 113 explicit FocusCandidate(HTMLAreaElement*, FocusType); |
116 bool isNull() const { return !visibleNode; } | 114 bool isNull() const { return !visibleNode; } |
117 bool inScrollableContainer() const { return visibleNode && enclosingScrollab
leBox; } | 115 bool inScrollableContainer() const { return visibleNode && enclosingScrollab
leBox; } |
118 bool isFrameOwnerElement() const { return visibleNode && visibleNode->isFram
eOwnerElement(); } | 116 bool isFrameOwnerElement() const { return visibleNode && visibleNode->isFram
eOwnerElement(); } |
119 Document* document() const { return visibleNode ? &visibleNode->document() :
0; } | 117 Document* document() const { return visibleNode ? &visibleNode->document() :
0; } |
120 | 118 |
121 // We handle differently visibleNode and FocusableNode to properly handle th
e areas of imagemaps, | 119 // We handle differently visibleNode and FocusableNode to properly handle th
e areas of imagemaps, |
122 // where visibleNode would represent the image element and focusableNode wou
ld represent the area element. | 120 // where visibleNode would represent the image element and focusableNode wou
ld represent the area element. |
123 // In all other cases, visibleNode and focusableNode are one and the same. | 121 // In all other cases, visibleNode and focusableNode are one and the same. |
124 Node* visibleNode; | 122 Node* visibleNode; |
125 Node* focusableNode; | 123 Node* focusableNode; |
126 Node* enclosingScrollableBox; | 124 Node* enclosingScrollableBox; |
127 long long distance; | 125 long long distance; |
128 long long parentDistance; | |
129 RectsAlignment alignment; | 126 RectsAlignment alignment; |
130 RectsAlignment parentAlignment; | |
131 LayoutRect rect; | 127 LayoutRect rect; |
132 bool isOffscreen; | 128 bool isOffscreen; |
133 bool isOffscreenAfterScrolling; | 129 bool isOffscreenAfterScrolling; |
134 }; | 130 }; |
135 | 131 |
136 bool hasOffscreenRect(Node*, FocusType = FocusTypeNone); | 132 bool hasOffscreenRect(Node*, FocusType = FocusTypeNone); |
137 bool scrollInDirection(LocalFrame*, FocusType); | 133 bool scrollInDirection(LocalFrame*, FocusType); |
138 bool scrollInDirection(Node* container, FocusType); | 134 bool scrollInDirection(Node* container, FocusType); |
139 bool canScrollInDirection(const Node* container, FocusType); | 135 bool canScrollInDirection(const Node* container, FocusType); |
140 bool canScrollInDirection(const LocalFrame*, FocusType); | 136 bool canScrollInDirection(const LocalFrame*, FocusType); |
141 bool canBeScrolledIntoView(FocusType, const FocusCandidate&); | 137 bool canBeScrolledIntoView(FocusType, const FocusCandidate&); |
142 bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCand
idate& secondCandidate); | 138 bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCand
idate& secondCandidate); |
143 void distanceDataForNode(FocusType, const FocusCandidate& current, FocusCandidat
e&); | 139 void distanceDataForNode(FocusType, const FocusCandidate& current, FocusCandidat
e&); |
144 Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusType, Node*); | 140 Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusType, Node*); |
145 LayoutRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false); | 141 LayoutRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false); |
146 LayoutRect frameRectInAbsoluteCoordinates(LocalFrame*); | 142 LayoutRect frameRectInAbsoluteCoordinates(LocalFrame*); |
147 LayoutRect virtualRectForDirection(FocusType, const LayoutRect& startingRect, La
youtUnit width = 0); | 143 LayoutRect virtualRectForDirection(FocusType, const LayoutRect& startingRect, La
youtUnit width = 0); |
148 LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement&, FocusType); | 144 LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement&, FocusType); |
149 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&); | 145 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&); |
150 | 146 |
151 } // namspace WebCore | 147 } // namspace WebCore |
152 | 148 |
153 #endif // SpatialNavigation_h | 149 #endif // SpatialNavigation_h |
OLD | NEW |