Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 44e62df329a07ba50ca5feaad232f284705f4a63
https://github.com/WebKit/WebKit/commit/44e62df329a07ba50ca5feaad232f284705f4a63
Author: Vitor Roriz <[email protected]>
Date: 2024-08-13 (Tue, 13 Aug 2024)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-text/text-autospace/text-autospace-ideogram-alpha-001-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-text/text-autospace/text-autospace-ideogram-alpha-001-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-text/text-autospace/text-autospace-ideogram-alpha-001.html
M Source/WTF/wtf/text/CharacterProperties.h
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp
M Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp
M Source/WebCore/layout/formattingContexts/inline/text/TextUtil.h
M Source/WebCore/platform/graphics/ComplexTextController.cpp
M Source/WebCore/platform/graphics/ComplexTextController.h
M Source/WebCore/platform/graphics/FontCascade.cpp
M Source/WebCore/platform/graphics/GlyphBuffer.h
M Source/WebCore/platform/graphics/TextRun.cpp
M Source/WebCore/platform/graphics/TextRun.h
M Source/WebCore/platform/graphics/WidthCache.h
M Source/WebCore/platform/graphics/coretext/ComplexTextControllerCoreText.mm
M
Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp
M Source/WebCore/platform/graphics/skia/ComplexTextControllerSkia.cpp
A Source/WebCore/platform/text/TextSpacing.cpp
M Source/WebCore/platform/text/TextSpacing.h
Log Message:
-----------
text-autospace: implement ideograph-alpha for complex path within an text run
https://bugs.webkit.org/show_bug.cgi?id=277716
rdar://133309470
Reviewed by Matthieu Dubet.
This patch implements the processing of text-autospace: ideogram-alpha
only within an element. We don't yet handle element boundaries here.
Although we pass SpacingState context from one ComplexTextController
to another, we do that here in a limited way, only for measuring text for
layout and for painting. There are other places in code which this will
be necessary, for example, for handling element boundaries.
1. During the construction of ComplexTextController, we call
::adjustGlyphsAndAdvances
which already iterates through glyphs and adjust spacing for other reasons.
Now we process each pair of characters related to these glyphs here, adding the
spacing necessary before the "current" character. For that reason, the
SpacingState
stores information about the previous character of a run. We also save the
measured
spacing in a new parallel vector m_textAutoSpaceSpacings. At this phase we can
only manipulate a glyph advance, however, for adding space "before" a glyph,
we need to move the glyph to the logical right, which is done later on
::advance.
2. ComplexTextController::advance is called for both layout and painting, but
during
painting it has access to a GlyphBuffer and it add glyphs into it. We are
introducing
a new GlyphBuffer::add function that also takes the glyph's origin, so we can
manipulate
the origin as necessary by adding the previous calculated spacing.
3. Doing #1 and #2 is already enough for painting the extra spacing between
relevant characters
according to their classes. Howeverm the width measured during layout would be
broken because
IFC splits text content into inlineTextItem(s) and measure the width of each
item independently.
This means that we already have to handle SpacingState passing here, otherwise
we are not able
to handle spacing between characters on the boundary of different
InlineTextItem.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-text/text-autospace/text-autospace-ideogram-alpha-001-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-text/text-autospace/text-autospace-ideogram-alpha-001-ref.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-text/text-autospace/text-autospace-ideogram-alpha-001.html:
Added.
* Source/WTF/wtf/text/CharacterProperties.h:
(WTF::isPunctuation):
(WTF::isOpeningPunctuation):
(WTF::isClosingPunctuation):
(WTF::isOfScriptType):
(WTF::eastAsianWidth):
(WTF::isEastAsianFullWidth):
(WTF::isCJKSymbolOrPunctuation):
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::InlineItemsBuilder::computeInlineTextItemWidths):
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::width):
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.h:
(WebCore::Layout::TextUtil::width):
* Source/WebCore/platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::ComplexTextController):
(WebCore::ComplexTextController::advance):
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
* Source/WebCore/platform/graphics/ComplexTextController.h:
(WebCore::ComplexTextController::ComplexTextRun::textAutospaceSize const):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::width const):
(WebCore::FontCascade::codePath const):
* Source/WebCore/platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBuffer::add):
* Source/WebCore/platform/graphics/TextRun.cpp:
* Source/WebCore/platform/graphics/TextRun.h:
* Source/WebCore/platform/graphics/WidthCache.h:
(WebCore::WidthCache::add):
(WebCore::WidthCache::invalidateCacheForTextSpacing):
* Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
* Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
* Source/WebCore/platform/graphics/skia/ComplexTextControllerSkia.cpp:
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
* Source/WebCore/platform/text/TextSpacing.cpp: Added.
(WebCore::TextAutospace::shouldApplySpacing const):
(WebCore::TextAutospace::textAutospaceSize):
(WebCore::TextSpacing::isIdeograph):
(WebCore::TextSpacing::isNonIdeographicNumeral):
(WebCore::TextSpacing::characterClass):
* Source/WebCore/platform/text/TextSpacing.h:
(WebCore::TextAutospace::hasIdeographAlpha const):
(WebCore::TextAutospace::hasIdeographNumeric const):
Canonical link: https://commits.webkit.org/282192@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes