Skip to content

XFA - Fix auto-sized fields (bug 1722030) #13806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2021

Conversation

calixteman
Copy link
Contributor

  • In order to better compute text fields size, use line height with no gaps (and consequently guessed height for text are slightly better in general).
  • Fix default background color in fields.

@calixteman
Copy link
Contributor Author

A lot of failures are expected, overall it's an improvement, but of course if something is really bad, tell me.

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.67.70.0:8877/393c30e0644ab34/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://3.101.106.178:8877/5cb8e8165bab76b/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/393c30e0644ab34/output.txt

Total script time: 26.70 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 619
  different ref/snapshot: 308
  different first/second rendering: 1

Image differences available at: http://54.67.70.0:8877/393c30e0644ab34/reftest-analyzer.html#web=eq.log

@marco-c
Copy link
Contributor

marco-c commented Jul 27, 2021

There are some timeouts.

@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.67.70.0:8877/6b6153ea8532336/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 1

Live output at: http://3.101.106.178:8877/5bd6131c2b95a4e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/5cb8e8165bab76b/output.txt

Total script time: 38.16 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 6
  different ref/snapshot: 412
  different first/second rendering: 1

Image differences available at: http://3.101.106.178:8877/5cb8e8165bab76b/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/6b6153ea8532336/output.txt

Total script time: 33.29 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 6
  different ref/snapshot: 419

Image differences available at: http://54.67.70.0:8877/6b6153ea8532336/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/5bd6131c2b95a4e/output.txt

Total script time: 32.34 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 601
  different ref/snapshot: 366
  different first/second rendering: 1

Image differences available at: http://3.101.106.178:8877/5bd6131c2b95a4e/reftest-analyzer.html#web=eq.log

@marco-c
Copy link
Contributor

marco-c commented Jul 27, 2021

Still some errors

@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.67.70.0:8877/042379177ea3723/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://3.101.106.178:8877/fcd0644bf70e6fc/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/fcd0644bf70e6fc/output.txt

Total script time: 32.01 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 609
  different ref/snapshot: 324
  different first/second rendering: 1

Image differences available at: http://3.101.106.178:8877/fcd0644bf70e6fc/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/042379177ea3723/output.txt

Total script time: 33.48 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 421
  different first/second rendering: 2

Image differences available at: http://54.67.70.0:8877/042379177ea3723/reftest-analyzer.html#web=eq.log

@marco-c
Copy link
Contributor

marco-c commented Jul 27, 2021

There are some errors on Windows, maybe intermittent?

On firefox-xfa_bug1718670_1-page3, there is a field which was highlighted and isn't anymore, is it still fillable?
Same for firefox-xfa_imm5257e-page1, firefox-xfa_bug1716980-page1 and following pages of the same PDF, firefox-xfa_annual_expense_report-page5, firefox-xfa_issue13556-page3, firefox-xfa_issue13213-page5, firefox-xfa_issue13213-page6, firefox-xfa_imm1295e-page1, firefox-xfa_issue13500-page1, firefox-xfa_issue13500-page2.

A button at the end of firefox-issue13751-page1 disappeared.

Some text in firefox-xfa_issue13500-page1 is now hidden behind a field.

  - In order to better compute text fields size, use line height with no gaps (and consequently guessed height for text are slightly better in general).
  - Fix default background color in fields.
@calixteman
Copy link
Contributor Author

calixteman commented Jul 28, 2021

About the field colors:

  • some fields have no <border><fill... which means that by default they're transparent and in this case the bg color is taken from the css (unfocused: violet & focused: transparent);
  • some fields have <border><fill/>... which means that the background color is white by default and then the bg color is set through the style attribute. Then colors from the css are overwritten and there are no more distinction between focused/unfocused.

There are several solutions here:

  • do nothing: it's the actual state
  • add some js callbacks to change the colors on focus/blur events;
  • add a background-image: 1x1 with the violet-transparent color and remove it when the field has the focus;
  • remove this violet background which is out of specs but it help to see fields;
  • other ideas ??

About firefox-issue13751-page1: the button moved on the next page but the test is only with first page (see lastPage attribute in test_manifest.json). Looking at this pdf, it has some layout issues but unrelated to this patch.
About firefox-xfa_issue13500-page1: it's on purpose: I checked in Acrobat & Masterpdf: some checkboxes are behind the text field.

@Snuffleupagus
Copy link
Collaborator

There are several solutions here:

  • do nothing: it's the actual state

That'd be my definite preference, since it seems like the simplest approach; unless this is a widespread problem in practice.

  • add some js callbacks to change the colors on focus/blur events;
  • add a background-image: 1x1 with the violet-transparent color and remove it when the field has the focus;

All of these ideas sound like they'd easily add a bunch of complexity (and overhead), thus negatively impacting code readability/maintainability.

@marco-c
Copy link
Contributor

marco-c commented Jul 28, 2021

That'd be my definite preference, since it seems like the simplest approach; unless this is a widespread problem in practice.

My worry is that if some fields have it and some fields don't, users might think the white ones are not fillable. It seems to be occurring in many PDFs (Canadian ones included, and they're between the most important we want to support).

@calixteman
Copy link
Contributor Author

My opinion as a user is that we must be consistent.
So either we put this violet bg on every fillable field in trying to minimize the cost (memory, perf) or we remove it from everywhere.
But having a mix is a bit confusing: it gives the impress that fields haven't the same role, behaviour, whatever...
We already had this discussion: #13006 (which didn't land).
About the background-image idea: it should pretty simple (I didn't try it for now):

.xfaTextfield {
   background-image: url('a.png'); /* a.png is a 1x1 image with a transparent blue */
}
.xfaTextfield:focus {
   background-image: none;
}

I have no idea of the impact on memory/perf but from a code pov I'd say it isn't that painful to maintain

@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://3.101.106.178:8877/7f4fb57d1503e0c/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.67.70.0:8877/4d53839184c0520/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/7f4fb57d1503e0c/output.txt

Total script time: 31.99 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 610
  different ref/snapshot: 403
  different first/second rendering: 2

Image differences available at: http://3.101.106.178:8877/7f4fb57d1503e0c/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/4d53839184c0520/output.txt

Total script time: 33.49 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 539
  different first/second rendering: 2

Image differences available at: http://54.67.70.0:8877/4d53839184c0520/reftest-analyzer.html#web=eq.log

@calixteman
Copy link
Contributor Author

I replaced png image by an inlined svg one: this way we can easily modify it if we need:
e64078c#diff-3047fd328b0593becf1d475dceb17eed893613549d26c537cb9d105a113106afR17

Thanks to that change, the reftest are fine with one exception (at least locally): the one for xfa_filled_imm1344e has a bg color issue but only for the first page and only with Firefox.
Maybe it's because it's the first test ran...

@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.67.70.0:8877/092c437812770d9/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://3.101.106.178:8877/9489a0012503d14/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/092c437812770d9/output.txt

Total script time: 33.43 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 4
  different ref/snapshot: 468
  different first/second rendering: 2

Image differences available at: http://54.67.70.0:8877/092c437812770d9/reftest-analyzer.html#web=eq.log

@marco-c
Copy link
Contributor

marco-c commented Jul 28, 2021

Thanks to that change, the reftest are fine with one exception (at least locally): the one for xfa_filled_imm1344e has a bg color issue but only for the first page and only with Firefox.
Maybe it's because it's the first test ran...

It is happening with firefox-xfa_imm1295e-page1 too, is it only a reftest issue or is it occurring in the actual viewer too?

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/9489a0012503d14/output.txt

Total script time: 38.40 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  errors: 4
  different ref/snapshot: 461
  different first/second rendering: 1

Image differences available at: http://3.101.106.178:8877/9489a0012503d14/reftest-analyzer.html#web=eq.log

@marco-c
Copy link
Contributor

marco-c commented Jul 28, 2021

There are also a few errors.

@calixteman
Copy link
Contributor Author

Thanks to that change, the reftest are fine with one exception (at least locally): the one for xfa_filled_imm1344e has a bg color issue but only for the first page and only with Firefox.
Maybe it's because it's the first test ran...

It is happening with firefox-xfa_imm1295e-page1 too, is it only a reftest issue or is it occurring in the actual viewer too?

Locally: there are no problem... pffff
And it's ok with chrome.
I dumped the generated svg for all the page 1, copy/paste it in a file and then open it in Firefox: no problem at all.

@calixteman
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://3.101.106.178:8877/7e213a1dc752b54/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @calixteman received. Current queue size: 0

Live output at: http://54.67.70.0:8877/6562c837b514ffa/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/6562c837b514ffa/output.txt

Total script time: 33.45 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 481
  different first/second rendering: 1

Image differences available at: http://54.67.70.0:8877/6562c837b514ffa/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/7e213a1dc752b54/output.txt

Total script time: 38.99 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 479
  different first/second rendering: 1

Image differences available at: http://3.101.106.178:8877/7e213a1dc752b54/reftest-analyzer.html#web=eq.log

@marco-c
Copy link
Contributor

marco-c commented Jul 28, 2021

@calixteman can you check firefox-hsbc-page1 too? It also has white fields.

@calixteman
Copy link
Contributor Author

@calixteman can you check firefox-hsbc-page1 too? It also has white fields.

The chrome snapshot is ok for this one and locally there are no problems.

@calixteman calixteman merged commit ac5c4b7 into mozilla:master Jul 28, 2021
@calixteman
Copy link
Contributor Author

/botio makeref

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @calixteman received. Current queue size: 0

Live output at: http://54.67.70.0:8877/d1c5cc9ededc5d6/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_makeref from @calixteman received. Current queue size: 1

Live output at: http://3.101.106.178:8877/a198e7565cf1c9d/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/d1c5cc9ededc5d6/output.txt

Total script time: 30.28 mins

  • Lint: Passed
  • Make references: Passed
  • Check references: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/a198e7565cf1c9d/output.txt

Total script time: 29.09 mins

  • Lint: Passed
  • Make references: FAILED

@marco-c marco-c linked an issue Jul 29, 2021 that may be closed by this pull request
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 Subforms incorrectly colored
5 participants