use js::context::JSContext;
use crate::dom::NodeTraits;
use crate::dom::inputevent::HitTestResult;
#[derive(JSTraceable, MallocSizeOf)]
#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct DocumentSelectionDragHandler;
impl DocumentSelectionDragHandler {
pub(crate) fn still_connected(&self) -> bool {
true
}
pub(crate) fn moved(&self, cx: &mut JSContext, hit_test_result: &HitTestResult) -> bool {
let Some((container, offset)) = hit_test_result.dom_position_for_selection.as_ref() else {
return true;
};
let Some(selection) = container.owner_document().selection() else {
return true;
};
selection.collapse_or_extend_to_dom_position(cx, container, *offset);
true
}
}