RESOLVED FIXED 167446
Simple line layout: Add support for -webkit-hyphenate-limit-lines
https://bugs.webkit.org/show_bug.cgi?id=167446
Summary Simple line layout: Add support for -webkit-hyphenate-limit-lines
alan
Reported 2017-01-25 19:32:19 PST
Attachments
WIP patch (10.19 KB, patch)
2017-01-25 21:09 PST, alan
no flags
Patch (25.78 KB, patch)
2017-01-26 11:13 PST, alan
no flags
Patch (30.06 KB, patch)
2017-01-26 12:42 PST, alan
no flags
alan
Comment 1 2017-01-25 21:09:21 PST
Created attachment 299791 [details] WIP patch WIP patch.
alan
Comment 2 2017-01-26 11:13:36 PST
Antti Koivisto
Comment 3 2017-01-26 11:24:21 PST
Comment on attachment 299822 [details] Patch r=me
Antti Koivisto
Comment 4 2017-01-26 11:30:35 PST
Comment on attachment 299822 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299822&action=review > Source/WebCore/rendering/SimpleLineLayout.cpp:651 > + bool shouldHyphenate = style.shouldHyphenate && (!style.hyphenLimitLines || fragmentToSplit.wrappingWithHyphenCounter() < *style.hyphenLimitLines); > + if (shouldHyphenate && enoughWidthForHyphenation(availableWidth, style.font.pixelSize())) { > + // We might be able to fit the hyphen at the split position. > + auto splitPositionWithHyphen = splitPosition; > + // Find a splitting position where hyphen surely fits. > + auto leftSideWidth = textFragmentIterator.textWidth(start, splitPosition, 0); > + while (leftSideWidth + style.hyphenStringWidth > availableWidth) { > + if (--splitPositionWithHyphen <= start) > + break; // No space for hyphen. > + leftSideWidth -= textFragmentIterator.textWidth(splitPositionWithHyphen, splitPositionWithHyphen + 1, 0); > + } > + if (splitPositionWithHyphen > start) { > + if (auto hyphenPosition = textFragmentIterator.lastHyphenPosition(fragmentToSplit, splitPositionWithHyphen + 1)) > + return fragmentToSplit.splitWithHyphen(*hyphenPosition, textFragmentIterator); > + } > } Maybe the hyphenation branch could go to a helper function?
alan
Comment 5 2017-01-26 12:42:46 PST
WebKit Commit Bot
Comment 6 2017-01-26 13:20:57 PST
Comment on attachment 299835 [details] Patch Clearing flags on attachment: 299835 Committed r211228: <http://trac.webkit.org/changeset/211228>
WebKit Commit Bot
Comment 7 2017-01-26 13:21:01 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.