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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 }; | 95 }; |
96 | 96 |
97 struct FocusCandidate { | 97 struct FocusCandidate { |
98 STACK_ALLOCATED(); | 98 STACK_ALLOCATED(); |
99 public: | 99 public: |
100 FocusCandidate() | 100 FocusCandidate() |
101 : visibleNode(nullptr) | 101 : visibleNode(nullptr) |
102 , focusableNode(nullptr) | 102 , focusableNode(nullptr) |
103 , enclosingScrollableBox(nullptr) | 103 , enclosingScrollableBox(nullptr) |
104 , distance(maxDistance()) | 104 , distance(maxDistance()) |
105 , alignment(None) | |
106 , isOffscreen(true) | 105 , isOffscreen(true) |
107 , isOffscreenAfterScrolling(true) | 106 , isOffscreenAfterScrolling(true) |
108 { | 107 { |
109 } | 108 } |
110 | 109 |
111 FocusCandidate(Node*, WebFocusType); | 110 FocusCandidate(Node*, WebFocusType); |
112 explicit FocusCandidate(HTMLAreaElement*, WebFocusType); | 111 explicit FocusCandidate(HTMLAreaElement*, WebFocusType); |
113 bool isNull() const { return !visibleNode; } | 112 bool isNull() const { return !visibleNode; } |
114 bool inScrollableContainer() const { return visibleNode && enclosingScrollab
leBox; } | 113 bool inScrollableContainer() const { return visibleNode && enclosingScrollab
leBox; } |
115 bool isFrameOwnerElement() const { return visibleNode && visibleNode->isFram
eOwnerElement(); } | 114 bool isFrameOwnerElement() const { return visibleNode && visibleNode->isFram
eOwnerElement(); } |
116 Document* document() const { return visibleNode ? &visibleNode->document() :
nullptr; } | 115 Document* document() const { return visibleNode ? &visibleNode->document() :
nullptr; } |
117 | 116 |
118 // We handle differently visibleNode and FocusableNode to properly handle th
e areas of imagemaps, | 117 // We handle differently visibleNode and FocusableNode to properly handle th
e areas of imagemaps, |
119 // where visibleNode would represent the image element and focusableNode wou
ld represent the area element. | 118 // where visibleNode would represent the image element and focusableNode wou
ld represent the area element. |
120 // In all other cases, visibleNode and focusableNode are one and the same. | 119 // In all other cases, visibleNode and focusableNode are one and the same. |
121 RawPtrWillBeMember<Node> visibleNode; | 120 RawPtrWillBeMember<Node> visibleNode; |
122 RawPtrWillBeMember<Node> focusableNode; | 121 RawPtrWillBeMember<Node> focusableNode; |
123 RawPtrWillBeMember<Node> enclosingScrollableBox; | 122 RawPtrWillBeMember<Node> enclosingScrollableBox; |
124 double distance; | 123 double distance; |
125 RectsAlignment alignment; | |
126 LayoutRect rect; | 124 LayoutRect rect; |
127 bool isOffscreen; | 125 bool isOffscreen; |
128 bool isOffscreenAfterScrolling; | 126 bool isOffscreenAfterScrolling; |
129 }; | 127 }; |
130 | 128 |
131 bool hasOffscreenRect(Node*, WebFocusType = WebFocusTypeNone); | 129 bool hasOffscreenRect(Node*, WebFocusType = WebFocusTypeNone); |
132 bool scrollInDirection(LocalFrame*, WebFocusType); | 130 bool scrollInDirection(LocalFrame*, WebFocusType); |
133 bool scrollInDirection(Node* container, WebFocusType); | 131 bool scrollInDirection(Node* container, WebFocusType); |
134 bool canScrollInDirection(const Node* container, WebFocusType); | 132 bool canScrollInDirection(const Node* container, WebFocusType); |
135 bool canScrollInDirection(const LocalFrame*, WebFocusType); | 133 bool canScrollInDirection(const LocalFrame*, WebFocusType); |
136 bool canBeScrolledIntoView(WebFocusType, const FocusCandidate&); | 134 bool canBeScrolledIntoView(WebFocusType, const FocusCandidate&); |
137 bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCand
idate& secondCandidate); | 135 bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCand
idate& secondCandidate); |
138 void distanceDataForNode(WebFocusType, const FocusCandidate& current, FocusCandi
date&); | 136 void distanceDataForNode(WebFocusType, const FocusCandidate& current, FocusCandi
date&); |
139 Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(WebFocusType, Node*)
; | 137 Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(WebFocusType, Node*)
; |
140 LayoutRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false); | 138 LayoutRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false); |
141 LayoutRect frameRectInAbsoluteCoordinates(LocalFrame*); | 139 LayoutRect frameRectInAbsoluteCoordinates(LocalFrame*); |
142 LayoutRect virtualRectForDirection(WebFocusType, const LayoutRect& startingRect,
LayoutUnit width = 0); | 140 LayoutRect virtualRectForDirection(WebFocusType, const LayoutRect& startingRect,
LayoutUnit width = 0); |
143 LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement&, WebFocusType)
; | 141 LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement&, WebFocusType)
; |
144 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&); | 142 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&); |
145 | 143 |
146 } // namespace blink | 144 } // namespace blink |
147 | 145 |
148 #endif // SpatialNavigation_h | 146 #endif // SpatialNavigation_h |
OLD | NEW |