Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Side by Side Diff: Source/core/page/SpatialNavigation.cpp

Issue 336553003: Change Page::m_mainFrame to be a Frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/page/ScopedPageLoadDeferrer.cpp ('k') | Source/core/page/scrolling/ScrollingCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698