Bug 1082899 patch 6 - Convert touch caret code to using :-moz-native-anonymous so that it doesn't expose styles for magic attribute names to content. r=birtles

Note that this leaves a few selectors with repeated classes of the form
.moz-touchcaret.moz-touchcaret .   This is intentional, so that these
changes don't change the relative specificity of any of the touch caret
selectors.

I tested locally on a Flame that using this without the ua.css changes
breaks the touch caret (it doesn't appear), but with the ua.css changes
the touch caret appears again.
This commit is contained in:
L. David Baron 2014-10-23 12:57:28 -04:00
parent 4fc47ae87b
commit f708b8829c
2 changed files with 23 additions and 28 deletions

View File

@ -76,11 +76,6 @@ nsCanvasFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
NS_ENSURE_SUCCESS(rv, rv);
aElements.AppendElement(mTouchCaretElement);
// Add a _moz_anonclass attribute as touch caret selector.
mTouchCaretElement->SetAttribute(NS_LITERAL_STRING("_moz_anonclass"),
NS_LITERAL_STRING("mozTouchCaret"), er);
NS_ENSURE_SUCCESS(er.ErrorCode(), er.ErrorCode());
// Set touch caret to visibility: hidden by default.
nsAutoString classValue;
classValue.AppendLiteral("moz-touchcaret hidden");

View File

@ -309,9 +309,9 @@ parsererror|sourcetext {
font-size: 12pt;
}
div[\_moz_anonclass="mozTouchCaret"].moz-touchcaret,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-left,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right {
:-moz-native-anonymous.moz-touchcaret.moz-touchcaret,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-left,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-right {
background-image: url("resource://gre/res/text_caret.png");
position: absolute;
width: 29px;
@ -322,69 +322,69 @@ div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right {
z-index: 2147483647;
}
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-left.tilt {
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-left.tilt {
background-image: url("resource://gre/res/text_caret_tilt_left.png");
margin-left: -29px;
width: 29px;
}
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right.tilt {
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-right.tilt {
background-image: url("resource://gre/res/text_caret_tilt_right.png");
margin-left: 0px;
width: 29px;
}
@media (min-resolution: 1.5dppx) {
div[\_moz_anonclass="mozTouchCaret"].moz-touchcaret,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-left,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right {
:-moz-native-anonymous.moz-touchcaret.moz-touchcaret,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-left,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-right {
background-image: url("resource://gre/res/text_caret@1.5x.png");
}
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-left.tilt {
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-left.tilt {
background-image: url("resource://gre/res/text_caret_tilt_left@1.5x.png");
}
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right.tilt {
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-right.tilt {
background-image: url("resource://gre/res/text_caret_tilt_right@1.5x.png");
}
}
@media (min-resolution: 2dppx) {
div[\_moz_anonclass="mozTouchCaret"].moz-touchcaret,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-left,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right {
:-moz-native-anonymous.moz-touchcaret.moz-touchcaret,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-left,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-right {
background-image: url("resource://gre/res/text_caret@2x.png");
}
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-left.tilt {
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-left.tilt {
background-image: url("resource://gre/res/text_caret_tilt_left@2x.png");
}
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right.tilt {
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-right.tilt {
background-image: url("resource://gre/res/text_caret_tilt_right@2x.png");
}
}
@media (min-resolution: 2.25dppx) {
div[\_moz_anonclass="mozTouchCaret"].moz-touchcaret,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-left,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right {
:-moz-native-anonymous.moz-touchcaret.moz-touchcaret,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-left,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-right {
background-image: url("resource://gre/res/text_caret@2.25x.png");
}
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-left.tilt {
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-left.tilt {
background-image: url("resource://gre/res/text_caret_tilt_left@2.25x.png");
}
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right.tilt {
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-right.tilt {
background-image: url("resource://gre/res/text_caret_tilt_right@2.25x.png");
}
}
div[\_moz_anonclass="mozTouchCaret"].moz-touchcaret.hidden,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-left.hidden,
div[\_moz_anonclass="mozTouchCaret"].moz-selectioncaret-right.hidden {
:-moz-native-anonymous.moz-touchcaret.moz-touchcaret.hidden,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-left.hidden,
:-moz-native-anonymous.moz-touchcaret.moz-selectioncaret-right.hidden {
width: 0px;
height: 0px;
margin: 0px;