Diff
Modified: trunk/Source/WebCore/ChangeLog (201113 => 201114)
--- trunk/Source/WebCore/ChangeLog 2016-05-18 23:09:09 UTC (rev 201113)
+++ trunk/Source/WebCore/ChangeLog 2016-05-18 23:25:47 UTC (rev 201114)
@@ -1,3 +1,25 @@
+2016-05-18 Zalan Bujtas <za...@apple.com>
+
+ Remove LayoutUnit::operator unsigned().
+ https://bugs.webkit.org/show_bug.cgi?id=157856
+
+ Reviewed by Simon Fraser.
+
+ Converting LayoutUnit values to unsigned is lossy. We should avoid
+ such implicit conversions.
+
+ No behaviour change.
+
+ * html/ImageInputType.cpp:
+ (WebCore::ImageInputType::height):
+ (WebCore::ImageInputType::width):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::hitTestResultAtPoint):
+ * platform/LayoutUnit.h:
+ (WebCore::LayoutUnit::operator unsigned): Deleted.
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::computeColumnCountAndWidth):
+
2016-05-18 Alex Christensen <achristen...@webkit.org>
Clean up CSS code
Modified: trunk/Source/WebCore/html/ImageInputType.cpp (201113 => 201114)
--- trunk/Source/WebCore/html/ImageInputType.cpp 2016-05-18 23:09:09 UTC (rev 201113)
+++ trunk/Source/WebCore/html/ImageInputType.cpp 2016-05-18 23:25:47 UTC (rev 201114)
@@ -182,7 +182,7 @@
// If the image is available, use its height.
HTMLImageLoader* imageLoader = element->imageLoader();
if (imageLoader && imageLoader->image())
- return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height();
+ return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height().toUnsigned();
}
element->document().updateLayout();
@@ -203,7 +203,7 @@
// If the image is available, use its width.
HTMLImageLoader* imageLoader = element->imageLoader();
if (imageLoader && imageLoader->image())
- return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width();
+ return imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width().toUnsigned();
}
element->document().updateLayout();
Modified: trunk/Source/WebCore/page/EventHandler.cpp (201113 => 201114)
--- trunk/Source/WebCore/page/EventHandler.cpp 2016-05-18 23:09:09 UTC (rev 201113)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2016-05-18 23:25:47 UTC (rev 201114)
@@ -1131,7 +1131,9 @@
}
}
- HitTestResult result(point, padding.height(), padding.width(), padding.height(), padding.width());
+ unsigned nonNegativePaddingWidth = std::max<LayoutUnit>(0, padding.width()).toUnsigned();
+ unsigned nonNegativePaddingHeight = std::max<LayoutUnit>(0, padding.height()).toUnsigned();
+ HitTestResult result(point, nonNegativePaddingHeight, nonNegativePaddingWidth, nonNegativePaddingHeight, nonNegativePaddingWidth);
RenderView* renderView = m_frame.contentRenderer();
if (!renderView)
Modified: trunk/Source/WebCore/platform/LayoutUnit.h (201113 => 201114)
--- trunk/Source/WebCore/platform/LayoutUnit.h 2016-05-18 23:09:09 UTC (rev 201113)
+++ trunk/Source/WebCore/platform/LayoutUnit.h 2016-05-18 23:25:47 UTC (rev 201114)
@@ -114,7 +114,6 @@
unsigned toUnsigned() const { REPORT_OVERFLOW(m_value >= 0); return toInt(); }
operator int() const { return toInt(); }
- operator unsigned() const { return toUnsigned(); }
operator float() const { return toFloat(); }
operator double() const { return toDouble(); }
operator bool() const { return m_value; }
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (201113 => 201114)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2016-05-18 23:09:09 UTC (rev 201113)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2016-05-18 23:25:47 UTC (rev 201114)
@@ -412,16 +412,16 @@
LayoutUnit availWidth = desiredColumnWidth;
LayoutUnit colGap = columnGap();
LayoutUnit colWidth = std::max<LayoutUnit>(LayoutUnit::fromPixel(1), LayoutUnit(style().columnWidth()));
- int colCount = std::max<int>(1, style().columnCount());
+ unsigned colCount = std::max<unsigned>(1, style().columnCount());
if (style().hasAutoColumnWidth() && !style().hasAutoColumnCount()) {
desiredColumnCount = colCount;
desiredColumnWidth = std::max<LayoutUnit>(0, (availWidth - ((desiredColumnCount - 1) * colGap)) / desiredColumnCount);
} else if (!style().hasAutoColumnWidth() && style().hasAutoColumnCount()) {
- desiredColumnCount = std::max<LayoutUnit>(1, (availWidth + colGap) / (colWidth + colGap));
+ desiredColumnCount = std::max<LayoutUnit>(1, (availWidth + colGap) / (colWidth + colGap)).toUnsigned();
desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colGap;
} else {
- desiredColumnCount = std::max<LayoutUnit>(std::min<LayoutUnit>(colCount, (availWidth + colGap) / (colWidth + colGap)), 1);
+ desiredColumnCount = std::max<LayoutUnit>(std::min<LayoutUnit>(colCount, (availWidth + colGap) / (colWidth + colGap)), 1).toUnsigned();
desiredColumnWidth = ((availWidth + colGap) / desiredColumnCount) - colGap;
}
setComputedColumnCountAndWidth(desiredColumnCount, desiredColumnWidth);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (201113 => 201114)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-05-18 23:09:09 UTC (rev 201113)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-05-18 23:25:47 UTC (rev 201114)
@@ -5104,7 +5104,7 @@
LayoutUnit contentArea = pluginRenderBox.contentWidth() * pluginRenderBox.contentHeight();
if (contentArea > candidatePlugInArea * primarySnapshottedPlugInSearchBucketSize) {
- candidatePlugInArea = contentArea;
+ candidatePlugInArea = contentArea.toUnsigned();
return true;
}
return false;