Title: [253286] trunk/Source/WebCore
- Revision
- 253286
- Author
- [email protected]
- Date
- 2019-12-09 06:46:16 -0800 (Mon, 09 Dec 2019)
Log Message
[LFC][IFC] Fix fast/text/word-break.html
https://bugs.webkit.org/show_bug.cgi?id=204999
<rdar://problem/57736608>
Reviewed by Antti Koivisto.
Keep at least one character on the line when even the first character overflows and the line is empty.
* layout/inlineformatting/InlineLineBreaker.cpp:
(WebCore::Layout::LineBreaker::breakingContextForInlineContent):
(WebCore::Layout::LineBreaker::Content::firstTextRunIndex const):
* layout/inlineformatting/InlineLineBreaker.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (253285 => 253286)
--- trunk/Source/WebCore/ChangeLog 2019-12-09 14:24:43 UTC (rev 253285)
+++ trunk/Source/WebCore/ChangeLog 2019-12-09 14:46:16 UTC (rev 253286)
@@ -1,3 +1,18 @@
+2019-12-09 Zalan Bujtas <[email protected]>
+
+ [LFC][IFC] Fix fast/text/word-break.html
+ https://bugs.webkit.org/show_bug.cgi?id=204999
+ <rdar://problem/57736608>
+
+ Reviewed by Antti Koivisto.
+
+ Keep at least one character on the line when even the first character overflows and the line is empty.
+
+ * layout/inlineformatting/InlineLineBreaker.cpp:
+ (WebCore::Layout::LineBreaker::breakingContextForInlineContent):
+ (WebCore::Layout::LineBreaker::Content::firstTextRunIndex const):
+ * layout/inlineformatting/InlineLineBreaker.h:
+
2019-12-09 youenn fablet <[email protected]>
fast/mediastream/mediastreamtrack-video-clone.html is a flaky failure
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp (253285 => 253286)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp 2019-12-09 14:24:43 UTC (rev 253285)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.cpp 2019-12-09 14:46:16 UTC (rev 253286)
@@ -79,8 +79,17 @@
if (candidateRuns.hasTextContentOnly()) {
auto& runs = candidateRuns.runs();
- if (auto partialTrailingContent = wordBreakingBehavior(runs, lineStatus.availableWidth))
+ if (auto partialTrailingContent = wordBreakingBehavior(runs, lineStatus.availableWidth)) {
+ // We tried to split the content but the available space can't even accommodate the first character (but we need something on the line).
+ if (lineStatus.lineIsEmpty && !partialTrailingContent->length) {
+ auto firstTextRunIndex = *candidateRuns.firstTextRunIndex();
+ auto& inlineTextItem = downcast<InlineTextItem>(runs[firstTextRunIndex].inlineItem);
+ ASSERT(inlineTextItem.length());
+ auto firstCharacterWidth = TextUtil::width(inlineTextItem.layoutBox(), inlineTextItem.start(), inlineTextItem.start() + 1);
+ partialTrailingContent = BreakingContext::PartialTrailingContent { firstTextRunIndex, 1, firstCharacterWidth, false };
+ }
return { BreakingContext::ContentWrappingRule::Split, partialTrailingContent };
+ }
// If we did not manage to break this content, we still need to decide whether keep it or push it to the next line.
auto contentShouldOverflow = lineStatus.lineIsEmpty || !isContentWrappingAllowed(runs[0]);
// FIXME: white-space: pre-wrap needs clarification. According to CSS Text Module Level 3, content wrapping is as 'normal' but apparently
@@ -324,6 +333,15 @@
return false;
}
+Optional<unsigned> LineBreaker::Content::firstTextRunIndex() const
+{
+ for (size_t index = 0; index < m_continousRuns.size(); ++index) {
+ if (m_continousRuns[index].inlineItem.isText())
+ return index;
+ }
+ return { };
+}
+
bool LineBreaker::Content::hasNonContentRunsOnly() const
{
// <span></span> <- non content runs.
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h (253285 => 253286)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h 2019-12-09 14:24:43 UTC (rev 253285)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBreaker.h 2019-12-09 14:46:16 UTC (rev 253286)
@@ -87,6 +87,8 @@
bool hasTrailingTrimmableContent() const { return !!m_trailingTrimmableContent.width; }
bool isTrailingContentFullyTrimmable() const { return m_trailingTrimmableContent.isFullyTrimmable; }
+ Optional<unsigned> firstTextRunIndex() const;
+
private:
RunList m_continousRuns;
struct TrailingTrimmableContent {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes