mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
content: Replace uses of downcast
+is_some
/is_none
with is
(#33804)
* content: Replace uses of downcast+is_some/is_none with is Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> * Remove ! to return correct logic Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com> --------- Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
This commit is contained in:
parent
c5899e596d
commit
27b25e869b
5 changed files with 5 additions and 8 deletions
|
@ -76,7 +76,7 @@ impl DOMMatrixMethods for DOMMatrix {
|
|||
}
|
||||
match init.unwrap() {
|
||||
StringOrUnrestrictedDoubleSequence::String(ref s) => {
|
||||
if global.downcast::<Window>().is_none() {
|
||||
if !global.is::<Window>() {
|
||||
return Err(error::Error::Type(
|
||||
"String constructor is only supported in the main thread.".to_owned(),
|
||||
));
|
||||
|
|
|
@ -447,7 +447,7 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly {
|
|||
}
|
||||
match init.unwrap() {
|
||||
StringOrUnrestrictedDoubleSequence::String(ref s) => {
|
||||
if global.downcast::<Window>().is_none() {
|
||||
if !global.is::<Window>() {
|
||||
return Err(error::Error::Type(
|
||||
"String constructor is only supported in the main thread.".to_owned(),
|
||||
));
|
||||
|
|
|
@ -2909,7 +2909,7 @@ impl GlobalScope {
|
|||
/// Returns a boolean indicating whether the event-loop
|
||||
/// where this global is running on can continue running JS.
|
||||
pub fn can_continue_running(&self) -> bool {
|
||||
if self.downcast::<Window>().is_some() {
|
||||
if self.is::<Window>() {
|
||||
return ScriptThread::can_continue_running();
|
||||
}
|
||||
if let Some(worker) = self.downcast::<WorkerGlobalScope>() {
|
||||
|
|
|
@ -1102,10 +1102,7 @@ impl HTMLFormElement {
|
|||
let child = child.upcast::<Node>();
|
||||
|
||||
// Step 5.1: The field element has a datalist element ancestor.
|
||||
if child
|
||||
.ancestors()
|
||||
.any(|a| DomRoot::downcast::<HTMLDataListElement>(a).is_some())
|
||||
{
|
||||
if child.ancestors().any(|a| a.is::<HTMLDataListElement>()) {
|
||||
continue;
|
||||
}
|
||||
if let NodeTypeId::Element(ElementTypeId::HTMLElement(element)) = child.type_id() {
|
||||
|
|
|
@ -181,7 +181,7 @@ pub fn Fetch(
|
|||
|
||||
// Step 6. If globalObject is a ServiceWorkerGlobalScope object, then set request’s
|
||||
// service-workers mode to "none".
|
||||
if global.downcast::<ServiceWorkerGlobalScope>().is_some() {
|
||||
if global.is::<ServiceWorkerGlobalScope>() {
|
||||
request_init.service_workers_mode = ServiceWorkersMode::None;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue