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

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

Issue 797463003: spatnav: Allow focus move to a close-by not-fully-aligned node over a distant but fully-aligned nod… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 | « Source/core/page/SpatialNavigation.h ('k') | 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 e9ea56911a233c090ba660d29a03419265d2e80c..852b27ebbbc203a7ffa0c4184d8c48eda1aa370a 100644
--- a/Source/core/page/SpatialNavigation.cpp
+++ b/Source/core/page/SpatialNavigation.cpp
@@ -59,7 +59,6 @@ FocusCandidate::FocusCandidate(Node* node, FocusType type)
, focusableNode(nullptr)
, enclosingScrollableBox(nullptr)
, distance(maxDistance())
- , alignment(None)
, isOffscreen(true)
, isOffscreenAfterScrolling(true)
{
@@ -644,7 +643,6 @@ void distanceDataForNode(FocusType type, const FocusCandidate& current, FocusCan
if (areElementsOnSameLine(current, candidate)) {
if ((type == FocusTypeUp && current.rect.y() > candidate.rect.y()) || (type == FocusTypeDown && candidate.rect.y() > current.rect.y())) {
candidate.distance = 0;
- candidate.alignment = Full;
return;
}
}
@@ -690,7 +688,18 @@ void distanceDataForNode(FocusType type, const FocusCandidate& current, FocusCan
candidate.distance = sqrt(euclidianDistancePow2) + navigationAxisDistance+ orthogonalAxisDistance * 2 - sqrt(overlap);
LayoutSize viewSize = LayoutSize(candidate.visibleNode->document().page()->deprecatedLocalMainFrame()->view()->visibleContentRect().size());
- candidate.alignment = alignmentForRects(type, currentRect, nodeRect, viewSize);
+ RectsAlignment alignment = alignmentForRects(type, currentRect, nodeRect, viewSize);
fs 2014/12/15 11:36:09 Should the weights be applied to (one of) the comp
c.shu 2014/12/15 18:17:37 The distance calculation at L688 is based on the s
fs 2014/12/16 13:15:42 The link at L687 does not lead to a spec - it lead
+ if (alignment == None) {
+ if (type == FocusTypeLeft || type == FocusTypeRight)
+ candidate.distance *= 4;
+ else
+ candidate.distance *= 1.5;
+ } else if (alignment == Partial) {
+ if (type == FocusTypeLeft || type == FocusTypeRight)
+ candidate.distance *= 2;
+ else
+ candidate.distance *= 1.2;
+ }
}
bool canBeScrolledIntoView(FocusType type, const FocusCandidate& candidate)
« no previous file with comments | « Source/core/page/SpatialNavigation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698