mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
style: Update the Rust target version for bindgen.
This brings us alignas support and also associated constants for bitfield enums. Differential Revision: https://phabricator.services.mozilla.com/D15334
This commit is contained in:
parent
8a6230e5a2
commit
8929087d83
7 changed files with 26 additions and 40 deletions
|
@ -139,7 +139,9 @@ mod bindings {
|
|||
|
||||
// Disable rust unions, because we replace some types inside of
|
||||
// them.
|
||||
let mut builder = Builder::default().rust_target(RustTarget::Stable_1_0);
|
||||
let mut builder = Builder::default()
|
||||
.rust_target(RustTarget::Stable_1_25)
|
||||
.disable_untagged_union();
|
||||
|
||||
let rustfmt_path = env::var_os("RUSTFMT")
|
||||
// This can be replaced with
|
||||
|
|
|
@ -156,8 +156,6 @@ impl PseudoElement {
|
|||
/// Construct a `CSSPseudoElementType` from a pseudo-element
|
||||
#[inline]
|
||||
fn pseudo_type(&self) -> CSSPseudoElementType {
|
||||
use crate::gecko_bindings::structs::CSSPseudoElementType_InheritingAnonBox;
|
||||
|
||||
match *self {
|
||||
% for pseudo in PSEUDOS:
|
||||
% if not pseudo.is_anon_box():
|
||||
|
@ -165,7 +163,7 @@ impl PseudoElement {
|
|||
% elif pseudo.is_tree_pseudo_element():
|
||||
PseudoElement::${pseudo.capitalized_pseudo()}(..) => CSSPseudoElementType::XULTree,
|
||||
% elif pseudo.is_inheriting_anon_box():
|
||||
PseudoElement::${pseudo.capitalized_pseudo()} => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::${pseudo.capitalized_pseudo()} => CSSPseudoElementType::InheritingAnonBox,
|
||||
% else:
|
||||
PseudoElement::${pseudo.capitalized_pseudo()} => CSSPseudoElementType::NonInheritingAnonBox,
|
||||
% endif
|
||||
|
|
|
@ -83,7 +83,7 @@ impl GeckoRestyleDamage {
|
|||
/// Gets restyle damage to reconstruct the entire frame, subsuming all
|
||||
/// other damage.
|
||||
pub fn reconstruct() -> Self {
|
||||
GeckoRestyleDamage(structs::nsChangeHint_nsChangeHint_ReconstructFrame)
|
||||
GeckoRestyleDamage(structs::nsChangeHint::nsChangeHint_ReconstructFrame)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1501,9 +1501,6 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
|
||||
/// Process various tasks that are a result of animation-only restyle.
|
||||
fn process_post_animation(&self, tasks: PostAnimationTasks) {
|
||||
use crate::gecko_bindings::structs::nsChangeHint_nsChangeHint_Empty;
|
||||
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_Subtree;
|
||||
|
||||
debug_assert!(!tasks.is_empty(), "Should be involved a task");
|
||||
|
||||
// If display style was changed from none to other, we need to resolve
|
||||
|
@ -1519,8 +1516,8 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
);
|
||||
unsafe {
|
||||
self.note_explicit_hints(
|
||||
nsRestyleHint_eRestyle_Subtree,
|
||||
nsChangeHint_nsChangeHint_Empty,
|
||||
nsRestyleHint::eRestyle_Subtree,
|
||||
nsChangeHint::nsChangeHint_Empty,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,17 +5,14 @@
|
|||
//! Helper to iterate over `OriginFlags` bits.
|
||||
|
||||
use crate::gecko_bindings::structs::OriginFlags;
|
||||
use crate::gecko_bindings::structs::OriginFlags_Author;
|
||||
use crate::gecko_bindings::structs::OriginFlags_User;
|
||||
use crate::gecko_bindings::structs::OriginFlags_UserAgent;
|
||||
use crate::stylesheets::OriginSet;
|
||||
|
||||
/// Checks that the values for OriginFlags are the ones we expect.
|
||||
pub fn assert_flags_match() {
|
||||
use crate::stylesheets::origin::*;
|
||||
debug_assert_eq!(OriginFlags_UserAgent.0, OriginSet::ORIGIN_USER_AGENT.bits());
|
||||
debug_assert_eq!(OriginFlags_Author.0, OriginSet::ORIGIN_AUTHOR.bits());
|
||||
debug_assert_eq!(OriginFlags_User.0, OriginSet::ORIGIN_USER.bits());
|
||||
debug_assert_eq!(OriginFlags::UserAgent.0, OriginSet::ORIGIN_USER_AGENT.bits());
|
||||
debug_assert_eq!(OriginFlags::Author.0, OriginSet::ORIGIN_AUTHOR.bits());
|
||||
debug_assert_eq!(OriginFlags::User.0, OriginSet::ORIGIN_USER.bits());
|
||||
}
|
||||
|
||||
impl From<OriginFlags> for OriginSet {
|
||||
|
|
|
@ -193,38 +193,31 @@ impl Default for RestyleHint {
|
|||
#[cfg(feature = "gecko")]
|
||||
impl From<nsRestyleHint> for RestyleHint {
|
||||
fn from(mut raw: nsRestyleHint) -> Self {
|
||||
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_Force as eRestyle_Force;
|
||||
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_ForceDescendants as eRestyle_ForceDescendants;
|
||||
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_LaterSiblings as eRestyle_LaterSiblings;
|
||||
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_Self as eRestyle_Self;
|
||||
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_SomeDescendants as eRestyle_SomeDescendants;
|
||||
use crate::gecko_bindings::structs::nsRestyleHint_eRestyle_Subtree as eRestyle_Subtree;
|
||||
|
||||
let mut hint = RestyleHint::empty();
|
||||
|
||||
debug_assert!(
|
||||
raw.0 & eRestyle_LaterSiblings.0 == 0,
|
||||
raw.0 & nsRestyleHint::eRestyle_LaterSiblings.0 == 0,
|
||||
"Handle later siblings manually if necessary plz."
|
||||
);
|
||||
|
||||
if (raw.0 & (eRestyle_Self.0 | eRestyle_Subtree.0)) != 0 {
|
||||
raw.0 &= !eRestyle_Self.0;
|
||||
if (raw.0 & (nsRestyleHint::eRestyle_Self.0 | nsRestyleHint::eRestyle_Subtree.0)) != 0 {
|
||||
raw.0 &= !nsRestyleHint::eRestyle_Self.0;
|
||||
hint.insert(RestyleHint::RESTYLE_SELF);
|
||||
}
|
||||
|
||||
if (raw.0 & (eRestyle_Subtree.0 | eRestyle_SomeDescendants.0)) != 0 {
|
||||
raw.0 &= !eRestyle_Subtree.0;
|
||||
raw.0 &= !eRestyle_SomeDescendants.0;
|
||||
if (raw.0 & (nsRestyleHint::eRestyle_Subtree.0 | nsRestyleHint::eRestyle_SomeDescendants.0)) != 0 {
|
||||
raw.0 &= !nsRestyleHint::eRestyle_Subtree.0;
|
||||
raw.0 &= !nsRestyleHint::eRestyle_SomeDescendants.0;
|
||||
hint.insert(RestyleHint::RESTYLE_DESCENDANTS);
|
||||
}
|
||||
|
||||
if (raw.0 & (eRestyle_ForceDescendants.0 | eRestyle_Force.0)) != 0 {
|
||||
raw.0 &= !eRestyle_Force.0;
|
||||
if (raw.0 & (nsRestyleHint::eRestyle_ForceDescendants.0 | nsRestyleHint::eRestyle_Force.0)) != 0 {
|
||||
raw.0 &= !nsRestyleHint::eRestyle_Force.0;
|
||||
hint.insert(RestyleHint::RECASCADE_SELF);
|
||||
}
|
||||
|
||||
if (raw.0 & eRestyle_ForceDescendants.0) != 0 {
|
||||
raw.0 &= !eRestyle_ForceDescendants.0;
|
||||
if (raw.0 & nsRestyleHint::eRestyle_ForceDescendants.0) != 0 {
|
||||
raw.0 &= !nsRestyleHint::eRestyle_ForceDescendants.0;
|
||||
hint.insert(RestyleHint::RECASCADE_DESCENDANTS);
|
||||
}
|
||||
|
||||
|
@ -248,7 +241,7 @@ pub fn assert_restyle_hints_match() {
|
|||
if cfg!(debug_assertions) {
|
||||
let mut replacements = RestyleHint::replacements();
|
||||
$(
|
||||
assert_eq!(structs::$a.0 as usize, $b.bits() as usize, stringify!($b));
|
||||
assert_eq!(structs::nsRestyleHint::$a.0 as usize, $b.bits() as usize, stringify!($b));
|
||||
replacements.remove($b);
|
||||
)*
|
||||
assert_eq!(replacements, RestyleHint::empty(),
|
||||
|
@ -259,9 +252,9 @@ pub fn assert_restyle_hints_match() {
|
|||
}
|
||||
|
||||
check_restyle_hints! {
|
||||
nsRestyleHint_eRestyle_CSSTransitions => RestyleHint::RESTYLE_CSS_TRANSITIONS,
|
||||
nsRestyleHint_eRestyle_CSSAnimations => RestyleHint::RESTYLE_CSS_ANIMATIONS,
|
||||
nsRestyleHint_eRestyle_StyleAttribute => RestyleHint::RESTYLE_STYLE_ATTRIBUTE,
|
||||
nsRestyleHint_eRestyle_StyleAttribute_Animations => RestyleHint::RESTYLE_SMIL,
|
||||
eRestyle_CSSTransitions => RestyleHint::RESTYLE_CSS_TRANSITIONS,
|
||||
eRestyle_CSSAnimations => RestyleHint::RESTYLE_CSS_ANIMATIONS,
|
||||
eRestyle_StyleAttribute => RestyleHint::RESTYLE_STYLE_ATTRIBUTE,
|
||||
eRestyle_StyleAttribute_Animations => RestyleHint::RESTYLE_SMIL,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ use crate::gecko_bindings::bindings::RawGeckoPresContextBorrowed;
|
|||
use crate::gecko_bindings::structs;
|
||||
use crate::gecko_bindings::structs::nsCSSPropertyID;
|
||||
use crate::gecko_bindings::structs::mozilla::CSSPseudoElementType;
|
||||
use crate::gecko_bindings::structs::mozilla::CSSPseudoElementType_InheritingAnonBox;
|
||||
use crate::gecko_bindings::sugar::ns_style_coord::{CoordDataValue, CoordData, CoordDataMut};
|
||||
use crate::gecko_bindings::sugar::refptr::RefPtr;
|
||||
use crate::gecko::values::convert_nscolor_to_rgba;
|
||||
|
@ -138,7 +137,7 @@ impl ComputedValues {
|
|||
#[inline]
|
||||
pub fn is_anon_box(&self) -> bool {
|
||||
let our_type = self.get_pseudo_type();
|
||||
return our_type == CSSPseudoElementType_InheritingAnonBox ||
|
||||
return our_type == CSSPseudoElementType::InheritingAnonBox ||
|
||||
our_type == CSSPseudoElementType::NonInheritingAnonBox;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue