зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1004130 - Implement ::-moz-placeholder for <input type=number>. r=bz
This commit is contained in:
Родитель
a05c9522b2
Коммит
e7e830cc7a
|
@ -347,9 +347,20 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
|||
// Associate ::-moz-placeholder pseudo-element with the placeholder node.
|
||||
CSSPseudoElementType pseudoType = CSSPseudoElementType::mozPlaceholder;
|
||||
|
||||
// If this is a text input inside a number input then we want to use the
|
||||
// main number input as the source of style for the placeholder frame.
|
||||
nsIFrame* mainInputFrame = this;
|
||||
if (StyleContext()->GetPseudoType() == CSSPseudoElementType::mozNumberText) {
|
||||
do {
|
||||
mainInputFrame = mainInputFrame->GetParent();
|
||||
} while (mainInputFrame &&
|
||||
mainInputFrame->GetType() != nsGkAtoms::numberControlFrame);
|
||||
MOZ_ASSERT(mainInputFrame);
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> placeholderStyleContext =
|
||||
PresContext()->StyleSet()->ResolvePseudoElementStyle(
|
||||
mContent->AsElement(), pseudoType, StyleContext(),
|
||||
mainInputFrame->GetContent()->AsElement(), pseudoType, StyleContext(),
|
||||
placeholderNode->AsElement());
|
||||
|
||||
if (!aElements.AppendElement(ContentInfo(placeholderNode,
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
|
||||
input {
|
||||
width: 15em;
|
||||
}
|
||||
|
||||
input[type=text]::-moz-placeholder {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<input type="text" placeholder="placeholder">
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
|
||||
input {
|
||||
width: 15em;
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
input[type=number]::-moz-placeholder {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<input type="number" placeholder="placeholder">
|
||||
</body>
|
||||
</html>
|
|
@ -46,6 +46,8 @@ skip-if(B2G||Mulet) fuzzy-if(skiaContent,2,5) needs-focus == focus-handling.html
|
|||
# pseudo-elements not usable from content:
|
||||
== number-pseudo-elements.html number-pseudo-elements-ref.html
|
||||
|
||||
== number-placeholder.html number-placeholder-ref.html
|
||||
|
||||
# check that if the anonymous text control is reframed, we reframe the whole
|
||||
# number control (the fuzzy is for the top-right and bottom-left of the border
|
||||
# bevel which gets slightly different antialiasing after invalidation):
|
||||
|
|
Загрузка…
Ссылка в новой задаче