Index: Source/core/page/SpatialNavigation.cpp |
diff --git a/Source/core/page/SpatialNavigation.cpp b/Source/core/page/SpatialNavigation.cpp |
index 952bfd7e0bf67e00b45727706b915133692fd314..a6c4e683dff7add241cd59c6dd673068a58e51f6 100644 |
--- a/Source/core/page/SpatialNavigation.cpp |
+++ b/Source/core/page/SpatialNavigation.cpp |
@@ -505,6 +505,9 @@ bool areElementsOnSameLine(const FocusCandidate& firstCandidate, const FocusCand |
void distanceDataForNode(WebFocusType type, const FocusCandidate& current, FocusCandidate& candidate) |
{ |
+ if (!isRectInDirection(type, current.rect, candidate.rect)) |
+ return; |
+ |
if (areElementsOnSameLine(current, candidate)) { |
if ((type == WebFocusTypeUp && current.rect.y() > candidate.rect.y()) || (type == WebFocusTypeDown && candidate.rect.y() > current.rect.y())) { |
candidate.distance = 0; |
@@ -516,9 +519,6 @@ void distanceDataForNode(WebFocusType type, const FocusCandidate& current, Focus |
LayoutRect currentRect = current.rect; |
deflateIfOverlapped(currentRect, nodeRect); |
- if (!isRectInDirection(type, currentRect, nodeRect)) |
- return; |
- |
LayoutPoint exitPoint; |
LayoutPoint entryPoint; |
entryAndExitPointsForDirection(type, currentRect, nodeRect, exitPoint, entryPoint); |