Modified: trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp (267919 => 267920)
--- trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2020-10-03 06:28:13 UTC (rev 267919)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.cpp 2020-10-03 13:22:26 UTC (rev 267920)
@@ -115,7 +115,9 @@
}
auto length = moveToNextBreakablePosition(currentPosition, lineBreakIterator, style);
- inlineContent.append(InlineTextItem::createNonWhitespaceItem(inlineTextBox, currentPosition, length, inlineItemWidth(currentPosition, length)));
+ ASSERT(length);
+ auto hasTrailingSoftHyphen = text[currentPosition + length - 1] == softHyphen;
+ inlineContent.append(InlineTextItem::createNonWhitespaceItem(inlineTextBox, currentPosition, length, hasTrailingSoftHyphen, inlineItemWidth(currentPosition, length)));
currentPosition += length;
}
}
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.h (267919 => 267920)
--- trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.h 2020-10-03 06:28:13 UTC (rev 267919)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineTextItem.h 2020-10-03 13:22:26 UTC (rev 267920)
@@ -45,6 +45,7 @@
bool isWhitespace() const { return m_textItemType == TextItemType::Whitespace; }
bool isCollapsible() const { return m_isCollapsible; }
+ bool hasTrailingSoftHyphen() const { return m_hasTrailingSoftHyphen; }
Optional<InlineLayoutUnit> width() const { return m_hasWidth ? makeOptional(m_width) : Optional<InlineLayoutUnit> { }; }
bool isEmptyContent() const;
@@ -56,22 +57,22 @@
private:
using InlineItem::TextItemType;
- InlineTextItem(const InlineTextBox&, unsigned start, unsigned length, Optional<InlineLayoutUnit> width, TextItemType);
+ InlineTextItem(const InlineTextBox&, unsigned start, unsigned length, bool hasTrailingSoftHyphen, Optional<InlineLayoutUnit> width, TextItemType);
InlineTextItem(const InlineTextBox&);
static InlineTextItem createWhitespaceItem(const InlineTextBox&, unsigned start, unsigned length, Optional<InlineLayoutUnit> width);
- static InlineTextItem createNonWhitespaceItem(const InlineTextBox&, unsigned start, unsigned length, Optional<InlineLayoutUnit> width);
+ static InlineTextItem createNonWhitespaceItem(const InlineTextBox&, unsigned start, unsigned length, bool hasTrailingSoftHyphen, Optional<InlineLayoutUnit> width);
static InlineTextItem createEmptyItem(const InlineTextBox&);
};
inline InlineTextItem InlineTextItem::createWhitespaceItem(const InlineTextBox& inlineTextBox, unsigned start, unsigned length, Optional<InlineLayoutUnit> width)
{
- return { inlineTextBox, start, length, width, TextItemType::Whitespace };
+ return { inlineTextBox, start, length, false, width, TextItemType::Whitespace };
}
-inline InlineTextItem InlineTextItem::createNonWhitespaceItem(const InlineTextBox& inlineTextBox, unsigned start, unsigned length, Optional<InlineLayoutUnit> width)
+inline InlineTextItem InlineTextItem::createNonWhitespaceItem(const InlineTextBox& inlineTextBox, unsigned start, unsigned length, bool hasTrailingSoftHyphen, Optional<InlineLayoutUnit> width)
{
- return { inlineTextBox, start, length, width, TextItemType::NonWhitespace };
+ return { inlineTextBox, start, length, hasTrailingSoftHyphen, width, TextItemType::NonWhitespace };
}
inline InlineTextItem InlineTextItem::createEmptyItem(const InlineTextBox& inlineTextBox)
@@ -79,12 +80,13 @@
return { inlineTextBox };
}
-inline InlineTextItem::InlineTextItem(const InlineTextBox& inlineTextBox, unsigned start, unsigned length, Optional<InlineLayoutUnit> width, TextItemType textItemType)
+inline InlineTextItem::InlineTextItem(const InlineTextBox& inlineTextBox, unsigned start, unsigned length, bool hasTrailingSoftHyphen, Optional<InlineLayoutUnit> width, TextItemType textItemType)
: InlineItem(inlineTextBox, Type::Text)
{
m_startOrPosition = start;
m_length = length;
m_hasWidth = !!width;
+ m_hasTrailingSoftHyphen = hasTrailingSoftHyphen;
m_isCollapsible = textItemType == TextItemType::Whitespace && inlineTextBox.style().collapseWhiteSpace();
m_width = width.valueOr(0);
m_textItemType = textItemType;
@@ -100,7 +102,7 @@
RELEASE_ASSERT(length <= this->length());
ASSERT(m_textItemType != TextItemType::Undefined);
ASSERT(length);
- return { inlineTextBox(), start(), length, WTF::nullopt, m_textItemType };
+ return { inlineTextBox(), start(), length, false, WTF::nullopt, m_textItemType };
}
inline InlineTextItem InlineTextItem::right(unsigned length) const
@@ -108,7 +110,7 @@
RELEASE_ASSERT(length <= this->length());
ASSERT(m_textItemType != TextItemType::Undefined);
ASSERT(length);
- return { inlineTextBox(), end() - length, length, WTF::nullopt, m_textItemType };
+ return { inlineTextBox(), end() - length, length, hasTrailingSoftHyphen(), WTF::nullopt, m_textItemType };
}
}