Repository navigation
Give a widget joining a group its /Opt value, and read which groups have the list - #139
Merged
Merged
Conversation
…ave the list A checkbox or radio group may name its values in a list in the field (/Opt), as Acrobat writes values that repeat or aren't plain names: a widget's value is the list's entry at its place among the field's widgets, and its on-state name (/0, /1) only a key. EPDFForm_AttachWidget appended the new widget to /Kids but wrote no entry, so it read back Yes and never went on with its value. EPDFForm_DetachWidget left the list as it was, so every widget after the one that left read the value of the widget before it. EPDFForm_AttachWidget takes an export value before split_objnum (NULL: the on-state name). When the field has a list, its own or a parent's, the field gets a direct list of its own with the value at the new widget's place; a place the list lacked before it gets that widget's on-state name, its value without a list. A list that is an object of its own, or a parent's, is copied, never written. Without a list, a value other than the on-state is refused and nothing is written; a value for a field that isn't a checkbox or radio group is refused. EPDFForm_DetachWidget takes the widget's entry out of the list. Places are counted as CPDF_InteractiveForm counts a field's controls (/Kids entries that are widget dictionaries). EPDFForm_HasFieldValuesList(model, field_index): the form model records whether a checkbox or radio group has such a list. The engine could only guess before, from a widget's value differing from its on-state name, which misses a list that repeats the names (/Opt [(0) (1)]) or names Yes (/Opt [(Yes)]). Tests: eight new EPDFFormEmbedderTest cases on testing/resources/toggle_values_list.in (a group /Opt [(pick-a) (pick-b)] with states /0 /1, a unison group whose list is an object of its own, a merged checkbox whose value is not Latin), one of them in PDFium's own form filler on the saved file. The seven attach and detach tests fail with the writes switched off. All eight are in the layer-mode writers list. Every other attach in the tests passes nullptr.
A review of pull request 139 found two things in the attach. An empty export value was written as () in the field's list. An empty entry reads back as another value (PDFium's GetExportValue() gives Yes), so the widget never had the value asked for. EPDFForm_AttachWidget now refuses an empty export value before it writes anything. NULL still means the on-state name. A list may have fewer entries than the field has widgets. The attach fills each place the list lacks with that widget's on-state name. Acrobat reads a widget the list has no entry for by its on-state name (checked in Acrobat 26.002: a group cut to /Opt [(pick-a)] reads its second button as 1), as the fork's value transactions do, so the value Acrobat shows stays the same. GetExportValue() reads Yes there, which is why the review saw the value change; filling with Yes would change it in Acrobat instead. The comment and the header now say so. Tests: AWidgetJoiningAListedGroupGetsItsValue refuses an empty value and checks nothing was written. AShortListIsFilledBeforeTheNewPlace checks that the button that is on stays on with its value, after the attach and after the new widget leaves again.
AWidgetJoiningAListedGroupGetsItsValue makes one more widget for the refused empty value, so it leaves 12 objects in the layer, not 11.
bobsingor
added a commit
to embedpdf/embed-pdf-viewer
that referenced
this pull request
Dec 1, 2026
The release adds one runtime change to a0b1daa34: a widget joining a checkbox or radio group whose values /Opt names gets its entry, a widget that leaves takes its entry along, and the form model says which groups have the list (embedpdf/runtime#139). The previous commit uses all three. The bindings generated from the release's headers are the ones the previous commit carries. runtime-src moves to the pin. The pin file's nine checksums are the ones the release's assets carry.
roanutil
pushed a commit
to MFB-Technologies-Inc/embed-pdf-viewer
that referenced
this pull request
Dec 1, 2026
A checkbox or radio group may name its values in a list in the field (/Opt), as Acrobat writes values that repeat or aren't plain names. A new button in such a group read back Yes, so form.repeat() refused the group and addWidget() gave the wrong value. The runtime's attach now writes the new button's entry (embedpdf/runtime#139), and the engine uses it. - The fact: hasValuesList on CheckboxField and RadioField, read from the runtime's form model (EPDFForm_HasFieldValuesList). The wire member is required; an older server's group reads false. A created group predicts false. PR 1190's guess (valuesNamedByList) is gone. - addedToggleStates() picks each new button's on-state name: a repeat's source name, else the name of the field's buttons with that value, else the value itself, or for a listed group the lowest number no button uses. - FormMutator.addWidgets() passes each button's value to the attach; a repeat keeps its source's name, so copies switch with it. The add step keeps the values, so its redo writes the entries back. - formRepeat no longer refuses a listed group. Conformance (repeat suite, both engines): a listed group repeats with its values and switches in unison; undo and redo of a repeat and of an addWidget put the saved list back; a list that repeats the on-state names (/Opt [(0) (1)]); a checkbox and a one-button group whose list names Yes, by repeat and by addWidget. Contract, SDK, docs and api reports follow. The bindings carry the attach's new argument and the new getter: until the runtime pin, the calls into the runtime fail.
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.
Cause
A checkbox or radio group may name its values in a list in the field (
/Opt), as Acrobat writesvalues that repeat or aren't plain names: a widget's value is the list's entry at its place among
the field's widgets, and its on-state name (
/0,/1) only a key.EPDFForm_AttachWidgetappended the new widget to
/Kidsbut wrote no entry, so it read backYesand never went on withits value (embedpdf/embed-pdf-viewer#1190, review finding 2).
EPDFForm_DetachWidgetleft thelist as it was, so every widget after the one that left read the value of the widget before it.
Change
EPDFForm_AttachWidgettakesFPDF_WIDESTRING export_valuebeforesplit_objnum(NULL: theon-state name). When the field has a list, its own or a parent's, the field gets a direct list of
its own with the value at the new widget's place; a place the list lacked before it gets that
widget's on-state name, its value without a list. A list that is an object of its own, or a
parent's, is copied, never written. Without a list, a value other than the on-state is refused,
and nothing is written; a value for a field that isn't a checkbox or radio group is refused.
EPDFForm_DetachWidgettakes the widget's entry out of the list.CPDF_InteractiveFormcounts a field's controls (/Kidsentries that arewidget dictionaries). A list that is already the field's own is written in place.
EPDFForm_HasFieldValuesList(model, field_index): the form model records whether a checkbox orradio group has such a list (its own or a parent's). The engine could only guess before, from a
widget's value differing from its on-state name, which misses a list that repeats the names
(
/Opt [(0) (1)]) or namesYes(/Opt [(Yes)]).The new widget's on-state name is the caller's: the engine keeps a repeated widget's source name,
so widgets of one value share it and go on together (
RadiosInUnison).Tests
Eight new
EPDFFormEmbedderTestcases, the first seven ontesting/resources/toggle_values_list.in(anAcrobat-style group
/Opt [(pick-a) (pick-b)]with states/0 /1, a unison group whose list isan object of its own, a merged checkbox whose value is not Latin):
AWidgetJoiningAListedGroupGetsItsValue,AListThatIsAnObjectStaysAsItIs,AShortListIsFilledBeforeTheNewPlace,AFieldWithoutAListTakesNoOtherValue,AListedMergedCheckboxSplitsAndKeepsItsValue,ADetachedWidgetTakesItsListEntry;AFormFillerSwitchesANewListedButtonInUnison: the saved file in PDFium's own form filler; aclick on the new button turns on all three buttons of its value.
ModelTellsAGroupWhoseValuesAListNames: listed groups (own list, a list that is an object of itsown, a merged checkbox, a list that repeats the on-state names) read
true; a plain radio groupand a combo box's options read
false.The first seven fail with the writes switched off (signature kept). Every other attach in the tests
passes
nullptrfor the value.Checked
(8
FPDFProgressiveRenderEmbedderTest,EPDFMeasureEmbedderTest.CaptionAppearanceGolden,FPDFEditEmbedderTest.SetTextRenderMode,FPDFViewEmbedderTest.RenderBug664284WithNoNativeText,RenderHelloWorldWithFlags).testing/embedpdf_layer_mode_writers.txt.as before the change.
check-fork-tags.pyclean;check-c-api.py605 functions.boxes reads
pick-a/pick-bon every page and switches in unison; undo and redo put the listback; the saved file reopens the same.
Acrobat reads the group's value as
pick-a/pick-band its widgets' export values aspick-a, pick-bthree times. Every widget of a repeated checkbox whose list namesJa ✓exportsJa ✓.Left
regenerates the bindings and carries the engine's use of the new argument.