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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.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/paint/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index 459200019d647bf7c82659f05c821a8f2de435c4..1c356515a000fbe6f1ef14f2e71e5212e912f078 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -480,7 +480,7 @@ int PaintLayerScrollableArea::visibleWidth() const
IntSize PaintLayerScrollableArea::contentsSize() const
{
- return IntSize(scrollWidth(), scrollHeight());
+ return IntSize(scrollWidth().toInt(), scrollHeight().toInt());
}
IntPoint PaintLayerScrollableArea::lastKnownMousePosition() const
@@ -717,11 +717,11 @@ void PaintLayerScrollableArea::updateAfterLayout()
// Set up the range (and page step/line step).
if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
int clientWidth = box().pixelSnappedClientWidth();
- horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
+ horizontalScrollbar->setProportion(clientWidth, overflowRect().width().toInt());
}
if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
int clientHeight = box().pixelSnappedClientHeight();
- verticalScrollbar->setProportion(clientHeight, overflowRect().height());
+ verticalScrollbar->setProportion(clientHeight, overflowRect().height().toInt());
}
}
@@ -925,11 +925,11 @@ void PaintLayerScrollableArea::updateAfterOverflowRecalc()
updateScrollDimensions();
if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
int clientWidth = box().pixelSnappedClientWidth();
- horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
+ horizontalScrollbar->setProportion(clientWidth, overflowRect().width().toInt());
}
if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
int clientHeight = box().pixelSnappedClientHeight();
- verticalScrollbar->setProportion(clientHeight, overflowRect().height());
+ verticalScrollbar->setProportion(clientHeight, overflowRect().height().toInt());
}
bool hasHorizontalOverflow = this->hasHorizontalOverflow();
@@ -984,10 +984,10 @@ int PaintLayerScrollableArea::horizontalScrollbarStart(int minX) const
IntSize PaintLayerScrollableArea::scrollbarOffset(const Scrollbar& scrollbar) const
{
if (&scrollbar == verticalScrollbar())
- return IntSize(verticalScrollbarStart(0, box().size().width()), box().borderTop());
+ return IntSize(verticalScrollbarStart(0, box().size().width().toInt()), box().borderTop());
if (&scrollbar == horizontalScrollbar())
- return IntSize(horizontalScrollbarStart(0), box().size().height() - box().borderBottom() - scrollbar.height());
+ return IntSize(horizontalScrollbarStart(0), (box().size().height() - box().borderBottom() - scrollbar.height()).toInt());
ASSERT_NOT_REACHED();
return IntSize();
@@ -1180,10 +1180,11 @@ bool PaintLayerScrollableArea::hitTestOverflowControls(HitTestResult& result, co
int resizeControlSize = max(resizeControlRect.height(), 0);
if (hasVerticalScrollbar() && verticalScrollbar()->shouldParticipateInHitTesting()) {
- LayoutRect vBarRect(verticalScrollbarStart(0, box().size().width()),
- LayoutUnit(box().borderTop()),
+ // TODO(crbug.com/638981): Are the conversions to int intentional?
+ LayoutRect vBarRect(verticalScrollbarStart(0, box().size().width().toInt()),
+ box().borderTop(),
verticalScrollbar()->width(),
- box().size().height() - (box().borderTop() + box().borderBottom()) - (hasHorizontalScrollbar() ? horizontalScrollbar()->height() : resizeControlSize));
+ (box().size().height() - (box().borderTop() + box().borderBottom()) - (hasHorizontalScrollbar() ? horizontalScrollbar()->height() : resizeControlSize)).toInt());
if (vBarRect.contains(localPoint)) {
result.setScrollbar(verticalScrollbar());
return true;
@@ -1192,9 +1193,10 @@ bool PaintLayerScrollableArea::hitTestOverflowControls(HitTestResult& result, co
resizeControlSize = max(resizeControlRect.width(), 0);
if (hasHorizontalScrollbar() && horizontalScrollbar()->shouldParticipateInHitTesting()) {
- LayoutRect hBarRect(horizontalScrollbarStart(LayoutUnit()),
- box().size().height() - box().borderBottom() - horizontalScrollbar()->height(),
- box().size().width() - (box().borderLeft() + box().borderRight()) - (hasVerticalScrollbar() ? verticalScrollbar()->width() : resizeControlSize),
+ // TODO(crbug.com/638981): Are the conversions to int intentional?
+ LayoutRect hBarRect(horizontalScrollbarStart(0),
+ (box().size().height() - box().borderBottom() - horizontalScrollbar()->height()).toInt(),
+ (box().size().width() - (box().borderLeft() + box().borderRight()) - (hasVerticalScrollbar() ? verticalScrollbar()->width() : resizeControlSize)).toInt(),
horizontalScrollbar()->height());
if (hBarRect.contains(localPoint)) {
result.setScrollbar(horizontalScrollbar());

Powered by Google App Engine
This is Rietveld 408576698