[webkit-changes] [WebKit/WebKit] 8e48e8: Use `isControlCharacter()` helper

Vitaly Dyachkov noreply at github.com
Thu Feb 9 13:32:57 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8e48e89eb72f9b3a25ae0921da0f0d2f7ad2ba16
      https://github.com/WebKit/WebKit/commit/8e48e89eb72f9b3a25ae0921da0f0d2f7ad2ba16
  Author: Vitaly Dyachkov <vitaly at igalia.com>
  Date:   2023-02-09 (Thu, 09 Feb 2023)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/platform/graphics/FontCascade.cpp
    M Source/WebCore/platform/graphics/FontCascade.h
    M Source/WebCore/platform/graphics/WidthIterator.cpp
    M Source/WebCore/platform/text/CharacterProperties.h

  Log Message:
  -----------
  Use `isControlCharacter()` helper
https://bugs.webkit.org/show_bug.cgi?id=251691

Reviewed by Myles C. Maxfield.

Several ways to check whether a character is a Unicode control character
are used throughout the codebase. Such as:
```
u_charType(character) == U_CONTROL_CHAR
```
or
```
(character >= nullCharacter && character < space) || (character >= deleteCharacter && character < noBreakSpace)
```

We have a nice helper for this in `CharacterProperties.h` - `isControlCharacter()`.
It would be nice to use it since it is shorter and describes the intent
better.

* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::isCharacterWhoseGlyphsShouldBeDeletedForTextRendering):
* Source/WebCore/platform/graphics/FontCascade.h:
(WebCore::FontCascade::isCharacterWhoseGlyphsShouldBeDeletedForTextRendering): Deleted.
* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::characterCanUseSimplifiedTextMeasuring):
(WebCore::WidthIterator::applyCSSVisibilityRules):
* Source/WebCore/platform/text/CharacterProperties.h:
(WebCore::isControlCharacter):

Canonical link: https://commits.webkit.org/260081@main




More information about the webkit-changes mailing list