Diff
Modified: trunk/Source/WebCore/ChangeLog (285929 => 285930)
--- trunk/Source/WebCore/ChangeLog 2021-11-17 15:08:14 UTC (rev 285929)
+++ trunk/Source/WebCore/ChangeLog 2021-11-17 15:10:51 UTC (rev 285930)
@@ -1,3 +1,23 @@
+2021-11-17 Alan Bujtas <[email protected]>
+
+ [LFC][IFC] break-word is not considered when calculating min-content intrinsic sizes.
+ https://bugs.webkit.org/show_bug.cgi?id=233222
+
+ Reviewed by Antti Koivisto.
+
+ See https://drafts.csswg.org/css-text/#overflow-wrap-property
+
+ * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+ (WebCore::Layout::InlineContentBreaker::InlineContentBreaker):
+ (WebCore::Layout::InlineContentBreaker::wordBreakBehavior const):
+ * layout/formattingContexts/inline/InlineContentBreaker.h:
+ (WebCore::Layout::InlineContentBreaker::isIntrinsicWidthMode const):
+ * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineBuilder::placeInlineContent):
+ (WebCore::Layout::LineBuilder::initialConstraintsForLine const):
+ * layout/formattingContexts/inline/InlineLineBuilder.h:
+ (WebCore::Layout::LineBuilder::isIntrinsicWidthMode const):
+
2021-11-17 Youenn Fablet <[email protected]>
Increase CoreAudioCaptureSource capture verify timer to handle the case of device change
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (285929 => 285930)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp 2021-11-17 15:08:14 UTC (rev 285929)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp 2021-11-17 15:10:51 UTC (rev 285930)
@@ -125,6 +125,11 @@
return { };
}
+InlineContentBreaker::InlineContentBreaker(bool isInIntrinsicWidthMode)
+ : m_isInIntrinsicWidthMode(isInIntrinsicWidthMode)
+{
+}
+
bool InlineContentBreaker::shouldKeepEndOfLineWhitespace(const ContinuousContent& continuousContent) const
{
// Grab the style and check for white-space property to decide whether we should let this whitespace content overflow the current line.
@@ -646,13 +651,16 @@
return *wordBreakRule;
return { };
};
+
+ // Soft wrap opportunities introduced by break-word are not considered when calculating min-content intrinsic sizes.
+ auto breakWordIsApplicable = !isInIntrinsicWidthMode();
// For compatibility with legacy content, the word-break property also supports a deprecated break-word keyword.
// When specified, this has the same effect as word-break: normal and overflow-wrap: anywhere, regardless of the actual value of the overflow-wrap property.
- if (style.wordBreak() == WordBreak::BreakWord && !hasWrapOpportunityAtPreviousPosition)
+ if ((breakWordIsApplicable && style.wordBreak() == WordBreak::BreakWord) && !hasWrapOpportunityAtPreviousPosition)
return includeHyphenationIfAllowed(WordBreakRule::AtArbitraryPosition);
// OverflowWrap::BreakWord/Anywhere An otherwise unbreakable sequence of characters may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line.
// Note that this applies to content where CSS properties (e.g. WordBreak::KeepAll) make it unbreakable.
- if ((style.overflowWrap() == OverflowWrap::BreakWord || style.overflowWrap() == OverflowWrap::Anywhere) && !hasWrapOpportunityAtPreviousPosition)
+ if (((breakWordIsApplicable && style.overflowWrap() == OverflowWrap::BreakWord) || style.overflowWrap() == OverflowWrap::Anywhere) && !hasWrapOpportunityAtPreviousPosition)
return includeHyphenationIfAllowed(WordBreakRule::AtArbitraryPosition);
// Breaking is forbidden within “words”.
if (style.wordBreak() == WordBreak::KeepAll)
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h (285929 => 285930)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h 2021-11-17 15:08:14 UTC (rev 285929)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.h 2021-11-17 15:10:51 UTC (rev 285930)
@@ -38,6 +38,8 @@
class InlineContentBreaker {
public:
+ InlineContentBreaker(bool isInIntrinsicWidthMode);
+
struct PartialRun {
size_t length { 0 };
InlineLayoutUnit logicalWidth { 0 };
@@ -148,7 +150,9 @@
};
OptionSet<WordBreakRule> wordBreakBehavior(const RenderStyle&, bool hasWrapOpportunityAtPreviousPosition) const;
bool shouldKeepEndOfLineWhitespace(const ContinuousContent&) const;
+ bool isInIntrinsicWidthMode() const { return m_isInIntrinsicWidthMode; }
+ bool m_isInIntrinsicWidthMode { false };
bool n_hyphenationIsDisabled { false };
};
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp (285929 => 285930)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp 2021-11-17 15:08:14 UTC (rev 285929)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp 2021-11-17 15:10:51 UTC (rev 285930)
@@ -268,8 +268,8 @@
return boxGeometry.marginBoxWidth();
}
-LineBuilder::LineBuilder(InlineFormattingContext& inlineFormattingContext, FloatingState& floatingState, HorizontalConstraints rootHorizontalConstraints, const InlineItems& inlineItems, IsIntrinsicWidthMode isIntrinsicWidthMode)
- : m_isIntrinsicWidthMode(isIntrinsicWidthMode == IsIntrinsicWidthMode::Yes)
+LineBuilder::LineBuilder(InlineFormattingContext& inlineFormattingContext, FloatingState& floatingState, HorizontalConstraints rootHorizontalConstraints, const InlineItems& inlineItems, IsInIntrinsicWidthMode isInIntrinsicWidthMode)
+ : m_isInIntrinsicWidthMode(isInIntrinsicWidthMode == IsInIntrinsicWidthMode::Yes)
, m_inlineFormattingContext(inlineFormattingContext)
, m_inlineFormattingState(&inlineFormattingContext.formattingState())
, m_floatingState(&floatingState)
@@ -279,8 +279,8 @@
{
}
-LineBuilder::LineBuilder(const InlineFormattingContext& inlineFormattingContext, const InlineItems& inlineItems, IsIntrinsicWidthMode isIntrinsicWidthMode)
- : m_isIntrinsicWidthMode(isIntrinsicWidthMode == IsIntrinsicWidthMode::Yes)
+LineBuilder::LineBuilder(const InlineFormattingContext& inlineFormattingContext, const InlineItems& inlineItems, IsInIntrinsicWidthMode isInIntrinsicWidthMode)
+ : m_isInIntrinsicWidthMode(isInIntrinsicWidthMode == IsInIntrinsicWidthMode::Yes)
, m_inlineFormattingContext(inlineFormattingContext)
, m_line(inlineFormattingContext)
, m_inlineItems(inlineItems)
@@ -392,7 +392,7 @@
LineBuilder::CommittedContent LineBuilder::placeInlineContent(const InlineItemRange& needsLayoutRange)
{
auto lineCandidate = LineCandidate { layoutState().shouldIgnoreTrailingLetterSpacing() };
- auto inlineContentBreaker = InlineContentBreaker { };
+ auto inlineContentBreaker = InlineContentBreaker { isInIntrinsicWidthMode() };
auto currentItemIndex = needsLayoutRange.start;
size_t committedInlineItemCount = 0;
@@ -550,7 +550,7 @@
auto textIndent = root.style().textIndent();
if (textIndent == RenderStyle::initialTextIndent())
return { };
- if (m_isIntrinsicWidthMode && textIndent.isPercent()) {
+ if (isInIntrinsicWidthMode() && textIndent.isPercent()) {
// Percentages must be treated as 0 for the purpose of calculating intrinsic size contributions.
// https://drafts.csswg.org/css-text/#text-indent-property
return { };
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h (285929 => 285930)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h 2021-11-17 15:08:14 UTC (rev 285929)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h 2021-11-17 15:10:51 UTC (rev 285930)
@@ -39,9 +39,9 @@
class LineBuilder {
public:
- enum class IsIntrinsicWidthMode { No, Yes };
- LineBuilder(InlineFormattingContext&, FloatingState&, HorizontalConstraints rootHorizontalConstraints, const InlineItems&, IsIntrinsicWidthMode = IsIntrinsicWidthMode::No);
- LineBuilder(const InlineFormattingContext&, const InlineItems&, IsIntrinsicWidthMode = IsIntrinsicWidthMode::Yes);
+ enum class IsInIntrinsicWidthMode { No, Yes };
+ LineBuilder(InlineFormattingContext&, FloatingState&, HorizontalConstraints rootHorizontalConstraints, const InlineItems&, IsInIntrinsicWidthMode = IsInIntrinsicWidthMode::No);
+ LineBuilder(const InlineFormattingContext&, const InlineItems&, IsInIntrinsicWidthMode = IsInIntrinsicWidthMode::Yes);
struct InlineItemRange {
bool isEmpty() const { return start == end; }
@@ -112,6 +112,8 @@
InlineLayoutUnit inlineItemWidth(const InlineItem&, InlineLayoutUnit contentLogicalLeft) const;
bool isLastLineWithInlineContent(const InlineItemRange& lineRange, size_t lastInlineItemIndex, bool hasPartialTrailingContent) const;
+ bool isInIntrinsicWidthMode() const { return m_isInIntrinsicWidthMode; }
+
const InlineFormattingContext& formattingContext() const { return m_inlineFormattingContext; }
InlineFormattingState* formattingState() { return m_inlineFormattingState; }
FloatingState* floatingState() { return m_floatingState; }
@@ -121,7 +123,7 @@
private:
bool m_isFirstLine { false };
- bool m_isIntrinsicWidthMode { false };
+ bool m_isInIntrinsicWidthMode { false };
const InlineFormattingContext& m_inlineFormattingContext;
InlineFormattingState* m_inlineFormattingState { nullptr };
FloatingState* m_floatingState { nullptr };