in preparation for enabling complex font codepath for IFC.
Created attachment 448115 [details] Patch
Comment on attachment 448115 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=448115&action=review > Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:296 > + auto graphemeClustersIterator = NonSharedCharacterBreakIterator { textContent }; > + auto nextPosition = ubrk_following(graphemeClustersIterator, inlineTextItem.start()); > + if (nextPosition == UBRK_DONE) > + return inlineTextItem.length(); > + return nextPosition - inlineTextItem.start(); Isn't it slow to make the iterator repeatedly? Maybe we should cache it or make it in the caller?
Comment on attachment 448115 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=448115&action=review >> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:296 >> + auto graphemeClustersIterator = NonSharedCharacterBreakIterator { textContent }; >> + auto nextPosition = ubrk_following(graphemeClustersIterator, inlineTextItem.start()); >> + if (nextPosition == UBRK_DONE) >> + return inlineTextItem.length(); >> + return nextPosition - inlineTextItem.start(); > > Isn't it slow to make the iterator repeatedly? Maybe we should cache it or make it in the caller? I suppose it is always initialized with a different StringView so there is nothing to cache.
(In reply to Antti Koivisto from comment #3) > Comment on attachment 448115 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=448115&action=review > > >> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:296 > >> + auto graphemeClustersIterator = NonSharedCharacterBreakIterator { textContent }; > >> + auto nextPosition = ubrk_following(graphemeClustersIterator, inlineTextItem.start()); > >> + if (nextPosition == UBRK_DONE) > >> + return inlineTextItem.length(); > >> + return nextPosition - inlineTextItem.start(); > > > > Isn't it slow to make the iterator repeatedly? Maybe we should cache it or make it in the caller? > > I suppose it is always initialized with a different StringView so there is > nothing to cache. Yes. This codepath may be triggered once per line at most. It is also not a highly common case as regular web pages let their inline content fit the container. However it is very much used for testing content breaking (width: 0px).
Committed r287493 (245628@main): <https://commits.webkit.org/245628@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 448115 [details].
<rdar://problem/87028287>