mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
parent
72ead882c0
commit
fc25397c91
10 changed files with 101 additions and 120 deletions
|
@ -68,7 +68,6 @@ use std::sync::mpsc::{channel, Sender, Receiver, Select};
|
|||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
use style::computed_values::{filter, mix_blend_mode};
|
||||
use style::media_queries::{MediaType, MediaQueryList, Device};
|
||||
use style::node::TNode;
|
||||
use style::selector_matching::Stylist;
|
||||
use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt};
|
||||
use url::Url;
|
||||
|
|
|
@ -322,7 +322,7 @@ impl<'ln> LayoutNode<'ln> {
|
|||
}
|
||||
|
||||
pub fn has_children(self) -> bool {
|
||||
self.first_child().is_some()
|
||||
TLayoutNode::first_child(&self).is_some()
|
||||
}
|
||||
|
||||
/// While doing a reflow, the node at the root has no parent, as far as we're
|
||||
|
@ -347,34 +347,34 @@ impl<'ln> LayoutNode<'ln> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'ln> TNode<'ln> for LayoutNode<'ln> {
|
||||
impl<'ln> TNode for LayoutNode<'ln> {
|
||||
type Element = LayoutElement<'ln>;
|
||||
|
||||
fn parent_node(self) -> Option<LayoutNode<'ln>> {
|
||||
fn parent_node(&self) -> Option<LayoutNode<'ln>> {
|
||||
unsafe {
|
||||
self.node.parent_node_ref().map(|node| self.new_with_this_lifetime(&node))
|
||||
}
|
||||
}
|
||||
|
||||
fn first_child(self) -> Option<LayoutNode<'ln>> {
|
||||
fn first_child(&self) -> Option<LayoutNode<'ln>> {
|
||||
unsafe {
|
||||
self.node.first_child_ref().map(|node| self.new_with_this_lifetime(&node))
|
||||
}
|
||||
}
|
||||
|
||||
fn last_child(self) -> Option<LayoutNode<'ln>> {
|
||||
fn last_child(&self) -> Option<LayoutNode<'ln>> {
|
||||
unsafe {
|
||||
self.node.last_child_ref().map(|node| self.new_with_this_lifetime(&node))
|
||||
}
|
||||
}
|
||||
|
||||
fn prev_sibling(self) -> Option<LayoutNode<'ln>> {
|
||||
fn prev_sibling(&self) -> Option<LayoutNode<'ln>> {
|
||||
unsafe {
|
||||
self.node.prev_sibling_ref().map(|node| self.new_with_this_lifetime(&node))
|
||||
}
|
||||
}
|
||||
|
||||
fn next_sibling(self) -> Option<LayoutNode<'ln>> {
|
||||
fn next_sibling(&self) -> Option<LayoutNode<'ln>> {
|
||||
unsafe {
|
||||
self.node.next_sibling_ref().map(|node| self.new_with_this_lifetime(&node))
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ impl<'ln> TNode<'ln> for LayoutNode<'ln> {
|
|||
|
||||
/// If this is an element, accesses the element data. Fails if this is not an element node.
|
||||
#[inline]
|
||||
fn as_element(self) -> LayoutElement<'ln> {
|
||||
fn as_element(&self) -> LayoutElement<'ln> {
|
||||
unsafe {
|
||||
let elem: LayoutJS<Element> = match ElementCast::to_layout_js(&self.node) {
|
||||
Some(elem) => elem,
|
||||
|
@ -395,15 +395,15 @@ impl<'ln> TNode<'ln> for LayoutNode<'ln> {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_element(self) -> bool {
|
||||
fn is_element(&self) -> bool {
|
||||
self.node_is_element()
|
||||
}
|
||||
|
||||
fn is_document(self) -> bool {
|
||||
fn is_document(&self) -> bool {
|
||||
self.node_is_document()
|
||||
}
|
||||
|
||||
fn match_attr<F>(self, attr: &AttrSelector, test: F) -> bool where F: Fn(&str) -> bool {
|
||||
fn match_attr<F>(&self, attr: &AttrSelector, test: F) -> bool where F: Fn(&str) -> bool {
|
||||
assert!(self.is_element());
|
||||
let name = if self.is_html_element_in_html_document() {
|
||||
&attr.lower_name
|
||||
|
@ -422,7 +422,7 @@ impl<'ln> TNode<'ln> for LayoutNode<'ln> {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_html_element_in_html_document(self) -> bool {
|
||||
fn is_html_element_in_html_document(&self) -> bool {
|
||||
unsafe {
|
||||
match ElementCast::to_layout_js(&self.node) {
|
||||
Some(elem) => elem.html_element_in_html_document_for_layout(),
|
||||
|
@ -430,36 +430,34 @@ impl<'ln> TNode<'ln> for LayoutNode<'ln> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn has_changed(self) -> bool {
|
||||
impl<'ln> LayoutNode<'ln> {
|
||||
pub fn has_changed(&self) -> bool {
|
||||
unsafe { self.node.get_flag(HAS_CHANGED) }
|
||||
}
|
||||
|
||||
unsafe fn set_changed(self, value: bool) {
|
||||
pub unsafe fn set_changed(&self, value: bool) {
|
||||
self.node.set_flag(HAS_CHANGED, value)
|
||||
}
|
||||
|
||||
fn is_dirty(self) -> bool {
|
||||
pub fn is_dirty(&self) -> bool {
|
||||
unsafe { self.node.get_flag(IS_DIRTY) }
|
||||
}
|
||||
|
||||
unsafe fn set_dirty(self, value: bool) {
|
||||
pub unsafe fn set_dirty(&self, value: bool) {
|
||||
self.node.set_flag(IS_DIRTY, value)
|
||||
}
|
||||
|
||||
fn has_dirty_siblings(self) -> bool {
|
||||
unsafe { self.node.get_flag(HAS_DIRTY_SIBLINGS) }
|
||||
}
|
||||
|
||||
unsafe fn set_dirty_siblings(self, value: bool) {
|
||||
pub unsafe fn set_dirty_siblings(&self, value: bool) {
|
||||
self.node.set_flag(HAS_DIRTY_SIBLINGS, value);
|
||||
}
|
||||
|
||||
fn has_dirty_descendants(self) -> bool {
|
||||
pub fn has_dirty_descendants(&self) -> bool {
|
||||
unsafe { self.node.get_flag(HAS_DIRTY_DESCENDANTS) }
|
||||
}
|
||||
|
||||
unsafe fn set_dirty_descendants(self, value: bool) {
|
||||
pub unsafe fn set_dirty_descendants(&self, value: bool) {
|
||||
self.node.set_flag(HAS_DIRTY_DESCENDANTS, value)
|
||||
}
|
||||
}
|
||||
|
@ -529,19 +527,19 @@ impl<'le> LayoutElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'le> TElement<'le> for LayoutElement<'le> {
|
||||
impl<'le> TElement for LayoutElement<'le> {
|
||||
#[inline]
|
||||
fn get_local_name(self) -> &'le Atom {
|
||||
fn get_local_name<'a>(&'a self) -> &'a Atom {
|
||||
self.element.local_name()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_namespace(self) -> &'le Namespace {
|
||||
fn get_namespace<'a>(&'a self) -> &'a Namespace {
|
||||
use script::dom::element::ElementHelpers;
|
||||
self.element.namespace()
|
||||
}
|
||||
|
||||
fn is_link(self) -> bool {
|
||||
fn is_link(&self) -> bool {
|
||||
// FIXME: This is HTML only.
|
||||
let node: &Node = NodeCast::from_actual(self.element);
|
||||
match node.type_id_for_layout() {
|
||||
|
@ -558,17 +556,17 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn is_unvisited_link(self) -> bool {
|
||||
fn is_unvisited_link(&self) -> bool {
|
||||
self.is_link()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_visited_link(self) -> bool {
|
||||
fn is_visited_link(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_hover_state(self) -> bool {
|
||||
fn get_hover_state(&self) -> bool {
|
||||
unsafe {
|
||||
let node: &Node = NodeCast::from_actual(self.element);
|
||||
node.get_hover_state_for_layout()
|
||||
|
@ -576,7 +574,7 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn get_focus_state(self) -> bool {
|
||||
fn get_focus_state(&self) -> bool {
|
||||
unsafe {
|
||||
let node: &Node = NodeCast::from_actual(self.element);
|
||||
node.get_focus_state_for_layout()
|
||||
|
@ -584,14 +582,14 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn get_id(self) -> Option<Atom> {
|
||||
fn get_id(&self) -> Option<Atom> {
|
||||
unsafe {
|
||||
self.element.get_attr_atom_for_layout(&ns!(""), &atom!("id"))
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_disabled_state(self) -> bool {
|
||||
fn get_disabled_state(&self) -> bool {
|
||||
unsafe {
|
||||
let node: &Node = NodeCast::from_actual(self.element);
|
||||
node.get_disabled_state_for_layout()
|
||||
|
@ -599,7 +597,7 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn get_enabled_state(self) -> bool {
|
||||
fn get_enabled_state(&self) -> bool {
|
||||
unsafe {
|
||||
let node: &Node = NodeCast::from_actual(self.element);
|
||||
node.get_enabled_state_for_layout()
|
||||
|
@ -607,28 +605,28 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn get_checked_state(self) -> bool {
|
||||
fn get_checked_state(&self) -> bool {
|
||||
unsafe {
|
||||
self.element.get_checked_state_for_layout()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_indeterminate_state(self) -> bool {
|
||||
fn get_indeterminate_state(&self) -> bool {
|
||||
unsafe {
|
||||
self.element.get_indeterminate_state_for_layout()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_class(self, name: &Atom) -> bool {
|
||||
fn has_class(&self, name: &Atom) -> bool {
|
||||
unsafe {
|
||||
self.element.has_class_for_layout(name)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn each_class<F>(self, mut callback: F) where F: FnMut(&Atom) {
|
||||
fn each_class<F>(&self, mut callback: F) where F: FnMut(&Atom) {
|
||||
unsafe {
|
||||
match self.element.get_classes_for_layout() {
|
||||
None => {}
|
||||
|
@ -642,7 +640,7 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn has_nonzero_border(self) -> bool {
|
||||
fn has_servo_nonzero_border(&self) -> bool {
|
||||
unsafe {
|
||||
match self.element.get_attr_for_layout(&ns!(""), &atom!("border")) {
|
||||
None | Some(&AttrValue::UInt(_, 0)) => false,
|
||||
|
@ -652,8 +650,8 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'le> TElementAttributes<'le> for LayoutElement<'le> {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(self, hints: &mut V)
|
||||
impl<'le> TElementAttributes for LayoutElement<'le> {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V)
|
||||
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>
|
||||
{
|
||||
unsafe {
|
||||
|
@ -661,19 +659,19 @@ impl<'le> TElementAttributes<'le> for LayoutElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_unsigned_integer_attribute(self, attribute: UnsignedIntegerAttribute) -> Option<u32> {
|
||||
fn get_unsigned_integer_attribute(&self, attribute: UnsignedIntegerAttribute) -> Option<u32> {
|
||||
unsafe {
|
||||
self.element.get_unsigned_integer_attribute_for_layout(attribute)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_attr(self, namespace: &Namespace, name: &Atom) -> Option<&'le str> {
|
||||
fn get_attr<'a>(&'a self, namespace: &Namespace, name: &Atom) -> Option<&'a str> {
|
||||
unsafe { self.element.get_attr_val_for_layout(namespace, name) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_attrs(self, name: &Atom) -> Vec<&'le str> {
|
||||
fn get_attrs<'a>(&'a self, name: &Atom) -> Vec<&'a str> {
|
||||
unsafe {
|
||||
self.element.get_attr_vals_for_layout(name)
|
||||
}
|
||||
|
|
|
@ -1622,10 +1622,10 @@ impl<'a> VirtualMethods for &'a Element {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> style::node::TElement<'a> for &'a Element {
|
||||
fn is_link(self) -> bool {
|
||||
impl<'a> style::node::TElement for &'a Element {
|
||||
fn is_link(&self) -> bool {
|
||||
// FIXME: This is HTML only.
|
||||
let node = NodeCast::from_ref(self);
|
||||
let node = NodeCast::from_ref(*self);
|
||||
match node.type_id() {
|
||||
// https://html.spec.whatwg.org/multipage/#selector-link
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) |
|
||||
|
@ -1638,45 +1638,45 @@ impl<'a> style::node::TElement<'a> for &'a Element {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn is_unvisited_link(self) -> bool {
|
||||
fn is_unvisited_link(&self) -> bool {
|
||||
self.is_link()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn is_visited_link(self) -> bool {
|
||||
fn is_visited_link(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn get_local_name(self) -> &'a Atom {
|
||||
fn get_local_name<'b>(&'b self) -> &'b Atom {
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn get_local_name<'a, T: ElementHelpers<'a>>(this: T) -> &'a Atom {
|
||||
this.local_name()
|
||||
}
|
||||
|
||||
get_local_name(self)
|
||||
get_local_name(*self)
|
||||
}
|
||||
fn get_namespace(self) -> &'a Namespace {
|
||||
fn get_namespace<'b>(&'b self) -> &'b Namespace {
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn get_namespace<'a, T: ElementHelpers<'a>>(this: T) -> &'a Namespace {
|
||||
this.namespace()
|
||||
}
|
||||
|
||||
get_namespace(self)
|
||||
get_namespace(*self)
|
||||
}
|
||||
fn get_hover_state(self) -> bool {
|
||||
let node = NodeCast::from_ref(self);
|
||||
fn get_hover_state(&self) -> bool {
|
||||
let node = NodeCast::from_ref(*self);
|
||||
node.get_hover_state()
|
||||
}
|
||||
fn get_focus_state(self) -> bool {
|
||||
fn get_focus_state(&self) -> bool {
|
||||
// TODO: Also check whether the top-level browsing context has the system focus,
|
||||
// and whether this element is a browsing context container.
|
||||
// https://html.spec.whatwg.org/multipage/#selector-focus
|
||||
let node = NodeCast::from_ref(self);
|
||||
let node = NodeCast::from_ref(*self);
|
||||
node.get_focus_state()
|
||||
}
|
||||
fn get_id(self) -> Option<Atom> {
|
||||
fn get_id(&self) -> Option<Atom> {
|
||||
self.get_attribute(&ns!(""), &atom!("id")).map(|attr| {
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
let attr = attr.r();
|
||||
|
@ -1687,38 +1687,38 @@ impl<'a> style::node::TElement<'a> for &'a Element {
|
|||
}
|
||||
})
|
||||
}
|
||||
fn get_disabled_state(self) -> bool {
|
||||
let node = NodeCast::from_ref(self);
|
||||
fn get_disabled_state(&self) -> bool {
|
||||
let node = NodeCast::from_ref(*self);
|
||||
node.get_disabled_state()
|
||||
}
|
||||
fn get_enabled_state(self) -> bool {
|
||||
let node = NodeCast::from_ref(self);
|
||||
fn get_enabled_state(&self) -> bool {
|
||||
let node = NodeCast::from_ref(*self);
|
||||
node.get_enabled_state()
|
||||
}
|
||||
fn get_checked_state(self) -> bool {
|
||||
let input_element: Option<&HTMLInputElement> = HTMLInputElementCast::to_ref(self);
|
||||
fn get_checked_state(&self) -> bool {
|
||||
let input_element: Option<&HTMLInputElement> = HTMLInputElementCast::to_ref(*self);
|
||||
match input_element {
|
||||
Some(input) => input.Checked(),
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
fn get_indeterminate_state(self) -> bool {
|
||||
let input_element: Option<&HTMLInputElement> = HTMLInputElementCast::to_ref(self);
|
||||
fn get_indeterminate_state(&self) -> bool {
|
||||
let input_element: Option<&HTMLInputElement> = HTMLInputElementCast::to_ref(*self);
|
||||
match input_element {
|
||||
Some(input) => input.get_indeterminate_state(),
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
fn has_class(self, name: &Atom) -> bool {
|
||||
fn has_class(&self, name: &Atom) -> bool {
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn has_class<T: AttributeHandlers>(this: T, name: &Atom) -> bool {
|
||||
this.has_class(name)
|
||||
}
|
||||
|
||||
has_class(self, name)
|
||||
has_class(*self, name)
|
||||
}
|
||||
fn each_class<F>(self, mut callback: F)
|
||||
fn each_class<F>(&self, mut callback: F)
|
||||
where F: FnMut(&Atom)
|
||||
{
|
||||
if let Some(ref attr) = self.get_attribute(&ns!(""), &atom!("class")) {
|
||||
|
@ -1729,8 +1729,8 @@ impl<'a> style::node::TElement<'a> for &'a Element {
|
|||
}
|
||||
}
|
||||
}
|
||||
fn has_nonzero_border(self) -> bool {
|
||||
let table_element: Option<&HTMLTableElement> = HTMLTableElementCast::to_ref(self);
|
||||
fn has_servo_nonzero_border(&self) -> bool {
|
||||
let table_element: Option<&HTMLTableElement> = HTMLTableElementCast::to_ref(*self);
|
||||
match table_element {
|
||||
None => false,
|
||||
Some(this) => {
|
||||
|
|
|
@ -2492,59 +2492,59 @@ impl<'a> VirtualMethods for &'a Node {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> style::node::TNode<'a> for &'a Node {
|
||||
impl<'a> style::node::TNode for &'a Node {
|
||||
type Element = &'a Element;
|
||||
|
||||
fn parent_node(self) -> Option<&'a Node> {
|
||||
fn parent_node(&self) -> Option<&'a Node> {
|
||||
(*self).parent_node.get()
|
||||
.map(|node| node.root().get_unsound_ref_forever())
|
||||
}
|
||||
|
||||
fn first_child(self) -> Option<&'a Node> {
|
||||
fn first_child(&self) -> Option<&'a Node> {
|
||||
(*self).first_child.get()
|
||||
.map(|node| node.root().get_unsound_ref_forever())
|
||||
}
|
||||
|
||||
fn last_child(self) -> Option<&'a Node> {
|
||||
fn last_child(&self) -> Option<&'a Node> {
|
||||
(*self).last_child.get()
|
||||
.map(|node| node.root().get_unsound_ref_forever())
|
||||
}
|
||||
|
||||
fn prev_sibling(self) -> Option<&'a Node> {
|
||||
fn prev_sibling(&self) -> Option<&'a Node> {
|
||||
(*self).prev_sibling.get()
|
||||
.map(|node| node.root().get_unsound_ref_forever())
|
||||
}
|
||||
|
||||
fn next_sibling(self) -> Option<&'a Node> {
|
||||
fn next_sibling(&self) -> Option<&'a Node> {
|
||||
(*self).next_sibling.get()
|
||||
.map(|node| node.root().get_unsound_ref_forever())
|
||||
}
|
||||
|
||||
fn is_document(self) -> bool {
|
||||
fn is_document(&self) -> bool {
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn is_document<'a, T: DocumentDerived>(this: &T) -> bool {
|
||||
this.is_document()
|
||||
}
|
||||
|
||||
is_document(self)
|
||||
is_document(*self)
|
||||
}
|
||||
|
||||
fn is_element(self) -> bool {
|
||||
fn is_element(&self) -> bool {
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
fn is_element<'a, T: ElementDerived>(this: &T) -> bool {
|
||||
this.is_element()
|
||||
}
|
||||
|
||||
is_element(self)
|
||||
is_element(*self)
|
||||
}
|
||||
|
||||
fn as_element(self) -> &'a Element {
|
||||
ElementCast::to_ref(self).unwrap()
|
||||
fn as_element(&self) -> &'a Element {
|
||||
ElementCast::to_ref(*self).unwrap()
|
||||
}
|
||||
|
||||
fn match_attr<F>(self, attr: &AttrSelector, test: F) -> bool
|
||||
fn match_attr<F>(&self, attr: &AttrSelector, test: F) -> bool
|
||||
where F: Fn(&str) -> bool
|
||||
{
|
||||
let local_name = {
|
||||
|
@ -2577,25 +2577,9 @@ impl<'a> style::node::TNode<'a> for &'a Node {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_html_element_in_html_document(self) -> bool {
|
||||
fn is_html_element_in_html_document(&self) -> bool {
|
||||
self.as_element().html_element_in_html_document()
|
||||
}
|
||||
|
||||
fn has_changed(self) -> bool { self.get_has_changed() }
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn set_changed(self, value: bool) { self.set_has_changed(value) }
|
||||
|
||||
fn is_dirty(self) -> bool { self.get_is_dirty() }
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn set_dirty(self, value: bool) { self.set_is_dirty(value) }
|
||||
|
||||
fn has_dirty_siblings(self) -> bool { self.get_has_dirty_siblings() }
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn set_dirty_siblings(self, value: bool) { self.set_has_dirty_siblings(value) }
|
||||
|
||||
fn has_dirty_descendants(self) -> bool { self.get_has_dirty_descendants() }
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn set_dirty_descendants(self, value: bool) { self.set_has_dirty_descendants(value) }
|
||||
}
|
||||
|
||||
pub trait DisabledStateHelpers {
|
||||
|
|
2
components/servo/Cargo.lock
generated
2
components/servo/Cargo.lock
generated
|
@ -1088,7 +1088,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "selectors"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-selectors#dc70cec19ba083a2d8d63db8d57430394bf6ad00"
|
||||
source = "git+https://github.com/servo/rust-selectors#bb6b97f38c3684e475e762ca0363b58fa6984c62"
|
||||
dependencies = [
|
||||
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -32,18 +32,18 @@ pub trait PresentationalHintSynthesis {
|
|||
/// `common_style_affecting_attributes` or `rare_style_affecting_attributes` as appropriate. If
|
||||
/// you don't, you risk strange random nondeterministic failures due to false positives in
|
||||
/// style sharing.
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<'a,N,V>(
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<N,V>(
|
||||
&self, node: &N, matching_rules_list: &mut V, shareable: &mut bool)
|
||||
where N: TNode<'a>,
|
||||
N::Element: TElementAttributes<'a>,
|
||||
where N: TNode,
|
||||
N::Element: TElementAttributes,
|
||||
V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>;
|
||||
}
|
||||
|
||||
impl PresentationalHintSynthesis for Stylist {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<'a,N,V>(
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<N,V>(
|
||||
&self, node: &N, matching_rules_list: &mut V, shareable: &mut bool)
|
||||
where N: TNode<'a>,
|
||||
N::Element: TElementAttributes<'a>,
|
||||
where N: TNode,
|
||||
N::Element: TElementAttributes,
|
||||
V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>> {
|
||||
let element = node.as_element();
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@ use selectors::matching::DeclarationBlock;
|
|||
pub use selectors::tree::{TNode, TElement};
|
||||
use string_cache::{Atom, Namespace};
|
||||
|
||||
pub trait TElementAttributes<'a> : Copy {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(self, &mut V)
|
||||
pub trait TElementAttributes {
|
||||
fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, &mut V)
|
||||
where V: VecLike<DeclarationBlock<Vec<PropertyDeclaration>>>;
|
||||
fn get_unsigned_integer_attribute(self, attribute: UnsignedIntegerAttribute) -> Option<u32>;
|
||||
fn get_unsigned_integer_attribute(&self, attribute: UnsignedIntegerAttribute) -> Option<u32>;
|
||||
|
||||
fn get_attr(self, namespace: &Namespace, attr: &Atom) -> Option<&'a str>;
|
||||
fn get_attrs(self, attr: &Atom) -> Vec<&'a str>;
|
||||
fn get_attr<'a>(&'a self, namespace: &Namespace, attr: &Atom) -> Option<&'a str>;
|
||||
fn get_attrs<'a>(&'a self, attr: &Atom) -> Vec<&'a str>;
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ impl Stylist {
|
|||
/// The returned boolean indicates whether the style is *shareable*; that is, whether the
|
||||
/// matched selectors are simple enough to allow the matching logic to be reduced to the logic
|
||||
/// in `css::matching::PrivateMatchMethods::candidate_element_allows_for_style_sharing`.
|
||||
pub fn push_applicable_declarations<'a,N,V>(
|
||||
pub fn push_applicable_declarations<N,V>(
|
||||
&self,
|
||||
element: &N,
|
||||
parent_bf: &Option<Box<BloomFilter>>,
|
||||
|
@ -198,8 +198,8 @@ impl Stylist {
|
|||
pseudo_element: Option<PseudoElement>,
|
||||
applicable_declarations: &mut V)
|
||||
-> bool
|
||||
where N: TNode<'a>,
|
||||
N::Element: TElementAttributes<'a>,
|
||||
where N: TNode,
|
||||
N::Element: TElementAttributes,
|
||||
V: VecLike<DeclarationBlock> {
|
||||
assert!(!self.is_dirty);
|
||||
assert!(element.is_element());
|
||||
|
|
2
ports/cef/Cargo.lock
generated
2
ports/cef/Cargo.lock
generated
|
@ -1060,7 +1060,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "selectors"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-selectors#dc70cec19ba083a2d8d63db8d57430394bf6ad00"
|
||||
source = "git+https://github.com/servo/rust-selectors#bb6b97f38c3684e475e762ca0363b58fa6984c62"
|
||||
dependencies = [
|
||||
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
2
ports/gonk/Cargo.lock
generated
2
ports/gonk/Cargo.lock
generated
|
@ -968,7 +968,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "selectors"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-selectors#dc70cec19ba083a2d8d63db8d57430394bf6ad00"
|
||||
source = "git+https://github.com/servo/rust-selectors#bb6b97f38c3684e475e762ca0363b58fa6984c62"
|
||||
dependencies = [
|
||||
"bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue