1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

[Editor] Avoid to have a selected stamp annotation on top of the secondary toolbar (bug 1911980)

This commit is contained in:
Calixte Denizet 2024-09-25 17:09:24 +02:00
parent 3902a148e2
commit ec01af6b38
5 changed files with 50 additions and 3 deletions

0
test/images/firefox_logo.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 169 KiB

Before After
Before After

0
test/images/firefox_logo.svg Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

BIN
test/images/red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View file

@ -47,6 +47,7 @@ import {
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import { PNG } from "pngjs";
const __dirname = path.dirname(fileURLToPath(import.meta.url)); 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();
})
);
});
});
}); });

View file

@ -298,9 +298,9 @@ body {
inset-inline-start: calc(-1 * var(--sidebar-width)); inset-inline-start: calc(-1 * var(--sidebar-width));
width: var(--sidebar-width); width: var(--sidebar-width);
visibility: hidden; visibility: hidden;
z-index: 100; z-index: 1;
font: message-box; font: message-box;
border-top: 1px solid rgb(51 51 51); border-top: 1px solid transparent;
border-inline-end: var(--doorhanger-border-color-whcm); border-inline-end: var(--doorhanger-border-color-whcm);
transition-property: inset-inline-start; transition-property: inset-inline-start;
transition-duration: var(--sidebar-transition-duration); transition-duration: var(--sidebar-transition-duration);
@ -338,6 +338,7 @@ body {
position: absolute; position: absolute;
inset: var(--toolbar-height) 0 0; inset: var(--toolbar-height) 0 0;
outline: none; outline: none;
z-index: 0;
} }
#viewerContainer:not(.pdfPresentationMode) { #viewerContainer:not(.pdfPresentationMode) {
@ -355,7 +356,7 @@ body {
} }
.toolbar { .toolbar {
z-index: 9999; z-index: 2;
} }
#toolbarSidebar { #toolbarSidebar {