Skip to content

Commit 1f19310

Browse files
committed
Add Zoom compensation for viewport units
Compensates safeguards, but not authors styles
1 parent aa61484 commit 1f19310

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

css/src/modules/ReadiumCSS-safeguards-vertical.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ img, svg|svg, video {
5656
break-inside: avoid;
5757
}
5858

59+
/* Zoom Compensation of viewport units in Chrome/Firefox */
60+
@supports (zoom: 1) and (not ((-webkit-column-axis: horizontal) and (-webkit-column-progression: normal))) {
61+
:root:not(:--deprecated-font-size):not(:--iOS-patch)[style*="--USER__fontSize"] img,
62+
:root:not(:--deprecated-font-size):not(:--iOS-patch)[style*="--USER__fontSize"] svg|svg,
63+
:root:not(:--deprecated-font-size):not(:--iOS-patch)[style*="--USER__fontSize"] video,
64+
:root:not(:--deprecated-font-size):not(:--iOS-patch)[style*="--USER__fontSize"] div {
65+
zoom: calc(100% / var(--USER__fontSize));
66+
}
67+
}
68+
5969
/* Setting width and height for audio creates issues with controls (invisible in Chromium, only the play button is displayed in Webkit).
6070
These styles should just help a little bit if the fallback is displayed cos audio is not supported. */
6171
audio {
@@ -68,5 +78,5 @@ audio {
6878
/* Try preventing border being cut-off, webkit + blink have content-box by default */
6979
table {
7080
box-sizing: var(--RS__boxSizingTable);
71-
max-height: var(--RS__maxMediaWidth)
81+
max-height: var(--RS__maxMediaWidth);
7282
}

css/src/modules/ReadiumCSS-safeguards.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ img, svg|svg, video {
5757
break-inside: avoid;
5858
}
5959

60+
/* Zoom Compensation of viewport units in Chrome/Firefox */
61+
@supports (zoom: 1) and (not ((-webkit-column-axis: horizontal) and (-webkit-column-progression: normal))) {
62+
:root:not(:--deprecated-font-size):not(:--iOS-patch)[style*="--USER__fontSize"] img,
63+
:root:not(:--deprecated-font-size):not(:--iOS-patch)[style*="--USER__fontSize"] svg|svg,
64+
:root:not(:--deprecated-font-size):not(:--iOS-patch)[style*="--USER__fontSize"] video {
65+
zoom: calc(100% / var(--USER__fontSize));
66+
}
67+
}
68+
6069
/* Setting width and height for audio creates issues with controls (invisible in Chromium, only the play button is displayed in Webkit).
6170
These styles should just help a little bit if the fallback is displayed cos audio is not supported. */
6271
audio {

0 commit comments

Comments
 (0)