File tree Expand file tree Collapse file tree 6 files changed +49
-0
lines changed
Expand file tree Collapse file tree 6 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -448,6 +448,18 @@ function fixTextIndent(styles) {
448448 }
449449}
450450
451+ function setAccess ( node , classNames ) {
452+ switch ( node . access ) {
453+ case "nonInteractive" :
454+ case "readOnly" :
455+ classNames . push ( "xfaReadOnly" ) ;
456+ break ;
457+ case "protected" :
458+ classNames . push ( "xfaDisabled" ) ;
459+ break ;
460+ }
461+ }
462+
451463function getFonts ( family , fontFinder ) {
452464 if ( family . startsWith ( "'" ) || family . startsWith ( '"' ) ) {
453465 family = family . slice ( 1 , family . length - 1 ) ;
@@ -473,6 +485,7 @@ export {
473485 layoutClass ,
474486 layoutText ,
475487 measureToString ,
488+ setAccess ,
476489 setMinMaxDimensions ,
477490 toStyle ,
478491} ;
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ import {
7272 layoutClass ,
7373 layoutText ,
7474 measureToString ,
75+ setAccess ,
7576 setMinMaxDimensions ,
7677 toStyle ,
7778} from "./html_utils.js" ;
@@ -2023,8 +2024,11 @@ class ExclGroup extends XFAObject {
20232024 const children = [ ] ;
20242025 const attributes = {
20252026 id : this [ $uid ] ,
2027+ class : [ ] ,
20262028 } ;
20272029
2030+ setAccess ( this , attributes . class ) ;
2031+
20282032 if ( ! this [ $extra ] ) {
20292033 this [ $extra ] = Object . create ( null ) ;
20302034 }
@@ -2329,6 +2333,8 @@ class Field extends XFAObject {
23292333 class : classNames ,
23302334 } ;
23312335
2336+ setAccess ( this , classNames ) ;
2337+
23322338 if ( this . name ) {
23332339 attributes . xfaName = this . name ;
23342340 }
@@ -4171,8 +4177,11 @@ class Subform extends XFAObject {
41714177 const children = [ ] ;
41724178 const attributes = {
41734179 id : this [ $uid ] ,
4180+ class : [ ] ,
41744181 } ;
41754182
4183+ setAccess ( this , attributes . class ) ;
4184+
41764185 if ( ! this [ $extra ] ) {
41774186 this [ $extra ] = Object . create ( null ) ;
41784187 }
Original file line number Diff line number Diff line change @@ -181,6 +181,17 @@ class XfaLayer {
181181 childHtml . appendChild ( document . createTextNode ( child . value ) ) ;
182182 }
183183 }
184+
185+ for ( const el of rootDiv . querySelectorAll (
186+ ".xfaDisabled input, .xfaDisabled textarea"
187+ ) ) {
188+ el . setAttribute ( "disabled" , true ) ;
189+ }
190+ for ( const el of rootDiv . querySelectorAll (
191+ ".xfaReadOnly input, .xfaReadOnly textarea"
192+ ) ) {
193+ el . setAttribute ( "readOnly" , true ) ;
194+ }
184195 }
185196
186197 /**
Original file line number Diff line number Diff line change 1+ https://bugzilla.mozilla.org/attachment.cgi?id=9227455
Original file line number Diff line number Diff line change 946946 "enableXfa" : true ,
947947 "type" : " eq"
948948 },
949+ { "id" : " xfa_bug1716816" ,
950+ "file" : " pdfs/xfa_bug1716816.pdf" ,
951+ "md5" : " 3051cd18db7839bc4953df35b52cf3e0" ,
952+ "link" : true ,
953+ "rounds" : 1 ,
954+ "enableXfa" : true ,
955+ "type" : " eq"
956+ },
949957 { "id" : " xfa_bug1716809" ,
950958 "file" : " pdfs/xfa_bug1716809.pdf" ,
951959 "md5" : " 7192f9e27e8b84776d107f57cbe353d5" ,
Original file line number Diff line number Diff line change 277277 flex : 1 ;
278278}
279279
280+ .xfaDisabled input ,
281+ .xfaDisabled textarea ,
282+ .xfaReadOnly input ,
283+ .xfaReadOnly textarea {
284+ background : initial;
285+ }
286+
280287@media print {
281288 .xfaTextfield ,
282289 .xfaSelect {
You can’t perform that action at this time.
0 commit comments