Miscellaneous build / tidy fixes.

This commit is contained in:
Emilio Cobos Álvarez 2021-02-26 12:40:48 +01:00
parent 5158f65810
commit 31e8e418ea
66 changed files with 566 additions and 294 deletions

View file

@ -90,6 +90,7 @@ use style::shared_lock::{
};
use style::str::is_whitespace;
use style::stylist::CascadeData;
use style::values::{AtomIdent, AtomString};
use style::CaseSensitivityExt;
#[derive(Clone, Copy)]
@ -500,8 +501,8 @@ impl<'le> TElement for ServoLayoutElement<'le> {
}
#[inline]
fn has_attr(&self, namespace: &Namespace, attr: &LocalName) -> bool {
self.get_attr(namespace, attr).is_some()
fn has_attr(&self, namespace: &style::Namespace, attr: &style::LocalName) -> bool {
self.get_attr(&**namespace, &**attr).is_some()
}
#[inline]
@ -512,11 +513,11 @@ impl<'le> TElement for ServoLayoutElement<'le> {
#[inline(always)]
fn each_class<F>(&self, mut callback: F)
where
F: FnMut(&Atom),
F: FnMut(&AtomIdent),
{
if let Some(ref classes) = self.element.get_classes_for_layout() {
for class in *classes {
callback(class)
callback(AtomIdent::cast(class))
}
}
}
@ -640,7 +641,7 @@ impl<'le> TElement for ServoLayoutElement<'le> {
fn lang_attr(&self) -> Option<SelectorAttrValue> {
self.get_attr(&ns!(xml), &local_name!("lang"))
.or_else(|| self.get_attr(&ns!(), &local_name!("lang")))
.map(|v| String::from(v as &str))
.map(|v| SelectorAttrValue::from(v as &str))
}
fn match_element_lang(
@ -663,8 +664,8 @@ impl<'le> TElement for ServoLayoutElement<'le> {
// so we can decide when to fall back to the Content-Language check.
let element_lang = match override_lang {
Some(Some(lang)) => lang,
Some(None) => String::new(),
None => self.element.get_lang_for_layout(),
Some(None) => AtomString::default(),
None => AtomString::from(&*self.element.get_lang_for_layout()),
};
extended_filtering(&element_lang, &*value)
}
@ -813,9 +814,9 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
fn attr_matches(
&self,
ns: &NamespaceConstraint<&Namespace>,
local_name: &LocalName,
operation: &AttrSelectorOperation<&String>,
ns: &NamespaceConstraint<&style::Namespace>,
local_name: &style::LocalName,
operation: &AttrSelectorOperation<&AtomString>,
) -> bool {
match *ns {
NamespaceConstraint::Specific(ref ns) => self
@ -945,7 +946,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
}
#[inline]
fn has_id(&self, id: &Atom, case_sensitivity: CaseSensitivity) -> bool {
fn has_id(&self, id: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool {
unsafe {
(*self.element.id_attribute())
.as_ref()
@ -954,16 +955,16 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
}
#[inline]
fn is_part(&self, _name: &Atom) -> bool {
fn is_part(&self, _name: &AtomIdent) -> bool {
false
}
fn imported_part(&self, _: &Atom) -> Option<Atom> {
fn imported_part(&self, _: &AtomIdent) -> Option<AtomIdent> {
None
}
#[inline]
fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
fn has_class(&self, name: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool {
self.element.has_class_for_layout(name, case_sensitivity)
}
@ -1434,9 +1435,9 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
fn attr_matches(
&self,
ns: &NamespaceConstraint<&Namespace>,
local_name: &LocalName,
operation: &AttrSelectorOperation<&String>,
ns: &NamespaceConstraint<&style::Namespace>,
local_name: &style::LocalName,
operation: &AttrSelectorOperation<&AtomString>,
) -> bool {
match *ns {
NamespaceConstraint::Specific(ref ns) => self
@ -1470,23 +1471,23 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
false
}
fn has_id(&self, _id: &Atom, _case_sensitivity: CaseSensitivity) -> bool {
fn has_id(&self, _id: &AtomIdent, _case_sensitivity: CaseSensitivity) -> bool {
debug!("ServoThreadSafeLayoutElement::has_id called");
false
}
#[inline]
fn is_part(&self, _name: &Atom) -> bool {
fn is_part(&self, _name: &AtomIdent) -> bool {
debug!("ServoThreadSafeLayoutElement::is_part called");
false
}
fn imported_part(&self, _: &Atom) -> Option<Atom> {
fn imported_part(&self, _: &AtomIdent) -> Option<AtomIdent> {
debug!("ServoThreadSafeLayoutElement::imported_part called");
None
}
fn has_class(&self, _name: &Atom, _case_sensitivity: CaseSensitivity) -> bool {
fn has_class(&self, _name: &AtomIdent, _case_sensitivity: CaseSensitivity) -> bool {
debug!("ServoThreadSafeLayoutElement::has_class called");
false
}

View file

@ -506,6 +506,7 @@ impl LayoutThread {
let device = Device::new(
MediaType::screen(),
QuirksMode::NoQuirks,
window_size.initial_viewport,
window_size.device_pixel_ratio,
);
@ -1267,7 +1268,12 @@ impl LayoutThread {
};
let had_used_viewport_units = self.stylist.device().used_viewport_units();
let device = Device::new(MediaType::screen(), initial_viewport, device_pixel_ratio);
let device = Device::new(
MediaType::screen(),
self.stylist.quirks_mode(),
initial_viewport,
device_pixel_ratio,
);
let sheet_origins_affected_by_device_change = self.stylist.set_device(device, &guards);
self.stylist