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

Side by Side Diff: third_party/WebKit/Source/core/testing/Internals.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 LayoutBoxModelObject* current = searchRoot->layoutObject(); 1310 LayoutBoxModelObject* current = searchRoot->layoutObject();
1311 LayoutBoxModelObject* parent = searchRoot->parent()->layoutObjec t(); 1311 LayoutBoxModelObject* parent = searchRoot->parent()->layoutObjec t();
1312 layerOffset->setWidth((parent->offsetLeft(parent->offsetParent() ) - current->offsetLeft(parent->offsetParent())).toInt()); 1312 layerOffset->setWidth((parent->offsetLeft(parent->offsetParent() ) - current->offsetLeft(parent->offsetParent())).toInt());
1313 layerOffset->setHeight((parent->offsetTop(parent->offsetParent() ) - current->offsetTop(parent->offsetParent())).toInt()); 1313 layerOffset->setHeight((parent->offsetTop(parent->offsetParent() ) - current->offsetTop(parent->offsetParent())).toInt());
1314 return searchRoot->parent(); 1314 return searchRoot->parent();
1315 } 1315 }
1316 } 1316 }
1317 1317
1318 LayoutRect rect; 1318 LayoutRect rect;
1319 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*searchRoot->la youtObject(), rect); 1319 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*searchRoot->la youtObject(), rect);
1320 *layerOffset = IntSize(rect.x(), rect.y()); 1320 *layerOffset = IntSize(rect.x().toInt(), rect.y().toInt());
1321 return searchRoot; 1321 return searchRoot;
1322 } 1322 }
1323 1323
1324 // If the |graphicsLayer| is a scroller's scrollingContent layer, 1324 // If the |graphicsLayer| is a scroller's scrollingContent layer,
1325 // consider this is a scrolling layer. 1325 // consider this is a scrolling layer.
1326 GraphicsLayer* layerForScrolling = searchRoot->getScrollableArea() ? searchR oot->getScrollableArea()->layerForScrolling() : 0; 1326 GraphicsLayer* layerForScrolling = searchRoot->getScrollableArea() ? searchR oot->getScrollableArea()->layerForScrolling() : 0;
1327 if (graphicsLayer == layerForScrolling) { 1327 if (graphicsLayer == layerForScrolling) {
1328 *layerType = "scrolling"; 1328 *layerType = "scrolling";
1329 return searchRoot; 1329 return searchRoot;
1330 } 1330 }
1331 1331
1332 if (searchRoot->compositingState() == PaintsIntoGroupedBacking) { 1332 if (searchRoot->compositingState() == PaintsIntoGroupedBacking) {
1333 GraphicsLayer* squashingLayer = searchRoot->groupedMapping()->squashingL ayer(); 1333 GraphicsLayer* squashingLayer = searchRoot->groupedMapping()->squashingL ayer();
1334 if (graphicsLayer == squashingLayer) { 1334 if (graphicsLayer == squashingLayer) {
1335 *layerType ="squashing"; 1335 *layerType ="squashing";
1336 LayoutRect rect; 1336 LayoutRect rect;
1337 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*searchRoot ->layoutObject(), rect); 1337 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*searchRoot ->layoutObject(), rect);
1338 *layerOffset = IntSize(rect.x(), rect.y()); 1338 *layerOffset = IntSize(rect.x().toInt(), rect.y().toInt());
1339 return searchRoot; 1339 return searchRoot;
1340 } 1340 }
1341 } 1341 }
1342 1342
1343 GraphicsLayer* layerForHorizontalScrollbar = searchRoot->getScrollableArea() ? searchRoot->getScrollableArea()->layerForHorizontalScrollbar() : 0; 1343 GraphicsLayer* layerForHorizontalScrollbar = searchRoot->getScrollableArea() ? searchRoot->getScrollableArea()->layerForHorizontalScrollbar() : 0;
1344 if (graphicsLayer == layerForHorizontalScrollbar) { 1344 if (graphicsLayer == layerForHorizontalScrollbar) {
1345 *layerType = "horizontalScrollbar"; 1345 *layerType = "horizontalScrollbar";
1346 return searchRoot; 1346 return searchRoot;
1347 } 1347 }
1348 1348
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2619 2619
2620 ClientRect* Internals::visualRect(Node* node) 2620 ClientRect* Internals::visualRect(Node* node)
2621 { 2621 {
2622 if (!node || !node->layoutObject()) 2622 if (!node || !node->layoutObject())
2623 return ClientRect::create(); 2623 return ClientRect::create();
2624 2624
2625 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); 2625 return ClientRect::create(FloatRect(node->layoutObject()->visualRect()));
2626 } 2626 }
2627 2627
2628 } // namespace blink 2628 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.cpp ('k') | third_party/WebKit/Source/platform/LayoutUnit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698