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

Unified Diff: third_party/WebKit/Source/web/RotationViewportAnchor.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, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/RotationViewportAnchor.cpp
diff --git a/third_party/WebKit/Source/web/RotationViewportAnchor.cpp b/third_party/WebKit/Source/web/RotationViewportAnchor.cpp
index 8449f57ef22bbad0da6908cd81ad64ea14423531..36c7d14e18c5c86ff625c92d543b6629ce189911 100644
--- a/third_party/WebKit/Source/web/RotationViewportAnchor.cpp
+++ b/third_party/WebKit/Source/web/RotationViewportAnchor.cpp
@@ -21,12 +21,6 @@ namespace {
static const float viewportAnchorRelativeEpsilon = 0.1f;
static const int viewportToNodeMaxRelativeArea = 2;
-template <typename RectType>
-int area(const RectType& rect)
-{
- return rect.width() * rect.height();
-}
-
Node* findNonEmptyAnchorNode(const IntPoint& point, const IntRect& viewRect, EventHandler& eventHandler)
{
Node* node = eventHandler.hitTestResultAtPoint(point, HitTestRequest::ReadOnly | HitTestRequest::Active).innerNode();
@@ -34,8 +28,8 @@ Node* findNonEmptyAnchorNode(const IntPoint& point, const IntRect& viewRect, Eve
// If the node bounding box is sufficiently large, make a single attempt to
// find a smaller node; the larger the node bounds, the greater the
// variability under resize.
- const int maxNodeArea = area(viewRect) * viewportToNodeMaxRelativeArea;
- if (node && area(node->boundingBox()) > maxNodeArea) {
+ const int maxNodeArea = viewRect.width() * viewRect.height() * viewportToNodeMaxRelativeArea;
+ if (node && node->boundingBox().width() * node->boundingBox().height() > maxNodeArea) {
IntSize pointOffset = viewRect.size();
pointOffset.scale(viewportAnchorRelativeEpsilon);
node = eventHandler.hitTestResultAtPoint(point + pointOffset, HitTestRequest::ReadOnly | HitTestRequest::Active).innerNode();
« no previous file with comments | « third_party/WebKit/Source/platform/geometry/IntRect.cpp ('k') | third_party/WebKit/Source/web/WebInputEventConversion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698