haikuwebkit/LayoutTests/fast/inline/hyphenation-when-overflow-w...

12 lines
241 B
HTML
Raw Permalink Normal View History

word-wrap/overflow-wrap "overwrite" hyphens https://bugs.webkit.org/show_bug.cgi?id=222548 <rdar://problem/75061741> Reviewed by Antti Koivisto. Source/WebCore: According to https://drafts.csswg.org/css-text-3/#overflow-wrap-property "overflow-wrap/word-wrap property specifies whether the UA may break at otherwise disallowed points within a line to prevent overflow, when an otherwise-unbreakable string is too long to fit within the line box." which means that in case of "hyphen: auto", we should only try to break the content at arbitrary position when there's no prior hyphenation opportunity. This patch turns WordBreakRule into and OptionSet so that we can put both the hyphenation and arbitrary position break runles in there and prioritize them in tryBreakingTextRun (check for the hyphenation value first/break the content at hyphenation position and do arbitrary position only if no hyphenation opportunities are found). Test: fast/inline/hyphenation-when-overflow-wrap-is-break-word.html * layout/inlineformatting/InlineContentBreaker.cpp: (WebCore::Layout::InlineContentBreaker::wordBreakBehavior const): (WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const): * layout/inlineformatting/InlineContentBreaker.h: LayoutTests: * fast/inline/hyphenation-when-overflow-wrap-is-break-word-expected.html: Added. * fast/inline/hyphenation-when-overflow-wrap-is-break-word.html: Added. Canonical link: https://commits.webkit.org/234946@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-05 22:31:07 +00:00
<style>
div {
font-size: 16px;
border: 1px solid green;
width: 50px;
-webkit-hyphens: auto;
word-wrap: break-word;
overflow-wrap: break-word;
}
</style>
<div>Automatic hyphenation opportunities override arbitrary positions</div>