servo: Merge #20508 - Convert StylePrefs to StaticPrefs (from nnethercote:bug-1448225); r=emilio

<!-- Please describe your changes on the following line: -->

This is the Servo part of https://bugzilla.mozilla.org/show_bug.cgi?id=1448225.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1448225

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because tested on the Gecko side.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

r? emilio

Source-Repo: https://github.com/servo/servo
Source-Revision: 0a3ffc0c6045eb6983273010d91a35267d8ec3fa

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 53bd7e885a4c85bf4ab3db2c16b4fb36536dc108
This commit is contained in:
Nicholas Nethercote 2018-04-03 01:54:24 -04:00
parent c14a8ffa84
commit 04568ff65e
9 changed files with 46 additions and 46 deletions

View File

@ -224,13 +224,13 @@ macro_rules! is_descriptor_enabled {
("font-display") => {
unsafe {
use gecko_bindings::structs::mozilla;
mozilla::StylePrefs_sFontDisplayEnabled
mozilla::StaticPrefs_sVarCache_layout_css_font_display_enabled
}
};
("font-variation-settings") => {
unsafe {
use gecko_bindings::structs::mozilla;
mozilla::StylePrefs_sFontVariationsEnabled
mozilla::StaticPrefs_sVarCache_layout_css_font_variations_enabled
}
};
($name: tt) => { true }

View File

@ -188,7 +188,7 @@ impl PerDocumentStyleDataImpl {
/// Returns whether visited links are enabled.
fn visited_links_enabled(&self) -> bool {
unsafe { structs::StylePrefs_sVisitedLinksEnabled }
unsafe { structs::StaticPrefs_sVarCache_layout_css_visited_links_enabled }
}
/// Returns whether visited styles are enabled.

View File

@ -11974,79 +11974,79 @@ pub mod root {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct StylePrefs {
pub struct StaticPrefs {
pub _address: u8,
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs19sFontDisplayEnabledE"]
pub static mut StylePrefs_sFontDisplayEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs41sVarCache_layout_css_font_display_enabledE"]
pub static mut StaticPrefs_sVarCache_layout_css_font_display_enabled: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs19sOpentypeSVGEnabledE"]
pub static mut StylePrefs_sOpentypeSVGEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs49sVarCache_gfx_font_rendering_opentype_svg_enabledE"]
pub static mut StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs29sWebkitPrefixedAliasesEnabledE"]
pub static mut StylePrefs_sWebkitPrefixedAliasesEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs36sVarCache_layout_css_prefixes_webkitE"]
pub static mut StaticPrefs_sVarCache_layout_css_prefixes_webkit: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs30sWebkitDevicePixelRatioEnabledE"]
pub static mut StylePrefs_sWebkitDevicePixelRatioEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs55sVarCache_layout_css_prefixes_device_pixel_ratio_webkitE"]
pub static mut StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs20sMozGradientsEnabledE"]
pub static mut StylePrefs_sMozGradientsEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs39sVarCache_layout_css_prefixes_gradientsE"]
pub static mut StaticPrefs_sVarCache_layout_css_prefixes_gradients: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs22sControlCharVisibilityE"]
pub static mut StylePrefs_sControlCharVisibility: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs47sVarCache_layout_css_control_characters_visibleE"]
pub static mut StaticPrefs_sVarCache_layout_css_control_characters_visible: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs28sFramesTimingFunctionEnabledE"]
pub static mut StylePrefs_sFramesTimingFunctionEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs42sVarCache_layout_css_frames_timing_enabledE"]
pub static mut StaticPrefs_sVarCache_layout_css_frames_timing_enabled: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs31sUnprefixedFullscreenApiEnabledE"]
pub static mut StylePrefs_sUnprefixedFullscreenApiEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs42sVarCache_full_screen_api_unprefix_enabledE"]
pub static mut StaticPrefs_sVarCache_full_screen_api_unprefix_enabled: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs20sVisitedLinksEnabledE"]
pub static mut StylePrefs_sVisitedLinksEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs42sVarCache_layout_css_visited_links_enabledE"]
pub static mut StaticPrefs_sVarCache_layout_css_visited_links_enabled: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs28sMozDocumentEnabledInContentE"]
pub static mut StylePrefs_sMozDocumentEnabledInContent: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs49sVarCache_layout_css_moz_document_content_enabledE"]
pub static mut StaticPrefs_sVarCache_layout_css_moz_document_content_enabled: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs32sMozDocumentURLPrefixHackEnabledE"]
pub static mut StylePrefs_sMozDocumentURLPrefixHackEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs57sVarCache_layout_css_moz_document_url_prefix_hack_enabledE"]
pub static mut StaticPrefs_sVarCache_layout_css_moz_document_url_prefix_hack_enabled: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs32sGridTemplateSubgridValueEnabledE"]
pub static mut StylePrefs_sGridTemplateSubgridValueEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs56sVarCache_layout_css_grid_template_subgrid_value_enabledE"]
pub static mut StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs22sFontVariationsEnabledE"]
pub static mut StylePrefs_sFontVariationsEnabled: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs44sVarCache_layout_css_font_variations_enabledE"]
pub static mut StaticPrefs_sVarCache_layout_css_font_variations_enabled: bool;
}
extern "C" {
#[link_name = "\u{1}_ZN7mozilla10StylePrefs22sEmulateMozBoxWithFlexE"]
pub static mut StylePrefs_sEmulateMozBoxWithFlex: bool;
#[link_name = "\u{1}_ZN7mozilla11StaticPrefs46sVarCache_layout_css_emulate_moz_box_with_flexE"]
pub static mut StaticPrefs_sVarCache_layout_css_emulate_moz_box_with_flex: bool;
}
#[test]
fn bindgen_test_layout_StylePrefs() {
fn bindgen_test_layout_StaticPrefs() {
assert_eq!(
::std::mem::size_of::<StylePrefs>(),
::std::mem::size_of::<StaticPrefs>(),
1usize,
concat!("Size of: ", stringify!(StylePrefs))
concat!("Size of: ", stringify!(StaticPrefs))
);
assert_eq!(
::std::mem::align_of::<StylePrefs>(),
::std::mem::align_of::<StaticPrefs>(),
1usize,
concat!("Alignment of ", stringify!(StylePrefs))
concat!("Alignment of ", stringify!(StaticPrefs))
);
}
impl Clone for StylePrefs {
impl Clone for StaticPrefs {
fn clone(&self) -> Self {
*self
}

View File

@ -610,11 +610,11 @@ impl Expression {
let result = {
let mut feature_name = &**ident;
if unsafe { structs::StylePrefs_sWebkitPrefixedAliasesEnabled } &&
if unsafe { structs::StaticPrefs_sVarCache_layout_css_prefixes_webkit } &&
starts_with_ignore_ascii_case(feature_name, "-webkit-") {
feature_name = &feature_name[8..];
flags |= structs::nsMediaFeature_RequirementFlags_eHasWebkitPrefix;
if unsafe { structs::StylePrefs_sWebkitDevicePixelRatioEnabled } {
if unsafe { structs::StaticPrefs_sVarCache_layout_css_prefixes_device_pixel_ratio_webkit } {
flags |= structs::nsMediaFeature_RequirementFlags_eWebkitDevicePixelRatioPrefEnabled;
}
}

View File

@ -179,7 +179,7 @@ impl NonTSPseudoClass {
// For pseudo-classes with pref, the availability in content
// depends on the pref.
NonTSPseudoClass::Fullscreen =>
unsafe { mozilla::StylePrefs_sUnprefixedFullscreenApiEnabled },
unsafe { mozilla::StaticPrefs_sVarCache_full_screen_api_unprefix_enabled },
// Otherwise, a pseudo-class is enabled in content when it
// doesn't have any enabled flag.
_ => !self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),

View File

@ -220,11 +220,11 @@ impl DocumentCondition {
return true;
}
if unsafe { structs::StylePrefs_sMozDocumentEnabledInContent } {
if unsafe { structs::StaticPrefs_sVarCache_layout_css_moz_document_content_enabled } {
return true;
}
if !unsafe { structs::StylePrefs_sMozDocumentURLPrefixHackEnabled } {
if !unsafe { structs::StaticPrefs_sVarCache_layout_css_moz_document_url_prefix_hack_enabled } {
return false;
}

View File

@ -329,7 +329,7 @@ impl ToComputedValue for TrackList<LengthOrPercentage, Integer> {
#[inline]
fn allow_grid_template_subgrids() -> bool {
use gecko_bindings::structs::mozilla;
unsafe { mozilla::StylePrefs_sGridTemplateSubgridValueEnabled }
unsafe { mozilla::StaticPrefs_sVarCache_layout_css_grid_template_subgrid_value_enabled }
}
#[cfg(feature = "servo")]

View File

@ -28,7 +28,7 @@ fn is_context_value_enabled() -> bool {
// to read whenever we are on the main thread or the main thread is
// blocked.
use gecko_bindings::structs::mozilla;
unsafe { mozilla::StylePrefs_sOpentypeSVGEnabled }
unsafe { mozilla::StaticPrefs_sVarCache_gfx_font_rendering_opentype_svg_enabled }
}
#[cfg(not(feature = "gecko"))]
fn is_context_value_enabled() -> bool {

View File

@ -355,7 +355,7 @@ impl<S> OriginComponent<S> {
#[inline]
fn allow_frames_timing() -> bool {
use gecko_bindings::structs::mozilla;
unsafe { mozilla::StylePrefs_sFramesTimingFunctionEnabled }
unsafe { mozilla::StaticPrefs_sVarCache_layout_css_frames_timing_enabled }
}
#[cfg(feature = "servo")]