Introduce user-defined literal for LayoutUnit
https://bugs.webkit.org/show_bug.cgi?id=191915
Reviewed by Dean Jackson.
* platform/LayoutUnit.h:
Introduce a user-defined literal for LayoutUnit, _lu, replacing the existing "fromPixel" factory function.
* layout/FormattingContextGeometry.cpp:
* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
* layout/inlineformatting/InlineLineBreaker.cpp:
* page/FrameView.cpp:
* page/FrameViewLayoutContext.h:
* page/Page.cpp:
* page/SpatialNavigation.h:
* platform/ScrollableArea.cpp:
* rendering/EllipsisBox.cpp:
* rendering/FlexibleBoxAlgorithm.cpp:
* rendering/FloatingObjects.cpp:
* rendering/GridLayoutFunctions.cpp:
* rendering/GridTrackSizingAlgorithm.cpp:
* rendering/InlineFlowBox.cpp:
* rendering/InlineTextBox.cpp:
* rendering/LayoutState.h:
* rendering/LogicalSelectionOffsetCaches.h:
* rendering/RenderBlock.cpp:
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
* rendering/RenderBlockFlow.h:
* rendering/RenderBlockLineLayout.cpp:
* rendering/RenderBox.cpp:
* rendering/RenderBoxModelObject.cpp:
* rendering/RenderDeprecatedFlexibleBox.cpp:
* rendering/RenderDeprecatedFlexibleBox.h:
* rendering/RenderElement.cpp:
* rendering/RenderFlexibleBox.cpp:
* rendering/RenderFlexibleBox.h:
* rendering/RenderFragmentContainer.cpp:
* rendering/RenderFragmentedFlow.cpp:
* rendering/RenderGrid.cpp:
* rendering/RenderGrid.h:
* rendering/RenderImage.cpp:
* rendering/RenderLayer.cpp:
* rendering/RenderListMarker.cpp:
* rendering/RenderMultiColumnFlow.cpp:
* rendering/RenderMultiColumnSet.cpp:
* rendering/RenderReplaced.cpp:
* rendering/RenderReplaced.h:
* rendering/RenderRubyRun.h:
* rendering/RenderTable.cpp:
* rendering/RenderTable.h:
* rendering/RenderTableSection.cpp:
* rendering/RenderTheme.cpp:
* rendering/RenderTreeAsText.cpp:
* rendering/RenderView.cpp:
* rendering/RootInlineBox.h:
* rendering/SimpleLineLayout.cpp:
* rendering/SimpleLineLayoutPagination.cpp:
* rendering/TableLayout.h:
* rendering/line/BreakingContext.h:
* rendering/line/LineLayoutState.h:
* rendering/line/LineWidth.h:
* rendering/mathml/MathOperator.cpp:
* rendering/mathml/MathOperator.h:
* rendering/mathml/RenderMathMLBlock.h:
* rendering/mathml/RenderMathMLFraction.cpp:
* rendering/mathml/RenderMathMLFraction.h:
* rendering/mathml/RenderMathMLMath.cpp:
* rendering/mathml/RenderMathMLMath.h:
* rendering/mathml/RenderMathMLMenclose.h:
* rendering/mathml/RenderMathMLOperator.cpp:
* rendering/mathml/RenderMathMLOperator.h:
* rendering/mathml/RenderMathMLPadded.h:
* rendering/mathml/RenderMathMLRoot.cpp:
* rendering/mathml/RenderMathMLRoot.h:
* rendering/mathml/RenderMathMLRow.h:
* rendering/mathml/RenderMathMLScripts.cpp:
* rendering/mathml/RenderMathMLScripts.h:
* rendering/mathml/RenderMathMLSpace.h:
* rendering/mathml/RenderMathMLToken.cpp:
* rendering/mathml/RenderMathMLToken.h:
* rendering/mathml/RenderMathMLUnderOver.h:
* rendering/shapes/ShapeOutsideInfo.cpp:
* rendering/style/CollapsedBorderValue.h:
Update all instances of LayoutUnit(), LayoutUnit(0), LayoutUnit { 0 }, etc. and add any other
literal conversions that will be needed when making non-int LayoutUnit constructors explicit.
For good measure, also mark all default values for LayoutUnit parameters.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@238463 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 373003a..1448708 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,93 @@
+2018-11-23 Ross Kirsling <ross.kirsling@sony.com>
+
+ Introduce user-defined literal for LayoutUnit
+ https://bugs.webkit.org/show_bug.cgi?id=191915
+
+ Reviewed by Dean Jackson.
+
+ * platform/LayoutUnit.h:
+ Introduce a user-defined literal for LayoutUnit, _lu, replacing the existing "fromPixel" factory function.
+
+ * layout/FormattingContextGeometry.cpp:
+ * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+ * layout/inlineformatting/InlineLineBreaker.cpp:
+ * page/FrameView.cpp:
+ * page/FrameViewLayoutContext.h:
+ * page/Page.cpp:
+ * page/SpatialNavigation.h:
+ * platform/ScrollableArea.cpp:
+ * rendering/EllipsisBox.cpp:
+ * rendering/FlexibleBoxAlgorithm.cpp:
+ * rendering/FloatingObjects.cpp:
+ * rendering/GridLayoutFunctions.cpp:
+ * rendering/GridTrackSizingAlgorithm.cpp:
+ * rendering/InlineFlowBox.cpp:
+ * rendering/InlineTextBox.cpp:
+ * rendering/LayoutState.h:
+ * rendering/LogicalSelectionOffsetCaches.h:
+ * rendering/RenderBlock.cpp:
+ * rendering/RenderBlock.h:
+ * rendering/RenderBlockFlow.cpp:
+ * rendering/RenderBlockFlow.h:
+ * rendering/RenderBlockLineLayout.cpp:
+ * rendering/RenderBox.cpp:
+ * rendering/RenderBoxModelObject.cpp:
+ * rendering/RenderDeprecatedFlexibleBox.cpp:
+ * rendering/RenderDeprecatedFlexibleBox.h:
+ * rendering/RenderElement.cpp:
+ * rendering/RenderFlexibleBox.cpp:
+ * rendering/RenderFlexibleBox.h:
+ * rendering/RenderFragmentContainer.cpp:
+ * rendering/RenderFragmentedFlow.cpp:
+ * rendering/RenderGrid.cpp:
+ * rendering/RenderGrid.h:
+ * rendering/RenderImage.cpp:
+ * rendering/RenderLayer.cpp:
+ * rendering/RenderListMarker.cpp:
+ * rendering/RenderMultiColumnFlow.cpp:
+ * rendering/RenderMultiColumnSet.cpp:
+ * rendering/RenderReplaced.cpp:
+ * rendering/RenderReplaced.h:
+ * rendering/RenderRubyRun.h:
+ * rendering/RenderTable.cpp:
+ * rendering/RenderTable.h:
+ * rendering/RenderTableSection.cpp:
+ * rendering/RenderTheme.cpp:
+ * rendering/RenderTreeAsText.cpp:
+ * rendering/RenderView.cpp:
+ * rendering/RootInlineBox.h:
+ * rendering/SimpleLineLayout.cpp:
+ * rendering/SimpleLineLayoutPagination.cpp:
+ * rendering/TableLayout.h:
+ * rendering/line/BreakingContext.h:
+ * rendering/line/LineLayoutState.h:
+ * rendering/line/LineWidth.h:
+ * rendering/mathml/MathOperator.cpp:
+ * rendering/mathml/MathOperator.h:
+ * rendering/mathml/RenderMathMLBlock.h:
+ * rendering/mathml/RenderMathMLFraction.cpp:
+ * rendering/mathml/RenderMathMLFraction.h:
+ * rendering/mathml/RenderMathMLMath.cpp:
+ * rendering/mathml/RenderMathMLMath.h:
+ * rendering/mathml/RenderMathMLMenclose.h:
+ * rendering/mathml/RenderMathMLOperator.cpp:
+ * rendering/mathml/RenderMathMLOperator.h:
+ * rendering/mathml/RenderMathMLPadded.h:
+ * rendering/mathml/RenderMathMLRoot.cpp:
+ * rendering/mathml/RenderMathMLRoot.h:
+ * rendering/mathml/RenderMathMLRow.h:
+ * rendering/mathml/RenderMathMLScripts.cpp:
+ * rendering/mathml/RenderMathMLScripts.h:
+ * rendering/mathml/RenderMathMLSpace.h:
+ * rendering/mathml/RenderMathMLToken.cpp:
+ * rendering/mathml/RenderMathMLToken.h:
+ * rendering/mathml/RenderMathMLUnderOver.h:
+ * rendering/shapes/ShapeOutsideInfo.cpp:
+ * rendering/style/CollapsedBorderValue.h:
+ Update all instances of LayoutUnit(), LayoutUnit(0), LayoutUnit { 0 }, etc. and add any other
+ literal conversions that will be needed when making non-int LayoutUnit constructors explicit.
+ For good measure, also mark all default values for LayoutUnit parameters.
+
2018-11-23 Jim Mason <jmason@ibinx.com>
[GTK] Scrollbars not following gtk-primary-button-warps-slider setting
diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp
index 3da4253..e70ac45 100644
--- a/Source/WebCore/layout/FormattingContextGeometry.cpp
+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp
@@ -458,10 +458,10 @@
marginLeft = marginRight = marginLeftAndRight / 2;
else {
if (isLeftToRightDirection) {
- marginLeft = LayoutUnit { 0 };
+ marginLeft = 0_lu;
marginRight = containingBlockWidth - (*left + *marginLeft + borderLeft + paddingLeft + *width + paddingRight + borderRight + *right);
} else {
- marginRight = LayoutUnit { 0 };
+ marginRight = 0_lu;
marginLeft = containingBlockWidth - (*left + borderLeft + paddingLeft + *width + paddingRight + borderRight + *marginRight + *right);
}
}
@@ -659,10 +659,10 @@
marginLeft = marginRight = marginLeftAndRight / 2;
else {
if (isLeftToRightDirection) {
- marginLeft = LayoutUnit { 0 };
+ marginLeft = 0_lu;
marginRight = containingBlockWidth - (*left + *marginLeft + borderLeft + paddingLeft + width + paddingRight + borderRight + *right);
} else {
- marginRight = LayoutUnit { 0 };
+ marginRight = 0_lu;
marginLeft = containingBlockWidth - (*left + borderLeft + paddingLeft + width + paddingRight + borderRight + *marginRight + *right);
}
}
@@ -900,14 +900,14 @@
if (precomputedMarginRight)
return precomputedMarginRight.value();
auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth);
- return marginRight.value_or(LayoutUnit { 0 });
+ return marginRight.value_or(0_lu);
};
auto computeMarginLeft = [&]() {
if (precomputedMarginLeft)
return precomputedMarginLeft.value();
auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth);
- return marginLeft.value_or(LayoutUnit { 0 });
+ return marginLeft.value_or(0_lu);
};
auto replaced = layoutBox.replaced();
@@ -1052,8 +1052,8 @@
auto& style = layoutBox.style();
auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
- auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth).value_or(LayoutUnit { 0 });
- auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth).value_or(LayoutUnit { 0 });
+ auto marginLeft = computedValueIfNotAuto(style.marginLeft(), containingBlockWidth).value_or(0_lu);
+ auto marginRight = computedValueIfNotAuto(style.marginRight(), containingBlockWidth).value_or(0_lu);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Margin] -> non collapsed horizontal -> margin(" << marginLeft << "px, " << marginRight << "px) -> layoutBox: " << &layoutBox);
return { marginLeft, marginRight };
@@ -1064,8 +1064,8 @@
auto& style = layoutBox.style();
auto containingBlockWidth = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).contentBoxWidth();
- auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(LayoutUnit { 0 });
- auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(LayoutUnit { 0 });
+ auto marginTop = computedValueIfNotAuto(style.marginTop(), containingBlockWidth).value_or(0_lu);
+ auto marginBottom = computedValueIfNotAuto(style.marginBottom(), containingBlockWidth).value_or(0_lu);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Margin] -> non collapsed vertical -> margin(" << marginTop << "px, " << marginBottom << "px) -> layoutBox: " << &layoutBox);
return { marginTop, marginBottom };
diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp b/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
index 2921c3f..3e88309 100644
--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp
@@ -88,10 +88,10 @@
case TextAlignMode::Right:
case TextAlignMode::WebKitRight:
case TextAlignMode::End:
- return lineLogicalLeft + std::max(remainingWidth, LayoutUnit());
+ return lineLogicalLeft + std::max(remainingWidth, 0_lu);
case TextAlignMode::Center:
case TextAlignMode::WebKitCenter:
- return lineLogicalLeft + std::max(remainingWidth / 2, LayoutUnit());
+ return lineLogicalLeft + std::max(remainingWidth / 2, 0_lu);
case TextAlignMode::Justify:
ASSERT_NOT_REACHED();
break;
diff --git a/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp b/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp
index 9458a92..5333dae 100644
--- a/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp
+++ b/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp
@@ -170,8 +170,8 @@
auto endPosition = std::min<ItemPosition>(startPosition + length, inlineItemLength);
auto textWidth = TextUtil::width(currentInlineItem, startPosition, endPosition, contentLogicalLeft);
- auto nonBreakableStart = !startPosition ? currentInlineItem.nonBreakableStart() : LayoutUnit();
- auto nonBreakableEnd = endPosition == inlineItemLength ? currentInlineItem.nonBreakableEnd() : LayoutUnit();
+ auto nonBreakableStart = !startPosition ? currentInlineItem.nonBreakableStart() : 0_lu;
+ auto nonBreakableEnd = endPosition == inlineItemLength ? currentInlineItem.nonBreakableEnd() : 0_lu;
auto contentWidth = nonBreakableStart + textWidth + nonBreakableEnd;
contentLogicalLeft += contentWidth;
width += contentWidth;
diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp
index f4ad2d6..173d4ac 100644
--- a/Source/WebCore/page/FrameView.cpp
+++ b/Source/WebCore/page/FrameView.cpp
@@ -1895,7 +1895,7 @@
// We impose an lower limit on the size (so an upper limit on the scale) of
// the rect used to position fixed objects so that they don't crowd into the
// center of the screen at larger scales.
- const LayoutUnit maxContentWidthForZoomThreshold = LayoutUnit::fromPixel(1024);
+ const LayoutUnit maxContentWidthForZoomThreshold = 1024_lu;
float zoomedOutScale = frameScaleFactor * visibleContentRect.width() / std::min(maxContentWidthForZoomThreshold, totalContentsSize.width());
float constraintThresholdScale = 1.5 * zoomedOutScale;
float maxPostionedObjectsRectScale = std::min(frameScaleFactor, constraintThresholdScale);
diff --git a/Source/WebCore/page/FrameViewLayoutContext.h b/Source/WebCore/page/FrameViewLayoutContext.h
index 394276a..9d0ddbd 100644
--- a/Source/WebCore/page/FrameViewLayoutContext.h
+++ b/Source/WebCore/page/FrameViewLayoutContext.h
@@ -139,7 +139,7 @@
// Subtree push/pop
void pushLayoutState(RenderElement&);
bool pushLayoutStateForPaginationIfNeeded(RenderBlockFlow&);
- bool pushLayoutState(RenderBox& renderer, const LayoutSize& offset, LayoutUnit pageHeight = 0, bool pageHeightChanged = false);
+ bool pushLayoutState(RenderBox& renderer, const LayoutSize& offset, LayoutUnit pageHeight = 0_lu, bool pageHeightChanged = false);
void popLayoutState();
// Suspends the LayoutState optimization. Used under transforms that cannot be represented by
diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp
index c493697..2e469eb 100644
--- a/Source/WebCore/page/Page.cpp
+++ b/Source/WebCore/page/Page.cpp
@@ -2115,7 +2115,7 @@
// both halves helps to prevent cases where we have a fully loaded menu bar or masthead with
// no content beneath that.
LayoutRect topRelevantRect = relevantRect;
- topRelevantRect.contract(LayoutSize(0, relevantRect.height() / 2));
+ topRelevantRect.contract(LayoutSize(0_lu, relevantRect.height() / 2));
LayoutRect bottomRelevantRect = topRelevantRect;
bottomRelevantRect.setY(relevantRect.height() / 2);
diff --git a/Source/WebCore/page/SpatialNavigation.h b/Source/WebCore/page/SpatialNavigation.h
index 6f201f6..0370983 100644
--- a/Source/WebCore/page/SpatialNavigation.h
+++ b/Source/WebCore/page/SpatialNavigation.h
@@ -139,7 +139,7 @@
Node* scrollableEnclosingBoxOrParentFrameForNodeInDirection(FocusDirection, Node*);
LayoutRect nodeRectInAbsoluteCoordinates(Node*, bool ignoreBorder = false);
LayoutRect frameRectInAbsoluteCoordinates(Frame*);
-LayoutRect virtualRectForDirection(FocusDirection, const LayoutRect& startingRect, LayoutUnit width = 0);
+LayoutRect virtualRectForDirection(FocusDirection, const LayoutRect& startingRect, LayoutUnit width = 0_lu);
LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement*, FocusDirection);
HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate&);
diff --git a/Source/WebCore/platform/LayoutUnit.h b/Source/WebCore/platform/LayoutUnit.h
index a89a98a..c569d85 100644
--- a/Source/WebCore/platform/LayoutUnit.h
+++ b/Source/WebCore/platform/LayoutUnit.h
@@ -85,11 +85,6 @@
m_value = clampToInteger(value * kFixedPointDenominator);
}
- static LayoutUnit fromPixel(int value)
- {
- return LayoutUnit(value);
- }
-
static LayoutUnit fromFloatCeil(float value)
{
LayoutUnit v;
@@ -826,6 +821,15 @@
return value.toInt() == value;
}
+inline namespace StringLiterals {
+
+inline LayoutUnit operator"" _lu(unsigned long long value)
+{
+ return LayoutUnit(value);
+}
+
+}
+
} // namespace WebCore
#ifndef NDEBUG
diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp
index 54b5da1..9462921 100644
--- a/Source/WebCore/platform/ScrollableArea.cpp
+++ b/Source/WebCore/platform/ScrollableArea.cpp
@@ -716,9 +716,9 @@
// If we still clip, push our rect "up" from the bottom right.
scrollRect.intersect(documentRect);
if (scrollRect.width() < idealScrollRectSize.width())
- scrollRect.move(-(idealScrollRectSize.width() - scrollRect.width()), 0);
+ scrollRect.move(-(idealScrollRectSize.width() - scrollRect.width()), 0_lu);
if (scrollRect.height() < idealScrollRectSize.height())
- scrollRect.move(0, -(idealScrollRectSize.height() - scrollRect.height()));
+ scrollRect.move(0_lu, -(idealScrollRectSize.height() - scrollRect.height()));
}
return scrollRect.location() - toLayoutSize(scrollOrigin);
diff --git a/Source/WebCore/rendering/EllipsisBox.cpp b/Source/WebCore/rendering/EllipsisBox.cpp
index 81054a3..08bb323 100644
--- a/Source/WebCore/rendering/EllipsisBox.cpp
+++ b/Source/WebCore/rendering/EllipsisBox.cpp
@@ -118,7 +118,7 @@
const FontCascade& font = lineStyle.fontCascade();
const RootInlineBox& rootBox = root();
// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
- LayoutRect selectionRect = LayoutRect(x(), y() + rootBox.selectionTopAdjustedForPrecedingBlock(), 0, rootBox.selectionHeightAdjustedForPrecedingBlock());
+ LayoutRect selectionRect = LayoutRect(x(), y() + rootBox.selectionTopAdjustedForPrecedingBlock(), 0_lu, rootBox.selectionHeightAdjustedForPrecedingBlock());
font.adjustSelectionRectForText(RenderBlock::constructTextRun(m_str, lineStyle, AllowTrailingExpansion), selectionRect);
// FIXME: use directional pixel snapping instead.
return enclosingIntRect(selectionRect);
@@ -139,7 +139,7 @@
const RootInlineBox& rootBox = root();
GraphicsContextStateSaver stateSaver(context);
// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
- LayoutRect selectionRect = LayoutRect(x() + paintOffset.x(), y() + paintOffset.y() + rootBox.selectionTop(), 0, rootBox.selectionHeight());
+ LayoutRect selectionRect = LayoutRect(x() + paintOffset.x(), y() + paintOffset.y() + rootBox.selectionTop(), 0_lu, rootBox.selectionHeight());
TextRun run = RenderBlock::constructTextRun(m_str, style, AllowTrailingExpansion);
font.adjustSelectionRectForText(run, selectionRect);
context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()), c);
diff --git a/Source/WebCore/rendering/FlexibleBoxAlgorithm.cpp b/Source/WebCore/rendering/FlexibleBoxAlgorithm.cpp
index 1b848d6..0137fd4 100644
--- a/Source/WebCore/rendering/FlexibleBoxAlgorithm.cpp
+++ b/Source/WebCore/rendering/FlexibleBoxAlgorithm.cpp
@@ -56,9 +56,9 @@
bool FlexLayoutAlgorithm::computeNextFlexLine(size_t& nextIndex, Vector<FlexItem>& lineItems, LayoutUnit& sumFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexShrink, LayoutUnit& sumHypotheticalMainSize)
{
lineItems.clear();
- sumFlexBaseSize = LayoutUnit();
+ sumFlexBaseSize = 0_lu;
totalFlexGrow = totalFlexShrink = totalWeightedFlexShrink = 0;
- sumHypotheticalMainSize = LayoutUnit();
+ sumHypotheticalMainSize = 0_lu;
bool lineHasInFlowItem = false;
diff --git a/Source/WebCore/rendering/FloatingObjects.cpp b/Source/WebCore/rendering/FloatingObjects.cpp
index 4338bd3..504e3cb 100644
--- a/Source/WebCore/rendering/FloatingObjects.cpp
+++ b/Source/WebCore/rendering/FloatingObjects.cpp
@@ -448,7 +448,7 @@
template <FloatingObject::Type FloatTypeValue>
LayoutUnit ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining() const
{
- return this->m_outermostFloat ? this->m_renderer->logicalBottomForFloat(*this->m_outermostFloat) - this->m_lineTop : LayoutUnit::fromPixel(1);
+ return this->m_outermostFloat ? this->m_renderer->logicalBottomForFloat(*this->m_outermostFloat) - this->m_lineTop : 1_lu;
}
template <FloatingObject::Type FloatTypeValue>
diff --git a/Source/WebCore/rendering/GridLayoutFunctions.cpp b/Source/WebCore/rendering/GridLayoutFunctions.cpp
index 5076900..7e315be 100644
--- a/Source/WebCore/rendering/GridLayoutFunctions.cpp
+++ b/Source/WebCore/rendering/GridLayoutFunctions.cpp
@@ -69,8 +69,8 @@
if (child.needsLayout())
return computeMarginLogicalSizeForChild(grid, direction, child);
bool isRowAxis = flowAwareDirectionForChild(grid, child, direction) == ForColumns;
- LayoutUnit marginStart = marginStartIsAuto(child, direction) ? LayoutUnit() : isRowAxis ? child.marginStart() : child.marginBefore();
- LayoutUnit marginEnd = marginEndIsAuto(child, direction) ? LayoutUnit() : isRowAxis ? child.marginEnd() : child.marginAfter();
+ LayoutUnit marginStart = marginStartIsAuto(child, direction) ? 0_lu : isRowAxis ? child.marginStart() : child.marginBefore();
+ LayoutUnit marginEnd = marginEndIsAuto(child, direction) ? 0_lu : isRowAxis ? child.marginEnd() : child.marginAfter();
return marginStart + marginEnd;
}
diff --git a/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp b/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
index dc3e842..3a02416 100644
--- a/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
+++ b/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
@@ -569,14 +569,14 @@
if (maxTrackSize.isContentSized() || maxTrackSize.isFlex() || isRelativeGridLengthAsAuto(maxTrackSize, direction))
gridAreaIsIndefinite = true;
else
- gridAreaSize += valueForLength(maxTrackSize.length(), availableSize.value_or(LayoutUnit()));
+ gridAreaSize += valueForLength(maxTrackSize.length(), availableSize.value_or(0_lu));
}
gridAreaSize += m_renderGrid->guttersSize(m_grid, direction, span.startLine(), span.integerSpan(), availableSize);
GridTrackSizingDirection childInlineDirection = GridLayoutFunctions::flowAwareDirectionForChild(*m_renderGrid, child, ForColumns);
if (gridAreaIsIndefinite)
- return direction == childInlineDirection ? std::max(child.maxPreferredLogicalWidth(), gridAreaSize) : LayoutUnit(-1);
+ return direction == childInlineDirection ? std::max(child.maxPreferredLogicalWidth(), gridAreaSize) : -1_lu;
return gridAreaSize;
}
@@ -735,7 +735,7 @@
void GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes()
{
- m_minContentSize = m_maxContentSize = LayoutUnit();
+ m_minContentSize = m_maxContentSize = 0_lu;
Vector<GridTrack>& allTracks = tracks(m_direction);
for (auto& track : allTracks) {
@@ -810,7 +810,7 @@
GridTrackSize trackSize = m_algorithm.gridTrackSize(direction(), trackPosition);
if (!trackSize.hasFixedMaxTrackBreadth())
return minSize;
- maxBreadth += valueForLength(trackSize.maxTrackBreadth().length(), availableSpace().value_or(LayoutUnit()));
+ maxBreadth += valueForLength(trackSize.maxTrackBreadth().length(), availableSpace().value_or(0_lu));
}
if (minSize > maxBreadth) {
auto marginAndBorderAndPadding = GridLayoutFunctions::marginLogicalSizeForChild(*renderGrid(), direction(), child);
@@ -1004,7 +1004,7 @@
if (!checkMinSize && !checkMaxSize)
return false;
- LayoutUnit freeSpace = checkMaxSize ? maxSize.value() : LayoutUnit(-1);
+ LayoutUnit freeSpace = checkMaxSize ? maxSize.value() : -1_lu;
const Grid& grid = m_algorithm.grid();
freeSpace = std::max(freeSpace, minSize.value()) - renderGrid->guttersSize(grid, ForRows, 0, grid.numTracks(ForRows), availableSpace());
@@ -1031,11 +1031,11 @@
{
ASSERT(!m_algorithm.freeSpace(direction()));
if (direction() == ForColumns)
- return LayoutUnit();
+ return 0_lu;
auto minSize = renderGrid()->computeContentLogicalHeight(MinSize, renderGrid()->style().logicalMinHeight(), std::nullopt);
if (!minSize)
- return LayoutUnit();
+ return 0_lu;
return minSize.value() - computeTrackBasedSize();
}
@@ -1101,7 +1101,7 @@
Vector<GridTrack>& allTracks = tracks(m_direction);
const bool hasDefiniteFreeSpace = !!availableSpace();
const bool indefiniteHeight = m_direction == ForRows && !m_renderGrid->hasDefiniteLogicalHeight();
- LayoutUnit maxSize = std::max(LayoutUnit(), availableSpace().value_or(LayoutUnit()));
+ LayoutUnit maxSize = std::max(0_lu, availableSpace().value_or(0_lu));
// 1. Initialize per Grid track variables.
for (unsigned i = 0; i < allTracks.size(); ++i) {
GridTrack& track = allTracks[i];
@@ -1186,7 +1186,7 @@
computeFlexSizedTracksGrowth(flexFraction, increments, totalGrowth);
if (m_strategy->recomputeUsedFlexFractionIfNeeded(flexFraction, totalGrowth)) {
- totalGrowth = LayoutUnit();
+ totalGrowth = 0_lu;
computeFlexSizedTracksGrowth(flexFraction, increments, totalGrowth);
}
@@ -1216,7 +1216,7 @@
auto& track = allTracks[trackIndex];
track.setBaseSize(track.baseSize() + sizeToIncrease);
}
- setFreeSpace(m_direction, LayoutUnit());
+ setFreeSpace(m_direction, 0_lu);
}
void GridTrackSizingAlgorithm::advanceNextState()
diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp
index d5d62cd..853bccb 100644
--- a/Source/WebCore/rendering/InlineFlowBox.cpp
+++ b/Source/WebCore/rendering/InlineFlowBox.cpp
@@ -698,8 +698,8 @@
auto& rubyRun = downcast<RenderRubyRun>(child->renderer());
if (RenderRubyBase* rubyBase = rubyRun.rubyBase()) {
- LayoutUnit bottomRubyBaseLeading = (child->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox() ? rubyBase->lastRootBox()->lineBottom() : LayoutUnit());
- LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (rubyBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : LayoutUnit());
+ LayoutUnit bottomRubyBaseLeading = (child->logicalHeight() - rubyBase->logicalBottom()) + rubyBase->logicalHeight() - (rubyBase->lastRootBox() ? rubyBase->lastRootBox()->lineBottom() : 0_lu);
+ LayoutUnit topRubyBaseLeading = rubyBase->logicalTop() + (rubyBase->firstRootBox() ? rubyBase->firstRootBox()->lineTop() : 0_lu);
newLogicalTop += !renderer().style().isFlippedLinesWritingMode() ? topRubyBaseLeading : bottomRubyBaseLeading;
boxHeight -= (topRubyBaseLeading + bottomRubyBaseLeading);
}
@@ -867,8 +867,8 @@
LayoutUnit logicalTopVisualOverflow = std::min<LayoutUnit>(logicalTop() - outsetLogicalTop, logicalVisualOverflow.y());
LayoutUnit logicalBottomVisualOverflow = std::max<LayoutUnit>(logicalBottom() + outsetLogicalBottom, logicalVisualOverflow.maxY());
- LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : LayoutUnit();
- LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogicalRight : LayoutUnit();
+ LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : 0_lu;
+ LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogicalRight : 0_lu;
LayoutUnit logicalLeftVisualOverflow = std::min<LayoutUnit>(logicalLeft() - outsetLogicalLeft, logicalVisualOverflow.x());
LayoutUnit logicalRightVisualOverflow = std::max<LayoutUnit>(logicalRight() + outsetLogicalRight, logicalVisualOverflow.maxX());
@@ -1273,8 +1273,8 @@
for (InlineFlowBox* curr = this; curr; curr = curr->prevLineBox())
totalLogicalWidth += curr->logicalWidth();
}
- LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : LayoutUnit());
- LayoutUnit stripY = rect.y() - (isHorizontal() ? LayoutUnit() : logicalOffsetOnLine);
+ LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : 0_lu);
+ LayoutUnit stripY = rect.y() - (isHorizontal() ? 0_lu : logicalOffsetOnLine);
LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : LayoutUnit(width());
LayoutUnit stripHeight = isHorizontal() ? LayoutUnit(height()) : totalLogicalWidth;
@@ -1409,8 +1409,8 @@
LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
totalLogicalWidth += curr->logicalWidth();
- LayoutUnit stripX = adjustedPaintoffset.x() - (isHorizontal() ? logicalOffsetOnLine : LayoutUnit());
- LayoutUnit stripY = adjustedPaintoffset.y() - (isHorizontal() ? LayoutUnit() : logicalOffsetOnLine);
+ LayoutUnit stripX = adjustedPaintoffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0_lu);
+ LayoutUnit stripY = adjustedPaintoffset.y() - (isHorizontal() ? 0_lu : logicalOffsetOnLine);
LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
@@ -1477,8 +1477,8 @@
LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
for (InlineFlowBox* curr = this; curr; curr = curr->nextLineBox())
totalLogicalWidth += curr->logicalWidth();
- LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalOffsetOnLine : LayoutUnit());
- LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? LayoutUnit() : logicalOffsetOnLine);
+ LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0_lu);
+ LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? 0_lu : logicalOffsetOnLine);
LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
@@ -1575,7 +1575,7 @@
continue;
if (!rubyRun.style().isFlippedLinesWritingMode()) {
- LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit());
+ LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : 0_lu);
if (topOfFirstRubyTextLine >= 0)
continue;
topOfFirstRubyTextLine += child->logicalTop();
@@ -1623,7 +1623,7 @@
continue;
if (rubyRun.style().isFlippedLinesWritingMode()) {
- LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit());
+ LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : 0_lu);
if (topOfFirstRubyTextLine >= 0)
continue;
topOfFirstRubyTextLine += child->logicalTop();
diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp
index 08eb039..1d01090 100644
--- a/Source/WebCore/rendering/InlineTextBox.cpp
+++ b/Source/WebCore/rendering/InlineTextBox.cpp
@@ -487,7 +487,7 @@
// truncated string i.e. |Hello|CBA| -> |...lo|CBA|
LayoutUnit widthOfVisibleText = renderer().width(m_start, m_truncation, textPos(), isFirstLine());
LayoutUnit widthOfHiddenText = logicalWidth() - widthOfVisibleText;
- LayoutSize truncationOffset(isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText, 0);
+ LayoutSize truncationOffset(isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText, 0_lu);
localPaintOffset.move(isHorizontal() ? truncationOffset : truncationOffset.transposedSize());
}
}
diff --git a/Source/WebCore/rendering/LayoutState.h b/Source/WebCore/rendering/LayoutState.h
index 8a430b0..8ec3603 100644
--- a/Source/WebCore/rendering/LayoutState.h
+++ b/Source/WebCore/rendering/LayoutState.h
@@ -137,7 +137,7 @@
class LayoutStateMaintainer {
WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer);
public:
- explicit LayoutStateMaintainer(RenderBox&, LayoutSize offset, bool disableState = false, LayoutUnit pageHeight = 0, bool pageHeightChanged = false);
+ explicit LayoutStateMaintainer(RenderBox&, LayoutSize offset, bool disableState = false, LayoutUnit pageHeight = 0_lu, bool pageHeightChanged = false);
~LayoutStateMaintainer();
private:
diff --git a/Source/WebCore/rendering/LogicalSelectionOffsetCaches.h b/Source/WebCore/rendering/LogicalSelectionOffsetCaches.h
index 5c4ecc9..2a309eb 100644
--- a/Source/WebCore/rendering/LogicalSelectionOffsetCaches.h
+++ b/Source/WebCore/rendering/LogicalSelectionOffsetCaches.h
@@ -49,9 +49,9 @@
ASSERT(m_cache);
if (m_hasFloatsOrFragmentedFlows || !m_cachedLogicalLeftSelectionOffset) {
m_cachedLogicalLeftSelectionOffset = true;
- m_logicalLeftSelectionOffset = m_block ? m_block->logicalLeftSelectionOffset(rootBlock, position, *m_cache) : LayoutUnit::fromPixel(0);
+ m_logicalLeftSelectionOffset = m_block ? m_block->logicalLeftSelectionOffset(rootBlock, position, *m_cache) : 0_lu;
} else
- ASSERT(m_logicalLeftSelectionOffset == (m_block ? m_block->logicalLeftSelectionOffset(rootBlock, position, *m_cache) : LayoutUnit::fromPixel(0)));
+ ASSERT(m_logicalLeftSelectionOffset == (m_block ? m_block->logicalLeftSelectionOffset(rootBlock, position, *m_cache) : 0_lu));
return m_logicalLeftSelectionOffset;
}
@@ -60,9 +60,9 @@
ASSERT(m_cache);
if (m_hasFloatsOrFragmentedFlows || !m_cachedLogicalRightSelectionOffset) {
m_cachedLogicalRightSelectionOffset = true;
- m_logicalRightSelectionOffset = m_block ? m_block->logicalRightSelectionOffset(rootBlock, position, *m_cache) : LayoutUnit::fromPixel(0);
+ m_logicalRightSelectionOffset = m_block ? m_block->logicalRightSelectionOffset(rootBlock, position, *m_cache) : 0_lu;
} else
- ASSERT(m_logicalRightSelectionOffset == (m_block ? m_block->logicalRightSelectionOffset(rootBlock, position, *m_cache) : LayoutUnit::fromPixel(0)));
+ ASSERT(m_logicalRightSelectionOffset == (m_block ? m_block->logicalRightSelectionOffset(rootBlock, position, *m_cache) : 0_lu));
return m_logicalRightSelectionOffset;
}
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 1df5734..f69b8c3 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -681,9 +681,9 @@
LayoutRect clientRect(flippedClientBoxRect());
LayoutRect rectToApply;
if (isHorizontalWritingMode())
- rectToApply = LayoutRect(clientRect.x(), clientRect.y(), 1, std::max<LayoutUnit>(0, oldClientAfterEdge - clientRect.y()));
+ rectToApply = LayoutRect(clientRect.x(), clientRect.y(), 1_lu, std::max(0_lu, oldClientAfterEdge - clientRect.y()));
else
- rectToApply = LayoutRect(clientRect.x(), clientRect.y(), std::max<LayoutUnit>(0, oldClientAfterEdge - clientRect.x()), 1);
+ rectToApply = LayoutRect(clientRect.x(), clientRect.y(), std::max(0_lu, oldClientAfterEdge - clientRect.x()), 1_lu);
addLayoutOverflow(rectToApply);
if (hasRenderOverflow())
m_overflow->setLayoutClientAfterEdge(oldClientAfterEdge);
@@ -774,11 +774,11 @@
{
if (isHorizontalWritingMode()) {
if (applyDelta == ApplyLayoutDelta)
- view().frameView().layoutContext().addLayoutDelta(LayoutSize(child.x() - logicalLeft, 0));
+ view().frameView().layoutContext().addLayoutDelta(LayoutSize(child.x() - logicalLeft, 0_lu));
child.setX(logicalLeft);
} else {
if (applyDelta == ApplyLayoutDelta)
- view().frameView().layoutContext().addLayoutDelta(LayoutSize(0, child.y() - logicalLeft));
+ view().frameView().layoutContext().addLayoutDelta(LayoutSize(0_lu, child.y() - logicalLeft));
child.setY(logicalLeft);
}
}
@@ -787,11 +787,11 @@
{
if (isHorizontalWritingMode()) {
if (applyDelta == ApplyLayoutDelta)
- view().frameView().layoutContext().addLayoutDelta(LayoutSize(0, child.y() - logicalTop));
+ view().frameView().layoutContext().addLayoutDelta(LayoutSize(0_lu, child.y() - logicalTop));
child.setY(logicalTop);
} else {
if (applyDelta == ApplyLayoutDelta)
- view().frameView().layoutContext().addLayoutDelta(LayoutSize(child.x() - logicalTop, 0));
+ view().frameView().layoutContext().addLayoutDelta(LayoutSize(child.x() - logicalTop, 0_lu));
child.setX(logicalTop);
}
}
@@ -2271,7 +2271,7 @@
RenderObject* child = firstChild();
RenderBlock* containingBlock = this->containingBlock();
- LayoutUnit floatLeftWidth = 0, floatRightWidth = 0;
+ LayoutUnit floatLeftWidth, floatRightWidth;
LayoutUnit childMinWidth;
LayoutUnit childMaxWidth;
@@ -2710,13 +2710,13 @@
LayoutUnit RenderBlock::paginationStrut() const
{
RenderBlockRareData* rareData = getBlockRareData(*this);
- return rareData ? rareData->m_paginationStrut : LayoutUnit();
+ return rareData ? rareData->m_paginationStrut : 0_lu;
}
LayoutUnit RenderBlock::pageLogicalOffset() const
{
RenderBlockRareData* rareData = getBlockRareData(*this);
- return rareData ? rareData->m_pageLogicalOffset : LayoutUnit();
+ return rareData ? rareData->m_pageLogicalOffset : 0_lu;
}
void RenderBlock::setPaginationStrut(LayoutUnit strut)
@@ -2840,8 +2840,8 @@
// FIXME: This is wrong for block-flows that are horizontal.
// https://bugs.webkit.org/show_bug.cgi?id=46781
bool prevInlineHasLineBox = downcast<RenderInline>(*inlineContinuation->element()->renderer()).firstLineBox();
- float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : LayoutUnit();
- float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : LayoutUnit();
+ float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : 0_lu;
+ float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : 0_lu;
LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin);
if (!rect.isEmpty())
rects.append(rect);
@@ -3184,7 +3184,7 @@
availableHeight = overrideContentLogicalHeight();
else if (styleToUse.logicalHeight().isFixed()) {
LayoutUnit contentBoxHeight = adjustContentBoxLogicalHeightForBoxSizing((LayoutUnit)styleToUse.logicalHeight().value());
- availableHeight = std::max(LayoutUnit(), constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - scrollbarLogicalHeight(), std::nullopt));
+ availableHeight = std::max(0_lu, constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - scrollbarLogicalHeight(), std::nullopt));
} else if (styleToUse.logicalHeight().isPercentOrCalculated() && !isOutOfFlowPositionedWithSpecifiedHeight) {
std::optional<LayoutUnit> heightWithScrollbar = computePercentageLogicalHeight(styleToUse.logicalHeight());
if (heightWithScrollbar) {
@@ -3194,12 +3194,12 @@
// return value from the recursive call will not have been adjusted
// yet.
LayoutUnit contentBoxHeight = constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - scrollbarLogicalHeight(), std::nullopt);
- availableHeight = std::max(LayoutUnit(), contentBoxHeight);
+ availableHeight = std::max(0_lu, contentBoxHeight);
}
} else if (isOutOfFlowPositionedWithSpecifiedHeight) {
// Don't allow this to affect the block' size() member variable, since this
// can get called while the block is still laying out its kids.
- LogicalExtentComputedValues computedValues = computeLogicalHeight(logicalHeight(), LayoutUnit());
+ LogicalExtentComputedValues computedValues = computeLogicalHeight(logicalHeight(), 0_lu);
availableHeight = computedValues.m_extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight();
} else if (isRenderView())
availableHeight = view().pageOrViewLogicalHeight();
@@ -3266,7 +3266,7 @@
LayoutUnit fieldsetBorderBefore = borderBefore();
LayoutUnit legendLogicalHeight = logicalHeightForChild(legend);
LayoutUnit legendAfterMargin = marginAfterForChild(legend);
- LayoutUnit topPositionForLegend = std::max(LayoutUnit(), (fieldsetBorderBefore - legendLogicalHeight) / 2);
+ LayoutUnit topPositionForLegend = std::max(0_lu, (fieldsetBorderBefore - legendLogicalHeight) / 2);
LayoutUnit bottomPositionForLegend = topPositionForLegend + legendLogicalHeight + legendAfterMargin;
// Place the legend now.
@@ -3307,12 +3307,12 @@
return;
if (style().isHorizontalWritingMode()) {
- LayoutUnit yOff = std::max(LayoutUnit(), (legend->height() - RenderBox::borderBefore()) / 2);
+ LayoutUnit yOff = std::max(0_lu, (legend->height() - RenderBox::borderBefore()) / 2);
paintRect.setHeight(paintRect.height() - yOff);
if (style().writingMode() == TopToBottomWritingMode)
paintRect.setY(paintRect.y() + yOff);
} else {
- LayoutUnit xOff = std::max(LayoutUnit(), (legend->width() - RenderBox::borderBefore()) / 2);
+ LayoutUnit xOff = std::max(0_lu, (legend->width() - RenderBox::borderBefore()) / 2);
paintRect.setWidth(paintRect.width() - xOff);
if (style().writingMode() == LeftToRightWritingMode)
paintRect.setX(paintRect.x() + xOff);
@@ -3346,7 +3346,7 @@
LayoutUnit RenderBlock::intrinsicBorderForFieldset() const
{
auto* rareData = getBlockRareData(*this);
- return rareData ? rareData->m_intrinsicBorderForFieldset : LayoutUnit();
+ return rareData ? rareData->m_intrinsicBorderForFieldset : 0_lu;
}
void RenderBlock::setIntrinsicBorderForFieldset(LayoutUnit padding)
@@ -3453,7 +3453,7 @@
result -= borderAndPaddingLogicalHeight();
else
result -= intrinsicBorderForFieldset();
- return std::max(LayoutUnit(), result);
+ return std::max(0_lu, result);
}
void RenderBlock::paintExcludedChildrenInBorder(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h
index 4c6148b..b2e9bac 100644
--- a/Source/WebCore/rendering/RenderBlock.h
+++ b/Source/WebCore/rendering/RenderBlock.h
@@ -73,7 +73,7 @@
// FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
virtual void deleteLines();
- virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0);
+ virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu);
virtual void invalidateLineLayoutPath() { }
@@ -124,48 +124,48 @@
// Versions that can compute line offsets with the fragment and page offset passed in. Used for speed to avoid having to
// compute the fragment all over again when you already know it.
- LayoutUnit availableLogicalWidthForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0) const
+ LayoutUnit availableLogicalWidthForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0_lu) const
{
return std::max<LayoutUnit>(0, logicalRightOffsetForLineInFragment(position, shouldIndentText, fragment, logicalHeight)
- logicalLeftOffsetForLineInFragment(position, shouldIndentText, fragment, logicalHeight));
}
- LayoutUnit logicalRightOffsetForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0) const
+ LayoutUnit logicalRightOffsetForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0_lu) const
{
return logicalRightOffsetForLine(position, logicalRightOffsetForContent(fragment), shouldIndentText, logicalHeight);
}
- LayoutUnit logicalLeftOffsetForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0) const
+ LayoutUnit logicalLeftOffsetForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0_lu) const
{
return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(fragment), shouldIndentText, logicalHeight);
}
- LayoutUnit startOffsetForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0) const
+ LayoutUnit startOffsetForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0_lu) const
{
return style().isLeftToRightDirection() ? logicalLeftOffsetForLineInFragment(position, shouldIndentText, fragment, logicalHeight)
: logicalWidth() - logicalRightOffsetForLineInFragment(position, shouldIndentText, fragment, logicalHeight);
}
- LayoutUnit endOffsetForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0) const
+ LayoutUnit endOffsetForLineInFragment(LayoutUnit position, IndentTextOrNot shouldIndentText, RenderFragmentContainer* fragment, LayoutUnit logicalHeight = 0_lu) const
{
return !style().isLeftToRightDirection() ? logicalLeftOffsetForLineInFragment(position, shouldIndentText, fragment, logicalHeight)
: logicalWidth() - logicalRightOffsetForLineInFragment(position, shouldIndentText, fragment, logicalHeight);
}
- LayoutUnit availableLogicalWidthForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit availableLogicalWidthForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0_lu) const
{
return availableLogicalWidthForLineInFragment(position, shouldIndentText, fragmentAtBlockOffset(position), logicalHeight);
}
- LayoutUnit logicalRightOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit logicalRightOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0_lu) const
{
return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), shouldIndentText, logicalHeight);
}
- LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0_lu) const
{
return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), shouldIndentText, logicalHeight);
}
- LayoutUnit startOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit startOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0_lu) const
{
return style().isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, logicalHeight)
: logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, logicalHeight);
}
- LayoutUnit endOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0) const
+ LayoutUnit endOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText, LayoutUnit logicalHeight = 0_lu) const
{
return !style().isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, logicalHeight)
: logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, logicalHeight);
@@ -338,11 +338,11 @@
enum PaintBlockType { PaintAsBlock, PaintAsInlineBlock };
bool paintChild(RenderBox&, PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect, PaintBlockType paintType = PaintAsBlock);
- LayoutUnit logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const
+ LayoutUnit logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit logicalHeight = 0_lu) const
{
return adjustLogicalRightOffsetForLine(logicalRightFloatOffsetForLine(logicalTop, fixedOffset, logicalHeight), applyTextIndent);
}
- LayoutUnit logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const
+ LayoutUnit logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit logicalHeight = 0_lu) const
{
return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logicalTop, fixedOffset, logicalHeight), applyTextIndent);
}
diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp
index 5afcea4..d9a75d2 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.cpp
+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp
@@ -100,8 +100,8 @@
m_discardMargin = m_canCollapseMarginBeforeWithChildren && block.mustDiscardMarginBefore();
- m_positiveMargin = (m_canCollapseMarginBeforeWithChildren && !block.mustDiscardMarginBefore()) ? block.maxPositiveMarginBefore() : LayoutUnit();
- m_negativeMargin = (m_canCollapseMarginBeforeWithChildren && !block.mustDiscardMarginBefore()) ? block.maxNegativeMarginBefore() : LayoutUnit();
+ m_positiveMargin = (m_canCollapseMarginBeforeWithChildren && !block.mustDiscardMarginBefore()) ? block.maxPositiveMarginBefore() : 0_lu;
+ m_negativeMargin = (m_canCollapseMarginBeforeWithChildren && !block.mustDiscardMarginBefore()) ? block.maxNegativeMarginBefore() : 0_lu;
}
RenderBlockFlow::RenderBlockFlow(Element& element, RenderStyle&& style)
@@ -845,7 +845,7 @@
RenderBlockFlow* parentBlock = downcast<RenderBlockFlow>(parent());
if (parentBlock && style().clear() != Clear::None && parentBlock->getClearDelta(*this, logicalHeight()))
return marginValuesForChild(*this).positiveMarginBefore();
- return LayoutUnit();
+ return 0_lu;
}
void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox& child, ApplyLayoutDeltaMode applyDelta)
@@ -882,7 +882,7 @@
// for by simply calling canCollapseWithMarginBefore. See
// http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/046.html for
// an example of this scenario.
- LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? LayoutUnit() : marginInfo.margin();
+ LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? 0_lu : marginInfo.margin();
setLogicalHeight(logicalHeight() + marginOffset);
positionNewFloats();
setLogicalHeight(logicalHeight() - marginOffset);
@@ -1084,7 +1084,7 @@
// If we are at the before side of the block and we collapse, ignore the computed margin
// and just add the child margin to the container height. This will correctly position
// the child inside the container.
- LayoutUnit separateMargin = !marginInfo.canCollapseWithMarginBefore() ? marginInfo.margin() : LayoutUnit::fromPixel(0);
+ LayoutUnit separateMargin = !marginInfo.canCollapseWithMarginBefore() ? marginInfo.margin() : 0_lu;
setLogicalHeight(logicalHeight() + separateMargin + marginBeforeForChild(*child));
logicalTop = logicalHeight();
} else if (!marginInfo.discardMargin() && (!marginInfo.atBeforeSideOfBlock()
@@ -1526,7 +1526,7 @@
bool checkAfterAlways = (checkColumnBreaks && child.style().breakAfter() == BreakBetween::Column)
|| (checkPageBreaks && alwaysPageBreak(child.style().breakAfter()));
if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, IncludePageBoundary)) {
- LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? LayoutUnit() : marginInfo.margin();
+ LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? 0_lu : marginInfo.margin();
// So our margin doesn't participate in the next collapsing steps.
marginInfo.clearMargin();
@@ -1744,7 +1744,7 @@
&& !isOutOfFlowPositioned() && !isTableCell()) {
auto firstRootBox = this->firstRootBox();
auto firstRootBoxOverflowRect = firstRootBox->logicalVisualOverflowRect(firstRootBox->lineTop(), firstRootBox->lineBottom());
- auto firstLineUpperOverhang = std::max(-firstRootBoxOverflowRect.y(), LayoutUnit());
+ auto firstLineUpperOverhang = std::max(-firstRootBoxOverflowRect.y(), 0_lu);
if (needsAppleMailPaginationQuirk(*lineBox))
return;
setPaginationStrut(remainingLogicalHeight + logicalOffset + firstLineUpperOverhang);
@@ -2353,8 +2353,8 @@
}
if (childBox.style().floating() == Float::Left) {
- LayoutUnit heightRemainingLeft = 1;
- LayoutUnit heightRemainingRight = 1;
+ LayoutUnit heightRemainingLeft = 1_lu;
+ LayoutUnit heightRemainingRight = 1_lu;
floatLogicalLeft = logicalLeftOffsetForPositioningFloat(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft);
while (logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight) - floatLogicalLeft < floatLogicalWidth) {
logicalTopOffset += std::min(heightRemainingLeft, heightRemainingRight);
@@ -2368,8 +2368,8 @@
}
floatLogicalLeft = std::max(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft);
} else {
- LayoutUnit heightRemainingLeft = 1;
- LayoutUnit heightRemainingRight = 1;
+ LayoutUnit heightRemainingLeft = 1_lu;
+ LayoutUnit heightRemainingRight = 1_lu;
floatLogicalLeft = logicalRightOffsetForPositioningFloat(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight);
while (floatLogicalLeft - logicalLeftOffsetForPositioningFloat(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft) < floatLogicalWidth) {
logicalTopOffset += std::min(heightRemainingLeft, heightRemainingRight);
@@ -2720,8 +2720,8 @@
// into account. Only apply this code if prev is the parent, since otherwise the left margin
// will get applied twice.
LayoutSize offset = isHorizontalWritingMode()
- ? LayoutSize(logicalLeftOffset - (prev != container ? prev->marginLeft() : LayoutUnit()), logicalTopOffset)
- : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != container ? prev->marginTop() : LayoutUnit()));
+ ? LayoutSize(logicalLeftOffset - (prev != container ? prev->marginLeft() : 0_lu), logicalTopOffset)
+ : LayoutSize(logicalTopOffset, logicalLeftOffset - (prev != container ? prev->marginTop() : 0_lu));
m_floatingObjects->add(floatingObject.copyToNewContainer(offset));
}
@@ -2817,7 +2817,7 @@
}
// We also clear floats if we are too big to sit on the same line as a float (and wish to avoid floats by default).
- LayoutUnit result = clearSet ? std::max<LayoutUnit>(0, logicalBottom - logicalTop) : LayoutUnit();
+ LayoutUnit result = clearSet ? std::max<LayoutUnit>(0, logicalBottom - logicalTop) : 0_lu;
if (!result && child.avoidsFloats()) {
LayoutUnit newLogicalTop = logicalTop;
while (true) {
@@ -3219,7 +3219,7 @@
if (block.childrenInline()) {
for (auto* box = block.firstRootBox(); box; box = box->nextRootBox()) {
if (++count == lineCount)
- return box->lineBottom() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : LayoutUnit());
+ return box->lineBottom() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : 0_lu);
}
} else {
RenderBox* normalFlowChildWithoutLines = nullptr;
@@ -3227,7 +3227,7 @@
if (is<RenderBlockFlow>(*obj) && shouldCheckLines(downcast<RenderBlockFlow>(*obj))) {
int result = getHeightForLineCount(downcast<RenderBlockFlow>(*obj), lineCount, false, count);
if (result != -1)
- return result + obj->y() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : LayoutUnit());
+ return result + obj->y() + (includeBottom ? (block.borderBottom() + block.paddingBottom()) : 0_lu);
} else if (!obj->isFloatingOrOutOfFlowPositioned())
normalFlowChildWithoutLines = obj;
}
@@ -3832,7 +3832,7 @@
if (RenderMultiColumnFlow* fragmentedFlow = multiColumnFlow()) {
LayoutUnit newColumnHeight;
if (hasDefiniteLogicalHeight() || view().frameView().pagination().mode != Pagination::Unpaginated) {
- auto computedValues = computeLogicalHeight(LayoutUnit(), logicalTop());
+ auto computedValues = computeLogicalHeight(0_lu, logicalTop());
newColumnHeight = std::max<LayoutUnit>(computedValues.m_extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight(), 0);
if (fragmentedFlow->columnHeightAvailable() != newColumnHeight)
relayoutChildren = true;
@@ -3850,7 +3850,7 @@
// it's unknown, we need to prevent the pagination code from assuming page breaks everywhere
// and thereby eating every top margin. It should be trivial to clean up and get rid of this
// hack once the old multicol implementation is gone (see also RenderView::pushLayoutStateForPagination).
- pageLogicalHeight = fragmentedFlow.isPageLogicalHeightKnown() ? LayoutUnit(1) : LayoutUnit(0);
+ pageLogicalHeight = fragmentedFlow.isPageLogicalHeightKnown() ? 1_lu : 0_lu;
pageLogicalHeightChanged = fragmentedFlow.pageLogicalSizeChanged();
}
@@ -4052,7 +4052,7 @@
const RenderStyle& styleToUse = style();
RenderBlock* containingBlock = this->containingBlock();
- LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : LayoutUnit();
+ LayoutUnit cw = containingBlock ? containingBlock->contentLogicalWidth() : 0_lu;
// If we are at the start of a line, we want to ignore all white-space.
// Also strip spaces if we previously had text that ended in a trailing space.
diff --git a/Source/WebCore/rendering/RenderBlockFlow.h b/Source/WebCore/rendering/RenderBlockFlow.h
index af68ba0..4e40b11 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.h
+++ b/Source/WebCore/rendering/RenderBlockFlow.h
@@ -56,7 +56,7 @@
RenderBlockFlow(Document&, RenderStyle&&);
virtual ~RenderBlockFlow();
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override;
protected:
void willBeDestroyed() override;
@@ -398,7 +398,7 @@
bool pushToNextPageWithMinimumLogicalHeight(LayoutUnit& adjustment, LayoutUnit logicalOffset, LayoutUnit minimumLogicalHeight) const;
// If the child is unsplittable and can't fit on the current page, return the top of the next page/column.
- LayoutUnit adjustForUnsplittableChild(RenderBox& child, LayoutUnit logicalOffset, LayoutUnit beforeMargin = LayoutUnit(), LayoutUnit afterMargin = LayoutUnit());
+ LayoutUnit adjustForUnsplittableChild(RenderBox& child, LayoutUnit logicalOffset, LayoutUnit beforeMargin = 0_lu, LayoutUnit afterMargin = 0_lu);
LayoutUnit adjustBlockChildForPagination(LayoutUnit logicalTopAfterClear, LayoutUnit estimateWithoutPagination, RenderBox& child, bool atBeforeSideOfBlock);
LayoutUnit applyBeforeBreak(RenderBox& child, LayoutUnit logicalOffset); // If the child has a before break, then return a new yPos that shifts to the top of the next page/column.
LayoutUnit applyAfterBreak(RenderBox& child, LayoutUnit logicalOffset, MarginInfo&); // If the child has an after break, then return a new offset that shifts to the top of the next page/column.
diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp
index 8005250..e03f7b2 100644
--- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -1609,8 +1609,8 @@
trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight, textBoxDataMap, verticalPositionCache);
trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight, blockLogicalHeight, blockLogicalHeight, blockLogicalHeight);
trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthForContent(blockLogicalHeight));
- LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLayoutOverflow - blockLogicalHeight);
- LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVisualOverflow - blockLogicalHeight);
+ LayoutRect logicalLayoutOverflow(0_lu, blockLogicalHeight, 1_lu, bottomLayoutOverflow - blockLogicalHeight);
+ LayoutRect logicalVisualOverflow(0_lu, blockLogicalHeight, 1_lu, bottomVisualOverflow - blockLogicalHeight);
trailingFloatsLineBox->setOverflowFromLogicalRects(logicalLayoutOverflow, logicalVisualOverflow, trailingFloatsLineBox->lineTop(), trailingFloatsLineBox->lineBottom());
if (layoutState.fragmentedFlow())
updateFragmentForLine(trailingFloatsLineBox);
@@ -2080,7 +2080,7 @@
SimpleLineLayout::collectFlowOverflow(*this, *layout);
return;
}
- LayoutUnit endPadding = hasOverflowClip() ? paddingEnd() : LayoutUnit();
+ LayoutUnit endPadding = hasOverflowClip() ? paddingEnd() : 0_lu;
// FIXME: Need to find another way to do this, since scrollbars could show when we don't want them to.
if (hasOverflowClip() && !endPadding && element() && element()->isRootEditableElement() && style().isLeftToRightDirection())
endPadding = 1;
diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp
index 582d5af..bf88bd5 100644
--- a/Source/WebCore/rendering/RenderBox.cpp
+++ b/Source/WebCore/rendering/RenderBox.cpp
@@ -1165,7 +1165,7 @@
LayoutUnit result = height.value();
if (style().boxSizing() == BoxSizing::BorderBox)
result -= borderAndPaddingLogicalHeight();
- return std::max(LayoutUnit(), result);
+ return std::max(0_lu, result);
}
// Hit Testing
@@ -1801,24 +1801,24 @@
if (!style().clipLeft().isAuto()) {
LayoutUnit c = valueForLength(style().clipLeft(), borderBoxRect.width());
- clipRect.move(c, 0);
- clipRect.contract(c, 0);
+ clipRect.move(c, 0_lu);
+ clipRect.contract(c, 0_lu);
}
// We don't use the fragment-specific border box's width and height since clip offsets are (stupidly) specified
// from the left and top edges. Therefore it's better to avoid constraining to smaller widths and heights.
if (!style().clipRight().isAuto())
- clipRect.contract(width() - valueForLength(style().clipRight(), width()), 0);
+ clipRect.contract(width() - valueForLength(style().clipRight(), width()), 0_lu);
if (!style().clipTop().isAuto()) {
LayoutUnit c = valueForLength(style().clipTop(), borderBoxRect.height());
- clipRect.move(0, c);
- clipRect.contract(0, c);
+ clipRect.move(0_lu, c);
+ clipRect.contract(0_lu, c);
}
if (!style().clipBottom().isAuto())
- clipRect.contract(0, height() - valueForLength(style().clipBottom(), height()));
+ clipRect.contract(0_lu, height() - valueForLength(style().clipBottom(), height()));
return clipRect;
}
@@ -1828,7 +1828,7 @@
RenderFragmentContainer* containingBlockFragment = nullptr;
LayoutUnit logicalTopPosition = logicalTop();
if (fragment) {
- LayoutUnit offsetFromLogicalTopOfFragment = fragment ? fragment->logicalTopForFragmentedFlowContent() - offsetFromLogicalTopOfFirstPage() : LayoutUnit();
+ LayoutUnit offsetFromLogicalTopOfFragment = fragment ? fragment->logicalTopForFragmentedFlowContent() - offsetFromLogicalTopOfFirstPage() : 0_lu;
logicalTopPosition = std::max(logicalTopPosition, logicalTopPosition + offsetFromLogicalTopOfFragment);
containingBlockFragment = cb.clampToStartAndEndFragments(fragment);
}
@@ -1873,7 +1873,7 @@
if (RenderBlock* cb = containingBlock())
return cb->availableLogicalWidth();
- return LayoutUnit();
+ return 0_lu;
}
LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHeightType heightType) const
@@ -1885,7 +1885,7 @@
if (RenderBlock* cb = containingBlock())
return cb->availableLogicalHeight(heightType);
- return LayoutUnit();
+ return 0_lu;
}
LayoutUnit RenderBox::containingBlockLogicalWidthForContentInFragment(RenderFragmentContainer* fragment) const
@@ -1910,7 +1910,7 @@
RenderFragmentContainer* containingBlockFragment = nullptr;
LayoutUnit logicalTopPosition = logicalTop();
if (fragment) {
- LayoutUnit offsetFromLogicalTopOfFragment = fragment ? fragment->logicalTopForFragmentedFlowContent() - offsetFromLogicalTopOfFirstPage() : LayoutUnit();
+ LayoutUnit offsetFromLogicalTopOfFragment = fragment ? fragment->logicalTopForFragmentedFlowContent() - offsetFromLogicalTopOfFirstPage() : 0_lu;
logicalTopPosition = std::max(logicalTopPosition, logicalTopPosition + offsetFromLogicalTopOfFragment);
containingBlockFragment = cb->clampToStartAndEndFragments(fragment);
}
@@ -2799,7 +2799,7 @@
// FIXME:: We should probably return something other than just
// border + padding, but for now we have no good way to do anything else
// without layout, so we just use that.
- LogicalExtentComputedValues computedValues = computeLogicalHeight(borderAndPaddingLogicalHeight(), LayoutUnit());
+ LogicalExtentComputedValues computedValues = computeLogicalHeight(borderAndPaddingLogicalHeight(), 0_lu);
return computedValues.m_extent;
}
@@ -2831,7 +2831,7 @@
if (logicalHeightLength.isFillAvailable())
return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadding) - borderAndPadding;
ASSERT_NOT_REACHED();
- return LayoutUnit(0);
+ return 0_lu;
}
std::optional<LayoutUnit> RenderBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heightType, const Length& height, std::optional<LayoutUnit> intrinsicContentHeight) const
@@ -2939,7 +2939,7 @@
if (!availableHeight)
return availableHeight;
- LayoutUnit result = valueForLength(height, availableHeight.value() - rootMarginBorderPaddingHeight + (isTable() && isOutOfFlowPositioned() ? cb->paddingBefore() + cb->paddingAfter() : LayoutUnit()));
+ LayoutUnit result = valueForLength(height, availableHeight.value() - rootMarginBorderPaddingHeight + (isTable() && isOutOfFlowPositioned() ? cb->paddingBefore() + cb->paddingAfter() : 0_lu));
// |overrideContentLogicalHeight| is the maximum height made available by the
// cell to its percent height children when we decide they can determine the
@@ -2950,7 +2950,7 @@
bool subtractBorderAndPadding = isTable() || (is<RenderTableCell>(*cb) && !skippedAutoHeightContainingBlock && cb->hasOverrideContentLogicalHeight());
if (subtractBorderAndPadding) {
result -= borderAndPaddingLogicalHeight();
- return std::max(LayoutUnit(), result);
+ return std::max(0_lu, result);
}
return result;
}
@@ -3001,7 +3001,7 @@
return computeIntrinsicLogicalWidthUsing(logicalWidth, cw, borderAndPaddingLogicalWidth()) - borderAndPaddingLogicalWidth();
if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogicalWidth.isPercentOrCalculated())))
return adjustContentBoxLogicalWidthForBoxSizing(minimumValueForLength(logicalWidth, cw));
- return LayoutUnit();
+ return 0_lu;
}
case Intrinsic:
case MinIntrinsic:
@@ -4330,7 +4330,7 @@
bool ltr = box ? box->isLeftToRightDirection() : style().isLeftToRightDirection();
if ((!caretOffset) ^ ltr)
- rect.move(LayoutSize(width() - caretWidth, 0));
+ rect.move(LayoutSize(width() - caretWidth, 0_lu));
if (box) {
const RootInlineBox& rootBox = box->root();
@@ -4406,9 +4406,9 @@
|| renderer.style().visibility() != Visibility::Visible)
continue;
- LayoutUnit top = renderer.borderTop() + renderer.paddingTop() + (is<RenderTableRow>(*this) ? LayoutUnit() : renderer.y());
+ LayoutUnit top = renderer.borderTop() + renderer.paddingTop() + (is<RenderTableRow>(*this) ? 0_lu : renderer.y());
LayoutUnit bottom = top + renderer.contentHeight();
- LayoutUnit left = renderer.borderLeft() + renderer.paddingLeft() + (is<RenderTableRow>(*this) ? LayoutUnit() : renderer.x());
+ LayoutUnit left = renderer.borderLeft() + renderer.paddingLeft() + (is<RenderTableRow>(*this) ? 0_lu : renderer.x());
LayoutUnit right = left + renderer.contentWidth();
if (point.x() <= right && point.x() >= left && point.y() <= top && point.y() >= bottom) {
diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp
index f54bbfe..96052ea 100644
--- a/Source/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp
@@ -403,11 +403,11 @@
// call availableWidth on our containing block.
if (!style().left().isAuto()) {
if (!style().right().isAuto() && !containingBlock()->style().isLeftToRightDirection())
- offset.setWidth(-valueForLength(style().right(), !style().right().isFixed() ? containingBlock()->availableWidth() : LayoutUnit()));
+ offset.setWidth(-valueForLength(style().right(), !style().right().isFixed() ? containingBlock()->availableWidth() : 0_lu));
else
- offset.expand(valueForLength(style().left(), !style().left().isFixed() ? containingBlock()->availableWidth() : LayoutUnit()), 0);
+ offset.expand(valueForLength(style().left(), !style().left().isFixed() ? containingBlock()->availableWidth() : 0_lu), 0_lu);
} else if (!style().right().isAuto()) {
- offset.expand(-valueForLength(style().right(), !style().right().isFixed() ? containingBlock()->availableWidth() : LayoutUnit()), 0);
+ offset.expand(-valueForLength(style().right(), !style().right().isFixed() ? containingBlock()->availableWidth() : 0_lu), 0_lu);
}
// If the containing block of a relatively positioned element does not
@@ -420,13 +420,13 @@
&& (!style().top().isPercentOrCalculated()
|| !containingBlock()->hasAutoHeightOrContainingBlockWithAutoHeight()
|| containingBlock()->stretchesToViewport()))
- offset.expand(0, valueForLength(style().top(), !style().top().isFixed() ? containingBlock()->availableHeight() : LayoutUnit()));
+ offset.expand(0_lu, valueForLength(style().top(), !style().top().isFixed() ? containingBlock()->availableHeight() : 0_lu));
else if (!style().bottom().isAuto()
&& (!style().bottom().isPercentOrCalculated()
|| !containingBlock()->hasAutoHeightOrContainingBlockWithAutoHeight()
|| containingBlock()->stretchesToViewport()))
- offset.expand(0, -valueForLength(style().bottom(), !style().bottom().isFixed() ? containingBlock()->availableHeight() : LayoutUnit()));
+ offset.expand(0_lu, -valueForLength(style().bottom(), !style().bottom().isFixed() ? containingBlock()->availableHeight() : 0_lu));
return offset;
}
@@ -636,7 +636,7 @@
{
RoundedRect border = style().getRoundedBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge);
if (box && (box->nextLineBox() || box->prevLineBox())) {
- RoundedRect segmentBorder = style().getRoundedBorderFor(LayoutRect(0, 0, inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightEdge);
+ RoundedRect segmentBorder = style().getRoundedBorderFor(LayoutRect(0_lu, 0_lu, inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightEdge);
border.setRadii(segmentBorder.radii());
}
return border;
@@ -678,8 +678,8 @@
{
LayoutRect shrunkRect = rect;
AffineTransform transform = context.getCTM();
- shrunkRect.inflateX(-ceilToDevicePixel(LayoutUnit::fromPixel(1) / transform.xScale(), devicePixelRatio));
- shrunkRect.inflateY(-ceilToDevicePixel(LayoutUnit::fromPixel(1) / transform.yScale(), devicePixelRatio));
+ shrunkRect.inflateX(-ceilToDevicePixel(1_lu / transform.xScale(), devicePixelRatio));
+ shrunkRect.inflateY(-ceilToDevicePixel(1_lu / transform.yScale(), devicePixelRatio));
return shrunkRect;
}
@@ -848,10 +848,10 @@
clipRoundedInnerRect(context, pixelSnappedRect, border.pixelSnappedRoundedRectForPainting(deviceScaleFactor));
}
- LayoutUnit bLeft = includeLeftEdge ? borderLeft() : LayoutUnit::fromPixel(0);
- LayoutUnit bRight = includeRightEdge ? borderRight() : LayoutUnit::fromPixel(0);
- LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : LayoutUnit();
- LayoutUnit pRight = includeRightEdge ? paddingRight() : LayoutUnit();
+ LayoutUnit bLeft = includeLeftEdge ? borderLeft() : 0_lu;
+ LayoutUnit bRight = includeRightEdge ? borderRight() : 0_lu;
+ LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : 0_lu;
+ LayoutUnit pRight = includeRightEdge ? paddingRight() : 0_lu;
GraphicsContextStateSaver clipWithScrollingStateSaver(context, clippedWithLocalScrolling);
LayoutRect scrolledPaintRect = rect;
@@ -874,10 +874,10 @@
// Clip to the padding or content boxes as necessary.
if (!clipToBorderRadius) {
bool includePadding = bgLayer.clip() == FillBox::Content;
- LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : LayoutUnit()),
- scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : LayoutUnit()),
- scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : LayoutUnit()),
- scrolledPaintRect.height() - borderTop() - borderBottom() - (includePadding ? paddingTop() + paddingBottom() : LayoutUnit()));
+ LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : 0_lu),
+ scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : 0_lu),
+ scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : 0_lu),
+ scrolledPaintRect.height() - borderTop() - borderBottom() - (includePadding ? paddingTop() + paddingBottom() : 0_lu));
backgroundClipStateSaver.save();
context.clip(clipRect);
}
@@ -1352,7 +1352,7 @@
if (backgroundRepeatX == FillRepeat::NoRepeat) {
LayoutUnit xOffset = left + computedXPosition;
if (xOffset > 0)
- destinationRect.move(xOffset, 0);
+ destinationRect.move(xOffset, 0_lu);
xOffset = std::min<LayoutUnit>(xOffset, 0);
phase.setWidth(-xOffset);
destinationRect.setWidth(tileSize.width() + xOffset);
@@ -1376,7 +1376,7 @@
if (backgroundRepeatY == FillRepeat::NoRepeat) {
LayoutUnit yOffset = top + computedYPosition;
if (yOffset > 0)
- destinationRect.move(0, yOffset);
+ destinationRect.move(0_lu, yOffset);
yOffset = std::min<LayoutUnit>(yOffset, 0);
phase.setHeight(-yOffset);
destinationRect.setHeight(tileSize.height() + yOffset);
@@ -2421,7 +2421,7 @@
// when painting the shadow. On the other hand, it introduces subpixel gaps along the
// corners. Those are avoided by insetting the clipping path by one pixel.
if (hasOpaqueBackground)
- rectToClipOut.inflateWithRadii(LayoutUnit::fromPixel(-1));
+ rectToClipOut.inflateWithRadii(-1.0f);
if (!rectToClipOut.isEmpty())
context.clipOutRoundedRect(rectToClipOut);
@@ -2447,7 +2447,7 @@
// FIXME: It's not clear if this check is right. What about integral scale factors?
AffineTransform transform = context.getCTM();
if (transform.a() != 1 || (transform.d() != 1 && transform.d() != -1) || transform.b() || transform.c())
- rectToClipOut.inflate(LayoutUnit::fromPixel(-1).toFloat());
+ rectToClipOut.inflate(-1.0f);
}
if (!rectToClipOut.isEmpty())
diff --git a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
index bfe9935..3483cba 100644
--- a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
+++ b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
@@ -415,7 +415,7 @@
// Our first pass is done without flexing. We simply lay the children
// out within the box. We have to do a layout first in order to determine
// our box's intrinsic height.
- LayoutUnit maxAscent = 0, maxDescent = 0;
+ LayoutUnit maxAscent, maxDescent;
for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
if (relayoutChildren)
child->setChildNeedsLayout(MarkOnlyThis);
@@ -650,7 +650,7 @@
remainingSpace -= (remainingSpace/totalChildren);
--totalChildren;
- placeChild(child, child->location() + LayoutSize(offset, 0));
+ placeChild(child, child->location() + LayoutSize(offset, 0_lu));
}
}
} else {
@@ -662,7 +662,7 @@
if (childDoesNotAffectWidthOrFlexing(child))
continue;
- placeChild(child, child->location() + LayoutSize(offset, 0));
+ placeChild(child, child->location() + LayoutSize(offset, 0_lu));
}
}
}
@@ -906,7 +906,7 @@
offset += remainingSpace/totalChildren;
remainingSpace -= (remainingSpace/totalChildren);
--totalChildren;
- placeChild(child, child->location() + LayoutSize(0, offset));
+ placeChild(child, child->location() + LayoutSize(0_lu, offset));
}
}
} else {
@@ -917,7 +917,7 @@
for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
if (childDoesNotAffectWidthOrFlexing(child))
continue;
- placeChild(child, child->location() + LayoutSize(0, offset));
+ placeChild(child, child->location() + LayoutSize(0_lu, offset));
}
}
}
diff --git a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h
index 482d5f0..9013a46 100644
--- a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h
+++ b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.h
@@ -40,7 +40,7 @@
void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0) override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0_lu) override;
void layoutHorizontalBox(bool relayoutChildren);
void layoutVerticalBox(bool relayoutChildren);
diff --git a/Source/WebCore/rendering/RenderElement.cpp b/Source/WebCore/rendering/RenderElement.cpp
index 01f387a..1db56c1 100644
--- a/Source/WebCore/rendering/RenderElement.cpp
+++ b/Source/WebCore/rendering/RenderElement.cpp
@@ -1134,8 +1134,8 @@
LayoutUnit shadowLeft;
LayoutUnit shadowRight;
style().getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
- LayoutUnit borderRight = is<RenderBox>(*this) ? downcast<RenderBox>(*this).borderRight() : LayoutUnit::fromPixel(0);
- LayoutUnit boxWidth = is<RenderBox>(*this) ? downcast<RenderBox>(*this).width() : LayoutUnit();
+ LayoutUnit borderRight = is<RenderBox>(*this) ? downcast<RenderBox>(*this).borderRight() : 0_lu;
+ LayoutUnit boxWidth = is<RenderBox>(*this) ? downcast<RenderBox>(*this).width() : 0_lu;
LayoutUnit minInsetRightShadowExtent = std::min<LayoutUnit>(-insetShadowExtent.right(), std::min(newBounds.width(), oldBounds.width()));
LayoutUnit borderWidth = std::max(borderRight, std::max(valueForLength(style().borderTopRightRadius().width, boxWidth), valueForLength(style().borderBottomRightRadius().width, boxWidth)));
LayoutUnit decorationsWidth = std::max<LayoutUnit>(-outlineStyle.outlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max(outlineWidth, shadowRight);
@@ -1154,8 +1154,8 @@
LayoutUnit shadowTop;
LayoutUnit shadowBottom;
style().getBoxShadowVerticalExtent(shadowTop, shadowBottom);
- LayoutUnit borderBottom = is<RenderBox>(*this) ? downcast<RenderBox>(*this).borderBottom() : LayoutUnit::fromPixel(0);
- LayoutUnit boxHeight = is<RenderBox>(*this) ? downcast<RenderBox>(*this).height() : LayoutUnit();
+ LayoutUnit borderBottom = is<RenderBox>(*this) ? downcast<RenderBox>(*this).borderBottom() : 0_lu;
+ LayoutUnit boxHeight = is<RenderBox>(*this) ? downcast<RenderBox>(*this).height() : 0_lu;
LayoutUnit minInsetBottomShadowExtent = std::min<LayoutUnit>(-insetShadowExtent.bottom(), std::min(newBounds.height(), oldBounds.height()));
LayoutUnit borderHeight = std::max(borderBottom, std::max(valueForLength(style().borderBottomLeftRadius().height, boxHeight),
valueForLength(style().borderBottomRightRadius().height, boxHeight)));
diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp
index 2128583..01bdf07 100644
--- a/Source/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp
@@ -120,8 +120,8 @@
// Due to negative margins, it is possible that we calculated a negative
// intrinsic width. Make sure that we never return a negative width.
- minLogicalWidth = std::max(LayoutUnit(), minLogicalWidth);
- maxLogicalWidth = std::max(LayoutUnit(), maxLogicalWidth);
+ minLogicalWidth = std::max(0_lu, minLogicalWidth);
+ maxLogicalWidth = std::max(0_lu, maxLogicalWidth);
if (hadExcludedChildren) {
minLogicalWidth = std::max(minLogicalWidth, childMinWidth);
@@ -359,7 +359,7 @@
void RenderFlexibleBox::repositionLogicalHeightDependentFlexItems(Vector<LineContext>& lineContexts)
{
- LayoutUnit crossAxisStartEdge = lineContexts.isEmpty() ? LayoutUnit() : lineContexts[0].crossAxisOffset;
+ LayoutUnit crossAxisStartEdge = lineContexts.isEmpty() ? 0_lu : lineContexts[0].crossAxisOffset;
alignFlexLines(lineContexts);
alignChildren(lineContexts);
@@ -512,7 +512,7 @@
auto computedValues = computeLogicalHeight(borderBoxLogicalHeight, logicalTop());
if (computedValues.m_extent == LayoutUnit::max())
return computedValues.m_extent;
- return std::max(LayoutUnit(), computedValues.m_extent - borderPaddingAndScrollbar);
+ return std::max(0_lu, computedValues.m_extent - borderPaddingAndScrollbar);
}
return contentLogicalWidth();
}
@@ -740,7 +740,7 @@
ASSERT(crossSizeLength.isPercentOrCalculated());
crossSize = hasOrthogonalFlow(child) ? adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(crossSizeLength, contentWidth())) : child.computePercentageLogicalHeight(crossSizeLength);
if (!crossSize)
- return LayoutUnit();
+ return 0_lu;
}
const LayoutSize& childIntrinsicSize = child.intrinsicSize();
@@ -821,7 +821,7 @@
Length flexBasis = flexBasisForChild(child);
if (mainAxisLengthIsDefinite(child, flexBasis))
- return std::max(LayoutUnit(), computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis).value());
+ return std::max(0_lu, computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis).value());
// The flex basis is indefinite (=auto), so we need to compute the actual
// width of the child. For the logical width axis we just use the preferred
@@ -918,8 +918,8 @@
LayoutUnit RenderFlexibleBox::autoMarginOffsetInMainAxis(const Vector<FlexItem>& children, LayoutUnit& availableFreeSpace)
{
- if (availableFreeSpace <= LayoutUnit())
- return LayoutUnit();
+ if (availableFreeSpace <= 0_lu)
+ return 0_lu;
int numberOfAutoMargins = 0;
bool isHorizontal = isHorizontalFlow();
@@ -939,16 +939,16 @@
}
}
if (!numberOfAutoMargins)
- return LayoutUnit();
+ return 0_lu;
LayoutUnit sizeOfAutoMargin = availableFreeSpace / numberOfAutoMargins;
- availableFreeSpace = LayoutUnit();
+ availableFreeSpace = 0_lu;
return sizeOfAutoMargin;
}
void RenderFlexibleBox::updateAutoMarginsInMainAxis(RenderBox& child, LayoutUnit autoMarginOffset)
{
- ASSERT(autoMarginOffset >= LayoutUnit());
+ ASSERT(autoMarginOffset >= 0_lu);
if (isHorizontalFlow()) {
if (child.style().marginLeft().isAuto())
@@ -980,7 +980,7 @@
bool RenderFlexibleBox::updateAutoMarginsInCrossAxis(RenderBox& child, LayoutUnit availableAlignmentSpace)
{
ASSERT(!child.isOutOfFlowPositioned());
- ASSERT(availableAlignmentSpace >= LayoutUnit());
+ ASSERT(availableAlignmentSpace >= 0_lu);
bool isHorizontal = isHorizontalFlow();
Length topOrLeft = isHorizontal ? child.style().marginTop() : child.style().marginLeft();
@@ -1079,7 +1079,7 @@
Length min = isHorizontalFlow() ? child.style().minWidth() : child.style().minHeight();
if (min.isSpecifiedOrIntrinsic())
- return std::max(childSize, std::max(LayoutUnit(), computeMainAxisExtentForChild(child, MinSize, min).value_or(childSize)));
+ return std::max(childSize, std::max(0_lu, computeMainAxisExtentForChild(child, MinSize, min).value_or(childSize)));
if (!isFlexibleBoxImpl() && min.isAuto() && mainAxisOverflowForChild(child) == Overflow::Visible && !(isColumnFlow() && is<RenderFlexibleBox>(child))) {
// FIXME: For now, we do not handle min-height: auto for nested
@@ -1115,7 +1115,7 @@
return std::max(childSize, contentSize);
}
- return std::max(LayoutUnit(), childSize);
+ return std::max(0_lu, childSize);
}
std::optional<LayoutUnit> RenderFlexibleBox::crossSizeForPercentageResolution(const RenderBox& child)
@@ -1401,7 +1401,7 @@
LayoutUnit RenderFlexibleBox::staticCrossAxisPositionForPositionedChild(const RenderBox& child)
{
LayoutUnit availableSpace = crossAxisContentExtent() - crossAxisExtentForChild(child);
- return alignmentOffset(availableSpace, alignmentForChild(child), LayoutUnit(), LayoutUnit(), style().flexWrap() == FlexWrap::Reverse);
+ return alignmentOffset(availableSpace, alignmentForChild(child), 0_lu, 0_lu, style().flexWrap() == FlexWrap::Reverse);
}
LayoutUnit RenderFlexibleBox::staticInlinePositionForPositionedChild(const RenderBox& child)
@@ -1479,14 +1479,14 @@
child.updateLogicalHeight();
if (isHorizontalFlow()) {
if (child.style().marginTop().isAuto())
- child.setMarginTop(LayoutUnit());
+ child.setMarginTop(0_lu);
if (child.style().marginBottom().isAuto())
- child.setMarginBottom(LayoutUnit());
+ child.setMarginBottom(0_lu);
} else {
if (child.style().marginLeft().isAuto())
- child.setMarginLeft(LayoutUnit());
+ child.setMarginLeft(0_lu);
if (child.style().marginRight().isAuto())
- child.setMarginRight(LayoutUnit());
+ child.setMarginRight(0_lu);
}
}
}
@@ -1668,7 +1668,7 @@
static LayoutUnit initialAlignContentOffset(LayoutUnit availableFreeSpace, ContentPosition alignContent, ContentDistribution alignContentDistribution, unsigned numberOfLines)
{
if (numberOfLines <= 1)
- return LayoutUnit();
+ return 0_lu;
if (alignContent == ContentPosition::FlexEnd)
return availableFreeSpace;
if (alignContent == ContentPosition::Center)
@@ -1685,7 +1685,7 @@
// Fallback to 'center'
return availableFreeSpace / 2;
}
- return LayoutUnit();
+ return 0_lu;
}
static LayoutUnit alignContentSpaceBetweenChildren(LayoutUnit availableFreeSpace, ContentDistribution alignContentDistribution, unsigned numberOfLines)
@@ -1698,7 +1698,7 @@
if (alignContentDistribution == ContentDistribution::SpaceEvenly)
return availableFreeSpace / (numberOfLines + 1);
}
- return LayoutUnit();
+ return 0_lu;
}
void RenderFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts)
@@ -1741,7 +1741,7 @@
void RenderFlexibleBox::adjustAlignmentForChild(RenderBox& child, LayoutUnit delta)
{
ASSERT(!child.isOutOfFlowPositioned());
- setFlowAwareLocationForChild(child, flowAwareLocationForChild(child) + LayoutSize(LayoutUnit(), delta));
+ setFlowAwareLocationForChild(child, flowAwareLocationForChild(child) + LayoutSize(0_lu, delta));
}
void RenderFlexibleBox::alignChildren(const Vector<LineContext>& lineContexts)
@@ -1761,7 +1761,7 @@
const auto& flexItem = lineContext.flexItems[childNumber];
ASSERT(!flexItem.box.isOutOfFlowPositioned());
- if (updateAutoMarginsInCrossAxis(flexItem.box, std::max(LayoutUnit(), availableAlignmentSpaceForChild(lineCrossAxisExtent, flexItem.box))))
+ if (updateAutoMarginsInCrossAxis(flexItem.box, std::max(0_lu, availableAlignmentSpaceForChild(lineCrossAxisExtent, flexItem.box))))
continue;
ItemPosition position = alignmentForChild(flexItem.box);
@@ -1815,7 +1815,7 @@
if (childNeedsRelayout || !child.hasOverrideContentLogicalHeight())
child.setOverrideContentLogicalHeight(desiredLogicalHeight - child.borderAndPaddingLogicalHeight());
if (childNeedsRelayout) {
- child.setLogicalHeight(LayoutUnit());
+ child.setLogicalHeight(0_lu);
// We cache the child's intrinsic content logical height to avoid it being
// reset to the stretched height.
// FIXME: This is fragile. RendertBoxes should be smart enough to
@@ -1830,7 +1830,7 @@
setCachedChildIntrinsicContentLogicalHeight(child, childIntrinsicContentLogicalHeight);
}
} else if (hasOrthogonalFlow(child) && child.style().logicalWidth().isAuto()) {
- LayoutUnit childWidth = std::max(LayoutUnit(), lineCrossAxisExtent - crossAxisMarginExtentForChild(child));
+ LayoutUnit childWidth = std::max(0_lu, lineCrossAxisExtent - crossAxisMarginExtentForChild(child));
childWidth = child.constrainLogicalWidthInFragmentByMinMax(childWidth, crossAxisContentExtent(), *this, nullptr);
if (childWidth != child.logicalWidth()) {
diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h
index 39d7cf2..79bfeee 100644
--- a/Source/WebCore/rendering/RenderFlexibleBox.h
+++ b/Source/WebCore/rendering/RenderFlexibleBox.h
@@ -50,7 +50,7 @@
bool avoidsFloats() const final { return true; }
bool canDropAnonymousBlockChild() const final { return false; }
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
std::optional<int> firstLineBaseline() const override;
diff --git a/Source/WebCore/rendering/RenderFragmentContainer.cpp b/Source/WebCore/rendering/RenderFragmentContainer.cpp
index 0d446d4..5661f00 100644
--- a/Source/WebCore/rendering/RenderFragmentContainer.cpp
+++ b/Source/WebCore/rendering/RenderFragmentContainer.cpp
@@ -81,7 +81,7 @@
effectiveFixedPointDenominator.setRawValue(1);
if (pointLogicalTop < 0) {
- LayoutPoint pointInThread(0, fragmentedFlowLogicalTop);
+ LayoutPoint pointInThread(0_lu, fragmentedFlowLogicalTop);
return isHorizontalWritingMode() ? pointInThread : pointInThread.transposedPoint();
}
diff --git a/Source/WebCore/rendering/RenderFragmentedFlow.cpp b/Source/WebCore/rendering/RenderFragmentedFlow.cpp
index 0e60594..941da4f 100644
--- a/Source/WebCore/rendering/RenderFragmentedFlow.cpp
+++ b/Source/WebCore/rendering/RenderFragmentedFlow.cpp
@@ -168,7 +168,7 @@
// If the fragments have non-uniform logical widths, then insert inset information for the RenderFragmentedFlow.
for (auto& fragment : m_fragmentList) {
LayoutUnit fragmentLogicalWidth = fragment->pageLogicalWidth();
- LayoutUnit logicalLeft = style().direction() == TextDirection::LTR ? LayoutUnit() : logicalWidth - fragmentLogicalWidth;
+ LayoutUnit logicalLeft = style().direction() == TextDirection::LTR ? 0_lu : logicalWidth - fragmentLogicalWidth;
fragment->setRenderBoxFragmentInfo(this, logicalLeft, fragmentLogicalWidth, false);
}
}
@@ -288,7 +288,7 @@
if (is<RenderBox>(boxModelObject)) {
// Use borderBoxRectInFragment to account for variations such as percentage margins.
LayoutRect borderBoxRect = downcast<RenderBox>(boxModelObject).borderBoxRectInFragment(startFragment, RenderBox::DoNotCacheRenderBoxFragmentInfo);
- referencePoint.move(borderBoxRect.location().x(), 0);
+ referencePoint.move(borderBoxRect.location().x(), 0_lu);
}
// Get the logical top coordinate of the current object.
@@ -314,9 +314,9 @@
// Since the top has been overridden, check if the
// relative/sticky positioning must be reconsidered.
if (boxModelObject.isRelativelyPositioned())
- referencePoint.move(0, boxModelObject.relativePositionOffset().height());
+ referencePoint.move(0_lu, boxModelObject.relativePositionOffset().height());
else if (boxModelObject.isStickilyPositioned())
- referencePoint.move(0, boxModelObject.stickyPositionOffset().height());
+ referencePoint.move(0_lu, boxModelObject.stickyPositionOffset().height());
}
// Since we're looking for the offset relative to the body, we must also
@@ -330,7 +330,7 @@
LayoutUnit RenderFragmentedFlow::pageLogicalTopForOffset(LayoutUnit offset) const
{
RenderFragmentContainer* fragment = fragmentAtBlockOffset(0, offset, false);
- return fragment ? fragment->pageLogicalTopForOffset(offset) : LayoutUnit();
+ return fragment ? fragment->pageLogicalTopForOffset(offset) : 0_lu;
}
LayoutUnit RenderFragmentedFlow::pageLogicalWidthForOffset(LayoutUnit offset) const
@@ -787,7 +787,7 @@
LayoutUnit fragmentLogicalWidth = fragment->pageLogicalWidth();
LayoutUnit fragmentLogicalHeight = std::min<LayoutUnit>(RenderFragmentedFlow::maxLogicalHeight() - logicalHeight, fragment->logicalHeightOfAllFragmentedFlowContent());
- LayoutRect fragmentRect(style().direction() == TextDirection::LTR ? LayoutUnit() : logicalWidth() - fragmentLogicalWidth, logicalHeight, fragmentLogicalWidth, fragmentLogicalHeight);
+ LayoutRect fragmentRect(style().direction() == TextDirection::LTR ? 0_lu : logicalWidth() - fragmentLogicalWidth, logicalHeight, fragmentLogicalWidth, fragmentLogicalHeight);
fragment->setFragmentedFlowPortionRect(isHorizontalWritingMode() ? fragmentRect : fragmentRect.transposedRect());
@@ -852,7 +852,7 @@
LayoutUnit RenderFragmentedFlow::offsetFromLogicalTopOfFirstFragment(const RenderBlock* currentBlock) const
{
// As a last resort, take the slow path.
- LayoutRect blockRect(0, 0, currentBlock->width(), currentBlock->height());
+ LayoutRect blockRect(0_lu, 0_lu, currentBlock->width(), currentBlock->height());
while (currentBlock && !is<RenderView>(*currentBlock) && !currentBlock->isRenderFragmentedFlow()) {
RenderBlock* containerBlock = currentBlock->containingBlock();
ASSERT(containerBlock);
diff --git a/Source/WebCore/rendering/RenderGrid.cpp b/Source/WebCore/rendering/RenderGrid.cpp
index 54a98eb..eef9b88 100644
--- a/Source/WebCore/rendering/RenderGrid.cpp
+++ b/Source/WebCore/rendering/RenderGrid.cpp
@@ -246,8 +246,8 @@
// 2- Next, the track sizing algorithm resolves the sizes of the grid rows,
// using the grid column sizes calculated in the previous step.
if (!hasDefiniteLogicalHeight) {
- m_minContentHeight = LayoutUnit();
- m_maxContentHeight = LayoutUnit();
+ m_minContentHeight = 0_lu;
+ m_maxContentHeight = 0_lu;
computeTrackSizesForIndefiniteSize(m_trackSizingAlgorithm, ForRows, *m_minContentHeight, *m_maxContentHeight);
// FIXME: This should be really added to the intrinsic height in RenderBox::computeContentAndScrollbarLogicalHeightUsing().
// Remove this when that is fixed.
@@ -317,7 +317,7 @@
{
const GapLength& gapLength = direction == ForColumns? style().columnGap() : style().rowGap();
if (gapLength.isNormal())
- return LayoutUnit();
+ return 0_lu;
return valueForLength(gapLength.length(), availableSize.value_or(0));
}
@@ -505,7 +505,7 @@
}
// For the purpose of finding the number of auto-repeated tracks, the UA must floor the track size to a UA-specified
// value to avoid division by zero. It is suggested that this floor be 1px.
- autoRepeatTracksSize = std::max<LayoutUnit>(LayoutUnit(1), autoRepeatTracksSize);
+ autoRepeatTracksSize = std::max<LayoutUnit>(1_lu, autoRepeatTracksSize);
// There will be always at least 1 auto-repeat track, so take it already into account when computing the total track size.
LayoutUnit tracksSize = autoRepeatTracksSize;
@@ -875,7 +875,7 @@
ASSERT(!m_grid.needsItemsPlacement());
bool hasCollapsedTracks = m_grid.hasAutoRepeatEmptyTracks(direction);
- LayoutUnit gap = !hasCollapsedTracks ? gridGap(direction) : LayoutUnit();
+ LayoutUnit gap = !hasCollapsedTracks ? gridGap(direction) : 0_lu;
tracks.reserveCapacity(numPositions - 1);
for (size_t i = 0; i < numPositions - 2; ++i)
tracks.append(positions[i + 1] - positions[i] - offsetBetweenTracks - gap);
@@ -1057,7 +1057,7 @@
if (numberOfLines > 1) {
// If we have collapsed tracks we just ignore gaps here and add them later as we might not
// compute the gap between two consecutive tracks without examining the surrounding ones.
- LayoutUnit gap = !hasCollapsedTracks ? gridGap(direction) : LayoutUnit();
+ LayoutUnit gap = !hasCollapsedTracks ? gridGap(direction) : 0_lu;
unsigned nextToLastLine = numberOfLines - 2;
for (unsigned i = 0; i < nextToLastLine; ++i)
positions[i + 1] = positions[i] + offset.distributionOffset + tracks[i].baseSize() + gap;
@@ -1145,11 +1145,11 @@
bool allowedToStretchChildBlockSize = blockFlowIsColumnAxis ? allowedToStretchChildAlongColumnAxis(child) : allowedToStretchChildAlongRowAxis(child);
if (allowedToStretchChildBlockSize) {
LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBeforeStretching(GridLayoutFunctions::overrideContainingBlockContentSizeForChild(child, childBlockDirection).value(), child);
- LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, LayoutUnit(-1));
+ LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, -1_lu);
child.setOverrideContentLogicalHeight(desiredLogicalHeight - child.borderAndPaddingLogicalHeight());
if (desiredLogicalHeight != child.logicalHeight()) {
// FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905.
- child.setLogicalHeight(LayoutUnit());
+ child.setLogicalHeight(0_lu);
child.setNeedsLayout();
}
}
@@ -1500,7 +1500,7 @@
LayoutUnit RenderGrid::resolveAutoStartGridPosition(GridTrackSizingDirection direction) const
{
if (direction == ForRows || style().isLeftToRightDirection())
- return LayoutUnit();
+ return 0_lu;
int lastLine = numTracks(ForColumns, m_grid);
ContentPosition position = style().resolvedJustifyContentPosition(contentAlignmentNormalBehaviorGrid());
@@ -1508,7 +1508,7 @@
return m_columnPositions[lastLine] - clientLogicalWidth();
if (position == ContentPosition::Start || style().resolvedJustifyContentDistribution(contentAlignmentNormalBehaviorGrid()) == ContentDistribution::Stretch)
return m_columnPositions[0] - borderAndPaddingLogicalLeft();
- return LayoutUnit();
+ return 0_lu;
}
LayoutUnit RenderGrid::resolveAutoEndGridPosition(GridTrackSizingDirection direction) const
@@ -1571,13 +1571,13 @@
end -= isRowAxis ? m_offsetBetweenColumns.distributionOffset : m_offsetBetweenRows.distributionOffset;
}
}
- return std::max(end - start, LayoutUnit());
+ return std::max(end - start, 0_lu);
}
LayoutUnit RenderGrid::logicalOffsetForChild(const RenderBox& child, GridTrackSizingDirection direction, LayoutUnit trackBreadth) const
{
if (hasStaticPositionForChild(child, direction))
- return LayoutUnit();
+ return 0_lu;
bool isRowAxis = direction == ForColumns;
bool isFlowAwareRowAxis = GridLayoutFunctions::flowAwareDirectionForChild(*this, child, direction) == ForColumns;
@@ -1662,8 +1662,8 @@
fallbackPosition = resolveContentDistributionFallback(distribution);
// Initialize to an invalid offset.
- offset.positionOffset = LayoutUnit(-1);
- offset.distributionOffset = LayoutUnit(-1);
+ offset.positionOffset = -1_lu;
+ offset.distributionOffset = -1_lu;
if (availableFreeSpace <= 0)
return;
@@ -1674,7 +1674,7 @@
if (numberOfGridTracks < 2)
return;
distributionOffset = availableFreeSpace / (numberOfGridTracks - 1);
- positionOffset = LayoutUnit();
+ positionOffset = 0_lu;
break;
case ContentDistribution::SpaceAround:
if (numberOfGridTracks < 1)
@@ -1717,8 +1717,8 @@
return;
if (availableFreeSpace <= 0 && contentAlignmentData.overflow() == OverflowAlignment::Safe) {
- offset.positionOffset = LayoutUnit();
- offset.distributionOffset = LayoutUnit();
+ offset.positionOffset = 0_lu;
+ offset.distributionOffset = 0_lu;
return;
}
@@ -1737,21 +1737,21 @@
case ContentPosition::FlexEnd: // Only used in flex layout, for other layout, it's equivalent to 'end'.
case ContentPosition::End:
if (isRowAxis)
- positionOffset = style().isLeftToRightDirection() ? availableFreeSpace : LayoutUnit();
+ positionOffset = style().isLeftToRightDirection() ? availableFreeSpace : 0_lu;
else
positionOffset = availableFreeSpace;
break;
case ContentPosition::FlexStart: // Only used in flex layout, for other layout, it's equivalent to 'start'.
case ContentPosition::Start:
if (isRowAxis)
- positionOffset = style().isLeftToRightDirection() ? LayoutUnit() : availableFreeSpace;
+ positionOffset = style().isLeftToRightDirection() ? 0_lu : availableFreeSpace;
break;
case ContentPosition::Baseline:
case ContentPosition::LastBaseline:
// FIXME: Implement the previous values. For now, we always 'start' align.
// http://webkit.org/b/145566
if (isRowAxis)
- positionOffset = style().isLeftToRightDirection() ? LayoutUnit() : availableFreeSpace;
+ positionOffset = style().isLeftToRightDirection() ? 0_lu : availableFreeSpace;
break;
case ContentPosition::Normal:
default:
@@ -1760,7 +1760,7 @@
}
offset.positionOffset = positionOffset;
- offset.distributionOffset = LayoutUnit();
+ offset.distributionOffset = 0_lu;
}
LayoutUnit RenderGrid::translateOutOfFlowRTLCoordinate(const RenderBox& child, LayoutUnit coordinate) const
diff --git a/Source/WebCore/rendering/RenderGrid.h b/Source/WebCore/rendering/RenderGrid.h
index 7de5fee..20b77df 100644
--- a/Source/WebCore/rendering/RenderGrid.h
+++ b/Source/WebCore/rendering/RenderGrid.h
@@ -56,7 +56,7 @@
Element& element() const { return downcast<Element>(nodeForNonAnonymous()); }
void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override;
bool avoidsFloats() const override { return true; }
bool canDropAnonymousBlockChild() const override { return false; }
diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp
index 2c83490..c2d059b 100644
--- a/Source/WebCore/rendering/RenderImage.cpp
+++ b/Source/WebCore/rendering/RenderImage.cpp
@@ -703,7 +703,7 @@
LayoutUnit RenderImage::minimumReplacedHeight() const
{
- return imageResource().errorOccurred() ? intrinsicSize().height() : LayoutUnit();
+ return imageResource().errorOccurred() ? intrinsicSize().height() : 0_lu;
}
HTMLMapElement* RenderImage::imageMap() const
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp
index ba24169..3aa2553 100644
--- a/Source/WebCore/rendering/RenderLayer.cpp
+++ b/Source/WebCore/rendering/RenderLayer.cpp
@@ -2508,7 +2508,7 @@
RenderBox* box = renderBox();
ASSERT(box);
LayoutRect localExposeRect(box->absoluteToLocalQuad(FloatQuad(FloatRect(absoluteRect))).boundingBox());
- LayoutRect layerBounds(0, 0, box->clientWidth(), box->clientHeight());
+ LayoutRect layerBounds(0_lu, 0_lu, box->clientWidth(), box->clientHeight());
LayoutRect revealRect = getRectToExpose(layerBounds, localExposeRect, insideFixed, options.alignX, options.alignY);
ScrollOffset clampedScrollOffset = clampScrollOffset(scrollOffset() + toIntSize(roundedIntRect(revealRect).location()));
@@ -2755,7 +2755,7 @@
styledElement->setInlineStyleProperty(CSSPropertyMarginLeft, renderer->marginLeft() / zoomFactor, CSSPrimitiveValue::CSS_PX);
styledElement->setInlineStyleProperty(CSSPropertyMarginRight, renderer->marginRight() / zoomFactor, CSSPrimitiveValue::CSS_PX);
}
- LayoutUnit baseWidth = renderer->width() - (isBoxSizingBorder ? LayoutUnit() : renderer->horizontalBorderAndPaddingExtent());
+ LayoutUnit baseWidth = renderer->width() - (isBoxSizingBorder ? 0_lu : renderer->horizontalBorderAndPaddingExtent());
baseWidth = baseWidth / zoomFactor;
styledElement->setInlineStyleProperty(CSSPropertyWidth, roundToInt(baseWidth + difference.width()), CSSPrimitiveValue::CSS_PX);
}
@@ -2766,7 +2766,7 @@
styledElement->setInlineStyleProperty(CSSPropertyMarginTop, renderer->marginTop() / zoomFactor, CSSPrimitiveValue::CSS_PX);
styledElement->setInlineStyleProperty(CSSPropertyMarginBottom, renderer->marginBottom() / zoomFactor, CSSPrimitiveValue::CSS_PX);
}
- LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? LayoutUnit() : renderer->verticalBorderAndPaddingExtent());
+ LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? 0_lu : renderer->verticalBorderAndPaddingExtent());
baseHeight = baseHeight / zoomFactor;
styledElement->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight + difference.height()), CSSPrimitiveValue::CSS_PX);
}
@@ -3771,7 +3771,7 @@
GraphicsContextStateSaver stateSaver(context);
context.clip(absRect);
LayoutRect largerCorner = absRect;
- largerCorner.setSize(LayoutSize(largerCorner.width() + LayoutUnit::fromPixel(1), largerCorner.height() + LayoutUnit::fromPixel(1)));
+ largerCorner.setSize(LayoutSize(largerCorner.width() + 1_lu, largerCorner.height() + 1_lu));
context.setStrokeColor(Color(makeRGB(217, 217, 217)));
context.setStrokeThickness(1.0f);
context.setFillColor(Color::transparent);
diff --git a/Source/WebCore/rendering/RenderListMarker.cpp b/Source/WebCore/rendering/RenderListMarker.cpp
index 71da6d7..495e20f 100644
--- a/Source/WebCore/rendering/RenderListMarker.cpp
+++ b/Source/WebCore/rendering/RenderListMarker.cpp
@@ -1177,8 +1177,8 @@
const RootInlineBox& rootBox = m_inlineBoxWrapper->root();
LayoutUnit newLogicalTop = rootBox.blockFlow().style().isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop();
if (rootBox.blockFlow().style().isHorizontalWritingMode())
- return LayoutRect(0, newLogicalTop, width(), rootBox.selectionHeight());
- return LayoutRect(newLogicalTop, 0, rootBox.selectionHeight(), height());
+ return LayoutRect(0_lu, newLogicalTop, width(), rootBox.selectionHeight());
+ return LayoutRect(newLogicalTop, 0_lu, rootBox.selectionHeight(), height());
}
void RenderListMarker::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
@@ -1385,9 +1385,9 @@
for (auto* ancestor = parentBox(); ancestor && ancestor != &m_listItem; ancestor = ancestor->parentBox())
blockOffset += ancestor->logicalTop();
if (style().isLeftToRightDirection())
- m_lineOffsetForListItem = m_listItem.logicalLeftOffsetForLine(blockOffset, DoNotIndentText, LayoutUnit());
+ m_lineOffsetForListItem = m_listItem.logicalLeftOffsetForLine(blockOffset, DoNotIndentText, 0_lu);
else
- m_lineOffsetForListItem = m_listItem.logicalRightOffsetForLine(blockOffset, DoNotIndentText, LayoutUnit());
+ m_lineOffsetForListItem = m_listItem.logicalRightOffsetForLine(blockOffset, DoNotIndentText, 0_lu);
if (isImage()) {
updateMarginsAndContent();
@@ -1441,7 +1441,7 @@
if (isImage()) {
// FIXME: This is a somewhat arbitrary width. Generated images for markers really won't become particularly useful
// until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box.
- LayoutUnit bulletWidth = style().fontMetrics().ascent() / LayoutUnit(2);
+ LayoutUnit bulletWidth = style().fontMetrics().ascent() / 2_lu;
LayoutSize defaultBulletSize(bulletWidth, bulletWidth);
LayoutSize imageSize = calculateImageIntrinsicDimensions(m_image.get(), defaultBulletSize, DoNotScaleByEffectiveZoom);
m_image->setContainerContextForRenderer(*this, imageSize, style().effectiveZoom());
@@ -1700,7 +1700,7 @@
case ListStyleType::None:
break;
default:
- marginStart = m_text.isEmpty() ? LayoutUnit() : -minPreferredLogicalWidth() - offset / 2;
+ marginStart = m_text.isEmpty() ? 0_lu : -minPreferredLogicalWidth() - offset / 2;
}
}
marginEnd = -marginStart - minPreferredLogicalWidth();
@@ -1907,7 +1907,7 @@
return LayoutRect();
RootInlineBox& rootBox = inlineBoxWrapper()->root();
- LayoutRect rect(0, rootBox.selectionTop() - y(), width(), rootBox.selectionHeight());
+ LayoutRect rect(0_lu, rootBox.selectionTop() - y(), width(), rootBox.selectionHeight());
if (clipToVisibleContent)
return computeRectForRepaint(rect, repaintContainer);
diff --git a/Source/WebCore/rendering/RenderMultiColumnFlow.cpp b/Source/WebCore/rendering/RenderMultiColumnFlow.cpp
index 6afa0dd..0cf7a36 100644
--- a/Source/WebCore/rendering/RenderMultiColumnFlow.cpp
+++ b/Source/WebCore/rendering/RenderMultiColumnFlow.cpp
@@ -260,7 +260,7 @@
if (auto* multicolSet = downcast<RenderMultiColumnSet>(fragmentAtBlockOffset(block, offset))) {
multicolSet->addForcedBreak(offset);
if (offsetBreakAdjustment)
- *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRemainingLogicalHeightForOffset(offset, IncludePageBoundary) : LayoutUnit::fromPixel(0);
+ *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRemainingLogicalHeightForOffset(offset, IncludePageBoundary) : 0_lu;
return true;
}
return false;
@@ -365,9 +365,9 @@
columnRect.setWidth(portionRect.width());
columnSet->flipForWritingMode(columnRect);
if (isHorizontalWritingMode())
- translationOffset.move(0, columnRect.y() - portionRect.y() - physicalDeltaFromPortionBottom);
+ translationOffset.move(0_lu, columnRect.y() - portionRect.y() - physicalDeltaFromPortionBottom);
else
- translationOffset.move(columnRect.x() - portionRect.x() - physicalDeltaFromPortionBottom, 0);
+ translationOffset.move(columnRect.x() - portionRect.x() - physicalDeltaFromPortionBottom, 0_lu);
}
return LayoutSize(translationOffset.x(), translationOffset.y());
diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.cpp b/Source/WebCore/rendering/RenderMultiColumnSet.cpp
index be11be1..1c12ba8 100644
--- a/Source/WebCore/rendering/RenderMultiColumnSet.cpp
+++ b/Source/WebCore/rendering/RenderMultiColumnSet.cpp
@@ -148,7 +148,7 @@
LayoutUnit contentLogicalTop = logicalTop() - multicolBlock.borderAndPaddingBefore();
height -= contentLogicalTop;
- return std::max(height, LayoutUnit::fromPixel(1)); // Let's avoid zero height, as that would probably cause an infinite amount of columns to be created.
+ return std::max(height, 1_lu); // Let's avoid zero height, as that would probably cause an infinite amount of columns to be created.
}
LayoutUnit RenderMultiColumnSet::pageLogicalTopForOffset(LayoutUnit offset) const
@@ -598,9 +598,9 @@
if (fragmentedFlow->progressionIsInline()) {
bool leftToRight = style().isLeftToRightDirection() ^ fragmentedFlow->progressionIsReversed();
- LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentLogicalWidth();
+ LayoutUnit currLogicalLeftOffset = leftToRight ? 0_lu : contentLogicalWidth();
LayoutUnit ruleAdd = logicalLeftOffsetForContent();
- LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogicalWidth();
+ LayoutUnit ruleLogicalLeft = leftToRight ? 0_lu : contentLogicalWidth();
LayoutUnit inlineDirectionSize = computedColumnWidth();
BoxSide boxSide = isHorizontalWritingMode()
? leftToRight ? BSLeft : BSRight
@@ -630,9 +630,9 @@
}
} else {
bool topToBottom = !style().isFlippedBlocksWritingMode() ^ fragmentedFlow->progressionIsReversed();
- LayoutUnit ruleLeft = isHorizontalWritingMode() ? LayoutUnit() : colGap / 2 - colGap - ruleThickness / 2;
+ LayoutUnit ruleLeft = isHorizontalWritingMode() ? 0_lu : colGap / 2 - colGap - ruleThickness / 2;
LayoutUnit ruleWidth = isHorizontalWritingMode() ? contentWidth() : ruleThickness;
- LayoutUnit ruleTop = isHorizontalWritingMode() ? colGap / 2 - colGap - ruleThickness / 2 : LayoutUnit();
+ LayoutUnit ruleTop = isHorizontalWritingMode() ? colGap / 2 - colGap - ruleThickness / 2 : 0_lu;
LayoutUnit ruleHeight = isHorizontalWritingMode() ? ruleThickness : contentHeight();
LayoutRect ruleRect(ruleLeft, ruleTop, ruleWidth, ruleHeight);
@@ -647,7 +647,7 @@
BoxSide boxSide = isHorizontalWritingMode() ? topToBottom ? BSTop : BSBottom : topToBottom ? BSLeft : BSRight;
- LayoutSize step(0, topToBottom ? computedColumnHeight() + colGap : -(computedColumnHeight() + colGap));
+ LayoutSize step(0_lu, topToBottom ? computedColumnHeight() + colGap : -(computedColumnHeight() + colGap));
if (!isHorizontalWritingMode())
step = step.transposedSize();
@@ -785,7 +785,7 @@
// We also need to intersect the dirty rect. We have to apply a translation and shift based off
// our column index.
LayoutSize translationOffset;
- LayoutUnit inlineOffset = progressionIsInline ? i * (colLogicalWidth + colGap) : LayoutUnit();
+ LayoutUnit inlineOffset = progressionIsInline ? i * (colLogicalWidth + colGap) : 0_lu;
bool leftToRight = style().isLeftToRightDirection() ^ progressionReversed;
if (!leftToRight) {
@@ -915,7 +915,7 @@
// no next column, this still maps to just after this column.
else if (point.y() >= gapAndColumnRect.maxY()) {
point = gapAndColumnRect.location();
- point.move(0, gapAndColumnRect.height());
+ point.move(0_lu, gapAndColumnRect.height());
}
} else {
if (point.x() < colRect.x())
@@ -944,7 +944,7 @@
// no next column, this still maps to just after this column.
else if (point.x() >= gapAndColumnRect.maxX()) {
point = gapAndColumnRect.location();
- point.move(gapAndColumnRect.width(), 0);
+ point.move(gapAndColumnRect.width(), 0_lu);
}
} else {
if (point.y() < colRect.y())
diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp
index 5e6a5b5..a0f0839 100644
--- a/Source/WebCore/rendering/RenderReplaced.cpp
+++ b/Source/WebCore/rendering/RenderReplaced.cpp
@@ -435,7 +435,7 @@
LayoutUnit RenderReplaced::computeConstrainedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const
{
if (shouldComputePreferred == ComputePreferred)
- return computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit(), ComputePreferred);
+ return computeReplacedLogicalWidthRespectingMinMaxWidth(0_lu, ComputePreferred);
// The aforementioned 'constraint equation' used for block-level, non-replaced
// elements in normal flow:
@@ -447,7 +447,7 @@
// This solves above equation for 'width' (== logicalWidth).
LayoutUnit marginStart = minimumValueForLength(style().marginStart(), logicalWidth);
LayoutUnit marginEnd = minimumValueForLength(style().marginEnd(), logicalWidth);
- logicalWidth = std::max(LayoutUnit(), (logicalWidth - (marginStart + marginEnd + (size().width() - clientWidth()))));
+ logicalWidth = std::max(0_lu, (logicalWidth - (marginStart + marginEnd + (size().width() - clientWidth()))));
return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, shouldComputePreferred);
}
@@ -633,8 +633,8 @@
const RootInlineBox& rootBox = m_inlineBoxWrapper->root();
LayoutUnit newLogicalTop = rootBox.blockFlow().style().isFlippedBlocksWritingMode() ? m_inlineBoxWrapper->logicalBottom() - rootBox.selectionBottom() : rootBox.selectionTop() - m_inlineBoxWrapper->logicalTop();
if (rootBox.blockFlow().style().isHorizontalWritingMode())
- return LayoutRect(0, newLogicalTop, width(), rootBox.selectionHeight());
- return LayoutRect(newLogicalTop, 0, rootBox.selectionHeight(), height());
+ return LayoutRect(0_lu, newLogicalTop, width(), rootBox.selectionHeight());
+ return LayoutRect(newLogicalTop, 0_lu, rootBox.selectionHeight(), height());
}
void RenderReplaced::setSelectionState(SelectionState state)
diff --git a/Source/WebCore/rendering/RenderReplaced.h b/Source/WebCore/rendering/RenderReplaced.h
index 0de1526..a8db86a 100644
--- a/Source/WebCore/rendering/RenderReplaced.h
+++ b/Source/WebCore/rendering/RenderReplaced.h
@@ -52,7 +52,7 @@
void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const final;
- virtual LayoutUnit minimumReplacedHeight() const { return LayoutUnit(); }
+ virtual LayoutUnit minimumReplacedHeight() const { return 0_lu; }
void setSelectionState(SelectionState) override;
diff --git a/Source/WebCore/rendering/RenderRubyRun.h b/Source/WebCore/rendering/RenderRubyRun.h
index 6516690..14b8e60 100644
--- a/Source/WebCore/rendering/RenderRubyRun.h
+++ b/Source/WebCore/rendering/RenderRubyRun.h
@@ -53,7 +53,7 @@
void layoutExcludedChildren(bool relayoutChildren) override;
void layout() override;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0) override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageHeight = 0_lu) override;
bool isChildAllowed(const RenderObject&, const RenderStyle&) const override;
diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp
index a240403..94e566b 100644
--- a/Source/WebCore/rendering/RenderTable.cpp
+++ b/Source/WebCore/rendering/RenderTable.cpp
@@ -303,19 +303,19 @@
LayoutUnit borders;
bool isCSSTable = !is<HTMLTableElement>(element());
if (isCSSTable && styleLogicalWidth.isSpecified() && styleLogicalWidth.isPositive() && style().boxSizing() == BoxSizing::ContentBox)
- borders = borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit() : paddingStart() + paddingEnd());
+ borders = borderStart() + borderEnd() + (collapseBorders() ? 0_lu : paddingStart() + paddingEnd());
return minimumValueForLength(styleLogicalWidth, availableWidth) + borders;
}
LayoutUnit RenderTable::convertStyleLogicalHeightToComputedHeight(const Length& styleLogicalHeight)
{
- LayoutUnit borderAndPaddingBefore = borderBefore() + (collapseBorders() ? LayoutUnit() : paddingBefore());
- LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders() ? LayoutUnit() : paddingAfter());
+ LayoutUnit borderAndPaddingBefore = borderBefore() + (collapseBorders() ? 0_lu : paddingBefore());
+ LayoutUnit borderAndPaddingAfter = borderAfter() + (collapseBorders() ? 0_lu : paddingAfter());
LayoutUnit borderAndPadding = borderAndPaddingBefore + borderAndPaddingAfter;
if (styleLogicalHeight.isFixed()) {
// HTML tables size as though CSS height includes border/padding, CSS tables do not.
- LayoutUnit borders = LayoutUnit();
+ LayoutUnit borders;
// FIXME: We cannot apply box-sizing: content-box on <table> which other browsers allow.
if (is<HTMLTableElement>(element()) || style().boxSizing() == BoxSizing::BorderBox) {
borders = borderAndPadding;
@@ -327,7 +327,7 @@
return computeIntrinsicLogicalContentHeightUsing(styleLogicalHeight, logicalHeight() - borderAndPadding, borderAndPadding).value_or(0);
else
ASSERT_NOT_REACHED();
- return LayoutUnit();
+ return 0_lu;
}
void RenderTable::layoutCaption(RenderTableCaption& caption)
@@ -457,8 +457,8 @@
movedSectionLogicalTop = std::min(logicalHeight(), oldTableLogicalTop);
}
- LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? LayoutUnit() : paddingBefore());
- LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? LayoutUnit() : paddingAfter());
+ LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0_lu : paddingBefore());
+ LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0_lu : paddingAfter());
setLogicalHeight(logicalHeight() + borderAndPaddingBefore);
@@ -724,11 +724,11 @@
if (style().isHorizontalWritingMode()) {
rect.setHeight(rect.height() - captionLogicalHeight);
if (captionIsBefore)
- rect.move(0, captionLogicalHeight);
+ rect.move(0_lu, captionLogicalHeight);
} else {
rect.setWidth(rect.width() - captionLogicalHeight);
if (captionIsBefore)
- rect.move(captionLogicalHeight, 0);
+ rect.move(captionLogicalHeight, 0_lu);
}
}
@@ -915,7 +915,7 @@
return m_columnOffsetTop;
}
RenderTableSection* section = topNonEmptySection();
- return m_columnOffsetTop = section ? section->offsetTop() : LayoutUnit(0);
+ return m_columnOffsetTop = section ? section->offsetTop() : 0_lu;
}
LayoutUnit RenderTable::offsetLeftForColumn(const RenderTableCol& column) const
diff --git a/Source/WebCore/rendering/RenderTable.h b/Source/WebCore/rendering/RenderTable.h
index 94c751b..9ad6d26 100644
--- a/Source/WebCore/rendering/RenderTable.h
+++ b/Source/WebCore/rendering/RenderTable.h
@@ -204,7 +204,7 @@
LayoutUnit bordersPaddingAndSpacingInRowDirection() const
{
// 'border-spacing' only applies to separate borders (see 17.6.1 The separated borders model).
- return borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit() : (paddingStart() + paddingEnd() + borderSpacingInRowDirection()));
+ return borderStart() + borderEnd() + (collapseBorders() ? 0_lu : (paddingStart() + paddingEnd() + borderSpacingInRowDirection()));
}
// Return the first column or column-group.
diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp
index 09badf9..6655d82 100644
--- a/Source/WebCore/rendering/RenderTableSection.cpp
+++ b/Source/WebCore/rendering/RenderTableSection.cpp
@@ -247,7 +247,7 @@
LayoutUnit baselineDescent;
// Our base size is the biggest logical height from our cells' styles (excluding row spanning cells).
- m_rowPos[r + 1] = std::max(m_rowPos[r] + resolveLogicalHeightForRow(m_grid[r].logicalHeight), LayoutUnit::fromPixel(0));
+ m_rowPos[r + 1] = std::max(m_rowPos[r] + resolveLogicalHeightForRow(m_grid[r].logicalHeight), 0_lu);
Row& row = m_grid[r].row;
unsigned totalCols = row.size();
@@ -318,7 +318,7 @@
// Add the border-spacing to our final position.
// Use table border-spacing even in non-top sections
spacing = table()->vBorderSpacing();
- m_rowPos[r + 1] += m_grid[r].rowRenderer ? spacing : LayoutUnit::fromPixel(0);
+ m_rowPos[r + 1] += m_grid[r].rowRenderer ? spacing : 0_lu;
m_rowPos[r + 1] = std::max(m_rowPos[r + 1], m_rowPos[r]);
}
@@ -391,7 +391,7 @@
LayoutUnit toAdd = std::min<LayoutUnit>(extraLogicalHeight, (totalHeight * m_grid[r].logicalHeight.percent() / 100) - rowHeight);
// If toAdd is negative, then we don't want to shrink the row (this bug
// affected Outlook Web Access).
- toAdd = std::max(LayoutUnit::fromPixel(0), toAdd);
+ toAdd = std::max(0_lu, toAdd);
totalLogicalHeightAdded += toAdd;
extraLogicalHeight -= toAdd;
totalPercent -= m_grid[r].logicalHeight.percent();
@@ -560,7 +560,7 @@
if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) {
// FIXME: the x() position of the row should be table()->hBorderSpacing() so that it can
// report the correct offsetLeft. However, that will require a lot of rebaselining of test results.
- rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r]));
+ rowRenderer->setLocation(LayoutPoint(0_lu, m_rowPos[r]));
rowRenderer->setLogicalWidth(logicalWidth());
rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
rowRenderer->updateLayerTransform();
@@ -1089,42 +1089,42 @@
{
if (style().isHorizontalWritingMode()) {
if (style().isLeftToRightDirection())
- return cell ? cell->x() + cell->width() : LayoutUnit::fromPixel(0);
+ return cell ? cell->x() + cell->width() : 0_lu;
return -outerBorderLeft(&style());
}
bool isLastRow = row + 1 == m_grid.size();
- return rowGroupRect.width() - m_rowPos[row + 1] + (isLastRow ? -outerBorderLeft(&style()) : LayoutUnit::fromPixel(0));
+ return rowGroupRect.width() - m_rowPos[row + 1] + (isLastRow ? -outerBorderLeft(&style()) : 0_lu);
}
LayoutUnit RenderTableSection::offsetTopForRowGroupBorder(RenderTableCell* cell, BoxSide borderSide, unsigned row)
{
bool isLastRow = row + 1 == m_grid.size();
if (style().isHorizontalWritingMode())
- return m_rowPos[row] + (!row && borderSide == BSRight ? -outerBorderTop(&style()) : isLastRow && borderSide == BSLeft ? outerBorderTop(&style()) : LayoutUnit::fromPixel(0));
+ return m_rowPos[row] + (!row && borderSide == BSRight ? -outerBorderTop(&style()) : isLastRow && borderSide == BSLeft ? outerBorderTop(&style()) : 0_lu);
if (style().isLeftToRightDirection())
- return (cell ? cell->y() + cell->height() : LayoutUnit::fromPixel(0)) + (borderSide == BSLeft ? outerBorderTop(&style()) : LayoutUnit::fromPixel(0));
- return borderSide == BSRight ? -outerBorderTop(&style()) : LayoutUnit::fromPixel(0);
+ return (cell ? cell->y() + cell->height() : 0_lu) + (borderSide == BSLeft ? outerBorderTop(&style()) : 0_lu);
+ return borderSide == BSRight ? -outerBorderTop(&style()) : 0_lu;
}
LayoutUnit RenderTableSection::verticalRowGroupBorderHeight(RenderTableCell* cell, const LayoutRect& rowGroupRect, unsigned row)
{
bool isLastRow = row + 1 == m_grid.size();
if (style().isHorizontalWritingMode())
- return m_rowPos[row + 1] - m_rowPos[row] + (!row ? outerBorderTop(&style()) : isLastRow ? outerBorderBottom(&style()) : LayoutUnit::fromPixel(0));
+ return m_rowPos[row + 1] - m_rowPos[row] + (!row ? outerBorderTop(&style()) : isLastRow ? outerBorderBottom(&style()) : 0_lu);
if (style().isLeftToRightDirection())
- return rowGroupRect.height() - (cell ? cell->y() + cell->height() : LayoutUnit::fromPixel(0)) + outerBorderBottom(&style());
- return cell ? rowGroupRect.height() - (cell->y() - cell->height()) : LayoutUnit::fromPixel(0);
+ return rowGroupRect.height() - (cell ? cell->y() + cell->height() : 0_lu) + outerBorderBottom(&style());
+ return cell ? rowGroupRect.height() - (cell->y() - cell->height()) : 0_lu;
}
LayoutUnit RenderTableSection::horizontalRowGroupBorderWidth(RenderTableCell* cell, const LayoutRect& rowGroupRect, unsigned row, unsigned column)
{
if (style().isHorizontalWritingMode()) {
if (style().isLeftToRightDirection())
- return rowGroupRect.width() - (cell ? cell->x() + cell->width() : LayoutUnit::fromPixel(0)) + (!column ? outerBorderLeft(&style()) : column == table()->numEffCols() ? outerBorderRight(&style()) : LayoutUnit::fromPixel(0));
- return cell ? rowGroupRect.width() - (cell->x() - cell->width()) : LayoutUnit::fromPixel(0);
+ return rowGroupRect.width() - (cell ? cell->x() + cell->width() : 0_lu) + (!column ? outerBorderLeft(&style()) : column == table()->numEffCols() ? outerBorderRight(&style()) : 0_lu);
+ return cell ? rowGroupRect.width() - (cell->x() - cell->width()) : 0_lu;
}
bool isLastRow = row + 1 == m_grid.size();
- return m_rowPos[row + 1] - m_rowPos[row] + (isLastRow ? outerBorderLeft(&style()) : !row ? outerBorderRight(&style()) : LayoutUnit::fromPixel(0));
+ return m_rowPos[row + 1] - m_rowPos[row] + (isLastRow ? outerBorderLeft(&style()) : !row ? outerBorderRight(&style()) : 0_lu);
}
void RenderTableSection::paintRowGroupBorderIfRequired(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, unsigned row, unsigned column, BoxSide borderSide, RenderTableCell* cell)
@@ -1137,7 +1137,7 @@
const RenderStyle& style = this->style();
bool antialias = shouldAntialiasLines(paintInfo.context());
LayoutRect rowGroupRect = LayoutRect(paintOffset, size());
- rowGroupRect.moveBy(-LayoutPoint(outerBorderLeft(&style), (borderSide == BSRight) ? LayoutUnit::fromPixel(0) : outerBorderTop(&style)));
+ rowGroupRect.moveBy(-LayoutPoint(outerBorderLeft(&style), (borderSide == BSRight) ? 0_lu : outerBorderTop(&style)));
switch (borderSide) {
case BSTop:
@@ -1565,7 +1565,7 @@
{
LayoutPoint oldCellLocation = cell->location();
- LayoutPoint cellLocation(0, m_rowPos[cell->rowIndex()]);
+ LayoutPoint cellLocation(0_lu, m_rowPos[cell->rowIndex()]);
LayoutUnit horizontalBorderSpacing = table()->hBorderSpacing();
// FIXME: The table's direction should determine our row's direction, not the section's (see bug 96691).
diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp
index 2573903..d65a58d 100644
--- a/Source/WebCore/rendering/RenderTheme.cpp
+++ b/Source/WebCore/rendering/RenderTheme.cpp
@@ -598,7 +598,7 @@
FloatPoint absPoint = muteButtonBox.localToAbsolute(FloatPoint(muteButtonBox.offsetLeft(), y), IsFixed | UseTransforms);
if (absPoint.y() < 0)
y = muteButtonBox.height();
- return LayoutPoint(0, y);
+ return LayoutPoint(0_lu, y);
}
#endif
diff --git a/Source/WebCore/rendering/RenderTreeAsText.cpp b/Source/WebCore/rendering/RenderTreeAsText.cpp
index 1e8664b..8fd301f 100644
--- a/Source/WebCore/rendering/RenderTreeAsText.cpp
+++ b/Source/WebCore/rendering/RenderTreeAsText.cpp
@@ -230,7 +230,7 @@
// FIXME: Temporary in order to ensure compatibility with existing layout test results.
if (adjustForTableCells)
- r.move(0, -downcast<RenderTableCell>(*o.containingBlock()).intrinsicPaddingBefore());
+ r.move(0_lu, -downcast<RenderTableCell>(*o.containingBlock()).intrinsicPaddingBefore());
// FIXME: Convert layout test results to report sub-pixel values, in the meantime using enclosingIntRect
// for consistency with old results.
diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp
index 9357cbc..df479fc 100644
--- a/Source/WebCore/rendering/RenderView.cpp
+++ b/Source/WebCore/rendering/RenderView.cpp
@@ -173,7 +173,7 @@
RenderBox::LogicalExtentComputedValues RenderView::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit) const
{
- return { !shouldUsePrintingLayout() ? LayoutUnit(viewLogicalHeight()) : logicalHeight, LayoutUnit(), ComputedMarginValues() };
+ return { !shouldUsePrintingLayout() ? LayoutUnit(viewLogicalHeight()) : logicalHeight, 0_lu, ComputedMarginValues() };
}
void RenderView::updateLogicalWidth()
@@ -209,7 +209,7 @@
if (shouldUsePrintingLayout()) {
if (!m_pageLogicalSize)
- m_pageLogicalSize = LayoutSize(logicalWidth(), 0);
+ m_pageLogicalSize = LayoutSize(logicalWidth(), 0_lu);
m_minPreferredLogicalWidth = m_pageLogicalSize->width();
m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth;
}
diff --git a/Source/WebCore/rendering/RootInlineBox.h b/Source/WebCore/rendering/RootInlineBox.h
index 379021e..a6795a4 100644
--- a/Source/WebCore/rendering/RootInlineBox.h
+++ b/Source/WebCore/rendering/RootInlineBox.h
@@ -207,7 +207,7 @@
bool includeInitialLetterForBox(InlineBox&) const;
bool includeMarginForBox(InlineBox&) const;
- LayoutUnit lineSnapAdjustment(LayoutUnit delta = 0) const;
+ LayoutUnit lineSnapAdjustment(LayoutUnit delta = 0_lu) const;
LayoutUnit beforeAnnotationsAdjustment() const;
diff --git a/Source/WebCore/rendering/SimpleLineLayout.cpp b/Source/WebCore/rendering/SimpleLineLayout.cpp
index f10fc46..112a7fa 100644
--- a/Source/WebCore/rendering/SimpleLineLayout.cpp
+++ b/Source/WebCore/rendering/SimpleLineLayout.cpp
@@ -607,7 +607,7 @@
bool shouldApplyTextIndent = !flow.isAnonymous() || flow.parent()->firstChild() == &flow;
LayoutUnit height = flow.logicalHeight();
LayoutUnit logicalHeight = flow.minLineHeightForReplacedRenderer(false, 0);
- line.setLogicalLeftOffset(flow.logicalLeftOffsetForLine(height, DoNotIndentText, logicalHeight) + (shouldApplyTextIndent && isFirstLine ? flow.textIndentOffset() : LayoutUnit(0)));
+ line.setLogicalLeftOffset(flow.logicalLeftOffsetForLine(height, DoNotIndentText, logicalHeight) + (shouldApplyTextIndent && isFirstLine ? flow.textIndentOffset() : 0_lu));
float logicalRightOffset = flow.logicalRightOffsetForLine(height, DoNotIndentText, logicalHeight);
line.setAvailableWidth(std::max<float>(0, logicalRightOffset - line.logicalLeftOffset()));
if (style.textAlign == TextAlignMode::Justify)
diff --git a/Source/WebCore/rendering/SimpleLineLayoutPagination.cpp b/Source/WebCore/rendering/SimpleLineLayoutPagination.cpp
index 823e0c3..997dd93 100644
--- a/Source/WebCore/rendering/SimpleLineLayoutPagination.cpp
+++ b/Source/WebCore/rendering/SimpleLineLayoutPagination.cpp
@@ -88,7 +88,7 @@
static LayoutUnit computeOffsetAfterLineBreak(LayoutUnit lineBreakPosition, bool isFirstLine, bool atTheTopOfColumnOrPage, const RenderBlockFlow& flow)
{
// No offset for top of the page lines unless widows pushed the line break.
- LayoutUnit offset = isFirstLine ? flow.borderAndPaddingBefore() : LayoutUnit();
+ LayoutUnit offset = isFirstLine ? flow.borderAndPaddingBefore() : 0_lu;
if (atTheTopOfColumnOrPage)
return offset;
return offset + flow.pageRemainingLogicalHeightForOffset(lineBreakPosition, RenderBlockFlow::ExcludePageBoundary);
@@ -104,8 +104,8 @@
auto orphanDoesNotFit = !style.hasAutoOrphans() && style.orphans() > (short)lineBreakIndex;
if (firstLineDoesNotFit || orphanDoesNotFit) {
auto firstLine = lines.first();
- auto firstLineOverflowRect = computeOverflow(flow, LayoutRect(0, firstLine.top, 0, firstLine.height));
- auto firstLineUpperOverhang = std::max<LayoutUnit>(-firstLineOverflowRect.y(), 0);
+ auto firstLineOverflowRect = computeOverflow(flow, LayoutRect(0_lu, firstLine.top, 0_lu, firstLine.height));
+ auto firstLineUpperOverhang = std::max<LayoutUnit>(-firstLineOverflowRect.y(), 0_lu);
flow.setPaginationStrut(line.top + remainingLogicalHeight + firstLineUpperOverhang);
return;
}
diff --git a/Source/WebCore/rendering/TableLayout.h b/Source/WebCore/rendering/TableLayout.h
index 939e5de..5b6cd01 100644
--- a/Source/WebCore/rendering/TableLayout.h
+++ b/Source/WebCore/rendering/TableLayout.h
@@ -39,7 +39,7 @@
virtual ~TableLayout() = default;
virtual void computeIntrinsicLogicalWidths(LayoutUnit& minWidth, LayoutUnit& maxWidth) = 0;
- virtual LayoutUnit scaledWidthFromPercentColumns() const { return LayoutUnit(0); }
+ virtual LayoutUnit scaledWidthFromPercentColumns() const { return 0_lu; }
virtual void applyPreferredLogicalWidthQuirks(LayoutUnit& minWidth, LayoutUnit& maxWidth) const = 0;
virtual void layout() = 0;
diff --git a/Source/WebCore/rendering/line/BreakingContext.h b/Source/WebCore/rendering/line/BreakingContext.h
index 62f3977..1ba01dd 100644
--- a/Source/WebCore/rendering/line/BreakingContext.h
+++ b/Source/WebCore/rendering/line/BreakingContext.h
@@ -855,7 +855,7 @@
// We need to see if a measurement that excludes the stop would fit. If so, then we should hang
// the stop/comma at the end. First measure including the comma.
m_hangsAtEnd = false;
- float inlineStartWidth = !m_appliedStartWidth ? inlineLogicalWidth(m_current.renderer(), true, false) : LayoutUnit();
+ float inlineStartWidth = !m_appliedStartWidth ? inlineLogicalWidth(m_current.renderer(), true, false) : 0_lu;
float widthIncludingComma = computeAdditionalBetweenWordsWidth(renderText, textLayout, c, wordTrailingSpace, fallbackFonts, wordMeasurements, font, isFixedPitch, lastSpace, lastSpaceWordSpacing, wordSpacingForWordMeasurement, m_current.offset() + 1) + inlineStartWidth;
m_width.addUncommittedWidth(widthIncludingComma);
if (!m_width.fitsOnLine()) {
diff --git a/Source/WebCore/rendering/line/LineLayoutState.h b/Source/WebCore/rendering/line/LineLayoutState.h
index 7b1d6de..792f54a 100644
--- a/Source/WebCore/rendering/line/LineLayoutState.h
+++ b/Source/WebCore/rendering/line/LineLayoutState.h
@@ -144,7 +144,7 @@
m_repaintLogicalTop = m_repaintLogicalBottom = logicalHeight;
}
- void updateRepaintRangeFromBox(RootInlineBox* box, LayoutUnit paginationDelta = 0)
+ void updateRepaintRangeFromBox(RootInlineBox* box, LayoutUnit paginationDelta = 0_lu)
{
m_usesRepaintBounds = true;
m_repaintLogicalTop = std::min(m_repaintLogicalTop, box->logicalTopVisualOverflow() + std::min<LayoutUnit>(paginationDelta, 0));
diff --git a/Source/WebCore/rendering/line/LineWidth.h b/Source/WebCore/rendering/line/LineWidth.h
index 1a5ca30..dbfdb71 100644
--- a/Source/WebCore/rendering/line/LineWidth.h
+++ b/Source/WebCore/rendering/line/LineWidth.h
@@ -61,7 +61,7 @@
bool hasCommitted() const { return m_hasCommitted; }
bool hasCommittedReplaced() const { return m_hasCommittedReplaced; }
- void updateAvailableWidth(LayoutUnit minimumHeight = 0);
+ void updateAvailableWidth(LayoutUnit minimumHeight = 0_lu);
void shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject&);
void addUncommittedWidth(float delta)
{
diff --git a/Source/WebCore/rendering/mathml/MathOperator.cpp b/Source/WebCore/rendering/mathml/MathOperator.cpp
index d628849..a24a266 100644
--- a/Source/WebCore/rendering/mathml/MathOperator.cpp
+++ b/Source/WebCore/rendering/mathml/MathOperator.cpp
@@ -721,7 +721,7 @@
float radicalHorizontalScale = style.isLeftToRightDirection() ? 1 : -1;
if (radicalHorizontalScale == -1 || m_radicalVerticalScale > 1) {
LayoutPoint scaleOrigin = paintOffset;
- scaleOrigin.move(m_width / 2, 0);
+ scaleOrigin.move(m_width / 2, 0_lu);
paintInfo.applyTransform(AffineTransform().translate(scaleOrigin).scale(radicalHorizontalScale, m_radicalVerticalScale).translate(-scaleOrigin));
}
}
diff --git a/Source/WebCore/rendering/mathml/MathOperator.h b/Source/WebCore/rendering/mathml/MathOperator.h
index 735eb6a..bade48a 100644
--- a/Source/WebCore/rendering/mathml/MathOperator.h
+++ b/Source/WebCore/rendering/mathml/MathOperator.h
@@ -88,7 +88,7 @@
void setGlyphAssembly(const RenderStyle&, const GlyphAssemblyData&);
void getMathVariantsWithFallback(const RenderStyle&, bool isVertical, Vector<Glyph>&, Vector<OpenTypeMathData::AssemblyPart>&);
void calculateDisplayStyleLargeOperator(const RenderStyle&);
- void calculateStretchyData(const RenderStyle&, bool calculateMaxPreferredWidth, LayoutUnit targetSize = 0);
+ void calculateStretchyData(const RenderStyle&, bool calculateMaxPreferredWidth, LayoutUnit targetSize = 0_lu);
bool calculateGlyphAssemblyFallback(const Vector<OpenTypeMathData::AssemblyPart>&, GlyphAssemblyData&) const;
LayoutRect paintGlyph(const RenderStyle&, PaintInfo&, const GlyphData&, const LayoutPoint& origin, GlyphPaintTrimming);
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h
index 93926f6..3c4e6de 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h
@@ -75,7 +75,7 @@
}
LayoutUnit mathAxisHeight() const;
- LayoutUnit mirrorIfNeeded(LayoutUnit horizontalOffset, LayoutUnit boxWidth = 0) const;
+ LayoutUnit mirrorIfNeeded(LayoutUnit horizontalOffset, LayoutUnit boxWidth = 0_lu) const;
LayoutUnit mirrorIfNeeded(LayoutUnit horizontalOffset, const RenderBox& child) const { return mirrorIfNeeded(horizontalOffset, child.logicalWidth()); }
static LayoutUnit ascentForChild(const RenderBox& child)
@@ -83,7 +83,7 @@
return child.firstLineBaseline().value_or(child.logicalHeight());
}
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override;
void layoutInvalidMarkup(bool relayoutChildren);
private:
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
index 0a87e45..4958571 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
+++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
@@ -184,11 +184,11 @@
case MathMLFractionElement::FractionAlignmentCenter:
return LayoutUnit((logicalWidth() - child.logicalWidth()) / 2);
case MathMLFractionElement::FractionAlignmentLeft:
- return LayoutUnit(0);
+ return 0_lu;
}
ASSERT_NOT_REACHED();
- return LayoutUnit(0);
+ return 0_lu;
}
LayoutUnit RenderMathMLFraction::ascentOverHorizontalAxis() const
@@ -258,7 +258,7 @@
if (info.context().paintingDisabled() || info.phase != PaintPhase::Foreground || style().visibility() != Visibility::Visible || !isValid() || !thickness)
return;
- IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() + LayoutPoint(0, ascentOverHorizontalAxis()));
+ IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset + location() + LayoutPoint(0_lu, ascentOverHorizontalAxis()));
GraphicsContextStateSaver stateSaver(info.context());
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h
index 3145cd3..5d1d17a 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h
@@ -50,7 +50,7 @@
const char* renderName() const final { return "RenderMathMLFraction"; }
void computePreferredLogicalWidths() final;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
std::optional<int> firstLineBaseline() const final;
void paint(PaintInfo&, const LayoutPoint&) final;
RenderMathMLOperator* unembellishedOperator() const final;
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp b/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp
index e7c5cdf..1736811 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp
+++ b/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp
@@ -50,7 +50,7 @@
centerBlockOffset = -centerBlockOffset;
for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
if (!child->isOutOfFlowPositioned())
- child->setLocation(child->location() + LayoutPoint(centerBlockOffset, 0));
+ child->setLocation(child->location() + LayoutPoint(centerBlockOffset, 0_lu));
}
}
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLMath.h b/Source/WebCore/rendering/mathml/RenderMathMLMath.h
index 6084bce..fbd79fd 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLMath.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLMath.h
@@ -43,7 +43,7 @@
const char* renderName() const final { return "RenderMathMLMath"; }
void centerChildren(LayoutUnit contentWidth);
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
};
}
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h b/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h
index 7855e59..d1de754 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLMenclose.h
@@ -41,7 +41,7 @@
private:
const char* renderName() const final { return "RenderMathMLMenclose"; }
void computePreferredLogicalWidths() final;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
void paint(PaintInfo&, const LayoutPoint&) final;
LayoutUnit ruleThickness() const;
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
index 7777bdb..18bd9cc 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
+++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
@@ -238,7 +238,7 @@
setLogicalWidth(width);
// We then move the children to take spacing into account.
- LayoutPoint horizontalShift(style().direction() == TextDirection::LTR ? leadingSpaceValue : -leadingSpaceValue, 0);
+ LayoutPoint horizontalShift(style().direction() == TextDirection::LTR ? leadingSpaceValue : -leadingSpaceValue, 0_lu);
for (auto* child = firstChildBox(); child; child = child->nextSiblingBox())
child->setLocation(child->location() + horizontalShift);
}
@@ -309,7 +309,7 @@
return;
LayoutPoint operatorTopLeft = paintOffset + location();
- operatorTopLeft.move(style().isLeftToRightDirection() ? leadingSpace() : trailingSpace(), 0);
+ operatorTopLeft.move(style().isLeftToRightDirection() ? leadingSpace() : trailingSpace(), 0_lu);
m_mathOperator.paint(style(), info, operatorTopLeft);
}
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
index 2380dd5..44b52cc 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h
@@ -71,7 +71,7 @@
private:
void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
void computePreferredLogicalWidths() final;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
void paint(PaintInfo&, const LayoutPoint&) final;
const char* renderName() const final { return isAnonymous() ? "RenderMathMLOperator (anonymous)" : "RenderMathMLOperator"; }
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLPadded.h b/Source/WebCore/rendering/mathml/RenderMathMLPadded.h
index 71333e0..0906379 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLPadded.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLPadded.h
@@ -42,7 +42,7 @@
bool isRenderMathMLPadded() const final { return true; }
void computePreferredLogicalWidths() final;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
std::optional<int> firstLineBaseline() const final;
MathMLPaddedElement& element() const { return static_cast<MathMLPaddedElement&>(nodeForNonAnonymous()); }
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp b/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
index 8403956..6bc6ec5 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
+++ b/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
@@ -290,12 +290,12 @@
info.context().setStrokeThickness(ruleThickness);
info.context().setStrokeStyle(SolidStroke);
info.context().setStrokeColor(style().visitedDependentColorWithColorFilter(CSSPropertyColor));
- LayoutPoint ruleOffsetFrom = paintOffset + location() + LayoutPoint(0, m_radicalOperatorTop + ruleThickness / 2);
+ LayoutPoint ruleOffsetFrom = paintOffset + location() + LayoutPoint(0_lu, m_radicalOperatorTop + ruleThickness / 2);
LayoutPoint ruleOffsetTo = ruleOffsetFrom;
horizontalOffset += m_radicalOperator.width();
- ruleOffsetFrom.move(mirrorIfNeeded(horizontalOffset), 0);
+ ruleOffsetFrom.move(mirrorIfNeeded(horizontalOffset), 0_lu);
horizontalOffset += m_baseWidth;
- ruleOffsetTo.move(mirrorIfNeeded(horizontalOffset), 0);
+ ruleOffsetTo.move(mirrorIfNeeded(horizontalOffset), 0_lu);
info.context().drawLine(ruleOffsetFrom, ruleOffsetTo);
}
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRoot.h b/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
index 545fe21..90cae0a 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
@@ -56,7 +56,7 @@
void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
void computePreferredLogicalWidths() final;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
void paint(PaintInfo&, const LayoutPoint&) final;
struct HorizontalParameters {
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRow.h b/Source/WebCore/rendering/mathml/RenderMathMLRow.h
index d38b85f..119d2b91 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLRow.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLRow.h
@@ -41,7 +41,7 @@
MathMLRowElement& element() const;
protected:
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override;
std::optional<int> firstLineBaseline() const override;
void stretchVerticalOperatorsAndLayoutChildren();
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp b/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
index ec9febd..5fb73d2 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
+++ b/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
@@ -192,12 +192,12 @@
case ScriptType::Sub:
case ScriptType::Under:
m_maxPreferredLogicalWidth += reference.base->maxPreferredLogicalWidth();
- m_maxPreferredLogicalWidth += std::max(LayoutUnit(0), reference.firstPostScript->maxPreferredLogicalWidth() - baseItalicCorrection + space);
+ m_maxPreferredLogicalWidth += std::max(0_lu, reference.firstPostScript->maxPreferredLogicalWidth() - baseItalicCorrection + space);
break;
case ScriptType::Super:
case ScriptType::Over:
m_maxPreferredLogicalWidth += reference.base->maxPreferredLogicalWidth();
- m_maxPreferredLogicalWidth += std::max(LayoutUnit(0), reference.firstPostScript->maxPreferredLogicalWidth() + space);
+ m_maxPreferredLogicalWidth += std::max(0_lu, reference.firstPostScript->maxPreferredLogicalWidth() + space);
break;
case ScriptType::SubSup:
case ScriptType::UnderOver:
@@ -215,7 +215,7 @@
while (subScript && subScript != reference.prescriptDelimiter) {
auto supScript = subScript->nextSiblingBox();
ASSERT(supScript);
- LayoutUnit subSupPairWidth = std::max(std::max(LayoutUnit(0), subScript->maxPreferredLogicalWidth() - baseItalicCorrection), supScript->maxPreferredLogicalWidth());
+ LayoutUnit subSupPairWidth = std::max(std::max(0_lu, subScript->maxPreferredLogicalWidth() - baseItalicCorrection), supScript->maxPreferredLogicalWidth());
m_maxPreferredLogicalWidth += subSupPairWidth + space;
subScript = supScript->nextSiblingBox();
}
@@ -380,7 +380,7 @@
switch (scriptType()) {
case ScriptType::Sub:
case ScriptType::Under: {
- setLogicalWidth(reference.base->logicalWidth() + std::max(LayoutUnit(0), reference.firstPostScript->logicalWidth() - baseItalicCorrection + space));
+ setLogicalWidth(reference.base->logicalWidth() + std::max(0_lu, reference.firstPostScript->logicalWidth() - baseItalicCorrection + space));
LayoutPoint baseLocation(mirrorIfNeeded(horizontalOffset, *reference.base), ascent - baseAscent);
reference.base->setLocation(baseLocation);
horizontalOffset += reference.base->logicalWidth();
@@ -391,7 +391,7 @@
break;
case ScriptType::Super:
case ScriptType::Over: {
- setLogicalWidth(reference.base->logicalWidth() + std::max(LayoutUnit(0), reference.firstPostScript->logicalWidth() + space));
+ setLogicalWidth(reference.base->logicalWidth() + std::max(0_lu, reference.firstPostScript->logicalWidth() + space));
LayoutPoint baseLocation(mirrorIfNeeded(horizontalOffset, *reference.base), ascent - baseAscent);
reference.base->setLocation(baseLocation);
horizontalOffset += reference.base->logicalWidth();
@@ -418,7 +418,7 @@
while (subScript && subScript != reference.prescriptDelimiter) {
auto supScript = subScript->nextSiblingBox();
ASSERT(supScript);
- LayoutUnit subSupPairWidth = std::max(std::max(LayoutUnit(0), subScript->logicalWidth() - baseItalicCorrection), supScript->logicalWidth());
+ LayoutUnit subSupPairWidth = std::max(std::max(0_lu, subScript->logicalWidth() - baseItalicCorrection), supScript->logicalWidth());
logicalWidth += subSupPairWidth + space;
subScript = supScript->nextSiblingBox();
}
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLScripts.h b/Source/WebCore/rendering/mathml/RenderMathMLScripts.h
index 7eb3f08..6cc77d8 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLScripts.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLScripts.h
@@ -49,7 +49,7 @@
const char* renderName() const override { return "RenderMathMLScripts"; }
ScriptType scriptType() const;
void computePreferredLogicalWidths() override;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override;
private:
MathMLScriptsElement& element() const;
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSpace.h b/Source/WebCore/rendering/mathml/RenderMathMLSpace.h
index 20cb155..9dcec7b 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLSpace.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLSpace.h
@@ -43,7 +43,7 @@
bool isRenderMathMLSpace() const final { return true; }
bool isChildAllowed(const RenderObject&, const RenderStyle&) const final { return false; }
void computePreferredLogicalWidths() final;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
std::optional<int> firstLineBaseline() const final;
LayoutUnit spaceWidth() const;
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp b/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp
index 38af4c7..5d4166b 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp
+++ b/Source/WebCore/rendering/mathml/RenderMathMLToken.cpp
@@ -607,7 +607,7 @@
GlyphBuffer buffer;
buffer.add(mathVariantGlyph.glyph, mathVariantGlyph.font, mathVariantGlyph.font->widthForGlyph(mathVariantGlyph.glyph));
LayoutUnit glyphAscent = static_cast<int>(lroundf(-mathVariantGlyph.font->boundsForGlyph(mathVariantGlyph.glyph).y()));
- info.context().drawGlyphs(*mathVariantGlyph.font, buffer, 0, 1, paintOffset + location() + LayoutPoint(0, glyphAscent), style().fontCascade().fontDescription().fontSmoothing());
+ info.context().drawGlyphs(*mathVariantGlyph.font, buffer, 0, 1, paintOffset + location() + LayoutPoint(0_lu, glyphAscent), style().fontCascade().fontDescription().fontSmoothing());
}
void RenderMathMLToken::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect)
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLToken.h b/Source/WebCore/rendering/mathml/RenderMathMLToken.h
index b7466f1..9ce8f58 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLToken.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLToken.h
@@ -50,7 +50,7 @@
void paint(PaintInfo&, const LayoutPoint&) override;
void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) override;
std::optional<int> firstLineBaseline() const override;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) override;
void computePreferredLogicalWidths() override;
private:
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h
index e812115..10d1c44 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h
@@ -46,7 +46,7 @@
MathMLUnderOverElement& element() const;
void computePreferredLogicalWidths() final;
- void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0_lu) final;
void stretchHorizontalOperatorsAndLayoutChildren();
bool isValid() const;
diff --git a/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp b/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
index 01aa855..ed4b8a9 100644
--- a/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
+++ b/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp
@@ -169,7 +169,7 @@
const RenderStyle& containingBlockStyle = m_renderer.containingBlock()->style();
WritingMode writingMode = containingBlockStyle.writingMode();
- float margin = floatValueForLength(m_renderer.style().shapeMargin(), m_renderer.containingBlock() ? m_renderer.containingBlock()->contentWidth() : LayoutUnit());
+ float margin = floatValueForLength(m_renderer.style().shapeMargin(), m_renderer.containingBlock() ? m_renderer.containingBlock()->contentWidth() : 0_lu);
float shapeImageThreshold = style.shapeImageThreshold();
const ShapeValue& shapeValue = *style.shapeOutside();
@@ -227,7 +227,7 @@
case CSSBoxType::MarginBox:
return -m_renderer.marginBefore(&m_renderer.containingBlock()->style());
case CSSBoxType::BorderBox:
- return LayoutUnit();
+ return 0_lu;
case CSSBoxType::PaddingBox:
return borderBeforeInWritingMode(m_renderer, m_renderer.containingBlock()->style().writingMode());
case CSSBoxType::ContentBox:
@@ -243,7 +243,7 @@
}
ASSERT_NOT_REACHED();
- return LayoutUnit();
+ return 0_lu;
}
static inline LayoutUnit borderStartWithStyleForWritingMode(const RenderBox& renderer, const RenderStyle& style)
@@ -277,13 +277,13 @@
LayoutUnit ShapeOutsideInfo::logicalLeftOffset() const
{
if (m_renderer.isRenderFragmentContainer())
- return LayoutUnit();
+ return 0_lu;
switch (referenceBox(*m_renderer.style().shapeOutside())) {
case CSSBoxType::MarginBox:
return -m_renderer.marginStart(&m_renderer.containingBlock()->style());
case CSSBoxType::BorderBox:
- return LayoutUnit();
+ return 0_lu;
case CSSBoxType::PaddingBox:
return borderStartWithStyleForWritingMode(m_renderer, m_renderer.containingBlock()->style());
case CSSBoxType::ContentBox:
@@ -299,7 +299,7 @@
}
ASSERT_NOT_REACHED();
- return LayoutUnit();
+ return 0_lu;
}
bool ShapeOutsideInfo::isEnabledFor(const RenderBox& box)
@@ -326,18 +326,18 @@
if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, lineHeight)) {
LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset();
- LayoutUnit floatMarginBoxWidth = std::max<LayoutUnit>(LayoutUnit(), containingBlock.logicalWidthForFloat(floatingObject));
+ LayoutUnit floatMarginBoxWidth = std::max<LayoutUnit>(0_lu, containingBlock.logicalWidthForFloat(floatingObject));
if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, lineHeight)) {
LineSegment segment = computedShape().getExcludedInterval((borderBoxLineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borderBoxLineTop));
if (segment.isValid) {
LayoutUnit logicalLeftMargin = containingBlock.style().isLeftToRightDirection() ? containingBlock.marginStartForChild(m_renderer) : containingBlock.marginEndForChild(m_renderer);
LayoutUnit rawLeftMarginBoxDelta = segment.logicalLeft + logicalLeftOffset() + logicalLeftMargin;
- LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMarginBoxDelta, LayoutUnit(), floatMarginBoxWidth);
+ LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMarginBoxDelta, 0_lu, floatMarginBoxWidth);
LayoutUnit logicalRightMargin = containingBlock.style().isLeftToRightDirection() ? containingBlock.marginEndForChild(m_renderer) : containingBlock.marginStartForChild(m_renderer);
LayoutUnit rawRightMarginBoxDelta = segment.logicalRight + logicalLeftOffset() - containingBlock.logicalWidthForChild(m_renderer) - logicalRightMargin;
- LayoutUnit rightMarginBoxDelta = clampTo<LayoutUnit>(rawRightMarginBoxDelta, -floatMarginBoxWidth, LayoutUnit());
+ LayoutUnit rightMarginBoxDelta = clampTo<LayoutUnit>(rawRightMarginBoxDelta, -floatMarginBoxWidth, 0_lu);
m_shapeOutsideDeltas = ShapeOutsideDeltas(leftMarginBoxDelta, rightMarginBoxDelta, true, borderBoxLineTop, lineHeight);
return m_shapeOutsideDeltas;
diff --git a/Source/WebCore/rendering/style/CollapsedBorderValue.h b/Source/WebCore/rendering/style/CollapsedBorderValue.h
index 7bcb716..ef7607e 100644
--- a/Source/WebCore/rendering/style/CollapsedBorderValue.h
+++ b/Source/WebCore/rendering/style/CollapsedBorderValue.h
@@ -47,7 +47,7 @@
{
}
- LayoutUnit width() const { return style() > BorderStyle::Hidden ? m_width : LayoutUnit::fromPixel(0); }
+ LayoutUnit width() const { return style() > BorderStyle::Hidden ? m_width : 0_lu; }
BorderStyle style() const { return static_cast<BorderStyle>(m_style); }
bool exists() const { return precedence() != BorderPrecedence::Off; }
const Color& color() const { return m_color; }