-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Replace dir
-dependent margin
/margin-left
/margin-right
with logical properties
#14670
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For the GENERIC viewer, the contents of the built --- C:\Users\Jonas\Desktop\viewer.css
+++ C:\Users\Jonas\Git\pdf.js\build\generic\web\viewer.css
@@ -1162,18 +1162,27 @@
0 0 1px rgba(0, 0, 0, 0.1);
}
-html[dir="ltr"] #toolbarSidebar .toolbarButton {
+[dir="ltr"] #toolbarSidebar .toolbarButton {
margin-right: 2px !important;
}
-html[dir="rtl"] #toolbarSidebar .toolbarButton {
+
+[dir="rtl"] #toolbarSidebar .toolbarButton {
margin-left: 2px !important;
}
-html[dir="ltr"] #toolbarSidebarRight .toolbarButton {
+#toolbarSidebar .toolbarButton {
+ -webkit-margin-end: 2px !important;
+ margin-inline-end: 2px !important;
+}
+[dir="ltr"] #toolbarSidebarRight .toolbarButton {
margin-right: 3px !important;
}
-html[dir="rtl"] #toolbarSidebarRight .toolbarButton {
+[dir="rtl"] #toolbarSidebarRight .toolbarButton {
margin-left: 3px !important;
+}
+#toolbarSidebarRight .toolbarButton {
+ -webkit-margin-end: 3px !important;
+ margin-inline-end: 3px !important;
}
#sidebarResizer {
@@ -1325,16 +1334,19 @@
right: 64px;
}
+[dir="ltr"] .findbar .splitToolbarButton {
+ margin-left: 0;
+ margin-right: 5px;
+}
+
+[dir="rtl"] .findbar .splitToolbarButton {
+ margin-right: 0;
+ margin-left: 5px;
+}
+
.findbar .splitToolbarButton {
margin-top: 3px;
-}
-html[dir="ltr"] .findbar .splitToolbarButton {
- margin-left: 0;
- margin-right: 5px;
-}
-html[dir="rtl"] .findbar .splitToolbarButton {
- margin-left: 5px;
- margin-right: 0;
+ margin-inline: 0 5px;
}
.findbar .splitToolbarButton > .toolbarButton {
@@ -1446,7 +1458,7 @@
.doorHangerRight:after,
.doorHangerRight:before {
bottom: 100%;
- border: solid rgba(0, 0, 0, 0);
+ border: 8px solid rgba(0, 0, 0, 0);
content: " ";
height: 0;
width: 0;
@@ -1454,14 +1466,40 @@
pointer-events: none;
opacity: var(--doorhanger-triangle-opacity-whcm);
}
-.doorHanger:after,
+[dir="ltr"] .doorHanger:after {
+ left: 10px;
+}
+[dir="rtl"] .doorHanger:after {
+ right: 10px;
+}
+[dir="ltr"] .doorHanger:after {
+ margin-left: -8px;
+}
+[dir="rtl"] .doorHanger:after {
+ margin-right: -8px;
+}
+.doorHanger:after {
+ inset-inline-start: 10px;
+ -webkit-margin-start: -8px;
+ margin-inline-start: -8px;
+ border-bottom-color: var(--toolbar-bg-color);
+}
+[dir="ltr"] .doorHangerRight:after {
+ right: 10px;
+}
+[dir="rtl"] .doorHangerRight:after {
+ left: 10px;
+}
+[dir="ltr"] .doorHangerRight:after {
+ margin-right: -8px;
+}
+[dir="rtl"] .doorHangerRight:after {
+ margin-left: -8px;
+}
.doorHangerRight:after {
- border-width: 8px;
-}
-.doorHanger:after {
- border-bottom-color: var(--toolbar-bg-color);
-}
-.doorHangerRight:after {
+ inset-inline-end: 10px;
+ -webkit-margin-end: -8px;
+ margin-inline-end: -8px;
border-bottom-color: var(--doorhanger-bg-color);
}
.doorHanger:before,
@@ -1469,29 +1507,39 @@
border-bottom-color: var(--doorhanger-border-color);
border-width: 9px;
}
-
-html[dir="ltr"] .doorHanger:after,
-html[dir="rtl"] .doorHangerRight:after {
+[dir="ltr"] .doorHanger:before {
left: 10px;
- margin-left: -8px;
-}
-
-html[dir="ltr"] .doorHanger:before,
-html[dir="rtl"] .doorHangerRight:before {
+}
+[dir="rtl"] .doorHanger:before {
+ right: 10px;
+}
+[dir="ltr"] .doorHanger:before {
+ margin-left: -9px;
+}
+[dir="rtl"] .doorHanger:before {
+ margin-right: -9px;
+}
+.doorHanger:before {
+ inset-inline-start: 10px;
+ -webkit-margin-start: -9px;
+ margin-inline-start: -9px;
+}
+[dir="ltr"] .doorHangerRight:before {
+ right: 10px;
+}
+[dir="rtl"] .doorHangerRight:before {
left: 10px;
+}
+[dir="ltr"] .doorHangerRight:before {
+ margin-right: -9px;
+}
+[dir="rtl"] .doorHangerRight:before {
margin-left: -9px;
}
-
-html[dir="rtl"] .doorHanger:after,
-html[dir="ltr"] .doorHangerRight:after {
- right: 10px;
- margin-right: -8px;
-}
-
-html[dir="rtl"] .doorHanger:before,
-html[dir="ltr"] .doorHangerRight:before {
- right: 10px;
- margin-right: -9px;
+.doorHangerRight:before {
+ inset-inline-end: 10px;
+ -webkit-margin-end: -9px;
+ margin-inline-end: -9px;
}
#findResultsCount {
@@ -1607,9 +1655,7 @@
position: relative;
}
html[dir="ltr"] .splitToolbarButton > .toolbarButton:first-child,
-html[dir="rtl"] .splitToolbarButton > .toolbarButton:last-child {
- margin: 0;
-}
+html[dir="rtl"] .splitToolbarButton > .toolbarButton:last-child,
html[dir="ltr"] .splitToolbarButton > .toolbarButton:last-child,
html[dir="rtl"] .splitToolbarButton > .toolbarButton:first-child {
margin: 0;
@@ -1655,15 +1701,29 @@
box-sizing: border-box;
}
-html[dir="ltr"] #toolbarViewerLeft > .toolbarButton:first-child,
-html[dir="rtl"] #toolbarViewerRight > .toolbarButton:last-child {
+[dir="ltr"] #toolbarViewerLeft > .toolbarButton:first-child {
margin-left: 2px;
}
-html[dir="ltr"] #toolbarViewerRight > .toolbarButton:last-child,
-html[dir="rtl"] #toolbarViewerLeft > .toolbarButton:first-child {
+[dir="rtl"] #toolbarViewerLeft > .toolbarButton:first-child {
margin-right: 2px;
}
+
+#toolbarViewerLeft > .toolbarButton:first-child {
+ -webkit-margin-start: 2px;
+ margin-inline-start: 2px;
+}
+[dir="ltr"] #toolbarViewerRight > .toolbarButton:last-child {
+ margin-right: 2px;
+}
+[dir="rtl"] #toolbarViewerRight > .toolbarButton:last-child {
+ margin-left: 2px;
+}
+#toolbarViewerRight > .toolbarButton:last-child {
+ -webkit-margin-end: 2px;
+ margin-inline-end: 2px;
+}
+
.toolbarButton:hover,
.toolbarButton:focus-visible {
background-color: var(--button-hover-color);
@@ -2048,12 +2108,6 @@
margin: 5px 2px;
width: 1px;
background-color: var(--separator-color);
-}
-html[dir="ltr"] .verticalToolbarSeparator {
- margin-left: 2px;
-}
-html[dir="rtl"] .verticalToolbarSeparator {
- margin-right: 2px;
}
.horizontalToolbarSeparator {
@@ -2080,18 +2134,21 @@
outline-style: none;
}
+[dir="ltr"] .toolbarField[type="checkbox"] {
+ margin-left: 7px;
+}
+
+[dir="rtl"] .toolbarField[type="checkbox"] {
+ margin-right: 7px;
+}
+
.toolbarField[type="checkbox"] {
opacity: 0;
position: absolute !important;
left: 0;
-}
-
-html[dir="ltr"] .toolbarField[type="checkbox"] {
- margin: 10px 0 3px 7px;
-}
-
-html[dir="rtl"] .toolbarField[type="checkbox"] {
- margin: 10px 7px 3px 0;
+ margin: 10px 0 3px;
+ -webkit-margin-start: 7px;
+ margin-inline-start: 7px;
}
.toolbarField.pageNumber {
@@ -2164,7 +2221,6 @@
#thumbnailView > a:last-of-type > .thumbnail {
margin-bottom: 10px;
}
-
#thumbnailView > a:last-of-type > .thumbnail:not([data-loaded]) {
margin-bottom: 9px;
}
@@ -2224,14 +2280,20 @@
user-select: none;
}
-html[dir="ltr"] .treeWithDeepNesting > .treeItem,
-html[dir="ltr"] .treeItem > .treeItems {
+[dir="ltr"] .treeWithDeepNesting > .treeItem,[dir="ltr"]
+.treeItem > .treeItems {
margin-left: 20px;
}
-html[dir="rtl"] .treeWithDeepNesting > .treeItem,
-html[dir="rtl"] .treeItem > .treeItems {
+[dir="rtl"] .treeWithDeepNesting > .treeItem,[dir="rtl"]
+.treeItem > .treeItems {
margin-right: 20px;
+}
+
+.treeWithDeepNesting > .treeItem,
+.treeItem > .treeItems {
+ -webkit-margin-start: 20px;
+ margin-inline-start: 20px;
}
.treeItem > a { |
Snuffleupagus
force-pushed
the
postcss-logical
branch
from
March 13, 2022 20:22
21655f8
to
6aa3f86
Compare
Snuffleupagus
force-pushed
the
postcss-logical
branch
2 times, most recently
from
March 16, 2022 21:50
fe459e0
to
6fd3338
Compare
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 1 Live output at: http://54.241.84.105:8877/4599990d906c922/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/4599990d906c922/output.txt Total script time: 2.54 mins Published |
…gical properties *Please note:* This is another step in what will, time permitting, become a series of patches to simplify/modernize the viewer CSS. Rather than having to manually specify ltr/rtl-specific margin-values in the CSS, we can use logical margin instead (and similar for some related left/right occurrences). These logical properties depend on, among other things, the direction of the HTML document which we *always* specify in the viewer. Given that most of these logical CSS properties are fairly new, and that cross-browser support is thus somewhat limited (see below), we need to use a couple of PostCSS plugins (see below) in order to support this in the GENERIC viewer. - https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-start#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-end#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline-start#browser_compatibility - https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline-end#browser_compatibility --- - https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-logical - https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-dir-pseudo-class
Snuffleupagus
force-pushed
the
postcss-logical
branch
from
March 19, 2022 12:35
6fd3338
to
c99d558
Compare
timvandermeij
approved these changes
Mar 19, 2022
Thank you for doing this! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please note: This is another step in what will, time permitting, become a series of patches to simplify/modernize the viewer CSS.
Rather than having to manually specify ltr/rtl-specific margin-values in the CSS, we can use logical margin instead (and similar for some related left/right occurrences).
These logical properties depend on, among other things, the direction of the HTML document which we always specify in the viewer.
Given that most of these logical CSS properties are fairly new, and that cross-browser support is thus somewhat limited (see below), we need to use a couple of PostCSS plugins (see below) in order to support this in the GENERIC viewer.