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 LayoutSize viewSize = candidate.visibleNode->document().page()->deprecatedLo
calMainFrame()->view()->visibleContentRect().size(); |
694 candidate.alignment = alignmentForRects(type, currentRect, nodeRect, viewSiz
e); | 694 candidate.alignment = alignmentForRects(type, currentRect, nodeRect, viewSiz
e); |
695 } | 695 } |
696 | 696 |
697 bool canBeScrolledIntoView(FocusType type, const FocusCandidate& candidate) | 697 bool canBeScrolledIntoView(FocusType type, const FocusCandidate& candidate) |
698 { | 698 { |
699 ASSERT(candidate.visibleNode && candidate.isOffscreen); | 699 ASSERT(candidate.visibleNode && candidate.isOffscreen); |
700 LayoutRect candidateRect = candidate.rect; | 700 LayoutRect candidateRect = candidate.rect; |
701 for (Node* parentNode = candidate.visibleNode->parentNode(); parentNode; par
entNode = parentNode->parentNode()) { | 701 for (Node* parentNode = candidate.visibleNode->parentNode(); parentNode; par
entNode = parentNode->parentNode()) { |
702 LayoutRect parentRect = nodeRectInAbsoluteCoordinates(parentNode); | 702 LayoutRect parentRect = nodeRectInAbsoluteCoordinates(parentNode); |
703 if (!candidateRect.intersects(parentRect)) { | 703 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); | 748 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar
ea.document().frame(), area.computeRect(area.imageElement()->renderer())), 1); |
749 return rect; | 749 return rect; |
750 } | 750 } |
751 | 751 |
752 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) | 752 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) |
753 { | 753 { |
754 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : 0; | 754 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : 0; |
755 }; | 755 }; |
756 | 756 |
757 } // namespace WebCore | 757 } // namespace WebCore |
OLD | NEW |