Skip to content

Comments

Use BitSet for canUseSimplifiedTextMeasuring#26213

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
Constellation:eng/Use-BitSet-for-canUseSimplifiedTextMeasuring
Mar 21, 2024
Merged

Use BitSet for canUseSimplifiedTextMeasuring#26213
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
Constellation:eng/Use-BitSet-for-canUseSimplifiedTextMeasuring

Conversation

@Constellation
Copy link
Member

@Constellation Constellation commented Mar 20, 2024

e3afdb4

Use BitSet for canUseSimplifiedTextMeasuring
https://bugs.webkit.org/show_bug.cgi?id=271347
rdar://125124560

Reviewed by Antti Koivisto.

This patch adds canUseSimplifiedTextMeasuringForNormalVariantCache BitSet cache in FontCascade
so that we do not need to query to GlyphData multiple times to obtain information about canUseSimplifiedTextMeasuring for Latin-1 characters.
Since this is stored in FontCascade, we can continue using this cache even beyond multiple different RenderText. Furthermore, we apply using
this function in TextUtil::width etc.
We also move CharacterProperties.h to WTF, and adding Latin-1 fast path to make caching condition clear and querying function fast (isEmojiWithPresentationByDefault).

* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/text/CharacterProperties.h: Renamed from Source/WebCore/platform/text/CharacterProperties.h.
(WTF::isEmojiGroupCandidate):
(WTF::isEmojiFitzpatrickModifier):
(WTF::isVariationSelector):
(WTF::isEmojiKeycapBase):
(WTF::isEmojiRegionalIndicator):
(WTF::isEmojiWithPresentationByDefault):
(WTF::isEmojiModifierBase):
(WTF::isDefaultIgnorableCodePoint):
(WTF::isControlCharacter):
(WTF::isPrivateUseAreaCharacter):
* Source/WTF/wtf/text/StringCommon.h:
(WTF::isLatin1):
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::canUseSimplifiedTextMeasuringForCharacters):
* Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::canUseSimplifiedTextMeasuringForCharacters):
* Source/WebCore/platform/graphics/ComplexTextController.cpp:
* Source/WebCore/platform/graphics/Font.cpp:
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::canUseSimplifiedTextMeasuring const):
* Source/WebCore/platform/graphics/FontCascade.h:
* Source/WebCore/platform/graphics/FontRanges.cpp:
* Source/WebCore/platform/graphics/GlyphPage.h:
(WebCore::GlyphPage::create): Deleted.
(WebCore::GlyphPage::~GlyphPage): Deleted.
(WebCore::GlyphPage::count): Deleted.
(WebCore::GlyphPage::sizeForPageNumber): Deleted.
(WebCore::GlyphPage::indexForCodePoint): Deleted.
(WebCore::GlyphPage::pageNumberForCodePoint): Deleted.
(WebCore::GlyphPage::startingCodePointInPageNumber): Deleted.
(WebCore::GlyphPage::pageNumberIsUsedForArabic): Deleted.
(WebCore::GlyphPage::glyphDataForCharacter const): Deleted.
(WebCore::GlyphPage::glyphForCharacter const): Deleted.
(WebCore::GlyphPage::glyphDataForIndex const): Deleted.
(WebCore::GlyphPage::glyphForIndex const): Deleted.
(WebCore::GlyphPage::colorGlyphTypeForIndex const): Deleted.
(WebCore::GlyphPage::setGlyphForIndex): Deleted.
(WebCore::GlyphPage::font const): Deleted.
(WebCore::GlyphPage::GlyphPage): Deleted.
* Source/WebCore/platform/graphics/WidthIterator.cpp:
* Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
* Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:
(WebCore::FontCascade::resolveEmojiPolicy):
* Source/WebCore/platform/graphics/freetype/FontSetCache.cpp:
* Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
* Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp:
* Source/WebCore/platform/graphics/skia/FontCascadeSkia.cpp:
* Source/WebCore/rendering/RenderText.cpp:
(WebCore::RenderText::initiateFontLoadingByAccessingGlyphDataAndComputeCanUseSimplifiedTextMeasuring):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WTF/CharacterProperties.cpp: Added.
(TestWebKitAPI::TEST):

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

8eff576

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-skia
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 tv-sim ✅ 🧪 api-gtk
✅ 🛠 watch ✅ 🛠 jsc-armv7
✅ 🛠 🧪 unsafe-merge ✅ 🛠 watch-sim ✅ 🧪 jsc-armv7-tests

@Constellation Constellation self-assigned this Mar 20, 2024
@Constellation Constellation added the Text For bugs in text layout and rendering, including international text support. label Mar 20, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 21, 2024
@Constellation Constellation removed the merging-blocked Applied to prevent a change from being merged label Mar 21, 2024
@Constellation Constellation force-pushed the eng/Use-BitSet-for-canUseSimplifiedTextMeasuring branch from 90d16d9 to 8eff576 Compare March 21, 2024 07:53
@Constellation Constellation marked this pull request as ready for review March 21, 2024 07:59
@Constellation Constellation added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Mar 21, 2024
https://bugs.webkit.org/show_bug.cgi?id=271347
rdar://125124560

Reviewed by Antti Koivisto.

This patch adds canUseSimplifiedTextMeasuringForNormalVariantCache BitSet cache in FontCascade
so that we do not need to query to GlyphData multiple times to obtain information about canUseSimplifiedTextMeasuring for Latin-1 characters.
Since this is stored in FontCascade, we can continue using this cache even beyond multiple different RenderText. Furthermore, we apply using
this function in TextUtil::width etc.
We also move CharacterProperties.h to WTF, and adding Latin-1 fast path to make caching condition clear and querying function fast (isEmojiWithPresentationByDefault).

* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/CMakeLists.txt:
* Source/WTF/wtf/text/CharacterProperties.h: Renamed from Source/WebCore/platform/text/CharacterProperties.h.
(WTF::isEmojiGroupCandidate):
(WTF::isEmojiFitzpatrickModifier):
(WTF::isVariationSelector):
(WTF::isEmojiKeycapBase):
(WTF::isEmojiRegionalIndicator):
(WTF::isEmojiWithPresentationByDefault):
(WTF::isEmojiModifierBase):
(WTF::isDefaultIgnorableCodePoint):
(WTF::isControlCharacter):
(WTF::isPrivateUseAreaCharacter):
* Source/WTF/wtf/text/StringCommon.h:
(WTF::isLatin1):
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::canUseSimplifiedTextMeasuringForCharacters):
* Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::canUseSimplifiedTextMeasuringForCharacters):
* Source/WebCore/platform/graphics/ComplexTextController.cpp:
* Source/WebCore/platform/graphics/Font.cpp:
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::canUseSimplifiedTextMeasuring const):
* Source/WebCore/platform/graphics/FontCascade.h:
* Source/WebCore/platform/graphics/FontRanges.cpp:
* Source/WebCore/platform/graphics/GlyphPage.h:
(WebCore::GlyphPage::create): Deleted.
(WebCore::GlyphPage::~GlyphPage): Deleted.
(WebCore::GlyphPage::count): Deleted.
(WebCore::GlyphPage::sizeForPageNumber): Deleted.
(WebCore::GlyphPage::indexForCodePoint): Deleted.
(WebCore::GlyphPage::pageNumberForCodePoint): Deleted.
(WebCore::GlyphPage::startingCodePointInPageNumber): Deleted.
(WebCore::GlyphPage::pageNumberIsUsedForArabic): Deleted.
(WebCore::GlyphPage::glyphDataForCharacter const): Deleted.
(WebCore::GlyphPage::glyphForCharacter const): Deleted.
(WebCore::GlyphPage::glyphDataForIndex const): Deleted.
(WebCore::GlyphPage::glyphForIndex const): Deleted.
(WebCore::GlyphPage::colorGlyphTypeForIndex const): Deleted.
(WebCore::GlyphPage::setGlyphForIndex): Deleted.
(WebCore::GlyphPage::font const): Deleted.
(WebCore::GlyphPage::GlyphPage): Deleted.
* Source/WebCore/platform/graphics/WidthIterator.cpp:
* Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
* Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp:
(WebCore::FontCascade::resolveEmojiPolicy):
* Source/WebCore/platform/graphics/freetype/FontSetCache.cpp:
* Source/WebCore/platform/graphics/freetype/GlyphPageTreeNodeFreeType.cpp:
* Source/WebCore/platform/graphics/skia/FontCacheSkia.cpp:
* Source/WebCore/platform/graphics/skia/FontCascadeSkia.cpp:
* Source/WebCore/rendering/RenderText.cpp:
(WebCore::RenderText::initiateFontLoadingByAccessingGlyphDataAndComputeCanUseSimplifiedTextMeasuring):
* Tools/TestWebKitAPI/CMakeLists.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WTF/CharacterProperties.cpp: Added.
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/276466@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Use-BitSet-for-canUseSimplifiedTextMeasuring branch from 8eff576 to e3afdb4 Compare March 21, 2024 15:53
@webkit-commit-queue
Copy link
Collaborator

Committed 276466@main (e3afdb4): https://commits.webkit.org/276466@main

Reviewed commits have been landed. Closing PR #26213 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit e3afdb4 into WebKit:main Mar 21, 2024
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Mar 21, 2024
@Constellation Constellation deleted the eng/Use-BitSet-for-canUseSimplifiedTextMeasuring branch March 21, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Text For bugs in text layout and rendering, including international text support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants