Bug 1373798 part 5. Use the new "dir" attribute pseudoclasses in html.css. r=emilio
MozReview-Commit-ID: AdxjsDBpbZs
--- a/layout/style/res/html.css
+++ b/layout/style/res/html.css
@@ -2,28 +2,28 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/* bidi */
-[dir] {
+:-moz-has-dir-attr {
unicode-bidi: isolate;
}
-[dir="rtl"] {
+:-moz-dir-attr-rtl {
direction: rtl;
}
-[dir="ltr"] {
+:-moz-dir-attr-ltr {
direction: ltr;
}
-bdi:dir(ltr), [dir="auto"]:dir(ltr) { direction: ltr; }
-bdi:dir(rtl), [dir="auto"]:dir(rtl) { direction: rtl; }
+:-moz-dir-attr-like-auto:dir(ltr) { direction: ltr; }
+:-moz-dir-attr-like-auto:dir(rtl) { direction: rtl; }
/* To ensure http://www.w3.org/TR/REC-html40/struct/dirlang.html#style-bidi:
*
* "When a block element that does not have a dir attribute is transformed to
* the style of an inline element by a style sheet, the resulting presentation
* should be equivalent, in terms of bidirectional formatting, to the
* formatting obtained by explicitly adding a dir attribute (assigned the
* inherited value) to the transformed element."
@@ -84,20 +84,25 @@ tr,
ul,
xmp {
unicode-bidi: isolate;
}
bdi, output {
unicode-bidi: isolate;
}
-bdo, bdo[dir] {
+/* We need the "bdo:-moz-has-dir-attr" bit because "bdo" has lower
+ specificity than the ":-moz-has-dir-attr" selector above. */
+bdo, bdo:-moz-has-dir-attr {
unicode-bidi: isolate-override;
}
-textarea[dir="auto"], pre[dir="auto"] { unicode-bidi: plaintext; }
+textarea:-moz-dir-attr-like-auto,
+pre:-moz-dir-attr-like-auto {
+ unicode-bidi: plaintext;
+}
/* blocks */
article,
aside,
details,
div,
dt,
--- a/layout/style/res/plaintext.css
+++ b/layout/style/res/plaintext.css
@@ -4,11 +4,11 @@
pre {
white-space: pre-wrap;
word-wrap: break-word;
-moz-control-character-visibility: visible;
}
/* Make text go with the rules of dir=auto, but allow it to be overriden if 'Switch Text Direction' is triggered */
-html:not([dir]) pre {
+html:not(:-moz-has-dir-attr) pre {
unicode-bidi: plaintext;
}