Repository navigation
Give an active form field the width and style of its CSS border (#431) - #445
Merged
jakejackson1 merged 4 commits intoSep 23, 2026
Merged
Conversation
jakejackson1
force-pushed
the
fix/432-static-field-css
branch
from
September 23, 2026 20:47
6185cdf to
2a3430c
Compare
An active text field, text area, select or button always had a 1pt solid border in /BS, whatever its CSS said. The border width, in points, and style the form tags record now reach /BS and the appearance: solid, dashed, dotted, inset and outset become /S, /D (dashed in the appearance too), /I and /B, and a border of style none has no width and no /BC, which a viewer would draw regardless. A select also takes its CSS border and background colours, which it ignored before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…n the field kinds Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…lect's border colour form-fields-active and form-fields-pdfa write the styled field's 0.5mm border in /BS and draw it in its appearance. page-break-avoid-forms and page-break-avoid-references draw their fields' 0.2mm CSS border, thinner than the 1pt default, and their select takes its grey colour too. Rasterised against #432's fixtures only those borders change; against this branch before its rebase onto #441, only the maxlength field differs, which #441 draws whole in a smaller font. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
jakejackson1
force-pushed
the
fix/431-active-field-border
branch
from
September 23, 2026 20:51
29c6463 to
d6513a6
Compare
jakejackson1
added a commit
that referenced
this pull request
Sep 23, 2026
#445) (#469) * Give an active form field the width and style of its CSS border (#431) An active text field, text area, select or button always had a 1pt solid border in /BS, whatever its CSS said. The border width, in points, and style the form tags record now reach /BS and the appearance: solid, dashed, dotted, inset and outset become /S, /D (dashed in the appearance too), /I and /B, and a border of style none has no width and no /BC, which a viewer would draw regardless. A select also takes its CSS border and background colours, which it ignored before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Share the active field colour fallback and the no-border rules between the field kinds Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Say what the active border helpers do more plainly Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Refresh the active form snapshots for the CSS border width and the select's border colour form-fields-active and form-fields-pdfa write the styled field's 0.5mm border in /BS and draw it in its appearance. page-break-avoid-forms and page-break-avoid-references draw their fields' 0.2mm CSS border, thinner than the 1pt default, and their select takes its grey colour too. Rasterised against #432's fixtures only those borders change; against this branch before its rebase onto #441, only the maxlength field differs, which #441 draws whole in a smaller font. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Cherry-picked from c675d3f. PR #445 was merged into fix/432-static-field-css after #442 had already merged that branch into feature/pdfa-2-conformance, so it never reached this branch.
jakejackson1
added a commit
that referenced
this pull request
Sep 23, 2026
#445) (#469) * Give an active form field the width and style of its CSS border (#431) An active text field, text area, select or button always had a 1pt solid border in /BS, whatever its CSS said. The border width, in points, and style the form tags record now reach /BS and the appearance: solid, dashed, dotted, inset and outset become /S, /D (dashed in the appearance too), /I and /B, and a border of style none has no width and no /BC, which a viewer would draw regardless. A select also takes its CSS border and background colours, which it ignored before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Share the active field colour fallback and the no-border rules between the field kinds Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Say what the active border helpers do more plainly Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Refresh the active form snapshots for the CSS border width and the select's border colour form-fields-active and form-fields-pdfa write the styled field's 0.5mm border in /BS and draw it in its appearance. page-break-avoid-forms and page-break-avoid-references draw their fields' 0.2mm CSS border, thinner than the 1pt default, and their select takes its grey colour too. Rasterised against #432's fixtures only those borders change; against this branch before its rebase onto #441, only the maxlength field differs, which #441 draws whole in a smaller font. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Cherry-picked from c675d3f. PR #445 was merged into fix/432-static-field-css after #442 had already merged that branch into feature/pdfa-2-conformance, so it never reached this branch.
jakejackson1
added a commit
that referenced
this pull request
Sep 23, 2026
#445) (#469) * Give an active form field the width and style of its CSS border (#431) An active text field, text area, select or button always had a 1pt solid border in /BS, whatever its CSS said. The border width, in points, and style the form tags record now reach /BS and the appearance: solid, dashed, dotted, inset and outset become /S, /D (dashed in the appearance too), /I and /B, and a border of style none has no width and no /BC, which a viewer would draw regardless. A select also takes its CSS border and background colours, which it ignored before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Share the active field colour fallback and the no-border rules between the field kinds Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Say what the active border helpers do more plainly Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Refresh the active form snapshots for the CSS border width and the select's border colour form-fields-active and form-fields-pdfa write the styled field's 0.5mm border in /BS and draw it in its appearance. page-break-avoid-forms and page-break-avoid-references draw their fields' 0.2mm CSS border, thinner than the 1pt default, and their select takes its grey colour too. Rasterised against #432's fixtures only those borders change; against this branch before its rebase onto #441, only the maxlength field differs, which #441 draws whole in a smaller font. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Cherry-picked from c675d3f. PR #445 was merged into fix/432-static-field-css after #442 had already merged that branch into feature/pdfa-2-conformance, so it never reached this branch.
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.
Fixes #431
Stacked on #442 (#432). That PR has the shared groundwork: the form tags record the field's CSS border, read from the
BORDER-TOPshorthand, whether or not forms are active. It also already made/MK /BCfollow a shorthand border colour. This PR adds the border width and style, and brings the select field in.What changed
/BS /Wnow comes from the CSS border width in points./BS /Scomes from its style:/S/D /D [3]/D /D [1]/I/B/S, since PDF has no equivalent.border: noneorborder-style: hiddengives/W 0, and/MKleaves out/BC, because a viewer that redraws the field draws a border wherever/BCis present. The same applies to text and choice fields left atSetFormBorderWidth('0').appearanceColor(), so they follow the output intent./MKis also CMYK when the document is restricted to CMYK.SetFormChoicealso takes the select's CSSborder-colorandbackground-colornow; before, it ignored them.Form::activeBorder($objattr)turns the recorded CSS into['W' => …, 'S' => …].SetFormText,SetFormChoice,SetFormButtonand the reset, submit and JS button wrappers take it as a new trailing optional$borderarray. When the array leavesWorSout, the existingform_border_*orform_button_border_*default is used for it.SetFormChoicealso gains the$background_coland$border_colparameters the others already had.Snapshots
Refreshed in their own commit and checked by rasterising with
pdftoppm:form-fields-activeandform-fields-pdfa: the "Styled" field's border goes from 1pt to 0.5mm (1.417pt) in both/BSand the appearance. Otherwise only the PDF/A document ID changes.page-break-avoid-formsandpage-break-avoid-references: these setborder: 0.2mm solid #404040on fields. The active fields now draw that thinner 0.567pt border, and the select picks up the grey border colour too.Verification
tests/Mpdf/ActiveFieldBorderTest.phphas 18 tests:/BS << /W 1.417 /S /S >>,/MK <</BC [ 0 0 1 ] /BG [ 1 1 0.8 ], and an appearance stroking0 0 1 RG 1.417 w;noneandhidden:/W 0, no/BC, no stroke;restrictColorSpace3.composer test: 3779 tests, 5 skipped (these were already skipped before this change), no failures.composer test -- --group=snapshot: 88 OK.composer test -- --group=conformance(veraPDF): 26 OK.composer csis clean. PHPStan 2.2 reports no errors.php -lunder PHP 5.6 is clean.Limits and follow-ups
/BS, but Give every active form widget its own appearance, and ask the viewer to redraw only text it cannot shape (#348, #59) #387's appearance draws them as a flat border. Only viewers that redraw the field show the bevel./BS << /W 1 /S /S >>andform_radio_colorborder, because their drawn appearances are fixed shapes.restrictColorSpaceset to 3 and no CMYK ICC profile fails veraPDF 6.2.4.3-3 even with no form at all. That problem predates this PR.activeBorder(), the new$borderparameters, the/BS//MKchanges andSetFormChoice's colours don't depend on Give every active form widget its own appearance, and ask the viewer to redraw only text it cannot shape (#348, #59) #387. ThewriteAppearancedash and width changes are fork-only.🤖 Generated with Claude Code