Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Unified Diff: Source/core/page/SpatialNavigation.cpp

Issue 1010203002: Avoid computing navigation data for nodes in the wrong navigation direction (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698