Skip to content

fix(ohos): keep inline-box chrome with text - #105

Draft
bytemain wants to merge 1 commit into
staging2from
codex/task942-ohos-inlinebox-atomic-edge-v2
Draft

fix(ohos): keep inline-box chrome with text#105
bytemain wants to merge 1 commit into
staging2from
codex/task942-ohos-inlinebox-atomic-edge-v2

Conversation

@bytemain

@bytemain bytemain commented Aug 1, 2026

Copy link
Copy Markdown
Member

Problem

The task Tencent-TDS#942 OHOS screenshot contains no literal [ / ] around the mention or task ref. The narrow yellow fragment left at the preceding line end is the inline box's own leading edge/chrome placeholder, while @artin / #188 starts on the next line.

OHOS currently lowers a text-only inline-box group as:

leading OH_Drawing placeholder → U+2060 → child text → U+2060 → trailing placeholder

That cannot be atomic. OpenHarmony OH_Drawing_TypographyHandlerAddPlaceholder reaches SkParagraph addPlaceholder(), which inserts U+FFFC. In OpenHarmony Skia TextWrapper, placeholders explicitly end the current word and become their own word, before normal U+2060 behavior can bind the units.

Change

For inline-box groups whose children are ordinary text:

U+200B  U+2011  U+2060 child U+2060  U+2011  U+200B
break   edge                         edge    break
  • Each U+2011 NON-BREAKING HYPHEN is rendered at font size 0, so its glyph advance is zero; letterSpacing supplies the exact reserved edge width (margin + border + padding).
  • U+2011 has Unicode line-break class GL and is not whitespace, so the edge stays in the token's non-breaking word and cannot become SkParagraph's intra-word-space fallback.
  • U+200B stays outside the click/chrome range, preserving a legal break before and after the complete group.
  • The existing U+2060 joins text children within the group.
  • Groups containing placeholder-backed children keep the existing placeholder lowering unchanged.
  • Layout-only edge/boundary clusters continue mapping to zero semantic characters. Crossing the trailing edge maps to the original semantic token exactly once, preserving selection/copy/accessibility source text.
  • Chrome/click ranges include the exact reserved edges; ordinary CJK/URL text outside the group is untouched.

U+2060 itself is deliberately not used as the width carrier: OpenHarmony API 26+ disables letter spacing for control characters, and ICU classifies U+2060 (Cf) as control.

Evidence

Source chain inspected at the platform commits used by OHOS:

  • openharmony/graphic_graphic_2d@fb7c3ba...
    • drawing_text_typography.cpp
    • typography_create.cpp
    • paragraph_builder_impl.cpp
  • openharmony/third_party_skia@fd56c1f8...
    • ParagraphBuilderImpl.cpp
    • TextWrapper.cpp
    • ParagraphImpl.cpp
    • Run.cpp
    • OneLineShaper.cpp
  • Skia's pinned HarfBuzz exact is a070f9eb...; font size 0 and the non-control GL carrier avoid default-ignorable/control-spacing ambiguity.

Validation

  • core-render-ohos/src/test/cpp/run_inline_box_atomic_text_edge_test.sh — PASS (-Wall -Wextra -Werror), with a bracket-free near-line-end @artin regression shape.
  • Existing OHOS scroller source contract — PASS.
  • OHOS arm64 KRRichTextShadow.cpp SDK syntax compile — PASS.
  • git diff --check — PASS.
  • Hosted exact matrix, including fresh OHOS arm64 production compile/link — pending on this Draft PR.

The prior bracket-keyed PR #104 is closed and VOID. It must not be reopened, merged, or consumed.

Task: Mobile task Tencent-TDS#942

Replace placeholder edges for text-only inline-box groups with zero-font non-breaking text carriers whose exact advance comes from letter spacing. Keep zero-width break opportunities outside the clickable/chrome range, preserve semantic mapping, and retain the existing placeholder path for groups that contain placeholder children.

Task: Tencent-TDS#942
Signed-off-by: Codex-Kuikly-KMP <raft-mobile-codex-kuikly-kmp@mail.build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant