mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
changed match
to 'matches!' (#31850)
This commit is contained in:
parent
9a76dd9325
commit
bd39e03eeb
29 changed files with 185 additions and 229 deletions
|
@ -169,10 +169,7 @@ impl QueuedTaskConversion for DedicatedWorkerScriptMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_wake_up(&self) -> bool {
|
fn is_wake_up(&self) -> bool {
|
||||||
match self {
|
matches!(self, DedicatedWorkerScriptMsg::WakeUp)
|
||||||
DedicatedWorkerScriptMsg::WakeUp => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,12 +206,12 @@ pub enum FireMouseEventType {
|
||||||
|
|
||||||
impl FireMouseEventType {
|
impl FireMouseEventType {
|
||||||
pub fn as_str(&self) -> &str {
|
pub fn as_str(&self) -> &str {
|
||||||
match self {
|
match *self {
|
||||||
&FireMouseEventType::Move => "mousemove",
|
FireMouseEventType::Move => "mousemove",
|
||||||
&FireMouseEventType::Over => "mouseover",
|
FireMouseEventType::Over => "mouseover",
|
||||||
&FireMouseEventType::Out => "mouseout",
|
FireMouseEventType::Out => "mouseout",
|
||||||
&FireMouseEventType::Enter => "mouseenter",
|
FireMouseEventType::Enter => "mouseenter",
|
||||||
&FireMouseEventType::Leave => "mouseleave",
|
FireMouseEventType::Leave => "mouseleave",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2924,10 +2924,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_character_value_key(key: &Key) -> bool {
|
fn is_character_value_key(key: &Key) -> bool {
|
||||||
match key {
|
matches!(key, Key::Character(_) | Key::Enter)
|
||||||
Key::Character(_) | Key::Enter => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(MallocSizeOf, PartialEq)]
|
#[derive(MallocSizeOf, PartialEq)]
|
||||||
|
@ -3055,10 +3052,7 @@ fn get_registrable_domain_suffix_of_or_is_equal_to(
|
||||||
|
|
||||||
/// <https://url.spec.whatwg.org/#network-scheme>
|
/// <https://url.spec.whatwg.org/#network-scheme>
|
||||||
fn url_has_network_scheme(url: &ServoUrl) -> bool {
|
fn url_has_network_scheme(url: &ServoUrl) -> bool {
|
||||||
match url.scheme() {
|
matches!(url.scheme(), "ftp" | "http" | "https")
|
||||||
"ftp" | "http" | "https" => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
|
#[derive(Clone, Copy, Eq, JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
|
@ -3982,8 +3976,7 @@ impl Document {
|
||||||
impl Element {
|
impl Element {
|
||||||
fn click_event_filter_by_disabled_state(&self) -> bool {
|
fn click_event_filter_by_disabled_state(&self) -> bool {
|
||||||
let node = self.upcast::<Node>();
|
let node = self.upcast::<Node>();
|
||||||
match node.type_id() {
|
matches!(node.type_id(), NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
|
||||||
HTMLElementTypeId::HTMLButtonElement,
|
HTMLElementTypeId::HTMLButtonElement,
|
||||||
)) |
|
)) |
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
|
@ -3997,9 +3990,7 @@ impl Element {
|
||||||
)) |
|
)) |
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
HTMLElementTypeId::HTMLTextAreaElement,
|
HTMLElementTypeId::HTMLTextAreaElement,
|
||||||
)) if self.disabled_state() => true,
|
)) if self.disabled_state())
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4599,14 +4590,15 @@ impl DocumentMethods for Document {
|
||||||
self.get_html_element().and_then(|root| {
|
self.get_html_element().and_then(|root| {
|
||||||
let node = root.upcast::<Node>();
|
let node = root.upcast::<Node>();
|
||||||
node.children()
|
node.children()
|
||||||
.find(|child| match child.type_id() {
|
.find(|child| {
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
matches!(
|
||||||
HTMLElementTypeId::HTMLBodyElement,
|
child.type_id(),
|
||||||
)) |
|
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
HTMLElementTypeId::HTMLBodyElement,
|
||||||
HTMLElementTypeId::HTMLFrameSetElement,
|
)) | NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
)) => true,
|
HTMLElementTypeId::HTMLFrameSetElement,
|
||||||
_ => false,
|
))
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.map(|node| DomRoot::downcast(node).unwrap())
|
.map(|node| DomRoot::downcast(node).unwrap())
|
||||||
})
|
})
|
||||||
|
|
|
@ -136,11 +136,11 @@ impl EventListenerType {
|
||||||
owner: &EventTarget,
|
owner: &EventTarget,
|
||||||
ty: &Atom,
|
ty: &Atom,
|
||||||
) -> Option<CompiledEventListener> {
|
) -> Option<CompiledEventListener> {
|
||||||
match self {
|
match *self {
|
||||||
&mut EventListenerType::Inline(ref mut inline) => inline
|
EventListenerType::Inline(ref mut inline) => inline
|
||||||
.get_compiled_handler(owner, ty)
|
.get_compiled_handler(owner, ty)
|
||||||
.map(CompiledEventListener::Handler),
|
.map(CompiledEventListener::Handler),
|
||||||
&mut EventListenerType::Additive(ref listener) => {
|
EventListenerType::Additive(ref listener) => {
|
||||||
Some(CompiledEventListener::Listener(listener.clone()))
|
Some(CompiledEventListener::Listener(listener.clone()))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -415,10 +415,9 @@ impl EventTarget {
|
||||||
Vacant(entry) => entry.insert(EventListeners(vec![])),
|
Vacant(entry) => entry.insert(EventListeners(vec![])),
|
||||||
};
|
};
|
||||||
|
|
||||||
let idx = entries.iter().position(|ref entry| match entry.listener {
|
let idx = entries
|
||||||
EventListenerType::Inline(_) => true,
|
.iter()
|
||||||
_ => false,
|
.position(|ref entry| matches!(entry.listener, EventListenerType::Inline(_)));
|
||||||
});
|
|
||||||
|
|
||||||
match idx {
|
match idx {
|
||||||
Some(idx) => match listener {
|
Some(idx) => match listener {
|
||||||
|
|
|
@ -301,10 +301,11 @@ impl GPUBufferMethods for GPUBuffer {
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::Operation);
|
return Err(Error::Operation);
|
||||||
};
|
};
|
||||||
let mut valid = match self.state.get() {
|
let mut valid = matches!(
|
||||||
GPUBufferState::Mapped | GPUBufferState::MappedAtCreation => true,
|
self.state.get(),
|
||||||
_ => false,
|
GPUBufferState::Mapped | GPUBufferState::MappedAtCreation
|
||||||
};
|
);
|
||||||
|
|
||||||
valid &= offset % RANGE_OFFSET_ALIGN_MASK == 0 &&
|
valid &= offset % RANGE_OFFSET_ALIGN_MASK == 0 &&
|
||||||
range_size % RANGE_SIZE_ALIGN_MASK == 0 &&
|
range_size % RANGE_SIZE_ALIGN_MASK == 0 &&
|
||||||
offset >= m_info.mapping_range.start &&
|
offset >= m_info.mapping_range.start &&
|
||||||
|
|
|
@ -74,10 +74,9 @@ impl GPUQueueMethods for GPUQueue {
|
||||||
/// <https://gpuweb.github.io/gpuweb/#dom-gpuqueue-submit>
|
/// <https://gpuweb.github.io/gpuweb/#dom-gpuqueue-submit>
|
||||||
fn Submit(&self, command_buffers: Vec<DomRoot<GPUCommandBuffer>>) {
|
fn Submit(&self, command_buffers: Vec<DomRoot<GPUCommandBuffer>>) {
|
||||||
let valid = command_buffers.iter().all(|cb| {
|
let valid = command_buffers.iter().all(|cb| {
|
||||||
cb.buffers().iter().all(|b| match b.state() {
|
cb.buffers()
|
||||||
GPUBufferState::Unmapped => true,
|
.iter()
|
||||||
_ => false,
|
.all(|b| matches!(b.state(), GPUBufferState::Unmapped))
|
||||||
})
|
|
||||||
});
|
});
|
||||||
let scope_id = self.device.borrow().as_ref().unwrap().use_current_scope();
|
let scope_id = self.device.borrow().as_ref().unwrap().use_current_scope();
|
||||||
if !valid {
|
if !valid {
|
||||||
|
|
|
@ -344,10 +344,7 @@ impl Iterable for Headers {
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#forbidden-response-header-name
|
// https://fetch.spec.whatwg.org/#forbidden-response-header-name
|
||||||
fn is_forbidden_response_header(name: &str) -> bool {
|
fn is_forbidden_response_header(name: &str) -> bool {
|
||||||
match name {
|
matches!(name, "set-cookie" | "set-cookie2")
|
||||||
"set-cookie" | "set-cookie2" => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#forbidden-header-name
|
// https://fetch.spec.whatwg.org/#forbidden-header-name
|
||||||
|
@ -487,18 +484,12 @@ fn is_legal_header_value(value: &ByteString) -> bool {
|
||||||
|
|
||||||
// https://tools.ietf.org/html/rfc5234#appendix-B.1
|
// https://tools.ietf.org/html/rfc5234#appendix-B.1
|
||||||
pub fn is_vchar(x: u8) -> bool {
|
pub fn is_vchar(x: u8) -> bool {
|
||||||
match x {
|
matches!(x, 0x21..=0x7E)
|
||||||
0x21..=0x7E => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://tools.ietf.org/html/rfc7230#section-3.2.6
|
// http://tools.ietf.org/html/rfc7230#section-3.2.6
|
||||||
pub fn is_obs_text(x: u8) -> bool {
|
pub fn is_obs_text(x: u8) -> bool {
|
||||||
match x {
|
matches!(x, 0x80..=0xFF)
|
||||||
0x80..=0xFF => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
|
// https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
|
||||||
|
|
|
@ -186,20 +186,19 @@ impl VirtualMethods for HTMLFieldSetElement {
|
||||||
let fields = children.flat_map(|child| {
|
let fields = children.flat_map(|child| {
|
||||||
child
|
child
|
||||||
.traverse_preorder(ShadowIncluding::No)
|
.traverse_preorder(ShadowIncluding::No)
|
||||||
.filter(|descendant| match descendant.type_id() {
|
.filter(|descendant| {
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
matches!(
|
||||||
HTMLElementTypeId::HTMLButtonElement,
|
descendant.type_id(),
|
||||||
)) |
|
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
HTMLElementTypeId::HTMLButtonElement,
|
||||||
HTMLElementTypeId::HTMLInputElement,
|
)) | NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
)) |
|
HTMLElementTypeId::HTMLInputElement,
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
)) | NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
HTMLElementTypeId::HTMLSelectElement,
|
HTMLElementTypeId::HTMLSelectElement,
|
||||||
)) |
|
)) | NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
HTMLElementTypeId::HTMLTextAreaElement,
|
||||||
HTMLElementTypeId::HTMLTextAreaElement,
|
))
|
||||||
)) => true,
|
)
|
||||||
_ => false,
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
if disabled_state {
|
if disabled_state {
|
||||||
|
|
|
@ -1065,10 +1065,7 @@ impl HTMLImageElement {
|
||||||
|
|
||||||
let elem = self.upcast::<Element>();
|
let elem = self.upcast::<Element>();
|
||||||
let document = document_from_node(elem);
|
let document = document_from_node(elem);
|
||||||
let has_pending_request = match self.image_request.get() {
|
let has_pending_request = matches!(self.image_request.get(), ImageRequestPhase::Pending);
|
||||||
ImageRequestPhase::Pending => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Step 2
|
// Step 2
|
||||||
if !document.is_active() || !Self::uses_srcset_or_picture(elem) || has_pending_request {
|
if !document.is_active() || !Self::uses_srcset_or_picture(elem) || has_pending_request {
|
||||||
|
|
|
@ -2270,8 +2270,8 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
|
|
||||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||||
match attr.local_name() {
|
match *attr.local_name() {
|
||||||
&local_name!("disabled") => {
|
local_name!("disabled") => {
|
||||||
let disabled_state = match mutation {
|
let disabled_state = match mutation {
|
||||||
AttributeMutation::Set(None) => true,
|
AttributeMutation::Set(None) => true,
|
||||||
AttributeMutation::Set(Some(_)) => {
|
AttributeMutation::Set(Some(_)) => {
|
||||||
|
@ -2292,7 +2292,7 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
|
|
||||||
el.update_sequentially_focusable_status();
|
el.update_sequentially_focusable_status();
|
||||||
},
|
},
|
||||||
&local_name!("checked") if !self.checked_changed.get() => {
|
local_name!("checked") if !self.checked_changed.get() => {
|
||||||
let checked_state = match mutation {
|
let checked_state = match mutation {
|
||||||
AttributeMutation::Set(None) => true,
|
AttributeMutation::Set(None) => true,
|
||||||
AttributeMutation::Set(Some(_)) => {
|
AttributeMutation::Set(Some(_)) => {
|
||||||
|
@ -2303,11 +2303,11 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
};
|
};
|
||||||
self.update_checked_state(checked_state, false);
|
self.update_checked_state(checked_state, false);
|
||||||
},
|
},
|
||||||
&local_name!("size") => {
|
local_name!("size") => {
|
||||||
let size = mutation.new_value(attr).map(|value| value.as_uint());
|
let size = mutation.new_value(attr).map(|value| value.as_uint());
|
||||||
self.size.set(size.unwrap_or(DEFAULT_INPUT_SIZE));
|
self.size.set(size.unwrap_or(DEFAULT_INPUT_SIZE));
|
||||||
},
|
},
|
||||||
&local_name!("type") => {
|
local_name!("type") => {
|
||||||
let el = self.upcast::<Element>();
|
let el = self.upcast::<Element>();
|
||||||
match mutation {
|
match mutation {
|
||||||
AttributeMutation::Set(_) => {
|
AttributeMutation::Set(_) => {
|
||||||
|
@ -2396,7 +2396,7 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
|
|
||||||
self.update_placeholder_shown_state();
|
self.update_placeholder_shown_state();
|
||||||
},
|
},
|
||||||
&local_name!("value") if !self.value_dirty.get() => {
|
local_name!("value") if !self.value_dirty.get() => {
|
||||||
let value = mutation.new_value(attr).map(|value| (**value).to_owned());
|
let value = mutation.new_value(attr).map(|value| (**value).to_owned());
|
||||||
let mut value = value.map_or(DOMString::new(), DOMString::from);
|
let mut value = value.map_or(DOMString::new(), DOMString::from);
|
||||||
|
|
||||||
|
@ -2404,12 +2404,12 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
self.textinput.borrow_mut().set_content(value);
|
self.textinput.borrow_mut().set_content(value);
|
||||||
self.update_placeholder_shown_state();
|
self.update_placeholder_shown_state();
|
||||||
},
|
},
|
||||||
&local_name!("name") if self.input_type() == InputType::Radio => {
|
local_name!("name") if self.input_type() == InputType::Radio => {
|
||||||
self.radio_group_updated(
|
self.radio_group_updated(
|
||||||
mutation.new_value(attr).as_ref().map(|name| name.as_atom()),
|
mutation.new_value(attr).as_ref().map(|name| name.as_atom()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
&local_name!("maxlength") => match *attr.value() {
|
local_name!("maxlength") => match *attr.value() {
|
||||||
AttrValue::Int(_, value) => {
|
AttrValue::Int(_, value) => {
|
||||||
let mut textinput = self.textinput.borrow_mut();
|
let mut textinput = self.textinput.borrow_mut();
|
||||||
|
|
||||||
|
@ -2421,7 +2421,7 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
},
|
},
|
||||||
_ => panic!("Expected an AttrValue::Int"),
|
_ => panic!("Expected an AttrValue::Int"),
|
||||||
},
|
},
|
||||||
&local_name!("minlength") => match *attr.value() {
|
local_name!("minlength") => match *attr.value() {
|
||||||
AttrValue::Int(_, value) => {
|
AttrValue::Int(_, value) => {
|
||||||
let mut textinput = self.textinput.borrow_mut();
|
let mut textinput = self.textinput.borrow_mut();
|
||||||
|
|
||||||
|
@ -2433,7 +2433,7 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
},
|
},
|
||||||
_ => panic!("Expected an AttrValue::Int"),
|
_ => panic!("Expected an AttrValue::Int"),
|
||||||
},
|
},
|
||||||
&local_name!("placeholder") => {
|
local_name!("placeholder") => {
|
||||||
{
|
{
|
||||||
let mut placeholder = self.placeholder.borrow_mut();
|
let mut placeholder = self.placeholder.borrow_mut();
|
||||||
placeholder.clear();
|
placeholder.clear();
|
||||||
|
@ -2444,7 +2444,7 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
}
|
}
|
||||||
self.update_placeholder_shown_state();
|
self.update_placeholder_shown_state();
|
||||||
},
|
},
|
||||||
&local_name!("readonly") => {
|
local_name!("readonly") => {
|
||||||
if self.input_type().is_textual() {
|
if self.input_type().is_textual() {
|
||||||
let el = self.upcast::<Element>();
|
let el = self.upcast::<Element>();
|
||||||
match mutation {
|
match mutation {
|
||||||
|
@ -2457,7 +2457,7 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
&local_name!("form") => {
|
local_name!("form") => {
|
||||||
self.form_attribute_mutated(mutation);
|
self.form_attribute_mutated(mutation);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
@ -2468,14 +2468,14 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
|
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
|
||||||
match name {
|
match *name {
|
||||||
&local_name!("accept") => AttrValue::from_comma_separated_tokenlist(value.into()),
|
local_name!("accept") => AttrValue::from_comma_separated_tokenlist(value.into()),
|
||||||
&local_name!("size") => AttrValue::from_limited_u32(value.into(), DEFAULT_INPUT_SIZE),
|
local_name!("size") => AttrValue::from_limited_u32(value.into(), DEFAULT_INPUT_SIZE),
|
||||||
&local_name!("type") => AttrValue::from_atomic(value.into()),
|
local_name!("type") => AttrValue::from_atomic(value.into()),
|
||||||
&local_name!("maxlength") => {
|
local_name!("maxlength") => {
|
||||||
AttrValue::from_limited_i32(value.into(), DEFAULT_MAX_LENGTH)
|
AttrValue::from_limited_i32(value.into(), DEFAULT_MAX_LENGTH)
|
||||||
},
|
},
|
||||||
&local_name!("minlength") => {
|
local_name!("minlength") => {
|
||||||
AttrValue::from_limited_i32(value.into(), DEFAULT_MIN_LENGTH)
|
AttrValue::from_limited_i32(value.into(), DEFAULT_MIN_LENGTH)
|
||||||
},
|
},
|
||||||
_ => self
|
_ => self
|
||||||
|
|
|
@ -156,8 +156,8 @@ impl VirtualMethods for HTMLLabelElement {
|
||||||
|
|
||||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||||
match attr.local_name() {
|
match *attr.local_name() {
|
||||||
&local_name!("form") => {
|
local_name!("form") => {
|
||||||
self.form_attribute_mutated(mutation);
|
self.form_attribute_mutated(mutation);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
|
|
@ -204,8 +204,8 @@ impl VirtualMethods for HTMLLinkElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
let rel = get_attr(self.upcast(), &local_name!("rel"));
|
let rel = get_attr(self.upcast(), &local_name!("rel"));
|
||||||
match attr.local_name() {
|
match *attr.local_name() {
|
||||||
&local_name!("href") => {
|
local_name!("href") => {
|
||||||
if string_is_stylesheet(&rel) {
|
if string_is_stylesheet(&rel) {
|
||||||
self.handle_stylesheet_url(&attr.value());
|
self.handle_stylesheet_url(&attr.value());
|
||||||
} else if is_favicon(&rel) {
|
} else if is_favicon(&rel) {
|
||||||
|
@ -213,7 +213,7 @@ impl VirtualMethods for HTMLLinkElement {
|
||||||
self.handle_favicon_url(rel.as_ref().unwrap(), &attr.value(), &sizes);
|
self.handle_favicon_url(rel.as_ref().unwrap(), &attr.value(), &sizes);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
&local_name!("sizes") => {
|
local_name!("sizes") => {
|
||||||
if is_favicon(&rel) {
|
if is_favicon(&rel) {
|
||||||
if let Some(ref href) = get_attr(self.upcast(), &local_name!("href")) {
|
if let Some(ref href) = get_attr(self.upcast(), &local_name!("href")) {
|
||||||
self.handle_favicon_url(
|
self.handle_favicon_url(
|
||||||
|
|
|
@ -2425,17 +2425,17 @@ impl VirtualMethods for HTMLMediaElement {
|
||||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||||
|
|
||||||
match attr.local_name() {
|
match *attr.local_name() {
|
||||||
&local_name!("muted") => {
|
local_name!("muted") => {
|
||||||
self.SetMuted(mutation.new_value(attr).is_some());
|
self.SetMuted(mutation.new_value(attr).is_some());
|
||||||
},
|
},
|
||||||
&local_name!("src") => {
|
local_name!("src") => {
|
||||||
if mutation.new_value(attr).is_none() {
|
if mutation.new_value(attr).is_none() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.media_element_load_algorithm();
|
self.media_element_load_algorithm();
|
||||||
},
|
},
|
||||||
&local_name!("controls") => {
|
local_name!("controls") => {
|
||||||
if mutation.new_value(attr).is_some() {
|
if mutation.new_value(attr).is_some() {
|
||||||
self.render_controls();
|
self.render_controls();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -155,13 +155,13 @@ impl VirtualMethods for HTMLObjectElement {
|
||||||
|
|
||||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||||
match attr.local_name() {
|
match *attr.local_name() {
|
||||||
&local_name!("data") => {
|
local_name!("data") => {
|
||||||
if let AttributeMutation::Set(_) = mutation {
|
if let AttributeMutation::Set(_) = mutation {
|
||||||
self.process_data_url();
|
self.process_data_url();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
&local_name!("form") => {
|
local_name!("form") => {
|
||||||
self.form_attribute_mutated(mutation);
|
self.form_attribute_mutated(mutation);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
|
|
@ -298,8 +298,8 @@ impl VirtualMethods for HTMLOptionElement {
|
||||||
|
|
||||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||||
match attr.local_name() {
|
match *attr.local_name() {
|
||||||
&local_name!("disabled") => {
|
local_name!("disabled") => {
|
||||||
let el = self.upcast::<Element>();
|
let el = self.upcast::<Element>();
|
||||||
match mutation {
|
match mutation {
|
||||||
AttributeMutation::Set(_) => {
|
AttributeMutation::Set(_) => {
|
||||||
|
@ -314,7 +314,7 @@ impl VirtualMethods for HTMLOptionElement {
|
||||||
}
|
}
|
||||||
self.update_select_validity();
|
self.update_select_validity();
|
||||||
},
|
},
|
||||||
&local_name!("selected") => {
|
local_name!("selected") => {
|
||||||
match mutation {
|
match mutation {
|
||||||
AttributeMutation::Set(_) => {
|
AttributeMutation::Set(_) => {
|
||||||
// https://html.spec.whatwg.org/multipage/#concept-option-selectedness
|
// https://html.spec.whatwg.org/multipage/#concept-option-selectedness
|
||||||
|
|
|
@ -419,12 +419,12 @@ impl VirtualMethods for HTMLSelectElement {
|
||||||
|
|
||||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||||
match attr.local_name() {
|
match *attr.local_name() {
|
||||||
&local_name!("required") => {
|
local_name!("required") => {
|
||||||
self.validity_state()
|
self.validity_state()
|
||||||
.perform_validation_and_update(ValidationFlags::VALUE_MISSING);
|
.perform_validation_and_update(ValidationFlags::VALUE_MISSING);
|
||||||
},
|
},
|
||||||
&local_name!("disabled") => {
|
local_name!("disabled") => {
|
||||||
let el = self.upcast::<Element>();
|
let el = self.upcast::<Element>();
|
||||||
match mutation {
|
match mutation {
|
||||||
AttributeMutation::Set(_) => {
|
AttributeMutation::Set(_) => {
|
||||||
|
@ -441,7 +441,7 @@ impl VirtualMethods for HTMLSelectElement {
|
||||||
self.validity_state()
|
self.validity_state()
|
||||||
.perform_validation_and_update(ValidationFlags::VALUE_MISSING);
|
.perform_validation_and_update(ValidationFlags::VALUE_MISSING);
|
||||||
},
|
},
|
||||||
&local_name!("form") => {
|
local_name!("form") => {
|
||||||
self.form_attribute_mutated(mutation);
|
self.form_attribute_mutated(mutation);
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
|
|
|
@ -144,9 +144,9 @@ impl HTMLTableElement {
|
||||||
|
|
||||||
let section =
|
let section =
|
||||||
HTMLTableSectionElement::new(atom.clone(), None, &document_from_node(self), None);
|
HTMLTableSectionElement::new(atom.clone(), None, &document_from_node(self), None);
|
||||||
match atom {
|
match *atom {
|
||||||
&local_name!("thead") => self.SetTHead(Some(§ion)),
|
local_name!("thead") => self.SetTHead(Some(§ion)),
|
||||||
&local_name!("tfoot") => self.SetTFoot(Some(§ion)),
|
local_name!("tfoot") => self.SetTFoot(Some(§ion)),
|
||||||
_ => unreachable!("unexpected section type"),
|
_ => unreachable!("unexpected section type"),
|
||||||
}
|
}
|
||||||
.expect("unexpected section type");
|
.expect("unexpected section type");
|
||||||
|
|
|
@ -118,18 +118,18 @@ impl Permissions {
|
||||||
// (Query, Request) Step 5.
|
// (Query, Request) Step 5.
|
||||||
let result = BluetoothPermissionResult::new(&self.global(), &status);
|
let result = BluetoothPermissionResult::new(&self.global(), &status);
|
||||||
|
|
||||||
match &op {
|
match op {
|
||||||
// (Request) Step 6 - 8.
|
// (Request) Step 6 - 8.
|
||||||
&Operation::Request => {
|
Operation::Request => {
|
||||||
Bluetooth::permission_request(cx, &p, &bluetooth_desc, &result)
|
Bluetooth::permission_request(cx, &p, &bluetooth_desc, &result)
|
||||||
},
|
},
|
||||||
|
|
||||||
// (Query) Step 6 - 7.
|
// (Query) Step 6 - 7.
|
||||||
&Operation::Query => {
|
Operation::Query => {
|
||||||
Bluetooth::permission_query(cx, &p, &bluetooth_desc, &result)
|
Bluetooth::permission_query(cx, &p, &bluetooth_desc, &result)
|
||||||
},
|
},
|
||||||
|
|
||||||
&Operation::Revoke => {
|
Operation::Revoke => {
|
||||||
// (Revoke) Step 3.
|
// (Revoke) Step 3.
|
||||||
let globalscope = self.global();
|
let globalscope = self.global();
|
||||||
globalscope
|
globalscope
|
||||||
|
@ -143,8 +143,8 @@ impl Permissions {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
match &op {
|
match op {
|
||||||
&Operation::Request => {
|
Operation::Request => {
|
||||||
// (Request) Step 6.
|
// (Request) Step 6.
|
||||||
Permissions::permission_request(cx, &p, &root_desc, &status);
|
Permissions::permission_request(cx, &p, &root_desc, &status);
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ impl Permissions {
|
||||||
// (Request) Step 8.
|
// (Request) Step 8.
|
||||||
p.resolve_native(&status);
|
p.resolve_native(&status);
|
||||||
},
|
},
|
||||||
&Operation::Query => {
|
Operation::Query => {
|
||||||
// (Query) Step 6.
|
// (Query) Step 6.
|
||||||
Permissions::permission_query(cx, &p, &root_desc, &status);
|
Permissions::permission_query(cx, &p, &root_desc, &status);
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ impl Permissions {
|
||||||
p.resolve_native(&status);
|
p.resolve_native(&status);
|
||||||
},
|
},
|
||||||
|
|
||||||
&Operation::Revoke => {
|
Operation::Revoke => {
|
||||||
// (Revoke) Step 3.
|
// (Revoke) Step 3.
|
||||||
let globalscope = self.global();
|
let globalscope = self.global();
|
||||||
globalscope
|
globalscope
|
||||||
|
|
|
@ -229,10 +229,7 @@ impl Promise {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn is_fulfilled(&self) -> bool {
|
pub fn is_fulfilled(&self) -> bool {
|
||||||
let state = unsafe { GetPromiseState(self.promise_obj()) };
|
let state = unsafe { GetPromiseState(self.promise_obj()) };
|
||||||
match state {
|
matches!(state, PromiseState::Rejected | PromiseState::Fulfilled)
|
||||||
PromiseState::Rejected | PromiseState::Fulfilled => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
|
|
@ -127,13 +127,13 @@ impl Range {
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#contained>
|
/// <https://dom.spec.whatwg.org/#contained>
|
||||||
fn contains(&self, node: &Node) -> bool {
|
fn contains(&self, node: &Node) -> bool {
|
||||||
match (
|
matches!(
|
||||||
bp_position(node, 0, &self.start_container(), self.start_offset()),
|
(
|
||||||
bp_position(node, node.len(), &self.end_container(), self.end_offset()),
|
bp_position(node, 0, &self.start_container(), self.start_offset()),
|
||||||
) {
|
bp_position(node, node.len(), &self.end_container(), self.end_offset()),
|
||||||
(Some(Ordering::Greater), Some(Ordering::Less)) => true,
|
),
|
||||||
_ => false,
|
(Some(Ordering::Greater), Some(Ordering::Less))
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://dom.spec.whatwg.org/#partially-contained>
|
/// <https://dom.spec.whatwg.org/#partially-contained>
|
||||||
|
|
|
@ -493,12 +493,10 @@ fn is_method(m: &ByteString) -> bool {
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#forbidden-method
|
// https://fetch.spec.whatwg.org/#forbidden-method
|
||||||
fn is_forbidden_method(m: &ByteString) -> bool {
|
fn is_forbidden_method(m: &ByteString) -> bool {
|
||||||
match m.to_lower().as_str() {
|
matches!(
|
||||||
Some("connect") => true,
|
m.to_lower().as_str(),
|
||||||
Some("trace") => true,
|
Some("connect") | Some("trace") | Some("track")
|
||||||
Some("track") => true,
|
)
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#cors-safelisted-method
|
// https://fetch.spec.whatwg.org/#cors-safelisted-method
|
||||||
|
|
|
@ -112,10 +112,7 @@ impl QueuedTaskConversion for ServiceWorkerScriptMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_wake_up(&self) -> bool {
|
fn is_wake_up(&self) -> bool {
|
||||||
match self {
|
matches!(self, ServiceWorkerScriptMsg::WakeUp)
|
||||||
ServiceWorkerScriptMsg::WakeUp => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,9 @@ impl VirtualMethods for SVGSVGElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
|
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
|
||||||
match name {
|
match *name {
|
||||||
&local_name!("width") => AttrValue::from_u32(value.into(), DEFAULT_WIDTH),
|
local_name!("width") => AttrValue::from_u32(value.into(), DEFAULT_WIDTH),
|
||||||
&local_name!("height") => AttrValue::from_u32(value.into(), DEFAULT_HEIGHT),
|
local_name!("height") => AttrValue::from_u32(value.into(), DEFAULT_HEIGHT),
|
||||||
_ => self
|
_ => self
|
||||||
.super_type()
|
.super_type()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -116,10 +116,7 @@ impl VertexArrayObject {
|
||||||
return Err(WebGLError::InvalidValue);
|
return Err(WebGLError::InvalidValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
let is_webgl2 = match self.context.webgl_version() {
|
let is_webgl2 = matches!(self.context.webgl_version(), WebGLVersion::WebGL2);
|
||||||
WebGLVersion::WebGL2 => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
let bytes_per_component: i32 = match type_ {
|
let bytes_per_component: i32 = match type_ {
|
||||||
constants::BYTE | constants::UNSIGNED_BYTE => 1,
|
constants::BYTE | constants::UNSIGNED_BYTE => 1,
|
||||||
|
|
|
@ -851,13 +851,10 @@ impl WebGLFramebuffer {
|
||||||
attachment: &DomRefCell<Option<WebGLFramebufferAttachment>>,
|
attachment: &DomRefCell<Option<WebGLFramebufferAttachment>>,
|
||||||
target: &WebGLTextureId,
|
target: &WebGLTextureId,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
match *attachment.borrow() {
|
matches!(*attachment.borrow(), Some(WebGLFramebufferAttachment::Texture {
|
||||||
Some(WebGLFramebufferAttachment::Texture {
|
texture: ref att_texture,
|
||||||
texture: ref att_texture,
|
..
|
||||||
..
|
}) if att_texture.id() == *target)
|
||||||
}) if att_texture.id() == *target => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (attachment, name) in &attachments {
|
for (attachment, name) in &attachments {
|
||||||
|
|
|
@ -627,17 +627,16 @@ impl WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_stencil_actions(&self, action: u32) -> bool {
|
fn validate_stencil_actions(&self, action: u32) -> bool {
|
||||||
match action {
|
matches!(
|
||||||
0 |
|
action,
|
||||||
constants::KEEP |
|
0 | constants::KEEP |
|
||||||
constants::REPLACE |
|
constants::REPLACE |
|
||||||
constants::INCR |
|
constants::INCR |
|
||||||
constants::DECR |
|
constants::DECR |
|
||||||
constants::INVERT |
|
constants::INVERT |
|
||||||
constants::INCR_WRAP |
|
constants::INCR_WRAP |
|
||||||
constants::DECR_WRAP => true,
|
constants::DECR_WRAP
|
||||||
_ => false,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_image_pixels(&self, source: TexImageSource) -> Fallible<Option<TexPixels>> {
|
pub fn get_image_pixels(&self, source: TexImageSource) -> Fallible<Option<TexPixels>> {
|
||||||
|
@ -3146,23 +3145,20 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
.attachment(attachment)
|
.attachment(attachment)
|
||||||
{
|
{
|
||||||
Some(attachment_root) => match attachment_root {
|
Some(attachment_root) => match attachment_root {
|
||||||
WebGLFramebufferAttachmentRoot::Renderbuffer(_) => match pname {
|
WebGLFramebufferAttachmentRoot::Renderbuffer(_) => matches!(
|
||||||
|
pname,
|
||||||
constants::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
|
constants::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
|
||||||
constants::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME => true,
|
constants::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME
|
||||||
_ => false,
|
),
|
||||||
},
|
WebGLFramebufferAttachmentRoot::Texture(_) => matches!(
|
||||||
WebGLFramebufferAttachmentRoot::Texture(_) => match pname {
|
pname,
|
||||||
constants::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
|
constants::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
|
||||||
constants::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME |
|
constants::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME |
|
||||||
constants::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL |
|
constants::FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL |
|
||||||
constants::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE => true,
|
constants::FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE
|
||||||
_ => false,
|
),
|
||||||
},
|
|
||||||
},
|
|
||||||
_ => match pname {
|
|
||||||
constants::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE => true,
|
|
||||||
_ => false,
|
|
||||||
},
|
},
|
||||||
|
_ => matches!(pname, constants::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE),
|
||||||
};
|
};
|
||||||
|
|
||||||
if !target_matches || !attachment_matches || !pname_matches || !bound_attachment_matches {
|
if !target_matches || !attachment_matches || !pname_matches || !bound_attachment_matches {
|
||||||
|
@ -3212,18 +3208,18 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
// https://github.com/immersive-web/webxr/issues/862
|
// https://github.com/immersive-web/webxr/issues/862
|
||||||
let target_matches = target == constants::RENDERBUFFER;
|
let target_matches = target == constants::RENDERBUFFER;
|
||||||
|
|
||||||
let pname_matches = match pname {
|
let pname_matches = matches!(
|
||||||
|
pname,
|
||||||
constants::RENDERBUFFER_WIDTH |
|
constants::RENDERBUFFER_WIDTH |
|
||||||
constants::RENDERBUFFER_HEIGHT |
|
constants::RENDERBUFFER_HEIGHT |
|
||||||
constants::RENDERBUFFER_INTERNAL_FORMAT |
|
constants::RENDERBUFFER_INTERNAL_FORMAT |
|
||||||
constants::RENDERBUFFER_RED_SIZE |
|
constants::RENDERBUFFER_RED_SIZE |
|
||||||
constants::RENDERBUFFER_GREEN_SIZE |
|
constants::RENDERBUFFER_GREEN_SIZE |
|
||||||
constants::RENDERBUFFER_BLUE_SIZE |
|
constants::RENDERBUFFER_BLUE_SIZE |
|
||||||
constants::RENDERBUFFER_ALPHA_SIZE |
|
constants::RENDERBUFFER_ALPHA_SIZE |
|
||||||
constants::RENDERBUFFER_DEPTH_SIZE |
|
constants::RENDERBUFFER_DEPTH_SIZE |
|
||||||
constants::RENDERBUFFER_STENCIL_SIZE => true,
|
constants::RENDERBUFFER_STENCIL_SIZE
|
||||||
_ => false,
|
);
|
||||||
};
|
|
||||||
|
|
||||||
if !target_matches || !pname_matches {
|
if !target_matches || !pname_matches {
|
||||||
self.webgl_error(InvalidEnum);
|
self.webgl_error(InvalidEnum);
|
||||||
|
|
|
@ -66,10 +66,10 @@ fn validate_params(pname: u32, value: WebGLSamplerValue) -> bool {
|
||||||
};
|
};
|
||||||
allowed_values.contains(&value)
|
allowed_values.contains(&value)
|
||||||
},
|
},
|
||||||
WebGLSamplerValue::Float(_) => match pname {
|
WebGLSamplerValue::Float(_) => matches!(
|
||||||
constants::TEXTURE_MIN_LOD | constants::TEXTURE_MAX_LOD => true,
|
pname,
|
||||||
_ => false,
|
constants::TEXTURE_MIN_LOD | constants::TEXTURE_MAX_LOD
|
||||||
},
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -347,12 +347,14 @@ impl WebGLTexture {
|
||||||
|
|
||||||
pub fn is_using_linear_filtering(&self) -> bool {
|
pub fn is_using_linear_filtering(&self) -> bool {
|
||||||
let filters = [self.min_filter.get(), self.mag_filter.get()];
|
let filters = [self.min_filter.get(), self.mag_filter.get()];
|
||||||
filters.iter().any(|filter| match *filter {
|
filters.iter().any(|filter| {
|
||||||
constants::LINEAR |
|
matches!(
|
||||||
constants::NEAREST_MIPMAP_LINEAR |
|
*filter,
|
||||||
constants::LINEAR_MIPMAP_NEAREST |
|
constants::LINEAR |
|
||||||
constants::LINEAR_MIPMAP_LINEAR => true,
|
constants::NEAREST_MIPMAP_LINEAR |
|
||||||
_ => false,
|
constants::LINEAR_MIPMAP_NEAREST |
|
||||||
|
constants::LINEAR_MIPMAP_LINEAR
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2706,20 +2706,20 @@ fn debug_reflow_events(id: PipelineId, reflow_goal: &ReflowGoal, reason: &Reflow
|
||||||
ReflowGoal::Full => "\tFull",
|
ReflowGoal::Full => "\tFull",
|
||||||
ReflowGoal::TickAnimations => "\tTickAnimations",
|
ReflowGoal::TickAnimations => "\tTickAnimations",
|
||||||
ReflowGoal::UpdateScrollNode(_) => "\tUpdateScrollNode",
|
ReflowGoal::UpdateScrollNode(_) => "\tUpdateScrollNode",
|
||||||
ReflowGoal::LayoutQuery(ref query_msg, _) => match query_msg {
|
ReflowGoal::LayoutQuery(ref query_msg, _) => match *query_msg {
|
||||||
&QueryMsg::ContentBoxQuery(_n) => "\tContentBoxQuery",
|
QueryMsg::ContentBoxQuery(_n) => "\tContentBoxQuery",
|
||||||
&QueryMsg::ContentBoxesQuery(_n) => "\tContentBoxesQuery",
|
QueryMsg::ContentBoxesQuery(_n) => "\tContentBoxesQuery",
|
||||||
&QueryMsg::NodesFromPointQuery(..) => "\tNodesFromPointQuery",
|
QueryMsg::NodesFromPointQuery(..) => "\tNodesFromPointQuery",
|
||||||
&QueryMsg::ClientRectQuery(_n) => "\tClientRectQuery",
|
QueryMsg::ClientRectQuery(_n) => "\tClientRectQuery",
|
||||||
&QueryMsg::ScrollingAreaQuery(_n) => "\tNodeScrollGeometryQuery",
|
QueryMsg::ScrollingAreaQuery(_n) => "\tNodeScrollGeometryQuery",
|
||||||
&QueryMsg::NodeScrollIdQuery(_n) => "\tNodeScrollIdQuery",
|
QueryMsg::NodeScrollIdQuery(_n) => "\tNodeScrollIdQuery",
|
||||||
&QueryMsg::ResolvedStyleQuery(_, _, _) => "\tResolvedStyleQuery",
|
QueryMsg::ResolvedStyleQuery(_, _, _) => "\tResolvedStyleQuery",
|
||||||
&QueryMsg::ResolvedFontStyleQuery(..) => "\nResolvedFontStyleQuery",
|
QueryMsg::ResolvedFontStyleQuery(..) => "\nResolvedFontStyleQuery",
|
||||||
&QueryMsg::OffsetParentQuery(_n) => "\tOffsetParentQuery",
|
QueryMsg::OffsetParentQuery(_n) => "\tOffsetParentQuery",
|
||||||
&QueryMsg::StyleQuery => "\tStyleQuery",
|
QueryMsg::StyleQuery => "\tStyleQuery",
|
||||||
&QueryMsg::TextIndexQuery(..) => "\tTextIndexQuery",
|
QueryMsg::TextIndexQuery(..) => "\tTextIndexQuery",
|
||||||
&QueryMsg::ElementInnerTextQuery(_) => "\tElementInnerTextQuery",
|
QueryMsg::ElementInnerTextQuery(_) => "\tElementInnerTextQuery",
|
||||||
&QueryMsg::InnerWindowDimensionsQuery(_) => "\tInnerWindowDimensionsQuery",
|
QueryMsg::InnerWindowDimensionsQuery(_) => "\tInnerWindowDimensionsQuery",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2836,13 +2836,13 @@ fn is_named_element_with_name_attribute(elem: &Element) -> bool {
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(type_)) => type_,
|
NodeTypeId::Element(ElementTypeId::HTMLElement(type_)) => type_,
|
||||||
_ => return false,
|
_ => return false,
|
||||||
};
|
};
|
||||||
match type_ {
|
matches!(
|
||||||
|
type_,
|
||||||
HTMLElementTypeId::HTMLEmbedElement |
|
HTMLElementTypeId::HTMLEmbedElement |
|
||||||
HTMLElementTypeId::HTMLFormElement |
|
HTMLElementTypeId::HTMLFormElement |
|
||||||
HTMLElementTypeId::HTMLImageElement |
|
HTMLElementTypeId::HTMLImageElement |
|
||||||
HTMLElementTypeId::HTMLObjectElement => true,
|
HTMLElementTypeId::HTMLObjectElement
|
||||||
_ => false,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_named_element_with_id_attribute(elem: &Element) -> bool {
|
fn is_named_element_with_id_attribute(elem: &Element) -> bool {
|
||||||
|
|
|
@ -345,10 +345,7 @@ impl QueuedTaskConversion for MainThreadScriptMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_wake_up(&self) -> bool {
|
fn is_wake_up(&self) -> bool {
|
||||||
match self {
|
matches!(self, MainThreadScriptMsg::WakeUp)
|
||||||
MainThreadScriptMsg::WakeUp => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue