style: Fix servo build and tidy lints.

This commit is contained in:
Emilio Cobos Álvarez 2018-10-28 23:34:48 +01:00
parent a51b4e754c
commit 05f9f10a1c
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
9 changed files with 28 additions and 117 deletions

View file

@ -9,10 +9,8 @@ use app_units::Au;
use dom::TElement;
use properties::{self, ComputedValues, StyleBuilder};
use properties::computed_value_flags::ComputedValueFlags;
use properties::longhands::_moz_appearance::computed_value::T as Appearance;
use properties::longhands::display::computed_value::T as Display;
use properties::longhands::float::computed_value::T as Float;
use properties::longhands::line_height::computed_value::T as LineHeight;
use properties::longhands::overflow_x::computed_value::T as Overflow;
use properties::longhands::position::computed_value::T as Position;
@ -700,22 +698,28 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
/// the computed value of 'line-height' is 'normal'.
///
/// https://github.com/w3c/csswg-drafts/issues/3257
#[cfg(feature = "gecko")]
fn adjust_for_appearance<E>(&mut self, element: Option<E>)
where
E: TElement,
{
if self.style.get_box().clone__moz_appearance() == Appearance::Menulist &&
self.style.get_inherited_text().clone_line_height() != LineHeight::normal() {
if self.style.pseudo.is_some() {
return;
}
let is_html_select_element =
element.map_or(false, |e| e.is_html_element() && e.local_name() == &*local_name!("select"));
if !is_html_select_element {
return;
}
self.style.mutate_inherited_text().set_line_height(LineHeight::normal());
use properties::longhands::_moz_appearance::computed_value::T as Appearance;
use properties::longhands::line_height::computed_value::T as LineHeight;
if self.style.get_box().clone__moz_appearance() == Appearance::Menulist {
if self.style.get_inherited_text().clone_line_height() == LineHeight::normal() {
return;
}
if self.style.pseudo.is_some() {
return;
}
let is_html_select_element =
element.map_or(false, |e| e.is_html_element() && e.local_name() == &*local_name!("select"));
if !is_html_select_element {
return;
}
self.style.mutate_inherited_text().set_line_height(LineHeight::normal());
}
}
/// Adjusts the style to account for various fixups that don't fit naturally
@ -779,7 +783,10 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
{
self.adjust_for_text_decorations_in_effect();
}
self.adjust_for_appearance(element);
#[cfg(feature = "gecko")]
{
self.adjust_for_appearance(element);
}
self.set_bits();
}
}