Changeset 57304 in webkit
- Timestamp:
- Apr 8, 2010 4:24:26 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r57303 r57304 1 2010-03-29 Antonio Gomes <tonikitoo@webkit.org> 2 3 Reviewed by Simon Fraser. 4 5 Spatial Navigation: proper handle negative x or y coordinates 6 https://bugs.webkit.org/show_bug.cgi?id=36773 7 8 * fast/events/spatial-navigation/snav-offscreen-content-expected.txt: Added. 9 * fast/events/spatial-navigation/snav-offscreen-content.html: Added. 10 1 11 2010-04-08 Csaba Osztrogonác <ossy@webkit.org> 2 12 -
trunk/WebCore/ChangeLog
r57301 r57304 1 2010-03-29 Antonio Gomes <tonikitoo@webkit.org> 2 3 Reviewed by Simon Fraser. 4 5 Spatial Navigation: proper handle negative x or y coordinates 6 https://bugs.webkit.org/show_bug.cgi?id=36773 7 8 In Spatial Navigation logic, during rect acquisition in renderRectRelativeToRootDocument, 9 sometimes negative x() or y() values are got, and the current algorithm bails out in 10 any of such cases. 11 12 However, when a node is in a scrollable content (content overflow <div>) and 13 this scrollable container scrolled up, element gets offscreen, and gets negative values 14 for y(), for example. In such cases, they are still valid to be used in Spatial Navigation 15 logic. 16 17 Test: fast/events/spatial-navigation/snav-offscreen-content.html 18 19 * page/SpatialNavigation.cpp: 20 (WebCore::distanceDataForNode): 21 (WebCore::checkNegativeCoordsForNode): 22 1 23 2010-04-08 Dumitru Daniliuc <dumi@chromium.org> 2 24 -
trunk/WebCore/page/SpatialNavigation.cpp
r57061 r57304 47 47 static bool isRectInDirection(FocusDirection, const IntRect&, const IntRect&); 48 48 static void deflateIfOverlapped(IntRect&, IntRect&); 49 static bool checkNegativeCoordsForNode(Node*, const IntRect&); 49 50 50 51 void distanceDataForNode(FocusDirection direction, Node* start, FocusCandidate& candidate) … … 69 70 deflateIfOverlapped(curRect, targetRect); 70 71 72 // If empty rects or negative width or height, bail out. 71 73 if (curRect.isEmpty() || targetRect.isEmpty() 72 || targetRect.x() < 0 || targetRect.y() < 0) { 74 || targetRect.width() <= 0 || targetRect.height() <= 0) { 75 candidate.distance = maxDistance(); 76 return; 77 } 78 79 // Negative coordinates can be used if node is scrolled up offscreen. 80 if (!checkNegativeCoordsForNode(start, curRect)) { 81 candidate.distance = maxDistance(); 82 return; 83 } 84 85 if (!checkNegativeCoordsForNode(candidate.node, targetRect)) { 73 86 candidate.distance = maxDistance(); 74 87 return; … … 487 500 } 488 501 502 static bool checkNegativeCoordsForNode(Node* node, const IntRect& curRect) 503 { 504 ASSERT(node || node->renderer()); 505 506 if (curRect.x() > 0 && curRect.y() > 0) 507 return true; 508 509 bool canBeScrolled = false; 510 511 RenderObject* renderer = node->renderer(); 512 for (; renderer; renderer = renderer->parent()) { 513 if (renderer->isBox() && toRenderBox(renderer)->canBeScrolledAndHasScrollableArea()) { 514 canBeScrolled = true; 515 break; 516 } 517 } 518 519 return canBeScrolled; 520 } 521 489 522 } // namespace WebCore
Note: See TracChangeset
for help on using the changeset viewer.