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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 return; | 683 return; |
684 } | 684 } |
685 | 685 |
686 double euclidianDistancePow2 = (xAxis * xAxis + yAxis * yAxis).toDouble(); | 686 double euclidianDistancePow2 = (xAxis * xAxis + yAxis * yAxis).toDouble(); |
687 LayoutRect intersectionRect = intersection(currentRect, nodeRect); | 687 LayoutRect intersectionRect = intersection(currentRect, nodeRect); |
688 double overlap = (intersectionRect.width() * intersectionRect.height()).toDo
uble(); | 688 double overlap = (intersectionRect.width() * intersectionRect.height()).toDo
uble(); |
689 | 689 |
690 // Distance calculation is based on http://www.w3.org/TR/WICD/#focus-handlin
g | 690 // Distance calculation is based on http://www.w3.org/TR/WICD/#focus-handlin
g |
691 candidate.distance = sqrt(euclidianDistancePow2) + navigationAxisDistance+ o
rthogonalAxisDistance * 2 - sqrt(overlap); | 691 candidate.distance = sqrt(euclidianDistancePow2) + navigationAxisDistance+ o
rthogonalAxisDistance * 2 - sqrt(overlap); |
692 | 692 |
693 LayoutSize viewSize = candidate.visibleNode->document().page()->mainFrame()-
>view()->visibleContentRect().size(); | 693 // FIXME: Doesn't work with OOPI. |
| 694 LayoutSize viewSize = toLocalFrame(candidate.visibleNode->document().page()-
>mainFrame())->view()->visibleContentRect().size(); |
694 candidate.alignment = alignmentForRects(type, currentRect, nodeRect, viewSiz
e); | 695 candidate.alignment = alignmentForRects(type, currentRect, nodeRect, viewSiz
e); |
695 } | 696 } |
696 | 697 |
697 bool canBeScrolledIntoView(FocusType type, const FocusCandidate& candidate) | 698 bool canBeScrolledIntoView(FocusType type, const FocusCandidate& candidate) |
698 { | 699 { |
699 ASSERT(candidate.visibleNode && candidate.isOffscreen); | 700 ASSERT(candidate.visibleNode && candidate.isOffscreen); |
700 LayoutRect candidateRect = candidate.rect; | 701 LayoutRect candidateRect = candidate.rect; |
701 for (Node* parentNode = candidate.visibleNode->parentNode(); parentNode; par
entNode = parentNode->parentNode()) { | 702 for (Node* parentNode = candidate.visibleNode->parentNode(); parentNode; par
entNode = parentNode->parentNode()) { |
702 LayoutRect parentRect = nodeRectInAbsoluteCoordinates(parentNode); | 703 LayoutRect parentRect = nodeRectInAbsoluteCoordinates(parentNode); |
703 if (!candidateRect.intersects(parentRect)) { | 704 if (!candidateRect.intersects(parentRect)) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar
ea.document().frame(), area.computeRect(area.imageElement()->renderer())), 1); | 749 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar
ea.document().frame(), area.computeRect(area.imageElement()->renderer())), 1); |
749 return rect; | 750 return rect; |
750 } | 751 } |
751 | 752 |
752 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) | 753 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) |
753 { | 754 { |
754 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : 0; | 755 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : 0; |
755 }; | 756 }; |
756 | 757 |
757 } // namespace WebCore | 758 } // namespace WebCore |
OLD | NEW |