From db0b3cda8bbb8a72a04c71d9c2c5f450279343f5 Mon Sep 17 00:00:00 2001 From: Catherine Date: Mon, 18 Oct 2021 11:28:42 -0400 Subject: [PATCH] XFA - Fix xfaLink class to make links work (bug 1735738) There were some links not working in some XFA files,I realized that the anchor tag that contains the link has an inline display and couldn't receive any height, solved this by adding a "position: absolute". Tested with two different files in Firefox Nightly and Chrome and now all links are working perfectly fine. Added reftest to avoid future regressions --- test/driver.js | 8 ++++++-- test/pdfs/xfa_bug1735738.pdf.link | 1 + test/test_manifest.json | 8 ++++++++ test/xfa_layer_builder_overrides.css | 20 ++++++++++++++++++++ web/xfa_layer_builder.css | 3 +++ 5 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 test/pdfs/xfa_bug1735738.pdf.link create mode 100644 test/xfa_layer_builder_overrides.css diff --git a/test/driver.js b/test/driver.js index 13d4882eb..2eadf239e 100644 --- a/test/driver.js +++ b/test/driver.js @@ -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() { @@ -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, diff --git a/test/pdfs/xfa_bug1735738.pdf.link b/test/pdfs/xfa_bug1735738.pdf.link new file mode 100644 index 000000000..da349e949 --- /dev/null +++ b/test/pdfs/xfa_bug1735738.pdf.link @@ -0,0 +1 @@ +https://bugzilla.mozilla.org/attachment.cgi?id=9227382 diff --git a/test/test_manifest.json b/test/test_manifest.json index 2c6007b6a..59d8a302b 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -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" } ] diff --git a/test/xfa_layer_builder_overrides.css b/test/xfa_layer_builder_overrides.css new file mode 100644 index 000000000..adb77c3b4 --- /dev/null +++ b/test/xfa_layer_builder_overrides.css @@ -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 { + opacity: 0.2; + background: rgba(255, 255, 0, 1); + box-shadow: 0 2px 10px rgba(255, 255, 0, 1); +} diff --git a/web/xfa_layer_builder.css b/web/xfa_layer_builder.css index f2fcfc8d0..ab1a911cf 100644 --- a/web/xfa_layer_builder.css +++ b/web/xfa_layer_builder.css @@ -223,6 +223,9 @@ .xfaLink { width: 100%; height: 100%; + position: absolute; + top: 0; + left: 0; } .xfaCheckbox,