RESOLVED FIXED 204953
[LFC][IFC] Paint partial trailing run with hyphen when needed
https://bugs.webkit.org/show_bug.cgi?id=204953
Summary [LFC][IFC] Paint partial trailing run with hyphen when needed
alan
Reported 2019-12-06 11:13:58 PST
ssia
Attachments
Patch (22.61 KB, patch)
2019-12-06 11:24 PST, alan
koivisto: review+
Radar WebKit Bug Importer
Comment 1 2019-12-06 11:14:25 PST
alan
Comment 2 2019-12-06 11:24:29 PST
Antti Koivisto
Comment 3 2019-12-06 11:34:03 PST
Comment on attachment 385028 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=385028&action=review > Source/WebCore/layout/displaytree/DisplayRun.h:48 > - TextContext(unsigned position, unsigned length, const String&, Optional<ExpansionContext> = { }); > + TextContext(unsigned position, unsigned length, const String&, bool needsHyphen = false, Optional<ExpansionContext> = { }); I can't find where you are using the optional constructor parameters. They seem to be set via the setters. Can you remove them? > Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp:514 > + for (auto index = inlineContent.runs.size(); index--;) { > + auto& displayRun = inlineContent.runs[index]; > + if (!displayRun.textContext()) > + continue; > + // This has to be a run on this new line. > + ASSERT(!previousRunCount || index > previousRunCount - 1); Is the assert important? This would be nicer with range-for. > Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp:519 > + break; Not a fan of for loops that don't loop over the body. > Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp:227 > - TextRun textRun { textContext.content(), logicalLeft, horizontalExpansion, behavior }; > + String textWithHyphen; > + if (textContext.needsHyphen()) > + textWithHyphen = makeString(textContext.content(), style.hyphenString()); > + TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContext.content(), logicalLeft, horizontalExpansion, behavior }; Isn't there are FIXME here you remove?
Antti Koivisto
Comment 4 2019-12-06 11:37:22 PST
> Is the assert important? This would be nicer with range-for. that is for (auto& run : WTF::makeReversedRange(inlineContent.runs)) ....
alan
Comment 5 2019-12-06 13:42:25 PST
alan
Comment 6 2019-12-06 13:43:37 PST
(In reply to Antti Koivisto from comment #3) > Comment on attachment 385028 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=385028&action=review > > > Source/WebCore/layout/displaytree/DisplayRun.h:48 > > - TextContext(unsigned position, unsigned length, const String&, Optional<ExpansionContext> = { }); > > + TextContext(unsigned position, unsigned length, const String&, bool needsHyphen = false, Optional<ExpansionContext> = { }); > > I can't find where you are using the optional constructor parameters. They > seem to be set via the setters. Can you remove them? Done. > > > Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp:514 > > + for (auto index = inlineContent.runs.size(); index--;) { > > + auto& displayRun = inlineContent.runs[index]; > > + if (!displayRun.textContext()) > > + continue; > > + // This has to be a run on this new line. > > + ASSERT(!previousRunCount || index > previousRunCount - 1); > > Is the assert important? This would be nicer with range-for. > > > Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp:519 > > + break; > > Not a fan of for loops that don't loop over the body. Not a good practice indeed. I ended up doing it differently by tracking the index of the last text item instead. > > > Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp:227 > > - TextRun textRun { textContext.content(), logicalLeft, horizontalExpansion, behavior }; > > + String textWithHyphen; > > + if (textContext.needsHyphen()) > > + textWithHyphen = makeString(textContext.content(), style.hyphenString()); > > + TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContext.content(), logicalLeft, horizontalExpansion, behavior }; > > Isn't there are FIXME here you remove? Oh right! Removed.
Note You need to log in before you can comment on or make changes to this bug.