Skip to main content

Module drag

Module drag 

Source
Expand description

Platform-agnostic drag-and-drop state, accept-mask matching, bounded LRU dropped-file handle registry (max 256), and non-flickering ancestor enter/leave diffing.

Structs§

DragHoverTransition
Pure enter/leave reconciliation plan for one Web dragenter / dragover step.
DragNodeMeta
Compact 1-byte mirrored per-node drag metadata stored in WebEventState:
DragPayloadRegistry
Zero-overhead TableSlot-indexed registry of DragPayloadContributor hooks (32 B inline when empty; 1 branch and 0 heap allocations on the empty fast path).
DroppedFileLru
Bounded monotonic-ID LRU registry (max 256) holding sandboxed dropped file handles.

Constants§

MAX_DROPPED_FILES
Hard cap on live sandboxed browser File handles retained in DroppedFileLru.
NV_INTERNAL_DRAG_MIME
Internal MIME token stamped onto DataTransfer during in-app HTML5 drags.

Traits§

DragPayloadContributor
Capability-module hook supplying a DragPayload on drag start for nodes carrying its table (consumers: Link, TextContent, custom draggable components).

Functions§

build_internal_drag_payload
Builds a canonical DragPayload from an internal draggable node’s (mime, data) pair, matching skia-shell (text/uri-list -> uris + text, text/* -> text, custom MIME -> custom bytes) uniformly across DragStart, DragEnter, and Drop.
data_transfer_matches_accept
Synchronous dragover/dragenter/drop accept check against mirrored DragAcceptMask.
diff_drag_enter_leave
Computes (exited_bottom_up, entered_top_down) between previous and next drop-zone chains. Crossing into a child element inside the same drop zone leaves both slices empty (0 flicker).
drag_enter_leave_metas
Builds separate (leave_meta, enter_meta) headers for enter/leave reconciliation: DragLeave always carries DropEffect::None, while DragEnter carries resolved_effect.
drop_effect_web_str
Canonical W3C DataTransfer.dropEffect keyword.
effect_allowed_web_str
Canonical W3C DataTransfer.effectAllowed keyword for internal drags.
effective_drop_effect
Resolves the effective drop effect from the source’s allowed mask and the target’s preferred effect (falling back to Copy).
parse_uri_list
Parses an RFC 2483 text/uri-list payload, skipping # comments and blank lines, capped at max.
payload_matches_accept
Returns whether a DragPayload satisfies a drop target’s DragAcceptMask.
plan_drag_hover_transition
Resolves the effective drop effect and enter/leave diff for a dragenter/dragover event.
resolve_allowed_drop_effect
Aligns a drop zone’s preferred requested DropEffect against the browser’s active DataTransfer.effectAllowed keyword so dt.dropEffect is always permitted by the source.
resolve_matched_drop_effect
Resolves the effective DropEffect for the innermost matched drop target (or DropEffect::None when no drop target matched or the drag source disallowed all effects).