[Webkit-unassigned] [Bug 181315] ::first-letter incorrectly selects grapheme pairs

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 8 12:32:06 PST 2018


--- Comment #26 from Chris Nardi <christopherncarmel at hotmail.com> ---
Comment on attachment 330650
  --> https://bugs.webkit.org/attachment.cgi?id=330650

View in context: https://bugs.webkit.org/attachment.cgi?id=330650&action=review

>> Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp:240
>> +                scanLength += numCharacters - 1;
> The is a strange way to write the loop. I would instead suggest either:
> 1) Removing the ++scanLength from the for loop above and instead writing this here:
>     scanLength += numCharacters;
> or
> 2) Defining numCharacters before the loop so it can be used in the for loop and then writing:
>     for (unsigned scanLength = length; scanLength < oldText.length(); scanLength += numCharacters)
> Also seems that numCharacters and numCharacterInGraphemeClusters are both not great names. Since these are "code units", not "characters". Should be numCodeUnitsInGraphemeClusters and numCodeUnits. Someone should come back and rename.

I implemented your second suggestion. I did not change the function name or the variable name; I figured that would be better with another patch.

I also added my proposed WPT testcase as I realized that it could just be reviewed here instead of upstream.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180108/f41f2e0a/attachment.html>

More information about the webkit-unassigned mailing list