From ec01af6b389ff103412a60113fb4c569d0721fbf Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Wed, 25 Sep 2024 17:09:24 +0200 Subject: [PATCH] [Editor] Avoid to have a selected stamp annotation on top of the secondary toolbar (bug 1911980) --- test/images/firefox_logo.png | Bin test/images/firefox_logo.svg | 0 test/images/red.png | Bin 0 -> 4849 bytes test/integration/stamp_editor_spec.mjs | 46 +++++++++++++++++++++++++ web/viewer.css | 7 ++-- 5 files changed, 50 insertions(+), 3 deletions(-) mode change 100755 => 100644 test/images/firefox_logo.png mode change 100755 => 100644 test/images/firefox_logo.svg create mode 100644 test/images/red.png diff --git a/test/images/firefox_logo.png b/test/images/firefox_logo.png old mode 100755 new mode 100644 diff --git a/test/images/firefox_logo.svg b/test/images/firefox_logo.svg old mode 100755 new mode 100644 diff --git a/test/images/red.png b/test/images/red.png new file mode 100644 index 0000000000000000000000000000000000000000..a652643d7a4ed7add1cad0ae4866e6d6ab144b53 GIT binary patch literal 4849 zcmeAS@N?(olHy`uVBq!ia0y~yV15C@985rwLkFEVGcYi=W;#0ucse^P6cpvBW#*(Z zFlbDyooMTE*g@uKeDG2JReWUug(m`Hw{&+|Ow$rO=#;6wrZ@8hT!9ah4%OER^Qpn+)_1jWtuxnfaz(EV~dj1 zc59XGUBrI)#c`HDLdIV!vJ838e=OyfkAHv2=JfA7^B4P{oXPW{^N8RwX|a!NAKxrn zT6|BPZ_}bB0`rCarAizhxvx8|x4%%&Lg&Mo1rzUw&tagUE}Tjc@x67i5cPT*>+U`^GkD^@jhFJ1#~2 z^OBwMTV?OHOHS?w4ww}b-o5n1_CXQ5MAao#=OPt*U&Z2lp!eEkAYNV3E=qQp5rH#aq}gu%HeHL)Z$MWH;iBtya7 z(>EZzkx!g~LEx6Bi(^Q|t+&?<85tNj4jUZU|2(mAvhu_WtLFmKz&>eC28IJWm>C$3 z$ucnXSTisr+ySb4%m)!Lc*nrdP{f&}pEg&T%bFW7XLy>P=o)?n8Q zav98C?0R8_;r0Z`8n|AVVYmYTyF+jW098DJ5&)p6fd@R+03hrM5@V4FPap>XJTyUJ zg|&;!!aq2mMD}Lizw+Bdxj!0EsmBbqm>&{ zr3x#KheYKzTB3}WD2QeStZ6_*v54F>AfkGQWeSwW5=s?KV)Z`SMuBx8kYi#HRBods w%4mr)TB6`C+E7}HB(^kRt;CW(&zc|iUEV$+j913CZboFyt=akR{0A$nE+yDRo literal 0 HcmV?d00001 diff --git a/test/integration/stamp_editor_spec.mjs b/test/integration/stamp_editor_spec.mjs index 24e60499f7402..ed706d0c0b769 100644 --- a/test/integration/stamp_editor_spec.mjs +++ b/test/integration/stamp_editor_spec.mjs @@ -47,6 +47,7 @@ import { import { fileURLToPath } from "url"; import fs from "fs"; import path from "path"; +import { PNG } from "pngjs"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -1235,4 +1236,49 @@ describe("Stamp Editor", () => { ); }); }); + + describe("A stamp musn't be on top of the secondary toolbar", () => { + let pages; + + beforeAll(async () => { + pages = await loadAndWait("empty.pdf", ".annotationEditorLayer", 600); + }); + + afterAll(async () => { + await closePages(pages); + }); + + it("must check that a stamp editor isn't on top of the secondary toolbar", async () => { + // Run sequentially to avoid clipboard issues. + const editorSelector = getEditorSelector(0); + + for (const [, page] of pages) { + await switchToStamp(page); + + await copyImage(page, "../images/red.png", 0); + + await page.waitForSelector(editorSelector); + await waitForSerialized(page, 1); + } + + await Promise.all( + pages.map(async ([browserName, page]) => { + const debug = false; + + await page.click("#secondaryToolbarToggleButton"); + await page.waitForSelector("#secondaryToolbar", { visible: true }); + const secondary = await page.$("#secondaryToolbar"); + const png = await secondary.screenshot({ + type: "png", + path: debug ? `foo.png` : "", + }); + const secondaryImage = PNG.sync.read(Buffer.from(png)); + const buffer = new Uint32Array(secondaryImage.data.buffer); + expect(buffer.every(x => x === 0xff0000ff)) + .withContext(`In ${browserName}`) + .toBeFalse(); + }) + ); + }); + }); }); diff --git a/web/viewer.css b/web/viewer.css index bc217e830b2b7..559cf10914fdc 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -298,9 +298,9 @@ body { inset-inline-start: calc(-1 * var(--sidebar-width)); width: var(--sidebar-width); visibility: hidden; - z-index: 100; + z-index: 1; font: message-box; - border-top: 1px solid rgb(51 51 51); + border-top: 1px solid transparent; border-inline-end: var(--doorhanger-border-color-whcm); transition-property: inset-inline-start; transition-duration: var(--sidebar-transition-duration); @@ -338,6 +338,7 @@ body { position: absolute; inset: var(--toolbar-height) 0 0; outline: none; + z-index: 0; } #viewerContainer:not(.pdfPresentationMode) { @@ -355,7 +356,7 @@ body { } .toolbar { - z-index: 9999; + z-index: 2; } #toolbarSidebar {