Skip to content


Browse files Browse the repository at this point in the history
style: Assert that initial values in style structs match those in pro…
…perty definitions.

Differential Revision:
  • Loading branch information
heycam authored and emilio committed Apr 16, 2020
1 parent fa733ec commit c55cd22
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions components/style/properties/
Expand Up @@ -29,6 +29,7 @@ use crate::gecko_bindings::bindings::Gecko_nsStyleFont_CopyLangFrom;
use crate::gecko_bindings::structs;
use crate::gecko_bindings::structs::nsCSSPropertyID;
use crate::gecko_bindings::structs::mozilla::PseudoStyleType;
use crate::gecko::data::PerDocumentStyleData;
use crate::gecko::values::round_border_to_device_pixels;
use crate::logical_geometry::WritingMode;
use crate::media_queries::Device;
Expand Down Expand Up @@ -2128,3 +2129,40 @@ mask-mode mask-repeat mask-clip mask-origin mask-composite mask-position-x mask-
% endfor

/// Assert that the initial values set in Gecko style struct constructors
/// match the values returned by `get_initial_value()` for each longhand.
#[cfg(feature = "gecko")]
pub fn assert_initial_values_match(data: &PerDocumentStyleData) {
if cfg!(debug_assertions) {
let data = data.borrow();
let cv = data.stylist.device().default_computed_values();
# Skip properties with initial values that change at computed value time.
TO_TEST = [p for p in data.longhands if p.enabled_in != "" and not p.logical and not in SKIPPED]
% for property in TO_TEST:
"initial value in Gecko style struct for ",
" must match longhands::",
% endfor

0 comments on commit c55cd22

Please sign in to comment.