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

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

Issue 200023002: Making LayoutUnit conversions to Float type explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase to trunk Created 6 years, 9 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
« no previous file with comments | « Source/core/html/ImageDocument.cpp ('k') | Source/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 break; 655 break;
656 case FocusTypeDown: 656 case FocusTypeDown:
657 sameAxisDistance = entryPoint.y() - exitPoint.y(); 657 sameAxisDistance = entryPoint.y() - exitPoint.y();
658 otherAxisDistance = absoluteValue(entryPoint.x() - exitPoint.x()); 658 otherAxisDistance = absoluteValue(entryPoint.x() - exitPoint.x());
659 break; 659 break;
660 default: 660 default:
661 ASSERT_NOT_REACHED(); 661 ASSERT_NOT_REACHED();
662 return; 662 return;
663 } 663 }
664 664
665 float x = (entryPoint.x() - exitPoint.x()) * (entryPoint.x() - exitPoint.x() ); 665 float x = ((entryPoint.x() - exitPoint.x()) * (entryPoint.x() - exitPoint.x( ))).toFloat();
666 float y = (entryPoint.y() - exitPoint.y()) * (entryPoint.y() - exitPoint.y() ); 666 float y = ((entryPoint.y() - exitPoint.y()) * (entryPoint.y() - exitPoint.y( ))).toFloat();
667 667
668 float euclidianDistance = sqrt(x + y); 668 float euclidianDistance = sqrt(x + y);
669 669
670 // Loosely based on http://www.w3.org/TR/WICD/#focus-handling 670 // Loosely based on http://www.w3.org/TR/WICD/#focus-handling
671 // df = dotDist + dx + dy + 2 * (xdisplacement + ydisplacement) - sqrt(Overl ap) 671 // df = dotDist + dx + dy + 2 * (xdisplacement + ydisplacement) - sqrt(Overl ap)
672 672
673 float distance = euclidianDistance + sameAxisDistance + 2 * otherAxisDistanc e; 673 float distance = euclidianDistance + sameAxisDistance + 2 * otherAxisDistanc e;
674 candidate.distance = roundf(distance); 674 candidate.distance = roundf(distance);
675 LayoutSize viewSize = candidate.visibleNode->document().page()->mainFrame()- >view()->visibleContentRect().size(); 675 LayoutSize viewSize = candidate.visibleNode->document().page()->mainFrame()- >view()->visibleContentRect().size();
676 candidate.alignment = alignmentForRects(type, currentRect, nodeRect, viewSiz e); 676 candidate.alignment = alignmentForRects(type, currentRect, nodeRect, viewSiz e);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar ea.document().frame(), area.computeRect(area.imageElement()->renderer())), 1); 730 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar ea.document().frame(), area.computeRect(area.imageElement()->renderer())), 1);
731 return rect; 731 return rect;
732 } 732 }
733 733
734 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) 734 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate)
735 { 735 {
736 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v isibleNode) : 0; 736 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v isibleNode) : 0;
737 }; 737 };
738 738
739 } // namespace WebCore 739 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/ImageDocument.cpp ('k') | Source/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698