Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / page / SpatialNavigation.h
index 1e2f56c..4685168 100644 (file)
 #define SpatialNavigation_h
 
 #include "core/dom/Node.h"
-#include "core/html/HTMLFrameOwnerElement.h"
-#include "core/page/FocusDirection.h"
+#include "core/page/FocusType.h"
 #include "platform/geometry/LayoutRect.h"
 
 #include <limits>
 
-namespace WebCore {
+namespace blink {
 
-class Element;
-class Frame;
+class LocalFrame;
 class HTMLAreaElement;
-class IntRect;
-class RenderObject;
+class HTMLFrameOwnerElement;
 
 inline long long maxDistance()
 {
@@ -46,7 +43,7 @@ inline int fudgeFactor()
     return 2;
 }
 
-bool isSpatialNavigationEnabled(const Frame*);
+bool isSpatialNavigationEnabled(const LocalFrame*);
 
 // Spatially speaking, two given elements in a web page can be:
 // 1) Fully aligned: There is a full intersection between the rects, either
@@ -98,56 +95,54 @@ enum RectsAlignment {
 };
 
 struct FocusCandidate {
+    STACK_ALLOCATED();
+public:
     FocusCandidate()
-        : visibleNode(0)
-        , focusableNode(0)
-        , enclosingScrollableBox(0)
+        : visibleNode(nullptr)
+        , focusableNode(nullptr)
+        , enclosingScrollableBox(nullptr)
         , distance(maxDistance())
-        , parentDistance(maxDistance())
         , alignment(None)
-        , parentAlignment(None)
         , isOffscreen(true)
         , isOffscreenAfterScrolling(true)
     {
     }
 
-    FocusCandidate(Node* n, FocusDirection);
-    explicit FocusCandidate(HTMLAreaElement* area, FocusDirection);
+    FocusCandidate(Node*, FocusType);
+    explicit FocusCandidate(HTMLAreaElement*, FocusType);
     bool isNull() const { return !visibleNode; }
     bool inScrollableContainer() const { return visibleNode && enclosingScrollableBox; }
     bool isFrameOwnerElement() const { return visibleNode && visibleNode->isFrameOwnerElement(); }
-    Document* document() const { return visibleNode ? &visibleNode->document() : 0; }
+    Document* document() const { return visibleNode ? &visibleNode->document() : nullptr; }
 
     // We handle differently visibleNode and FocusableNode to properly handle the areas of imagemaps,
     // where visibleNode would represent the image element and focusableNode would represent the area element.
     // In all other cases, visibleNode and focusableNode are one and the same.
-    Node* visibleNode;
-    Node* focusableNode;
-    Node* enclosingScrollableBox;
+    RawPtrWillBeMember<Node> visibleNode;
+    RawPtrWillBeMember<Node> focusableNode;
+    RawPtrWillBeMember<Node> enclosingScrollableBox;
     long long distance;
-    long long parentDistance;
     RectsAlignment alignment;
-    RectsAlignment parentAlignment;
     LayoutRect rect;
     bool isOffscreen;
     bool isOffscreenAfterScrolling;
 };
 
-bool hasOffscreenRect(Node*, FocusDirection direction = FocusDirectionNone);
-bool scrollInDirection(Frame*, FocusDirection);
-bool scrollInDirection(Node* container, FocusDirection);
-bool canScrollInDirection(const Node* container, FocusDirection);
-bool canScrollInDirection(const Frame*, FocusDirection);
-bool canBeScrolledIntoView(FocusDirection, const FocusCandidate&);
+bool hasOffscreenRect(Node*, FocusType = FocusTypeNone);
+bool scrollInDirection(LocalFrame*, FocusType);
+bool scrollInDirection(Node* container, FocusType);
+bool canScrollInDirection(const Node* container, FocusType);
+bool canScrollInDirection(const LocalFrame*, FocusType);
+bool canBeScrolledIntoView(FocusType, const FocusCandidate&);
 bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCandidate& secondCandidate);
-void distanceDataForNode(FocusDirection, const FocusCandidate& current, FocusCandidate& candidate);
-Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusDirection, Node*);
+void distanceDataForNode(FocusType, const FocusCandidate& current, FocusCandidate&);
+Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusType, Node*);
 LayoutRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false);
-LayoutRect frameRectInAbsoluteCoordinates(Frame*);
-LayoutRect virtualRectForDirection(FocusDirection, const LayoutRect& startingRect, LayoutUnit width = 0);
-LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement*, FocusDirection);
+LayoutRect frameRectInAbsoluteCoordinates(LocalFrame*);
+LayoutRect virtualRectForDirection(FocusType, const LayoutRect& startingRect, LayoutUnit width = 0);
+LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement&, FocusType);
 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&);
 
-} // namspace WebCore
+} // namespace blink
 
 #endif // SpatialNavigation_h