style: Miscellaneous Servo build fixes.

This commit is contained in:
Emilio Cobos Álvarez 2020-02-10 16:50:40 +01:00
parent 18cda1567a
commit e227715aee
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
12 changed files with 59 additions and 10 deletions

View file

@ -2902,6 +2902,7 @@ pub struct ComputedValues {
impl ComputedValues {
/// Returns the pseudo-element that this style represents.
#[cfg(feature = "servo")]
pub fn pseudo(&self) -> Option<<&PseudoElement> {
self.pseudo.as_ref()
}

View file

@ -1718,6 +1718,7 @@ impl Clone for StrongRuleNode {
}
impl Drop for StrongRuleNode {
#[cfg_attr(feature = "servo", allow(unused_mut))]
fn drop(&mut self) {
let node = unsafe { &*self.ptr() };

View file

@ -378,6 +378,19 @@ impl LengthPercentage {
}
}
/// Converts to a `<percentage>` if possible.
#[inline]
pub fn to_percentage(&self) -> Option<Percentage> {
match self.unpack() {
Unpacked::Length(..) => None,
Unpacked::Percentage(p) => Some(p),
Unpacked::Calc(ref c) => {
debug_assert!(!c.length.is_zero());
None
}
}
}
/// Return the specified percentage if any.
#[inline]
pub fn specified_percentage(&self) -> Option<Percentage> {
@ -405,7 +418,7 @@ impl LengthPercentage {
/// Convert the computed value into used value.
#[inline]
fn maybe_to_used_value(&self, container_len: Option<Length>) -> Option<Au> {
pub fn maybe_to_used_value(&self, container_len: Option<Length>) -> Option<Au> {
self.maybe_percentage_relative_to(container_len).map(Au::from)
}

View file

@ -168,8 +168,9 @@ pub enum GenericContent<ImageUrl> {
pub use self::GenericContent as Content;
impl<ImageUrl> Content<ImageUrl> {
/// Whether `self` represents list of items.
#[inline]
pub(crate) fn is_items(&self) -> bool {
pub fn is_items(&self) -> bool {
matches!(*self, Self::Items(..))
}

View file

@ -113,6 +113,7 @@ impl Parse for Content {
// normal | none | [ <string> | <counter> | open-quote | close-quote | no-open-quote |
// no-close-quote ]+
// TODO: <uri>, attr(<identifier>)
#[cfg_attr(feature = "servo", allow(unused_mut))]
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,