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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutScrollbar.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/core/layout/LayoutScrollbar.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutScrollbar.cpp b/third_party/WebKit/Source/core/layout/LayoutScrollbar.cpp
index 521296a6918ca081fb4f19161cb137c99ff89efd..75530bdc932439f2b5632951ad038972ab2a142e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutScrollbar.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutScrollbar.cpp
@@ -187,7 +187,7 @@ void LayoutScrollbar::updateScrollbarParts(bool destroy)
LayoutScrollbarPart* part = m_parts.get(ScrollbarBGPart);
if (part) {
part->layout();
- newThickness = isHorizontal ? part->size().height() : part->size().width();
+ newThickness = (isHorizontal ? part->size().height() : part->size().width()).toInt();
}
if (newThickness != oldThickness) {
@@ -313,16 +313,16 @@ IntRect LayoutScrollbar::trackRect(int startLength, int endLength) const
part->layout();
if (orientation() == HorizontalScrollbar) {
- int marginLeft = part ? static_cast<int>(part->marginLeft()) : 0;
- int marginRight = part ? static_cast<int>(part->marginRight()) : 0;
+ int marginLeft = part ? part->marginLeft().toInt() : 0;
+ int marginRight = part ? part->marginRight().toInt() : 0;
startLength += marginLeft;
endLength += marginRight;
int totalLength = startLength + endLength;
return IntRect(x() + startLength, y(), width() - totalLength, height());
}
- int marginTop = part ? static_cast<int>(part->marginTop()) : 0;
- int marginBottom = part ? static_cast<int>(part->marginBottom()) : 0;
+ int marginTop = part ? part->marginTop().toInt() : 0;
+ int marginBottom = part ? part->marginBottom().toInt() : 0;
startLength += marginTop;
endLength += marginBottom;
int totalLength = startLength + endLength;
@@ -340,11 +340,11 @@ IntRect LayoutScrollbar::trackPieceRectWithMargins(ScrollbarPart partType, const
IntRect rect = oldRect;
if (orientation() == HorizontalScrollbar) {
- rect.setX(rect.x() + partLayoutObject->marginLeft());
- rect.setWidth(rect.width() - partLayoutObject->marginWidth());
+ rect.setX((rect.x() + partLayoutObject->marginLeft()).toInt());
+ rect.setWidth((rect.width() - partLayoutObject->marginWidth()).toInt());
} else {
- rect.setY(rect.y() + partLayoutObject->marginTop());
- rect.setHeight(rect.height() - partLayoutObject->marginHeight());
+ rect.setY((rect.y() + partLayoutObject->marginTop()).toInt());
+ rect.setHeight((rect.height() - partLayoutObject->marginHeight()).toInt());
}
return rect;
}
@@ -355,7 +355,7 @@ int LayoutScrollbar::minimumThumbLength() const
if (!partLayoutObject)
return 0;
partLayoutObject->layout();
- return orientation() == HorizontalScrollbar ? partLayoutObject->size().width() : partLayoutObject->size().height();
+ return (orientation() == HorizontalScrollbar ? partLayoutObject->size().width() : partLayoutObject->size().height()).toInt();
}
void LayoutScrollbar::invalidateDisplayItemClientsOfScrollbarParts()

Powered by Google App Engine
This is Rietveld 408576698