Skip to content
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

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

Merged
merged 1 commit into from
Sep 26, 2024
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
Empty file modified test/images/firefox_logo.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified test/images/firefox_logo.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/images/red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions test/integration/stamp_editor_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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();
})
);
});
});
});
7 changes: 4 additions & 3 deletions web/viewer.css
Snuffleupagus marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -338,6 +338,7 @@ body {
position: absolute;
inset: var(--toolbar-height) 0 0;
outline: none;
z-index: 0;
}

#viewerContainer:not(.pdfPresentationMode) {
Expand All @@ -355,7 +356,7 @@ body {
}

.toolbar {
z-index: 9999;
z-index: 2;
}

#toolbarSidebar {
Expand Down