| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 { | 313 { |
| 314 ASSERT(container); | 314 ASSERT(container); |
| 315 if (container->isDocumentNode()) | 315 if (container->isDocumentNode()) |
| 316 return canScrollInDirection(toDocument(container)->frame(), type); | 316 return canScrollInDirection(toDocument(container)->frame(), type); |
| 317 | 317 |
| 318 if (!isScrollableNode(container)) | 318 if (!isScrollableNode(container)) |
| 319 return false; | 319 return false; |
| 320 | 320 |
| 321 switch (type) { | 321 switch (type) { |
| 322 case WebFocusTypeLeft: | 322 case WebFocusTypeLeft: |
| 323 return (container->layoutObject()->style()->overflowX() != OHIDDEN && co
ntainer->layoutBox()->scrollLeft() > 0); | 323 return (container->layoutObject()->style()->overflowX() != OverflowHidde
n && container->layoutBox()->scrollLeft() > 0); |
| 324 case WebFocusTypeUp: | 324 case WebFocusTypeUp: |
| 325 return (container->layoutObject()->style()->overflowY() != OHIDDEN && co
ntainer->layoutBox()->scrollTop() > 0); | 325 return (container->layoutObject()->style()->overflowY() != OverflowHidde
n && container->layoutBox()->scrollTop() > 0); |
| 326 case WebFocusTypeRight: | 326 case WebFocusTypeRight: |
| 327 return (container->layoutObject()->style()->overflowX() != OHIDDEN && co
ntainer->layoutBox()->scrollLeft() + container->layoutBox()->clientWidth() < con
tainer->layoutBox()->scrollWidth()); | 327 return (container->layoutObject()->style()->overflowX() != OverflowHidde
n && container->layoutBox()->scrollLeft() + container->layoutBox()->clientWidth(
) < container->layoutBox()->scrollWidth()); |
| 328 case WebFocusTypeDown: | 328 case WebFocusTypeDown: |
| 329 return (container->layoutObject()->style()->overflowY() != OHIDDEN && co
ntainer->layoutBox()->scrollTop() + container->layoutBox()->clientHeight() < con
tainer->layoutBox()->scrollHeight()); | 329 return (container->layoutObject()->style()->overflowY() != OverflowHidde
n && container->layoutBox()->scrollTop() + container->layoutBox()->clientHeight(
) < container->layoutBox()->scrollHeight()); |
| 330 default: | 330 default: |
| 331 ASSERT_NOT_REACHED(); | 331 ASSERT_NOT_REACHED(); |
| 332 return false; | 332 return false; |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 bool canScrollInDirection(const LocalFrame* frame, WebFocusType type) | 336 bool canScrollInDirection(const LocalFrame* frame, WebFocusType type) |
| 337 { | 337 { |
| 338 if (!frame->view()) | 338 if (!frame->view()) |
| 339 return false; | 339 return false; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 candidate.distance = sqrt(euclidianDistancePow2) + navigationAxisDistance +
weightedOrthogonalAxisDistance - sqrt(overlap); | 577 candidate.distance = sqrt(euclidianDistancePow2) + navigationAxisDistance +
weightedOrthogonalAxisDistance - sqrt(overlap); |
| 578 } | 578 } |
| 579 | 579 |
| 580 bool canBeScrolledIntoView(WebFocusType type, const FocusCandidate& candidate) | 580 bool canBeScrolledIntoView(WebFocusType type, const FocusCandidate& candidate) |
| 581 { | 581 { |
| 582 ASSERT(candidate.visibleNode && candidate.isOffscreen); | 582 ASSERT(candidate.visibleNode && candidate.isOffscreen); |
| 583 LayoutRect candidateRect = candidate.rect; | 583 LayoutRect candidateRect = candidate.rect; |
| 584 for (Node* parentNode = candidate.visibleNode->parentNode(); parentNode; par
entNode = parentNode->parentNode()) { | 584 for (Node* parentNode = candidate.visibleNode->parentNode(); parentNode; par
entNode = parentNode->parentNode()) { |
| 585 LayoutRect parentRect = nodeRectInAbsoluteCoordinates(parentNode); | 585 LayoutRect parentRect = nodeRectInAbsoluteCoordinates(parentNode); |
| 586 if (!candidateRect.intersects(parentRect)) { | 586 if (!candidateRect.intersects(parentRect)) { |
| 587 if (((type == WebFocusTypeLeft || type == WebFocusTypeRight) && pare
ntNode->layoutObject()->style()->overflowX() == OHIDDEN) | 587 if (((type == WebFocusTypeLeft || type == WebFocusTypeRight) && pare
ntNode->layoutObject()->style()->overflowX() == OverflowHidden) |
| 588 || ((type == WebFocusTypeUp || type == WebFocusTypeDown) && pare
ntNode->layoutObject()->style()->overflowY() == OHIDDEN)) | 588 || ((type == WebFocusTypeUp || type == WebFocusTypeDown) && pare
ntNode->layoutObject()->style()->overflowY() == OverflowHidden)) |
| 589 return false; | 589 return false; |
| 590 } | 590 } |
| 591 if (parentNode == candidate.enclosingScrollableBox) | 591 if (parentNode == candidate.enclosingScrollableBox) |
| 592 return canScrollInDirection(parentNode, type); | 592 return canScrollInDirection(parentNode, type); |
| 593 } | 593 } |
| 594 return true; | 594 return true; |
| 595 } | 595 } |
| 596 | 596 |
| 597 // The starting rect is the rect of the focused node, in document coordinates. | 597 // The starting rect is the rect of the focused node, in document coordinates. |
| 598 // Compose a virtual starting rect if there is no focused node or if it is off s
creen. | 598 // Compose a virtual starting rect if there is no focused node or if it is off s
creen. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar
ea.document().frame(), area.computeRect(area.imageElement()->layoutObject())), L
ayoutUnit(1)); | 631 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar
ea.document().frame(), area.computeRect(area.imageElement()->layoutObject())), L
ayoutUnit(1)); |
| 632 return rect; | 632 return rect; |
| 633 } | 633 } |
| 634 | 634 |
| 635 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) | 635 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) |
| 636 { | 636 { |
| 637 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : nullptr; | 637 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : nullptr; |
| 638 }; | 638 }; |
| 639 | 639 |
| 640 } // namespace blink | 640 } // namespace blink |
| OLD | NEW |