mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
ID and class selectors are ASCII case-insensitive in quirks mode.
https://bugzilla.mozilla.org/show_bug.cgi?id=1363778
This commit is contained in:
parent
524fcac191
commit
5bccf98aa4
22 changed files with 313 additions and 191 deletions
|
@ -49,7 +49,7 @@ use script_layout_interface::{HTMLCanvasData, LayoutNodeType, SVGSVGData, Truste
|
|||
use script_layout_interface::{OpaqueStyleAndLayoutData, StyleData};
|
||||
use script_layout_interface::wrapper_traits::{DangerousThreadSafeLayoutNode, GetLayoutData, LayoutNode};
|
||||
use script_layout_interface::wrapper_traits::{PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
|
||||
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint};
|
||||
use selectors::attr::{AttrSelectorOperation, NamespaceConstraint, CaseSensitivity};
|
||||
use selectors::matching::{ElementSelectorFlags, LocalMatchingContext, MatchingContext, RelevantLinkStatus};
|
||||
use selectors::matching::VisitedHandlingMode;
|
||||
use servo_atoms::Atom;
|
||||
|
@ -61,6 +61,7 @@ use std::marker::PhantomData;
|
|||
use std::mem::transmute;
|
||||
use std::sync::atomic::Ordering;
|
||||
use style;
|
||||
use style::CaseSensitivityExt;
|
||||
use style::applicable_declarations::ApplicableDeclarationBlock;
|
||||
use style::attr::AttrValue;
|
||||
use style::computed_values::display;
|
||||
|
@ -414,6 +415,13 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
|||
self.get_attr(namespace, attr).is_some()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_id(&self) -> Option<Atom> {
|
||||
unsafe {
|
||||
(*self.element.id_attribute()).clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn each_class<F>(&self, mut callback: F) where F: FnMut(&Atom) {
|
||||
unsafe {
|
||||
|
@ -779,16 +787,24 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn get_id(&self) -> Option<Atom> {
|
||||
fn has_id(&self, id: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
||||
unsafe {
|
||||
(*self.element.id_attribute()).clone()
|
||||
(*self.element.id_attribute())
|
||||
.as_ref()
|
||||
.map_or(false, |atom| case_sensitivity.eq_atom(atom, id))
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn has_class(&self, name: &Atom) -> bool {
|
||||
fn has_class(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
||||
unsafe {
|
||||
self.element.has_class_for_layout(name)
|
||||
self.element.has_class_for_layout(name, case_sensitivity)
|
||||
}
|
||||
}
|
||||
|
||||
fn in_quirks_mode_document(&self) -> bool {
|
||||
unsafe {
|
||||
self.element.in_quirks_mode_document_for_layout()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1194,6 +1210,11 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
|
|||
true
|
||||
}
|
||||
|
||||
fn in_quirks_mode_document(&self) -> bool {
|
||||
debug!("ServoThreadSafeLayoutElement::in_quirks_mode_document called");
|
||||
false
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_local_name(&self) -> &LocalName {
|
||||
self.element.get_local_name()
|
||||
|
@ -1249,12 +1270,12 @@ impl<'le> ::selectors::Element for ServoThreadSafeLayoutElement<'le> {
|
|||
false
|
||||
}
|
||||
|
||||
fn get_id(&self) -> Option<Atom> {
|
||||
debug!("ServoThreadSafeLayoutElement::get_id called");
|
||||
None
|
||||
fn has_id(&self, _id: &Atom, _case_sensitivity: CaseSensitivity) -> bool {
|
||||
debug!("ServoThreadSafeLayoutElement::has_id called");
|
||||
false
|
||||
}
|
||||
|
||||
fn has_class(&self, _name: &Atom) -> bool {
|
||||
fn has_class(&self, _name: &Atom, _case_sensitivity: CaseSensitivity) -> bool {
|
||||
debug!("ServoThreadSafeLayoutElement::has_class called");
|
||||
false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue