Skip to content

Prepend bold/italic styles for XHTML B/I elements (issue 22023) - #22083

Open
cestercian wants to merge 1 commit into
mozilla:masterfrom
cestercian:xfa-rich-text-push-font
Open

cestercian wants to merge 1 commit into
mozilla:masterfrom
cestercian:xfa-rich-text-push-font

Conversation

@cestercian

@cestercian cestercian commented Oct 6, 2026 •

Copy link
Copy Markdown

B and I called measure.pushFont() in $pushGlyphs, but TextMeasure never had that method, so laying out rich text with <b> or <i> in an auto-sized field threw and the whole form failed to render.

Following the shorter approach from #22023 (comment): prepend font-weight:bold / font-style:italic in the B and I constructors (so explicit styles like font-weight:normal still win) and drop their $pushGlyphs overrides, letting the existing XhtmlObject path handle measurement and rendering.

Added a unit test with bold and italic rich text in a draw without a height; it fails without the change.

Fixes #22023

@codecov-commenter

codecov-commenter commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.30%. Comparing base (17bb244) to head (b9b6390).
⚠️ Report is 27 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #22083   +/-   ##
=======================================
  Coverage   90.30%   90.30%           
=======================================
  Files         269      269           
  Lines       67362    67363    +1     
=======================================
+ Hits        60828    60835    +7     
+ Misses       6534     6528    -6     
Flag Coverage Δ
browsertest 66.07% <0.00%> (-0.01%) ⬇️
fonttest 8.95% <ø> (ø)
integrationtest 69.23% <0.00%> (-0.01%) ⬇️
unittest 59.98% <100.00%> (+0.10%) ⬆️
unittestcli 58.53% <100.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Snuffleupagus Snuffleupagus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#22023 (comment) outlines a another possible, and shorter, solution. Would that work instead?

B and I called measure.pushFont in $pushGlyphs, but TextMeasure never
had that method, so rich text with <b> or <i> in an auto-sized field
failed during layout. Prepend font-weight:bold / font-style:italic in
the constructors (so explicit overrides like font-weight:normal still
win) and drop the $pushGlyphs overrides, letting the existing
XhtmlObject path handle measurement and rendering.
@cestercian
cestercian force-pushed the xfa-rich-text-push-font branch from b9b6390 to 11e274b Compare October 7, 2026 01:12
@cestercian

Copy link
Copy Markdown
Author

@Snuffleupagus Good call, thanks. Switched to the shorter style-prepend approach from that issue comment: B/I constructors now prepend font-weight:bold / font-style:italic and the $pushGlyphs overrides (and the TextMeasure.pushFont idea) are gone.

@cestercian cestercian changed the title Add the missing TextMeasure.prototype.pushFont method (issue 22023) Prepend bold/italic styles for XHTML B/I elements (issue 22023) Oct 7, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XFA: measure.pushFont is not a function — rich text containing <b> or <i> breaks layout

4 participants