Title: [267944] trunk/Source/WebCore
- Revision
- 267944
- Author
- za...@apple.com
- Date
- 2020-10-04 05:13:06 -0700 (Sun, 04 Oct 2020)
Log Message
[LFC][IFC][Soft hyphen] endsWithSoftWrapOpportunity should check if hyphenation is disabled
https://bugs.webkit.org/show_bug.cgi?id=217288
Reviewed by Antti Koivisto.
This is very similar InlineTextItem::createAndAppendTextItems where we
also construct a LazyLineBreakIterator to check for word wrap opportunities.
* layout/inlineformatting/InlineContentBreaker.cpp:
(WebCore::Layout::isTextContent): The trailing "only" is misleading since we can't have a mixture of text and non-text content
within a continuous content (there's always a word wrap opportunity between a text and a non-text content).
(WebCore::Layout::isVisuallyEmptyWhitespaceContent):
(WebCore::Layout::InlineContentBreaker::processInlineContent):
(WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
(WebCore::Layout::isTextContentOnly): Deleted.
(WebCore::Layout::isVisuallyEmptyWhitespaceContentOnly): Deleted.
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::endsWithSoftWrapOpportunity):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (267943 => 267944)
--- trunk/Source/WebCore/ChangeLog 2020-10-04 11:37:57 UTC (rev 267943)
+++ trunk/Source/WebCore/ChangeLog 2020-10-04 12:13:06 UTC (rev 267944)
@@ -1,3 +1,24 @@
+2020-10-04 Zalan Bujtas <za...@apple.com>
+
+ [LFC][IFC][Soft hyphen] endsWithSoftWrapOpportunity should check if hyphenation is disabled
+ https://bugs.webkit.org/show_bug.cgi?id=217288
+
+ Reviewed by Antti Koivisto.
+
+ This is very similar InlineTextItem::createAndAppendTextItems where we
+ also construct a LazyLineBreakIterator to check for word wrap opportunities.
+
+ * layout/inlineformatting/InlineContentBreaker.cpp:
+ (WebCore::Layout::isTextContent): The trailing "only" is misleading since we can't have a mixture of text and non-text content
+ within a continuous content (there's always a word wrap opportunity between a text and a non-text content).
+ (WebCore::Layout::isVisuallyEmptyWhitespaceContent):
+ (WebCore::Layout::InlineContentBreaker::processInlineContent):
+ (WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
+ (WebCore::Layout::isTextContentOnly): Deleted.
+ (WebCore::Layout::isVisuallyEmptyWhitespaceContentOnly): Deleted.
+ * layout/inlineformatting/InlineLineBuilder.cpp:
+ (WebCore::Layout::endsWithSoftWrapOpportunity):
+
2020-10-04 Youenn Fablet <you...@apple.com>
Make sure MediaRecorder does not call fetchData until the last fetchData is completed
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp (267943 => 267944)
--- trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2020-10-04 11:37:57 UTC (rev 267943)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp 2020-10-04 12:13:06 UTC (rev 267944)
@@ -37,7 +37,7 @@
namespace WebCore {
namespace Layout {
-static inline bool isTextContentOnly(const InlineContentBreaker::ContinuousContent& continuousContent)
+static inline bool isTextContent(const InlineContentBreaker::ContinuousContent& continuousContent)
{
// <span>text</span> is considered a text run even with the [container start][container end] inline items.
// Due to commit boundary rules, we just need to check the first non-typeless inline item (can't have both [img] and [text])
@@ -50,7 +50,7 @@
return false;
}
-static inline bool isVisuallyEmptyWhitespaceContentOnly(const InlineContentBreaker::ContinuousContent& continuousContent)
+static inline bool isVisuallyEmptyWhitespaceContent(const InlineContentBreaker::ContinuousContent& continuousContent)
{
// [<span></span> ] [<span> </span>] [ <span style="padding: 0px;"></span>] are all considered visually empty whitespace content.
// [<span style="border: 1px solid red"></span> ] while this is whitespace content only, it is not considered visually empty.
@@ -170,7 +170,7 @@
}
}
} else if (result.action == Result::Action::Wrap) {
- if (lineStatus.trailingSoftHyphenWidth && isTextContentOnly(candidateContent)) {
+ if (lineStatus.trailingSoftHyphenWidth && isTextContent(candidateContent)) {
// A trailing soft hyphen with a wrapped text content turns into a visible hyphen.
// Let's check if there's enough space for the hyphen character.
auto hyphenOverflows = *lineStatus.trailingSoftHyphenWidth > lineStatus.availableWidth;
@@ -194,7 +194,7 @@
ASSERT(continuousContent.logicalWidth() > lineStatus.availableWidth);
if (continuousContent.hasTrailingCollapsibleContent()) {
- ASSERT(isTextContentOnly(continuousContent));
+ ASSERT(isTextContent(continuousContent));
auto IsEndOfLine = isContentWrappingAllowed(continuousContent) ? IsEndOfLine::Yes : IsEndOfLine::No;
// First check if the content fits without the trailing collapsible part.
if (continuousContent.nonCollapsibleLogicalWidth() <= lineStatus.availableWidth)
@@ -210,13 +210,13 @@
if (continuousContent.logicalWidth() <= lineStatus.availableWidth + lineStatus.collapsibleWidth)
return { Result::Action::Keep };
}
- if (isVisuallyEmptyWhitespaceContentOnly(continuousContent) && shouldKeepEndOfLineWhitespace(continuousContent)) {
+ if (isVisuallyEmptyWhitespaceContent(continuousContent) && shouldKeepEndOfLineWhitespace(continuousContent)) {
// This overflowing content apparently falls into the remove/hang end-of-line-spaces category.
// see https://www.w3.org/TR/css-text-3/#white-space-property matrix
return { Result::Action::Keep };
}
- if (isTextContentOnly(continuousContent)) {
+ if (isTextContent(continuousContent)) {
if (auto trailingContent = processOverflowingTextContent(continuousContent, lineStatus)) {
if (!trailingContent->runIndex && trailingContent->hasOverflow) {
// We tried to break the content but the available space can't even accommodate the first character.
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (267943 => 267944)
--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-10-04 11:37:57 UTC (rev 267943)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp 2020-10-04 12:13:06 UTC (rev 267944)
@@ -34,6 +34,7 @@
#include "LayoutBoxGeometry.h"
#include "LayoutState.h"
#include "TextUtil.h"
+#include <wtf/unicode/CharacterNames.h>
namespace WebCore {
namespace Layout {
@@ -56,6 +57,8 @@
auto previousContentLength = previousContent.length();
// FIXME: We should look into the entire uncommitted content for more text context.
UChar lastCharacter = previousContentLength ? previousContent[previousContentLength - 1] : 0;
+ if (lastCharacter == softHyphen && currentTextItem.style().hyphens() == Hyphens::None)
+ return false;
UChar secondToLastCharacter = previousContentLength > 1 ? previousContent[previousContentLength - 2] : 0;
lineBreakIterator.setPriorContext(lastCharacter, secondToLastCharacter);
// Now check if we can break right at the inline item boundary.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes