Source/WebCore/ChangeLog

 12013-08-04 Abhijeet Kandalkar <abhijeet.k@samsung.com>
 2
 3 Spatial Navigation should prefer focusable elements with absolute positioning over other elements if both elements visible area completely intersects each other.
 4 https://bugs.webkit.org/show_bug.cgi?id=119468
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 If two or more focusable nodes are completely intersecting each other so that only one of them is visible to user then preference should be given the node on top.
 9 In case of partial intersection among the nodes, user should able to select every node visible to him.
 10
 11 Modified the existing testcase.
 12
 13 * page/FocusController.cpp:
 14 (WebCore::updateFocusCandidateIfNeeded):
 15 * page/SpatialNavigation.cpp:
 16 (WebCore::isRectInDirection):
 17
1182013-08-04 Andreas Kling <akling@apple.com>
219
320 [Mac] Disable screen font substitution at WebCore-level in OS X 10.9+
153696

Source/WebCore/page/FocusController.cpp

733733
734734 LayoutRect intersectionRect = intersection(candidate.rect, closest.rect);
735735 if (!intersectionRect.isEmpty() && !areElementsOnSameLine(closest, candidate)) {
736  // If 2 nodes are intersecting, do hit test to find which node in on top.
737  LayoutUnit x = intersectionRect.x() + intersectionRect.width() / 2;
738  LayoutUnit y = intersectionRect.y() + intersectionRect.height() / 2;
739  HitTestResult result = candidate.visibleNode->document()->page()->mainFrame()->eventHandler()->hitTestResultAtPoint(IntPoint(x, y), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
740  if (candidate.visibleNode->contains(result.innerNode())) {
741  closest = candidate;
742  return;
 736
 737 if (candidate.rect.contains(closest.rect) || closest.rect.contains(candidate.rect)) {
 738 // If 2 nodes are intersecting completelly, do hit test to find which node in on top.
 739 LayoutUnit x = intersectionRect.x() + intersectionRect.width() / 2;
 740 LayoutUnit y = intersectionRect.y() + intersectionRect.height() / 2;
 741 HitTestResult result = candidate.visibleNode->document()->page()->mainFrame()->eventHandler()->hitTestResultAtPoint(IntPoint(x, y), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
 742 if (candidate.visibleNode->contains(result.innerNode())) {
 743 closest = candidate;
 744 return;
 745 }
 746
 747 if (closest.visibleNode->contains(result.innerNode()))
 748 return;
 749
743750 }
744  if (closest.visibleNode->contains(result.innerNode()))
745  return;
746751 }
747752
748753 if (candidate.alignment == closest.alignment) {
153696

Source/WebCore/page/SpatialNavigation.cpp

269269
270270static bool isRectInDirection(FocusDirection direction, const LayoutRect& curRect, const LayoutRect& targetRect)
271271{
 272 bool pariallyIntersects = (curRect.intersects(targetRect) && !curRect.contains(targetRect) && !targetRect.contains(curRect));
272273 switch (direction) {
273274 case FocusDirectionLeft:
274  return targetRect.maxX() <= curRect.x();
 275 return pariallyIntersects ? (targetRect.x() < curRect.x()): (targetRect.maxX() <= curRect.x());
275276 case FocusDirectionRight:
276  return targetRect.x() >= curRect.maxX();
 277 return pariallyIntersects ? (targetRect.x() > curRect.x()) : (targetRect.x() >= curRect.maxX());
277278 case FocusDirectionUp:
278  return targetRect.maxY() <= curRect.y();
 279 return pariallyIntersects ? (targetRect.y() < curRect.y()) : (targetRect.maxY() <= curRect.y());
279280 case FocusDirectionDown:
280  return targetRect.y() >= curRect.maxY();
 281 return pariallyIntersects ? (targetRect.y() > curRect.y()) : (targetRect.y() >= curRect.maxY());
281282 default:
282283 ASSERT_NOT_REACHED();
283284 return false;
153696

LayoutTests/fast/spatial-navigation/snav-z-index-expected.txt

1212
1313
1414
 15PASS gFocusedDocument.activeElement.getAttribute("id") is "s22"
1516PASS gFocusedDocument.activeElement.getAttribute("id") is "p11"
 17PASS gFocusedDocument.activeElement.getAttribute("id") is "s23"
1618PASS gFocusedDocument.activeElement.getAttribute("id") is "p12"
 19PASS gFocusedDocument.activeElement.getAttribute("id") is "s24"
1720PASS gFocusedDocument.activeElement.getAttribute("id") is "s25"
18 PASS gFocusedDocument.activeElement.getAttribute("id") is "p12"
 21PASS gFocusedDocument.activeElement.getAttribute("id") is "s24"
 22PASS gFocusedDocument.activeElement.getAttribute("id") is "s14"
1923PASS gFocusedDocument.activeElement.getAttribute("id") is "s13"
20 PASS gFocusedDocument.activeElement.getAttribute("id") is "s12"
 24PASS gFocusedDocument.activeElement.getAttribute("id") is "s23"
2125PASS gFocusedDocument.activeElement.getAttribute("id") is "p11"
2226PASS gFocusedDocument.activeElement.getAttribute("id") is "p21"
 27PASS gFocusedDocument.activeElement.getAttribute("id") is "p22"
 28PASS gFocusedDocument.activeElement.getAttribute("id") is "p12"
 29PASS gFocusedDocument.activeElement.getAttribute("id") is "s23"
 30PASS gFocusedDocument.activeElement.getAttribute("id") is "p11"
 31PASS gFocusedDocument.activeElement.getAttribute("id") is "s22"
2332PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
24 This test is testing that we prefer focusable elements with absolute positioning over other elements.
 33Spatial Navigation should prefer focusable elements with absolute positioning over other elements if both elements visible area completely intersects each other.
153696

LayoutTests/fast/spatial-navigation/snav-z-index.html

55 <script type="application/javascript">
66
77 var resultMap = [
 8 ["Down", "s22"],
89 ["Down", "p11"],
 10 ["Down", "s23"],
911 ["Down", "p12"],
 12 ["Down", "s24"],
1013 ["Down", "s25"],
11  ["Up", "p12"],
12  ["Left", "s13"],
13  ["Up", "s12"],
 14 ["Up", "s24"],
 15 ["Left", "s14"],
 16 ["Up", "s13"],
 17 ["Right", "s23"],
1418 ["Right", "p11"],
1519 ["Right", "p21"],
 20 ["Down", "p22"],
 21 ["Left", "p12"],
 22 ["Left", "s23"],
 23 ["Up", "p11"],
 24 ["Up", "s22"],
1625 ["Up", "start"],
1726 ["DONE", "DONE"]
1827 ];

4756 div.positioned { border: 3px solid blue;}
4857 div.positioned:focus{ border: 3px solid gray;}
4958 #popup {position: absolute; top:120; left:240; border: 8px solid black; z-index:1000}
 59 div.hidden {display: block; height : 50px; width : 50px; border-style:solid; border-width:1px; border-color:#ff0000; background-color:#00ff00;}
5060 </style>
5161 </head>
5262<body id="some-content" xmlns="http://www.w3.org/1999/xhtml" style="padding:20px">

6070</td></tr></table>
6171</div>
6272
 73<div tabindex="1" id="h11" style="position:absolute;top:140px;left:295px" class="hidden"><img src="resources/green.png" width="50px" height="50px"></div>
 74
6375<table>
6476<tr><td>
6577<div tabindex="1" id="s11" class="simple"><img src="resources/green.png" width=160px height=60px></div>

7587<div tabindex="5" id="s25" class="simple"><img src="resources/green.png" width=160px height=60px></div>
7688</td></tr></table>
7789<div id="console"></div>
78 This test is testing that we prefer focusable elements with absolute positioning over other elements.
 90Spatial Navigation should prefer focusable elements with absolute positioning over other elements if both elements visible area completely intersects each other.
7991</body>
8092</html>
153696

LayoutTests/ChangeLog

 12013-08-04 Abhijeet Kandalkar <abhijeet.k@samsung.com>
 2
 3 Spatial Navigation should prefer focusable elements with absolute positioning over other elements if both elements visible area completely intersects each other.
 4 https://bugs.webkit.org/show_bug.cgi?id=119468
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 If two or more focusable nodes are completely intersecting each other so that only one of them is visible to user then preference should be given the node on top.
 9 In case of partial intersection among the nodes, user should able to select every node visible to him.
 10 Modified the existing layout-test to test above mentioned behavior.
 11
 12 * fast/spatial-navigation/snav-z-index-expected.txt:
 13 * fast/spatial-navigation/snav-z-index.html:
 14
1152013-08-03 Simon Fraser <simon.fraser@apple.com>
216
317 webaudio/audiobuffersource-loop-points.html always times out
153696