Skip to content

Fix XFA links (bug 1735738) #14153

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 1 commit into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions test/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ var rasterizeXfaLayer = (function rasterizeXfaLayerClosure() {
file: "../web/xfa_layer_builder.css",
promise: null,
},
overrides: {
file: "./xfa_layer_builder_overrides.css",
promise: null,
},
};

function getXfaLayerStyle() {
Expand Down Expand Up @@ -326,8 +330,8 @@ var rasterizeXfaLayer = (function rasterizeXfaLayerClosure() {
foreignObject.appendChild(div);

stylePromise
.then(async ([cssRules]) => {
style.textContent = fontRules + "\n" + cssRules;
.then(async ([common, overrides]) => {
style.textContent = fontRules + "\n" + common + "\n" + overrides;

XfaLayer.render({
xfa,
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/xfa_bug1735738.pdf.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=9227382
8 changes: 8 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6011,5 +6011,13 @@
"enableXfa": true,
"type": "eq",
"lastPage": 1
},
{ "id": "xfa_bug1735738",
"file": "pdfs/xfa_bug1735738.pdf",
"md5": "7aa91f6681798c48e0c9d9836ed30742",
"enableXfa": true,
"link": true,
"rounds": 1,
"type": "eq"
Copy link
Contributor

Choose a reason for hiding this comment

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

You should add "enableXfa": true else the pdf won't rendered correctly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, are we allowed to include the file or should it be a link test-case instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh yes, correct.
@catherinemds, please add a file named xfa_bug1735738.pdf.link which contains only the url to the pdf which is in the bugzilla bug and remove from this PR `xfa_bug1735738.pdf`` you added.

}
]
20 changes: 20 additions & 0 deletions test/xfa_layer_builder_overrides.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* Copyright 2021 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

.xfaLink {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file is missing a license header, please copy the one found e.g. in https://github.com/mozilla/pdf.js/blob/master/test/annotation_layer_builder_overrides.css (obviously with the year adjusted).

opacity: 0.2;
background: rgba(255, 255, 0, 1);
box-shadow: 0 2px 10px rgba(255, 255, 0, 1);
}
3 changes: 3 additions & 0 deletions web/xfa_layer_builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@
.xfaLink {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}

.xfaCheckbox,
Expand Down