mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Fix Servo_IsCssPropertyRecordedInUseCounter so that we also report disabled properties.
When zoom is disabled, we still count it, but with the current code the testing function will throw instead of returning the right value, which means we'd fail layout/style/test/test_use_counters.html. Differential Revision: https://phabricator.services.mozilla.com/D55005
This commit is contained in:
parent
22509ac3d0
commit
d06212c6c0
1 changed files with 12 additions and 4 deletions
|
@ -1813,8 +1813,8 @@ pub enum CountedUnknownProperty {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CountedUnknownProperty {
|
impl CountedUnknownProperty {
|
||||||
/// Parse the counted unknown property.
|
/// Parse the counted unknown property, for testing purposes only.
|
||||||
pub fn parse_for_test(property_name: &str) -> Option<Self> {
|
pub fn parse_for_testing(property_name: &str) -> Option<Self> {
|
||||||
ascii_case_insensitive_phf_map! {
|
ascii_case_insensitive_phf_map! {
|
||||||
unknown_id -> CountedUnknownProperty = {
|
unknown_id -> CountedUnknownProperty = {
|
||||||
% for property in data.counted_unknown_properties:
|
% for property in data.counted_unknown_properties:
|
||||||
|
@ -1826,6 +1826,7 @@ impl CountedUnknownProperty {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the underlying index, used for use counter.
|
/// Returns the underlying index, used for use counter.
|
||||||
|
#[inline]
|
||||||
pub fn bit(self) -> usize {
|
pub fn bit(self) -> usize {
|
||||||
self as usize
|
self as usize
|
||||||
}
|
}
|
||||||
|
@ -1842,9 +1843,16 @@ impl PropertyId {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a given property from the string `s`.
|
/// Returns a given property from the given name, _regardless of whether it
|
||||||
|
/// is enabled or not_, or Err(()) for unknown properties.
|
||||||
///
|
///
|
||||||
/// Returns Err(()) for unknown properties.
|
/// Do not use for non-testing purposes.
|
||||||
|
pub fn parse_unchecked_for_testing(name: &str) -> Result<Self, ()> {
|
||||||
|
Self::parse_unchecked(name, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a given property from the given name, _regardless of whether it
|
||||||
|
/// is enabled or not_, or Err(()) for unknown properties.
|
||||||
fn parse_unchecked(
|
fn parse_unchecked(
|
||||||
property_name: &str,
|
property_name: &str,
|
||||||
use_counters: Option< &UseCounters>,
|
use_counters: Option< &UseCounters>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue