Skip to content

Commit

Permalink
Revert "Cherry-pick 9f7e229. rdar://125853546"
Browse files Browse the repository at this point in the history
This reverts commit f4c9b33.

Identifier: 272448.864@safari-7618-branch
  • Loading branch information
Dan Robson authored and drobson1005 committed Apr 4, 2024
1 parent a1e0326 commit 034eeed
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 72 deletions.

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions Source/WebCore/layout/floats/FloatingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ FloatingContext::Constraints FloatingContext::constraints(LayoutUnit candidateTo
if (!shape->lineOverlapsShapeMarginBounds(positionInShape, candidateHeight))
return { };

// PolygonShape gets confused when passing in 0px height interval at vertices.
auto segment = shape->getExcludedInterval(positionInShape, std::max(candidateHeight, 1_lu));
auto segment = shape->getExcludedInterval(positionInShape, candidateHeight);
if (!segment.isValid)
return { };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void InlineContentBalancer::initialize()
if (numberOfVisibleLinesAllowed && (lineIndex + 1 >= numberOfVisibleLinesAllowed))
break;

layoutRange.start = InlineFormattingUtils::leadingInlineItemPositionForNextLine(lineLayoutResult.inlineItemRange.end, previousLineEnd, !lineLayoutResult.floatContent.hasIntrusiveFloat.isEmpty(), layoutRange.end);
layoutRange.start = InlineFormattingUtils::leadingInlineItemPositionForNextLine(lineLayoutResult.inlineItemRange.end, previousLineEnd, layoutRange.end);
previousLineEnd = layoutRange.start;
previousLine = PreviousLine { lineIndex, lineLayoutResult.contentGeometry.trailingOverflowingContentWidth, !lineLayoutResult.inlineContent.isEmpty() && lineLayoutResult.inlineContent.last().isLineBreak(), !lineLayoutResult.inlineContent.isEmpty(), lineLayoutResult.directionality.inlineBaseDirection, WTFMove(lineLayoutResult.floatContent.suspendedFloats) };
lineIndex++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ InlineLayoutResult InlineFormattingContext::lineLayout(AbstractLineBuilder& line
updateInlineLayoutStateWithLineLayoutResult(lineLayoutResult, lineLogicalRect, floatingContext);

auto lineContentEnd = lineLayoutResult.inlineItemRange.end;
leadingInlineItemPosition = InlineFormattingUtils::leadingInlineItemPositionForNextLine(lineContentEnd, previousLineEnd, !lineLayoutResult.floatContent.hasIntrusiveFloat.isEmpty(), needsLayoutRange.end);
leadingInlineItemPosition = InlineFormattingUtils::leadingInlineItemPositionForNextLine(lineContentEnd, previousLineEnd, needsLayoutRange.end);
auto isLastLine = leadingInlineItemPosition == needsLayoutRange.end && lineLayoutResult.floatContent.suspendedFloats.isEmpty();
if (isLastLine) {
layoutResult.range = !isPartialLayout ? InlineLayoutResult::Range::Full : InlineLayoutResult::Range::FullFromDamage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,22 +284,18 @@ InlineLayoutUnit InlineFormattingUtils::horizontalAlignmentOffset(const RenderSt
return { };
}

InlineItemPosition InlineFormattingUtils::leadingInlineItemPositionForNextLine(InlineItemPosition lineContentEnd, std::optional<InlineItemPosition> previousLineContentEnd, bool lineHasIntrusiveFloat, InlineItemPosition layoutRangeEnd)
InlineItemPosition InlineFormattingUtils::leadingInlineItemPositionForNextLine(InlineItemPosition lineContentEnd, std::optional<InlineItemPosition> previousLineTrailingInlineItemPosition, InlineItemPosition layoutRangeEnd)
{
if (!previousLineContentEnd)
if (!previousLineTrailingInlineItemPosition)
return lineContentEnd;
if (previousLineContentEnd->index < lineContentEnd.index || (previousLineContentEnd->index == lineContentEnd.index && previousLineContentEnd->offset < lineContentEnd.offset)) {
if (previousLineTrailingInlineItemPosition->index < lineContentEnd.index || (previousLineTrailingInlineItemPosition->index == lineContentEnd.index && previousLineTrailingInlineItemPosition->offset < lineContentEnd.offset)) {
// Either full or partial advancing.
return lineContentEnd;
}
if (lineContentEnd == *previousLineContentEnd && lineHasIntrusiveFloat) {
// Couldn't manage to put any content on line due to floats.
if (previousLineTrailingInlineItemPosition->index == lineContentEnd.index && !previousLineTrailingInlineItemPosition->offset && !lineContentEnd.offset) {
// Can't mangage to put any content on line (most likely due to floats). Note that this only applies to full content.
return lineContentEnd;
}
if (lineContentEnd == layoutRangeEnd) {
// End of content.
return layoutRangeEnd;
}
// This looks like a partial content and we are stuck. Let's force-move over to the next inline item.
// We certainly lose some content, but we would be busy looping otherwise.
ASSERT_NOT_REACHED();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class InlineFormattingUtils {

static InlineLayoutUnit horizontalAlignmentOffset(const RenderStyle& rootStyle, InlineLayoutUnit contentLogicalRight, InlineLayoutUnit lineLogicalRight, InlineLayoutUnit hangingTrailingWidth, const Line::RunList& runs, bool isLastLine, std::optional<TextDirection> inlineBaseDirectionOverride = std::nullopt);

static InlineItemPosition leadingInlineItemPositionForNextLine(InlineItemPosition lineContentEnd, std::optional<InlineItemPosition> previousLineContentEnd, bool lineHasIntrusiveFloat, InlineItemPosition layoutRangeEnd);
static InlineItemPosition leadingInlineItemPositionForNextLine(InlineItemPosition lineContentEnd, std::optional<InlineItemPosition> previousLineTrailingInlineItemPosition, InlineItemPosition layoutRangeEnd);

InlineLayoutUnit inlineItemWidth(const InlineItem&, InlineLayoutUnit contentLogicalLeft, bool useFirstLineStyle) const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,11 @@ LineContent LineBuilder::placeInlineAndFloatContent(const InlineItemRange& needs
layoutInlineAndFloatContent();

auto computePlacedInlineItemRange = [&] {
lineContent.range = { needsLayoutRange.start, needsLayoutRange.start };

if (!placedInlineItemCount)
return;

if (placedInlineItemCount == m_placedFloats.size() || !lineContent.partialTrailingContentLength) {
lineContent.range.end = { needsLayoutRange.startIndex() + placedInlineItemCount, { } };
lineContent.range = { needsLayoutRange.start, { needsLayoutRange.startIndex() + placedInlineItemCount, { } } };
if (!placedInlineItemCount || placedInlineItemCount == m_placedFloats.size() || !lineContent.partialTrailingContentLength)
return;
}

auto trailingInlineItemIndex = needsLayoutRange.startIndex() + placedInlineItemCount - 1;
auto trailingInlineItemIndex = lineContent.range.end.index - 1;
auto overflowingInlineTextItemLength = downcast<InlineTextItem>(m_inlineItemList[trailingInlineItemIndex]).length();
ASSERT(lineContent.partialTrailingContentLength && lineContent.partialTrailingContentLength < overflowingInlineTextItemLength);
lineContent.range.end = { trailingInlineItemIndex, overflowingInlineTextItemLength - lineContent.partialTrailingContentLength };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ InlineLayoutUnit IntrinsicWidthHandler::computedIntrinsicWidthForConstraint(Intr
if (lineEndsWithLineBreak)
contentWidthBetweenLineBreaks = { std::max(contentWidthBetweenLineBreaks.maximum, contentWidthBetweenLineBreaks.current), { } };

layoutRange.start = InlineFormattingUtils::leadingInlineItemPositionForNextLine(lineLayoutResult.inlineItemRange.end, previousLineEnd, !lineLayoutResult.floatContent.hasIntrusiveFloat.isEmpty(), layoutRange.end);
layoutRange.start = InlineFormattingUtils::leadingInlineItemPositionForNextLine(lineLayoutResult.inlineItemRange.end, previousLineEnd, layoutRange.end);
if (layoutRange.isEmpty()) {
auto cacheLineBreakingResultForSubsequentLayoutIfApplicable = [&] {
m_maximumIntrinsicWidthResultForSingleLine = { };
Expand Down

0 comments on commit 034eeed

Please sign in to comment.