Bug 930010 - Hide the CSS pseudo-elements for <input type=number>'s anonymous content tree from content. r=bz

This commit is contained in:
Jonathan Watt 2013-11-22 13:24:55 +00:00
parent c4864a961d
commit ed5a05ba14
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<input type="number" style="-moz-appearance:none;">
</body>
</html>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<style>
/* None of these selectors should match from content */
input[type=number]::-moz-number-wrapper,
input[type=number]::-moz-number-text,
input[type=number]::-moz-number-spin-box,
input[type=number]::-moz-number-spin-up,
input[type=number]::-moz-number-spin-down {
background-color: red;
}
</style>
</head>
<body>
<input type="number" style="-moz-appearance:none;">
</body>
</html>

View File

@ -20,3 +20,6 @@ fuzzy-if(/^Windows\x20NT\x205\.1/.test(http.oscpu),64,4) fuzzy-if(cocoaWidget,63
# focus
fails-if(B2G) needs-focus == focus-handling.html focus-handling-ref.html # bug 940760
# pseudo-elements not usable from content:
== number-pseudo-elements.html number-pseudo-elements-ref.html

View File

@ -3661,6 +3661,18 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
nsCSSPseudoClasses::Type pseudoClassType =
nsCSSPseudoClasses::GetPseudoType(pseudo);
if (!mUnsafeRulesEnabled &&
(pseudoElementType == nsCSSPseudoElements::ePseudo_mozNumberWrapper ||
pseudoElementType == nsCSSPseudoElements::ePseudo_mozNumberText ||
pseudoElementType == nsCSSPseudoElements::ePseudo_mozNumberSpinBox ||
pseudoElementType == nsCSSPseudoElements::ePseudo_mozNumberSpinUp ||
pseudoElementType == nsCSSPseudoElements::ePseudo_mozNumberSpinDown)) {
// Hide these pseudo-elements from content until we standardize them.
REPORT_UNEXPECTED_TOKEN(PEPseudoSelUnknown);
UngetToken();
return eSelectorParsingStatus_Error;
}
// We currently allow :-moz-placeholder and ::-moz-placeholder. We have to
// be a bit stricter regarding the pseudo-element parsing rules.
if (pseudoElementType == nsCSSPseudoElements::ePseudo_mozPlaceholder &&