| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) |
| 3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org> | 3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org> |
| 4 * | 4 * |
| 5 * All rights reserved. | 5 * All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 ASSERT(container); | 323 ASSERT(container); |
| 324 if (container->isDocumentNode()) | 324 if (container->isDocumentNode()) |
| 325 return canScrollInDirection(toDocument(container)->frame(), type); | 325 return canScrollInDirection(toDocument(container)->frame(), type); |
| 326 | 326 |
| 327 if (!isScrollableNode(container)) | 327 if (!isScrollableNode(container)) |
| 328 return false; | 328 return false; |
| 329 | 329 |
| 330 switch (type) { | 330 switch (type) { |
| 331 case WebFocusTypeLeft: | 331 case WebFocusTypeLeft: |
| 332 return (container->layoutObject()->style()->overflowX() != | 332 return (container->layoutObject()->style()->overflowX() != |
| 333 OverflowHidden && | 333 EOverflow::Hidden && |
| 334 container->layoutBox()->scrollLeft() > 0); | 334 container->layoutBox()->scrollLeft() > 0); |
| 335 case WebFocusTypeUp: | 335 case WebFocusTypeUp: |
| 336 return (container->layoutObject()->style()->overflowY() != | 336 return (container->layoutObject()->style()->overflowY() != |
| 337 OverflowHidden && | 337 EOverflow::Hidden && |
| 338 container->layoutBox()->scrollTop() > 0); | 338 container->layoutBox()->scrollTop() > 0); |
| 339 case WebFocusTypeRight: | 339 case WebFocusTypeRight: |
| 340 return (container->layoutObject()->style()->overflowX() != | 340 return (container->layoutObject()->style()->overflowX() != |
| 341 OverflowHidden && | 341 EOverflow::Hidden && |
| 342 container->layoutBox()->scrollLeft() + | 342 container->layoutBox()->scrollLeft() + |
| 343 container->layoutBox()->clientWidth() < | 343 container->layoutBox()->clientWidth() < |
| 344 container->layoutBox()->scrollWidth()); | 344 container->layoutBox()->scrollWidth()); |
| 345 case WebFocusTypeDown: | 345 case WebFocusTypeDown: |
| 346 return (container->layoutObject()->style()->overflowY() != | 346 return (container->layoutObject()->style()->overflowY() != |
| 347 OverflowHidden && | 347 EOverflow::Hidden && |
| 348 container->layoutBox()->scrollTop() + | 348 container->layoutBox()->scrollTop() + |
| 349 container->layoutBox()->clientHeight() < | 349 container->layoutBox()->clientHeight() < |
| 350 container->layoutBox()->scrollHeight()); | 350 container->layoutBox()->scrollHeight()); |
| 351 default: | 351 default: |
| 352 ASSERT_NOT_REACHED(); | 352 ASSERT_NOT_REACHED(); |
| 353 return false; | 353 return false; |
| 354 } | 354 } |
| 355 } | 355 } |
| 356 | 356 |
| 357 bool canScrollInDirection(const LocalFrame* frame, WebFocusType type) { | 357 bool canScrollInDirection(const LocalFrame* frame, WebFocusType type) { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 weightedOrthogonalAxisDistance - sqrt(overlap); | 619 weightedOrthogonalAxisDistance - sqrt(overlap); |
| 620 } | 620 } |
| 621 | 621 |
| 622 bool canBeScrolledIntoView(WebFocusType type, const FocusCandidate& candidate) { | 622 bool canBeScrolledIntoView(WebFocusType type, const FocusCandidate& candidate) { |
| 623 ASSERT(candidate.visibleNode && candidate.isOffscreen); | 623 ASSERT(candidate.visibleNode && candidate.isOffscreen); |
| 624 LayoutRect candidateRect = candidate.rect; | 624 LayoutRect candidateRect = candidate.rect; |
| 625 for (Node& parentNode : NodeTraversal::ancestorsOf(*candidate.visibleNode)) { | 625 for (Node& parentNode : NodeTraversal::ancestorsOf(*candidate.visibleNode)) { |
| 626 LayoutRect parentRect = nodeRectInAbsoluteCoordinates(&parentNode); | 626 LayoutRect parentRect = nodeRectInAbsoluteCoordinates(&parentNode); |
| 627 if (!candidateRect.intersects(parentRect)) { | 627 if (!candidateRect.intersects(parentRect)) { |
| 628 if (((type == WebFocusTypeLeft || type == WebFocusTypeRight) && | 628 if (((type == WebFocusTypeLeft || type == WebFocusTypeRight) && |
| 629 parentNode.layoutObject()->style()->overflowX() == OverflowHidden) || | 629 parentNode.layoutObject()->style()->overflowX() == |
| 630 EOverflow::Hidden) || |
| 630 ((type == WebFocusTypeUp || type == WebFocusTypeDown) && | 631 ((type == WebFocusTypeUp || type == WebFocusTypeDown) && |
| 631 parentNode.layoutObject()->style()->overflowY() == OverflowHidden)) | 632 parentNode.layoutObject()->style()->overflowY() == |
| 633 EOverflow::Hidden)) |
| 632 return false; | 634 return false; |
| 633 } | 635 } |
| 634 if (parentNode == candidate.enclosingScrollableBox) | 636 if (parentNode == candidate.enclosingScrollableBox) |
| 635 return canScrollInDirection(&parentNode, type); | 637 return canScrollInDirection(&parentNode, type); |
| 636 } | 638 } |
| 637 return true; | 639 return true; |
| 638 } | 640 } |
| 639 | 641 |
| 640 // The starting rect is the rect of the focused node, in document coordinates. | 642 // The starting rect is the rect of the focused node, in document coordinates. |
| 641 // Compose a virtual starting rect if there is no focused node or if it is off | 643 // Compose a virtual starting rect if there is no focused node or if it is off |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 return rect; | 683 return rect; |
| 682 } | 684 } |
| 683 | 685 |
| 684 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) { | 686 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) { |
| 685 return candidate.isFrameOwnerElement() | 687 return candidate.isFrameOwnerElement() |
| 686 ? toHTMLFrameOwnerElement(candidate.visibleNode) | 688 ? toHTMLFrameOwnerElement(candidate.visibleNode) |
| 687 : nullptr; | 689 : nullptr; |
| 688 }; | 690 }; |
| 689 | 691 |
| 690 } // namespace blink | 692 } // namespace blink |
| OLD | NEW |