WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
234758
[LFC][IFC] Take grapheme clusters into account when keeping the first "character" on the line
https://bugs.webkit.org/show_bug.cgi?id=234758
Summary
[LFC][IFC] Take grapheme clusters into account when keeping the first "charac...
alan
Reported
2021-12-30 19:27:46 PST
in preparation for enabling complex font codepath for IFC.
Attachments
Patch
(13.85 KB, patch)
2021-12-30 19:37 PST
,
alan
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
alan
Comment 1
2021-12-30 19:37:55 PST
Created
attachment 448115
[details]
Patch
Antti Koivisto
Comment 2
2021-12-31 00:47:23 PST
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?
Antti Koivisto
Comment 3
2021-12-31 01:00:32 PST
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.
alan
Comment 4
2021-12-31 06:15:29 PST
(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).
EWS
Comment 5
2021-12-31 06:22:08 PST
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]
.
Radar WebKit Bug Importer
Comment 6
2021-12-31 06:23:18 PST
<
rdar://problem/87028287
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug