Diff
Modified: trunk/Source/WebCore/ChangeLog (164696 => 164697)
--- trunk/Source/WebCore/ChangeLog 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/ChangeLog 2014-02-26 06:23:03 UTC (rev 164697)
@@ -1,3 +1,44 @@
+2014-02-25 Zalan Bujtas <[email protected]>
+
+ Subpixel layout: Remove explicit static_cast<LayoutUnit> conversions.
+ https://bugs.webkit.org/show_bug.cgi?id=129359
+
+ Reviewed by Simon Fraser.
+
+ No testable change in behavior.
+
+ * css/LengthFunctions.cpp:
+ (WebCore::minimumValueForLength):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::forceLayoutForPagination):
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::paintFillLayer):
+ * rendering/InlineFlowBox.h:
+ (WebCore::InlineFlowBox::logicalLeftVisualOverflow):
+ (WebCore::InlineFlowBox::logicalRightVisualOverflow):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::isSelected):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::computeColumnCountAndWidth):
+ (WebCore::getBPMWidth):
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::adjustForBorderFit):
+ * rendering/RenderDeprecatedFlexibleBox.cpp:
+ (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
+ * rendering/RenderFieldset.cpp:
+ (WebCore::RenderFieldset::paintBoxDecorations):
+ * rendering/RenderTable.h:
+ (WebCore::RenderTable::borderSpacingInRowDirection):
+ * rendering/RenderTextControlMultiLine.cpp:
+ (WebCore::RenderTextControlMultiLine::preferredContentLogicalWidth):
+ * rendering/RenderTextControlSingleLine.cpp:
+ (WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth):
+ * rendering/RootInlineBox.cpp:
+ (WebCore::RootInlineBox::beforeAnnotationsAdjustment):
+ (WebCore::RootInlineBox::ascentAndDescentForBox):
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::resolveLengthAttributeForSVG):
+
2014-02-25 Anders Carlsson <[email protected]>
Build fixes.
Modified: trunk/Source/WebCore/css/LengthFunctions.cpp (164696 => 164697)
--- trunk/Source/WebCore/css/LengthFunctions.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/css/LengthFunctions.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -47,29 +47,29 @@
return length.value();
case Percent:
if (roundPercentages)
- return static_cast<LayoutUnit>(round(maximumValue * length.percent() / 100.0f));
+ return LayoutUnit(round(maximumValue * length.percent() / 100.0f));
// Don't remove the extra cast to float. It is needed for rounding on 32-bit Intel machines that use the FPU stack.
- return static_cast<LayoutUnit>(static_cast<float>(maximumValue * length.percent() / 100.0f));
+ return LayoutUnit(static_cast<float>(maximumValue * length.percent() / 100.0f));
case Calculated:
return length.nonNanCalculatedValue(maximumValue);
case ViewportPercentageWidth:
if (renderView)
- return static_cast<LayoutUnit>(renderView->viewportSize().width() * length.viewportPercentageLength() / 100.0f);
+ return LayoutUnit(renderView->viewportSize().width() * length.viewportPercentageLength() / 100.0f);
return 0;
case ViewportPercentageHeight:
if (renderView)
- return static_cast<LayoutUnit>(renderView->viewportSize().height() * length.viewportPercentageLength() / 100.0f);
+ return LayoutUnit(renderView->viewportSize().height() * length.viewportPercentageLength() / 100.0f);
return 0;
case ViewportPercentageMin:
if (renderView) {
IntSize viewportSize = renderView->viewportSize();
- return static_cast<LayoutUnit>(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
+ return LayoutUnit(std::min(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
}
return 0;
case ViewportPercentageMax:
if (renderView) {
IntSize viewportSize = renderView->viewportSize();
- return static_cast<LayoutUnit>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
+ return LayoutUnit(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
}
return 0;
case FillAvailable:
Modified: trunk/Source/WebCore/page/FrameView.cpp (164696 => 164697)
--- trunk/Source/WebCore/page/FrameView.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/page/FrameView.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -3730,10 +3730,8 @@
float pageLogicalWidth = renderView->style().isHorizontalWritingMode() ? pageSize.width() : pageSize.height();
float pageLogicalHeight = renderView->style().isHorizontalWritingMode() ? pageSize.height() : pageSize.width();
- LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
- LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight);
- renderView->setLogicalWidth(flooredPageLogicalWidth);
- renderView->setPageLogicalHeight(flooredPageLogicalHeight);
+ renderView->setLogicalWidth(floor(pageLogicalWidth));
+ renderView->setPageLogicalHeight(floor(pageLogicalHeight));
renderView->setNeedsLayoutAndPrefWidthsRecalc();
forceLayout();
@@ -3751,10 +3749,8 @@
pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : maxPageSize.height();
pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : maxPageSize.width();
- flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
- flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight);
- renderView->setLogicalWidth(flooredPageLogicalWidth);
- renderView->setPageLogicalHeight(flooredPageLogicalHeight);
+ renderView->setLogicalWidth(floor(pageLogicalWidth));
+ renderView->setPageLogicalHeight(floor(pageLogicalHeight));
renderView->setNeedsLayoutAndPrefWidthsRecalc();
forceLayout();
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -1218,8 +1218,8 @@
}
LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : LayoutUnit());
LayoutUnit stripY = rect.y() - (isHorizontal() ? LayoutUnit() : logicalOffsetOnLine);
- LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : static_cast<LayoutUnit>(width());
- LayoutUnit stripHeight = isHorizontal() ? static_cast<LayoutUnit>(height()) : totalLogicalWidth;
+ LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : LayoutUnit(width());
+ LayoutUnit stripHeight = isHorizontal() ? LayoutUnit(height()) : totalLogicalWidth;
GraphicsContextStateSaver stateSaver(*paintInfo.context);
paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height()));
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (164696 => 164697)
--- trunk/Source/WebCore/rendering/InlineFlowBox.h 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h 2014-02-26 06:23:03 UTC (rev 164697)
@@ -248,8 +248,8 @@
{
return m_overflow ? m_overflow->visualOverflowRect() : enclosingLayoutRect(frameRectIncludingLineHeight(lineTop, lineBottom));
}
- LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->visualOverflowRect().x() : m_overflow->visualOverflowRect().y()) : static_cast<LayoutUnit>(logicalLeft()); }
- LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->visualOverflowRect().maxX() : m_overflow->visualOverflowRect().maxY()) : static_cast<LayoutUnit>(ceilf(logicalRight())); }
+ LayoutUnit logicalLeftVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->visualOverflowRect().x() : m_overflow->visualOverflowRect().y()) : LayoutUnit(logicalLeft()); }
+ LayoutUnit logicalRightVisualOverflow() const { return m_overflow ? (isHorizontal() ? m_overflow->visualOverflowRect().maxX() : m_overflow->visualOverflowRect().maxY()) : LayoutUnit(ceilf(logicalRight())); }
LayoutUnit logicalTopVisualOverflow(LayoutUnit lineTop) const
{
if (m_overflow)
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -196,8 +196,8 @@
bool InlineTextBox::isSelected(int startPos, int endPos) const
{
- LayoutUnit sPos = std::max<LayoutUnit>(startPos - m_start, 0);
- LayoutUnit ePos = std::min<LayoutUnit>(endPos - m_start, m_len);
+ int sPos = std::max(startPos - m_start, 0);
+ int ePos = std::min(endPos - m_start, static_cast<int>(m_len));
return (sPos < ePos);
}
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -3496,7 +3496,7 @@
LayoutUnit availWidth = desiredColumnWidth;
LayoutUnit colGap = columnGap();
- LayoutUnit colWidth = std::max<LayoutUnit>(1, LayoutUnit(style().columnWidth()));
+ LayoutUnit colWidth = std::max<LayoutUnit>(LayoutUnit::fromPixel(1), LayoutUnit(style().columnWidth()));
int colCount = std::max<int>(1, style().columnCount());
if (style().hasAutoColumnWidth() && !style().hasAutoColumnCount()) {
@@ -4008,7 +4008,7 @@
static LayoutUnit getBPMWidth(LayoutUnit childValue, Length cssUnit)
{
if (cssUnit.type() != Auto)
- return (cssUnit.isFixed() ? static_cast<LayoutUnit>(cssUnit.value()) : childValue);
+ return (cssUnit.isFixed() ? LayoutUnit(cssUnit.value()) : childValue);
return 0;
}
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -2719,9 +2719,9 @@
for (auto box = firstRootBox(); box; box = box->nextRootBox()) {
if (box->firstChild())
- left = std::min(left, x + static_cast<LayoutUnit>(box->firstChild()->x()));
+ left = std::min(left, x + LayoutUnit(box->firstChild()->x()));
if (box->lastChild())
- right = std::max(right, x + static_cast<LayoutUnit>(ceilf(box->lastChild()->logicalRight())));
+ right = std::max(right, x + LayoutUnit(ceilf(box->lastChild()->logicalRight())));
}
} else {
for (RenderBox* obj = firstChildBox(); obj; obj = obj->nextSiblingBox()) {
Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -833,7 +833,7 @@
for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
LayoutUnit allowedFlex = allowedChildFlex(child, expanding, i);
if (allowedFlex) {
- LayoutUnit projectedFlex = (allowedFlex == LayoutUnit::max()) ? allowedFlex : static_cast<LayoutUnit>(allowedFlex * (totalFlex / child->style().boxFlex()));
+ LayoutUnit projectedFlex = (allowedFlex == LayoutUnit::max()) ? allowedFlex : LayoutUnit(allowedFlex * (totalFlex / child->style().boxFlex()));
spaceAvailableThisPass = expanding ? std::min(spaceAvailableThisPass, projectedFlex) : std::max(spaceAvailableThisPass, projectedFlex);
}
}
@@ -848,7 +848,7 @@
// Now distribute the space to objects.
for (RenderBox* child = iterator.first(); child && spaceAvailableThisPass && totalFlex; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i)) {
- LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceAvailableThisPass * (child->style().boxFlex() / totalFlex));
+ LayoutUnit spaceAdd = spaceAvailableThisPass * (child->style().boxFlex() / totalFlex);
if (spaceAdd) {
child->setOverrideLogicalContentHeight(contentHeightForChild(child) + spaceAdd);
flexingChildren = true;
Modified: trunk/Source/WebCore/rendering/RenderFieldset.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/RenderFieldset.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/RenderFieldset.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -176,11 +176,11 @@
// https://bugs.webkit.org/show_bug.cgi?id=47236
if (style().isHorizontalWritingMode()) {
LayoutUnit clipTop = paintRect.y();
- LayoutUnit clipHeight = std::max(static_cast<LayoutUnit>(style().borderTopWidth()), legend->height() - ((legend->height() - borderTop()) / 2));
+ LayoutUnit clipHeight = std::max<LayoutUnit>(style().borderTopWidth(), legend->height() - ((legend->height() - borderTop()) / 2));
graphicsContext->clipOut(pixelSnappedIntRect(paintRect.x() + legend->x(), clipTop, legend->width(), clipHeight));
} else {
LayoutUnit clipLeft = paintRect.x();
- LayoutUnit clipWidth = std::max(static_cast<LayoutUnit>(style().borderLeftWidth()), legend->width());
+ LayoutUnit clipWidth = std::max<LayoutUnit>(style().borderLeftWidth(), legend->width());
graphicsContext->clipOut(pixelSnappedIntRect(clipLeft, paintRect.y() + legend->y(), clipWidth, legend->height()));
}
Modified: trunk/Source/WebCore/rendering/RenderTable.h (164696 => 164697)
--- trunk/Source/WebCore/rendering/RenderTable.h 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/RenderTable.h 2014-02-26 06:23:03 UTC (rev 164697)
@@ -191,7 +191,7 @@
LayoutUnit borderSpacingInRowDirection() const
{
if (unsigned effectiveColumnCount = numEffCols())
- return static_cast<LayoutUnit>(effectiveColumnCount + 1) * hBorderSpacing();
+ return (effectiveColumnCount + 1) * hBorderSpacing();
return 0;
}
Modified: trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -74,7 +74,7 @@
LayoutUnit RenderTextControlMultiLine::preferredContentLogicalWidth(float charWidth) const
{
- return static_cast<LayoutUnit>(ceilf(charWidth * textAreaElement().cols())) + scrollbarThickness();
+ return ceilf(charWidth * textAreaElement().cols()) + scrollbarThickness();
}
LayoutUnit RenderTextControlMultiLine::computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const
Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -333,7 +333,7 @@
if (factor <= 0)
factor = 20;
- LayoutUnit result = static_cast<LayoutUnit>(ceiledLayoutUnit(charWidth * factor));
+ LayoutUnit result = ceiledLayoutUnit(charWidth * factor);
float maxCharWidth = 0.f;
Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/RootInlineBox.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -324,12 +324,12 @@
return result;
// Annotations over this line may push us further down.
- LayoutUnit highestAllowedPosition = prevRootBox() ? std::min(prevRootBox()->lineBottom(), lineTop()) + result : static_cast<LayoutUnit>(blockFlow().borderBefore());
+ LayoutUnit highestAllowedPosition = prevRootBox() ? std::min(prevRootBox()->lineBottom(), lineTop()) + result : blockFlow().borderBefore();
result = computeOverAnnotationAdjustment(highestAllowedPosition);
} else {
// Annotations under this line may push us up.
if (hasAnnotationsBefore())
- result = computeUnderAnnotationAdjustment(prevRootBox() ? prevRootBox()->lineBottom() : static_cast<LayoutUnit>(blockFlow().borderBefore()));
+ result = computeUnderAnnotationAdjustment(prevRootBox() ? prevRootBox()->lineBottom() : blockFlow().borderBefore());
if (!prevRootBox() || !prevRootBox()->hasAnnotationsAfter())
return result;
@@ -954,7 +954,7 @@
else if (verticalAlign == TEXT_TOP)
verticalPosition += renderer->baselinePosition(baselineType(), firstLine, lineDirection) - fontMetrics.ascent(baselineType());
else if (verticalAlign == MIDDLE)
- verticalPosition = (verticalPosition - static_cast<LayoutUnit>(fontMetrics.xHeight() / 2) - renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection)).round();
+ verticalPosition = (verticalPosition - LayoutUnit(fontMetrics.xHeight() / 2) - renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection)).round();
else if (verticalAlign == TEXT_BOTTOM) {
verticalPosition += fontMetrics.descent(baselineType());
// lineHeight - baselinePosition is always 0 for replaced elements (except inline blocks), so don't bother wasting time in that case.
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (164696 => 164697)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2014-02-26 06:01:23 UTC (rev 164696)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2014-02-26 06:23:03 UTC (rev 164697)
@@ -133,7 +133,7 @@
static inline LayoutUnit resolveLengthAttributeForSVG(const Length& length, float scale, float maxSize, RenderView* renderView)
{
- return static_cast<LayoutUnit>(valueForLength(length, maxSize, renderView) * (length.isFixed() ? scale : 1));
+ return valueForLength(length, maxSize, renderView) * (length.isFixed() ? scale : 1);
}
LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const