[skia-sync/m150] Backport PDF backend to C++17 for the Tizen toolchain#255
Merged
Merged
Conversation
Skia m150's PDF backend uses C++20 defaulted three-way comparison
(operator<=>) and defaulted operator==, which require <compare> and a
C++20 stdlib. Tizen Studio's clang 10 + gcc 9.2 libstdc++ (tizen-8.0
rootstrap) lacks <compare> and crashes parsing the defaulted spaceship,
so SkiaSharp had to disable skia_enable_pdf on Tizen (SkiaSharp #4155).
The std::views::reverse usage in SkPDFTag.cpp was already replaced with
a reverse-iterator loop in the parent commit (for WASM/emscripten).
This commit removes the remaining C++20-only constructs:
src/pdf/SkPDFTypes.h
- drop <compare>
- SkPDFIndirectReference / SkPDFParentTreeKey: replace defaulted
operator<=> with explicit ==,!=,<,<=,>,>= over fValue.
src/pdf/SkPDFTag.cpp
- drop <compare> and the now-unused <ranges>
- ContentIndex: explicit comparison operators (lexicographic over
fParentId then fMcid).
- ContentSpan::Data and ContentSpan: explicit operator== replacing
the defaulted ones.
Behaviour is identical. Unblocks re-enabling skia_enable_pdf on Tizen.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b769ef4 to
d0b422e
Compare
mattleibow
added a commit
that referenced
this pull request
Jun 12, 2026
The SK_SUPPORT_PDF guard added for the Tizen PDF stopgap broke PDF document creation on ALL platforms: SkiaSharp's C API shims compile into :core, but SK_SUPPORT_PDF is a public_define of :pdf (a dep of :skia, not :core), so the guard was always false in sk_document.cpp. sk_document_create_pdf_* returned nullptr everywhere, failing SKDocumentTest.CanCreatePdf / PdfFileIsClosed / etc. The Tizen stopgap is fully reverted (PDF is now enabled on every platform via the C++17 backport, #4155 / mono/skia PR #255), so the guard is no longer needed. Restore the unconditional PDF factories. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mattleibow
added a commit
that referenced
this pull request
Jun 12, 2026
[skia-sync] Merge upstream chrome/m150 (#253) Context: https://skia.googlesource.com/skia/+log/chrome/m150 Changes: skiasharp...skia-sync/m150 Companion: mono/SkiaSharp#4146 Fixes: mono/SkiaSharp#4155 Advance the SkiaSharp fork's Skia engine from Chrome milestone 148 to 150 by merging upstream chrome/m150 (tip c925145) into skia-sync/m150 on top of the fork's skiasharp branch (1a155ba). Merge commit 0a248d1 resolved 19 conflicts; the fork's intentional deltas were preserved while taking upstream's behavior everywhere the fork had no opinion. Notable conflict resolutions: * DEPS: kept the fork's pinned native deps (expat 2.8.1, freetype 2.14.3, harfbuzz 14.2.0, libjpeg-turbo, libpng, libwebp, zlib) — upstream would have downgraded these security/bug-fix bumps. * include/core/SkFont.h: kept the fork's breakText() overloads and added upstream's new SkStrikeRef makeStrikeRef(). * src/gpu/ganesh/ops/AtlasTextOp.cpp: combined the fork's glyphSrcPadding()>0 guard with upstream's supportsBilerp() condition, taking upstream's graceful log+return on stride mismatch instead of the prior hard assert. ~~ Post-merge portability fixes ~~ The raw merge compiles on the primary toolchains, but SkiaSharp's CI builds the native libraries on toolchains upstream Skia CI does not exercise: WASM (emscripten 3.1.34 / libc++ 15), Tizen (clang 10 + gcc 9.2 libstdc++), and the Direct3D Ganesh backend on Windows. Those legs failed until the following fixes landed on top of the merge: * 8912293 — WASM/Tizen: rewrite std::views::reverse in SkPDFTag.cpp as a reverse-iterator loop; ranges/std::views are gated off in libc++ 15 and unavailable in clang 10. * d0b422e (PR #255) — Tizen: backport the PDF backend's C++20 three-way comparisons (<=>/==) to explicit C++17 operators in SkPDFTypes.h and SkPDFTag.cpp; the Tizen libstdc++ predates <compare>. This keeps PDF enabled on Tizen with no regression and resolves SkiaSharp #4155. * 144ebf9 — Tizen: replace optional::emplace on an aggregate with aggregate-init for libstdc++ 9.2. * a8ea924 — Tizen: opts("ml3")/opts("ml4") use clang-10-spellable -march=haswell / skylake-avx512 (keeping m150's new -mprefer-vector-width=512). m150 switched to -march=x86-64-v3/v4, which clang only understands from version 12. * d2fe11b — Windows: raise min_win_sdk_version to 10.0.22621.0 in gn/BUILDCONFIG.gn (a floor, not a pin) so the MSVC toolchain selects the Win11 SDK that defines IDWriteFontSet4, used by m150's SkFontMgr_win_dw.cpp. The interface is acquired via QueryInterface with a null-check fallback, so older Windows at runtime is unaffected. * 159b1ec — Windows D3D: declare GrD3DBackendFormatData::equal unconditionally and fully guard GrD3DBackendTextureData::equal under GPU_TEST_UTILS. Completes upstream 20c3044, which left the D3D backend abstract in non-test builds; only SkiaSharp compiles the D3D backend, so upstream CI never caught it. * bceb12a — All platforms: revert a SK_SUPPORT_PDF guard added to src/c/sk_document.cpp. The SkiaSharp C-API shim compiles into Skia's :core target, which never receives :pdf's SK_SUPPORT_PDF public define, so the guard was always false and the PDF factories returned null everywhere (caught by SKDocumentTest). These are toolchain/portability changes only — no change to Skia rendering behavior on any platform. The companion SkiaSharp PR #4146 re-pins the submodule to bceb12a, and Azure DevOps "SkiaSharp (Public)" build 158224 is green across all stages (native Windows/macOS/Linux/WASM, package, API diff, managed build, tests, samples). Co-authored-by: Matthew Leibowitz <mattleibow@live.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #253 (skia-sync/m150).
Why
Skia m150 modernized the PDF backend to require C++20 stdlib/language features:
src/pdf/SkPDFTypes.hincludes<compare>and uses defaultedoperator<=>(three-way comparison).src/pdf/SkPDFTag.cppuses<ranges>(std::views::reverse), a defaultedoperator<=>, and defaultedoperator==.The Tizen native build uses Tizen Studio's clang 10 + gcc 9.2 libstdc++ (tizen-8.0 rootstrap), which predates C++20:
<compare>is missing and clang 10 crashes parsing the defaulted spaceship operator. As a stopgap, SkiaSharp disabledskia_enable_pdfon Tizen (SkiaSharp issue #4155).What
Replace the C++20-only spellings with equivalent C++17 code so PDF compiles on the existing Tizen toolchain — no ABI-breaking platform bump, no toolchain container required:
src/pdf/SkPDFTypes.h<compare>.SkPDFIndirectReference/SkPDFParentTreeKey: replace defaultedoperator<=>with explicit==,!=,<,<=,>,>=overfValue.src/pdf/SkPDFTag.cpp<compare>and<ranges>.ContentIndex: explicit comparison operators (lexicographic overfParentIdthenfMcid).ContentSpan::DataandContentSpan: explicitoperator==replacing the defaulted ones.std::views::reverse(childSpans)with anrbegin()/rend()reverse-iterator loop.Behaviour is identical. This unblocks re-enabling
skia_enable_pdfon Tizen in SkiaSharp (issue #4155).Verified across all 48
src/pdffiles: these two are the only ones using the C++20 constructs.