Title: [276503] branches/safari-611-branch/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp
- Revision
- 276503
- Author
- [email protected]
- Date
- 2021-04-23 10:04:53 -0700 (Fri, 23 Apr 2021)
Log Message
Apply patch. rdar://problem/76963029
Modified Paths
Diff
Modified: branches/safari-611-branch/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp (276502 => 276503)
--- branches/safari-611-branch/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2021-04-23 16:55:47 UTC (rev 276502)
+++ branches/safari-611-branch/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2021-04-23 17:04:53 UTC (rev 276503)
@@ -87,10 +87,11 @@
return { };
}
-static inline bool isWrappingAllowed(const RenderStyle& style)
+static inline bool isWrappingAllowed(const InlineItem& inlineItem)
{
// Do not try to wrap overflown 'pre' and 'no-wrap' content to next line.
- return style.whiteSpace() != WhiteSpace::Pre && style.whiteSpace() != WhiteSpace::NoWrap;
+ auto& styleToUse = inlineItem.isBox() ? inlineItem.layoutBox().parent().style() : inlineItem.layoutBox().style();
+ return styleToUse.whiteSpace() != WhiteSpace::Pre && styleToUse.whiteSpace() != WhiteSpace::NoWrap;
}
static inline Optional<size_t> lastWrapOpportunityIndex(const InlineContentBreaker::ContinuousContent::RunList& runList)
@@ -102,7 +103,7 @@
// Return #0 as the index where the second continuous content can wrap at.
ASSERT(!runList.isEmpty());
auto lastItemIndex = runList.size() - 1;
- return isWrappingAllowed(runList[lastItemIndex].inlineItem.style()) ? makeOptional(lastItemIndex) : WTF::nullopt;
+ return isWrappingAllowed(runList[lastItemIndex].inlineItem) ? makeOptional(lastItemIndex) : WTF::nullopt;
}
bool InlineContentBreaker::shouldKeepEndOfLineWhitespace(const ContinuousContent& continuousContent) const
@@ -226,20 +227,20 @@
// e.g. <div style="white-space: nowrap">some text<div style="display: inline-block; white-space: pre-wrap"></div></div>.
// While the inline-block has pre-wrap which allows wrapping, the content lives in a nowrap context.
if (lastInlineItem.isBox() || lastInlineItem.isInlineBoxStart() || lastInlineItem.isInlineBoxEnd())
- return isWrappingAllowed(lastInlineItem.layoutBox().parent().style());
+ return isWrappingAllowed(lastInlineItem);
if (lastInlineItem.isText()) {
if (runs.size() == 1) {
// Fast path for the most common case of an individual text item.
- return isWrappingAllowed(lastInlineItem.layoutBox().style());
+ return isWrappingAllowed(lastInlineItem);
}
for (auto& run : WTF::makeReversedRange(runs)) {
auto& inlineItem = run.inlineItem;
if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxStart())
- return isWrappingAllowed(inlineItem.layoutBox().parent().style());
+ return isWrappingAllowed(inlineItem);
ASSERT(!inlineItem.isBox());
}
// This must be a set of individual text runs. We could just check the last item.
- return isWrappingAllowed(lastInlineItem.layoutBox().style());
+ return isWrappingAllowed(lastInlineItem);
}
ASSERT_NOT_REACHED();
return true;
@@ -261,7 +262,7 @@
return false;
}
// Check if this text run needs to stay on the current line.
- return isWrappingAllowed(run.inlineItem.style());
+ return isWrappingAllowed(run.inlineItem);
};
// Check where the overflow occurs and use the corresponding style to figure out the breaking behaviour.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes