style: Rewrite <input type=number> to avoid an anonymous input.

Instead, subclass nsTextControlFrame. This simplifies the code and avoids
correctness issues.

I kept the localization functionality though it is not spec compliant. But I
filed a bug to remove it in a followup.

Differential Revision: https://phabricator.services.mozilla.com/D57193
This commit is contained in:
Emilio Cobos Álvarez 2020-01-14 19:01:05 +00:00
parent c569d314a5
commit 9026720f04
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A

View file

@ -1869,22 +1869,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
#[inline]
fn pseudo_element_originating_element(&self) -> Option<Self> {
debug_assert!(self.is_pseudo_element());
let parent = self.closest_anon_subtree_root_parent()?;
// FIXME(emilio): Special-case for <input type="number">s
// pseudo-elements, which are nested NAC. Probably nsNumberControlFrame
// should instead inherit from nsTextControlFrame, and then this could
// go away.
if let Some(PseudoElement::MozNumberText) = parent.implemented_pseudo_element() {
debug_assert_eq!(
self.implemented_pseudo_element().unwrap(),
PseudoElement::Placeholder,
"You added a new pseudo, do you really want this?"
);
return parent.closest_anon_subtree_root_parent();
}
Some(parent)
self.closest_anon_subtree_root_parent()
}
#[inline]