Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 70dfce4103b6791ea0adeadf2fb7c87df6056f2d
      
https://github.com/WebKit/WebKit/commit/70dfce4103b6791ea0adeadf2fb7c87df6056f2d
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-05-28 (Thu, 28 May 2026)

  Changed paths:
    A 
LayoutTests/svg/text/glyph-orientation-vertical-auto-utr50-surrogate-expected.txt
    A LayoutTests/svg/text/glyph-orientation-vertical-auto-utr50-surrogate.html
    M Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp
    M Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp
    M Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h
    M Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp
    M Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h

  Log Message:
  -----------
  [SVG] glyph-orientation-vertical: auto should decode surrogate pairs for 
UTR#50 lookup
https://bugs.webkit.org/show_bug.cgi?id=313299
rdar://175570881

Reviewed by Nikolas Zimmermann.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

calculateGlyphOrientationAngle() took a single char16_t, so for
supplementary characters (U+10000 and above) only the lead surrogate
was passed to ICU's u_getIntPropertyValue(UCHAR_VERTICAL_ORIENTATION).
This returned the wrong Vertical_Orientation value, causing characters
like U+1F600 GRINNING FACE and U+20000 CJK Ext-B ideographs to be
rotated 90 degrees when they should be upright per UTR#50 [1].

Decode surrogate pairs at the call site in layoutTextOnLineOrPath()
using std::span for bounds-safe access, verify the trail surrogate
with U16_IS_TRAIL before combining, and widen the parameter to
const char32_t& so ICU receives the full code point.

Similar to a fix in Blink: 
https://chromium.googlesource.com/chromium/src.git/+/2754c16948f97fcf655d5f23613468fcd63ccb76

[1] https://www.unicode.org/reports/tr50/

Test: svg/text/glyph-orientation-vertical-auto-utr50-surrogate.html

* Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp:
(WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):
* Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:
(WebCore::SVGTextLayoutEngineBaseline::calculateGlyphOrientationAngle const):
* Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h:
* Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp:
(WebCore::SVGTextLayoutEngineSpacing::calculateCSSSpacing):
* Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h:

> This test is not WPT since other browsers don't support 
> glyph-orientation-vertical:
* 
LayoutTests/svg/text/glyph-orientation-vertical-auto-utr50-surrogate-expected.txt:
 Added.
* LayoutTests/svg/text/glyph-orientation-vertical-auto-utr50-surrogate.html: 
Added.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to