| 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, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef SpatialNavigation_h | 21 #ifndef SpatialNavigation_h |
| 22 #define SpatialNavigation_h | 22 #define SpatialNavigation_h |
| 23 | 23 |
| 24 #include "core/dom/Node.h" | 24 #include "core/dom/Node.h" |
| 25 #include "core/page/FocusType.h" | |
| 26 #include "platform/geometry/LayoutRect.h" | 25 #include "platform/geometry/LayoutRect.h" |
| 26 #include "public/platform/WebFocusType.h" |
| 27 | 27 |
| 28 #include <limits> | 28 #include <limits> |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 class LocalFrame; | 32 class LocalFrame; |
| 33 class HTMLAreaElement; | 33 class HTMLAreaElement; |
| 34 class HTMLFrameOwnerElement; | 34 class HTMLFrameOwnerElement; |
| 35 | 35 |
| 36 inline double maxDistance() | 36 inline double maxDistance() |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) | 105 , alignment(None) |
| 106 , isOffscreen(true) | 106 , isOffscreen(true) |
| 107 , isOffscreenAfterScrolling(true) | 107 , isOffscreenAfterScrolling(true) |
| 108 { | 108 { |
| 109 } | 109 } |
| 110 | 110 |
| 111 FocusCandidate(Node*, FocusType); | 111 FocusCandidate(Node*, WebFocusType); |
| 112 explicit FocusCandidate(HTMLAreaElement*, FocusType); | 112 explicit FocusCandidate(HTMLAreaElement*, WebFocusType); |
| 113 bool isNull() const { return !visibleNode; } | 113 bool isNull() const { return !visibleNode; } |
| 114 bool inScrollableContainer() const { return visibleNode && enclosingScrollab
leBox; } | 114 bool inScrollableContainer() const { return visibleNode && enclosingScrollab
leBox; } |
| 115 bool isFrameOwnerElement() const { return visibleNode && visibleNode->isFram
eOwnerElement(); } | 115 bool isFrameOwnerElement() const { return visibleNode && visibleNode->isFram
eOwnerElement(); } |
| 116 Document* document() const { return visibleNode ? &visibleNode->document() :
nullptr; } | 116 Document* document() const { return visibleNode ? &visibleNode->document() :
nullptr; } |
| 117 | 117 |
| 118 // We handle differently visibleNode and FocusableNode to properly handle th
e areas of imagemaps, | 118 // 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. | 119 // 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. | 120 // In all other cases, visibleNode and focusableNode are one and the same. |
| 121 RawPtrWillBeMember<Node> visibleNode; | 121 RawPtrWillBeMember<Node> visibleNode; |
| 122 RawPtrWillBeMember<Node> focusableNode; | 122 RawPtrWillBeMember<Node> focusableNode; |
| 123 RawPtrWillBeMember<Node> enclosingScrollableBox; | 123 RawPtrWillBeMember<Node> enclosingScrollableBox; |
| 124 double distance; | 124 double distance; |
| 125 RectsAlignment alignment; | 125 RectsAlignment alignment; |
| 126 LayoutRect rect; | 126 LayoutRect rect; |
| 127 bool isOffscreen; | 127 bool isOffscreen; |
| 128 bool isOffscreenAfterScrolling; | 128 bool isOffscreenAfterScrolling; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 bool hasOffscreenRect(Node*, FocusType = FocusTypeNone); | 131 bool hasOffscreenRect(Node*, WebFocusType = WebFocusTypeNone); |
| 132 bool scrollInDirection(LocalFrame*, FocusType); | 132 bool scrollInDirection(LocalFrame*, WebFocusType); |
| 133 bool scrollInDirection(Node* container, FocusType); | 133 bool scrollInDirection(Node* container, WebFocusType); |
| 134 bool canScrollInDirection(const Node* container, FocusType); | 134 bool canScrollInDirection(const Node* container, WebFocusType); |
| 135 bool canScrollInDirection(const LocalFrame*, FocusType); | 135 bool canScrollInDirection(const LocalFrame*, WebFocusType); |
| 136 bool canBeScrolledIntoView(FocusType, const FocusCandidate&); | 136 bool canBeScrolledIntoView(WebFocusType, const FocusCandidate&); |
| 137 bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCand
idate& secondCandidate); | 137 bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCand
idate& secondCandidate); |
| 138 void distanceDataForNode(FocusType, const FocusCandidate& current, FocusCandidat
e&); | 138 void distanceDataForNode(WebFocusType, const FocusCandidate& current, FocusCandi
date&); |
| 139 Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusType, Node*); | 139 Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(WebFocusType, Node*)
; |
| 140 LayoutRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false); | 140 LayoutRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false); |
| 141 LayoutRect frameRectInAbsoluteCoordinates(LocalFrame*); | 141 LayoutRect frameRectInAbsoluteCoordinates(LocalFrame*); |
| 142 LayoutRect virtualRectForDirection(FocusType, const LayoutRect& startingRect, La
youtUnit width = 0); | 142 LayoutRect virtualRectForDirection(WebFocusType, const LayoutRect& startingRect,
LayoutUnit width = 0); |
| 143 LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement&, FocusType); | 143 LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement&, WebFocusType)
; |
| 144 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&); | 144 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&); |
| 145 | 145 |
| 146 } // namespace blink | 146 } // namespace blink |
| 147 | 147 |
| 148 #endif // SpatialNavigation_h | 148 #endif // SpatialNavigation_h |
| OLD | NEW |