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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jan 7 22:36:22 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=181315

Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |darin at apple.com
 Attachment #330650|review?                     |review+
              Flags|                            |

--- Comment #22 from Darin Adler <darin at apple.com> ---
Comment on attachment 330650
  --> https://bugs.webkit.org/attachment.cgi?id=330650
Patch

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

> Source/WebCore/rendering/updating/RenderTreeBuilderFirstLetter.cpp:240
> +            if (numCharacters > 1)
> +                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.

-- 
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/e38647a3/attachment.html>


More information about the webkit-unassigned mailing list