diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/document.rs | 4 | ||||
-rw-r--r-- | components/script/dom/htmlformelement.rs | 10 | ||||
-rw-r--r-- | components/script/script_thread.rs | 3 |
3 files changed, 12 insertions, 5 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 1e2a3747751..ec2ad98c464 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -1180,7 +1180,9 @@ impl Document { let node = elem.upcast::<Node>(); elem.set_focus_state(false); // FIXME: pass appropriate relatedTarget - self.fire_focus_event(FocusEventType::Blur, node, None, can_gc); + if node.is_connected() { + self.fire_focus_event(FocusEventType::Blur, node, None, can_gc); + } // Notify the embedder to hide the input method. if elem.input_method_type().is_some() { diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index ce6dcca66f3..2421b683bf7 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -1270,8 +1270,14 @@ impl HTMLFormElement { return; } - let controls = self.controls.borrow(); - for child in controls.iter() { + let controls: Vec<_> = self + .controls + .borrow() + .iter() + .map(|c| c.as_rooted()) + .collect(); + + for child in controls { let child = child.upcast::<Node>(); match child.type_id() { diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index f78b5bf281b..9c93bef22df 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -331,8 +331,7 @@ pub struct ScriptThread { #[no_trace] layout_factory: Arc<dyn LayoutFactory>, - // Mouse down point. - // In future, this shall be mouse_down_point for primary button + /// The screen coordinates where the primary mouse button was pressed. #[no_trace] relative_mouse_down_point: Cell<Point2D<f32, DevicePixel>>, } |