Bug 1321302 - Undo changes from bug 1309316 that switches in-content checkboxes to real ones instead of pseudoelements. r?Gijs draft
authorMike Conley <mconley@mozilla.com>
Tue, 29 Nov 2016 18:37:24 -0500
changeset 445985 5a49dced27ab7febc3145d1e06bd2744611c3a89
parent 445984 9e401df5f83b2dfea065cb75952c70813e356098
child 445986 560fc21fe10d13429842228639161f9d8c8eb182
child 445987 8a2b3ecb0b0c9794f5aec46b0ff8612d0f5bf8b7
push id37656
push usermconley@mozilla.com
push dateWed, 30 Nov 2016 15:59:37 +0000
reviewersGijs
bugs1321302, 1309316, 418833
milestone52.0a2
Bug 1321302 - Undo changes from bug 1309316 that switches in-content checkboxes to real ones instead of pseudoelements. r?Gijs Checkboxes (and radio inputs) haven't traditionally been very stylable in Gecko, even with -moz-appearance: none;. That was fixed in bug 418833, but those patches will not be uplifted in time for 52. In bug 1309316, I had counted on getting bug 418833 landed in time to make 52, and so had written some CSS to switch us to using traditional checkboxes (with the new styling abilities) rather than the old mechanism, which was a hacky pseudoelement solution. Since bug 418833 didn't make the uplift, we have to go back to the old mechanism. That's what this patch does. MozReview-Commit-ID: 1NfvHWpioxF
toolkit/themes/shared/in-content/common.inc.css
--- a/toolkit/themes/shared/in-content/common.inc.css
+++ b/toolkit/themes/shared/in-content/common.inc.css
@@ -502,51 +502,70 @@ html|a:visited {
 html|a:hover:active,
 .text-link:hover:active {
   color: var(--in-content-link-color-active);
   text-decoration: none;
 }
 
 /* Checkboxes and radio buttons */
 
+/* Hide the actual checkbox */
+html|input[type="checkbox"] {
+  opacity: 0;
+  width: 0;
+  pointer-events: none;
+  position: absolute;
+}
+
+/* Create a box to style as the checkbox */
+html|input[type="checkbox"] + html|label:before {
+  display: inline-block;
+  content: "";
+  vertical-align: middle;
+}
+
+html|input[type="checkbox"] + html|label {
+  line-height: 0px;
+}
+
 xul|checkbox {
   margin-inline-start: 0;
 }
 
 xul|*.checkbox-check,
-html|input[type="checkbox"] {
+html|input[type="checkbox"] + html|label:before {
   -moz-appearance: none;
   width: 23px;
   height: 23px;
   border-radius: 2px;
   border: 1px solid var(--in-content-box-border-color);
   margin-inline-end: 10px;
   background-color: #f1f1f1;
   /* !important needed to override toolkit checked !important rule */
   background-image: linear-gradient(#fff, rgba(255,255,255,0.8)) !important;
   background-position: center center;
   background-repeat: no-repeat;
   box-shadow: 0 1px 1px 0 #fff, inset 0 2px 0 0 rgba(0,0,0,0.03);
 }
 
 xul|checkbox:not([disabled="true"]):hover > xul|*.checkbox-check,
-html|input[type="checkbox"]:not(:disabled):hover {
+html|input[type="checkbox"]:not(:disabled) + html|label:hover:before {
   border-color: var(--in-content-border-focus);
 }
 
 xul|*.checkbox-check[checked] {
   list-style-image: url("chrome://global/skin/in-content/check.svg#check");
 }
 
-html|input[type="checkbox"]:checked {
+html|input[type="checkbox"]:checked + html|label:before {
   background-image: url("chrome://global/skin/in-content/check.svg#check"), linear-gradient(#fff, rgba(255,255,255,0.8)) !important;
 }
 
 xul|checkbox[disabled="true"] > xul|*.checkbox-check,
-html|input[type="checkbox"]:disabled {
+html|input[type="checkbox"]:disabled + html|label {
   opacity: 0.5;
 }
 
 xul|*.checkbox-label-box {
   margin-inline-start: -1px; /* negative margin for the transparent border */
   padding-inline-start: 0;
 }