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) |