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

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

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 3 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
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // tests and experiments. 548 // tests and experiments.
549 const int orthogonalWeightForLeftRight = 30; 549 const int orthogonalWeightForLeftRight = 30;
550 const int orthogonalWeightForUpDown = 2; 550 const int orthogonalWeightForUpDown = 2;
551 int orthogonalBias = 0; 551 int orthogonalBias = 0;
552 552
553 switch (type) { 553 switch (type) {
554 case WebFocusTypeLeft: 554 case WebFocusTypeLeft:
555 case WebFocusTypeRight: 555 case WebFocusTypeRight:
556 navigationAxisDistance = xAxis; 556 navigationAxisDistance = xAxis;
557 if (!rectsIntersectOnOrthogonalAxis(type, currentRect, nodeRect)) 557 if (!rectsIntersectOnOrthogonalAxis(type, currentRect, nodeRect))
558 orthogonalBias = currentRect.height() / 2; 558 orthogonalBias = (currentRect.height() / 2).toInt();
559 weightedOrthogonalAxisDistance = (yAxis + orthogonalBias) * orthogonalWe ightForLeftRight; 559 weightedOrthogonalAxisDistance = (yAxis + orthogonalBias) * orthogonalWe ightForLeftRight;
560 break; 560 break;
561 case WebFocusTypeUp: 561 case WebFocusTypeUp:
562 case WebFocusTypeDown: 562 case WebFocusTypeDown:
563 navigationAxisDistance = yAxis; 563 navigationAxisDistance = yAxis;
564 if (!rectsIntersectOnOrthogonalAxis(type, currentRect, nodeRect)) 564 if (!rectsIntersectOnOrthogonalAxis(type, currentRect, nodeRect))
565 orthogonalBias = currentRect.width() / 2; 565 orthogonalBias = (currentRect.width() / 2).toInt();
566 weightedOrthogonalAxisDistance = (xAxis + orthogonalBias) * orthogonalWe ightForUpDown; 566 weightedOrthogonalAxisDistance = (xAxis + orthogonalBias) * orthogonalWe ightForUpDown;
567 break; 567 break;
568 default: 568 default:
569 ASSERT_NOT_REACHED(); 569 ASSERT_NOT_REACHED();
570 return; 570 return;
571 } 571 }
572 572
573 double euclidianDistancePow2 = (xAxis * xAxis + yAxis * yAxis).toDouble(); 573 double euclidianDistancePow2 = (xAxis * xAxis + yAxis * yAxis).toDouble();
574 LayoutRect intersectionRect = intersection(currentRect, nodeRect); 574 LayoutRect intersectionRect = intersection(currentRect, nodeRect);
575 double overlap = (intersectionRect.width() * intersectionRect.height()).toDo uble(); 575 double overlap = (intersectionRect.width() * intersectionRect.height()).toDo uble();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar ea.document().frame(), area.computeAbsoluteRect(area.imageElement()->layoutObjec t())), LayoutUnit(1)); 632 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar ea.document().frame(), area.computeAbsoluteRect(area.imageElement()->layoutObjec t())), LayoutUnit(1));
633 return rect; 633 return rect;
634 } 634 }
635 635
636 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) 636 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate)
637 { 637 {
638 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v isibleNode) : nullptr; 638 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v isibleNode) : nullptr;
639 }; 639 };
640 640
641 } // namespace blink 641 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698