pour-engine 1.35.0 → 1.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/project.config.js +1 -1
- package/engine/lib/contrast.js +29 -0
- package/package.json +1 -1
package/config/project.config.js
CHANGED
package/engine/lib/contrast.js
CHANGED
|
@@ -903,7 +903,36 @@ export function paintedBackdrop(element) {
|
|
|
903
903
|
overlays.push(own);
|
|
904
904
|
}
|
|
905
905
|
if (start === -1) return 'unresolved';
|
|
906
|
+
// Ancestors the hit-test cannot see. pointer-events: none is inherited
|
|
907
|
+
// and takes an element (and, unless they opt back in, its descendants)
|
|
908
|
+
// out of every hit-test stack, but it paints exactly as before. A white
|
|
909
|
+
// title inside a fixed black header with pointer-events: none, the title
|
|
910
|
+
// itself set back to auto, hit-tests as [title, page, body]: the black
|
|
911
|
+
// layer is skipped and the walk below composites the page colour under
|
|
912
|
+
// the glyphs (business.hsbc.com, 2026-08-27, asserted 1.10:1 white on
|
|
913
|
+
// #f3f3f3 under a black bar). So the painting ancestors missing from the
|
|
914
|
+
// stack are folded back in, each at its place in paint order: an
|
|
915
|
+
// ancestor paints beneath all of its descendants, so its turn comes when
|
|
916
|
+
// the next stack layer is no longer inside it. Only ancestors whose box
|
|
917
|
+
// holds the sample point count; a parent the text has been positioned
|
|
918
|
+
// out of paints nowhere under it and is rightly absent.
|
|
919
|
+
const missing = [];
|
|
920
|
+
const inStack = new Set(stack);
|
|
921
|
+
for (let a = element.parentElement ?? element.getRootNode()?.host; a && a.nodeType === 1; a = a.parentElement ?? a.getRootNode()?.host) {
|
|
922
|
+
if (inStack.has(a)) continue;
|
|
923
|
+
const box = a.getBoundingClientRect();
|
|
924
|
+
if (point.x < box.left || point.x >= box.right || point.y < box.top || point.y >= box.bottom) continue;
|
|
925
|
+
const st = getComputedStyle(a);
|
|
926
|
+
const c = parseColor(st.backgroundColor);
|
|
927
|
+
if ((c && c.a > 0) || (st.backgroundImage !== 'none' && !paintsNothing(st.backgroundImage))) missing.push(a);
|
|
928
|
+
}
|
|
929
|
+
const layers = [];
|
|
906
930
|
for (const layer of stack.slice(start + 1)) {
|
|
931
|
+
while (missing.length && !missing[0].contains(layer)) layers.push(missing.shift());
|
|
932
|
+
layers.push(layer);
|
|
933
|
+
}
|
|
934
|
+
layers.push(...missing);
|
|
935
|
+
for (const layer of layers) {
|
|
907
936
|
// Replaced elements paint their content, not a background — a photo or
|
|
908
937
|
// video in the stack is an image backdrop whatever its styles say.
|
|
909
938
|
if (/^(img|video|canvas|svg|picture|object|embed|iframe)$/i.test(layer.tagName)) {
|
package/package.json
CHANGED