mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-11 05:52:17 -04:00
use StaticStringMap for lookup
This commit is contained in:
4 files changed
+10
-12
No files matched your search
@@ -3151,11 +3151,8 @@ const SubmitFormOpts = struct {
|
||||
pub fn submitForm(self: *Frame, submitter_: ?*Element, form_: ?*Element.Html.Form, submit_opts: SubmitFormOpts) !void {
|
||||
const form = form_ orelse return;
|
||||
|
||||
// Interactive submission (submit button, requestSubmit) of a
|
||||
// disconnected form does nothing; the programmatic form.submit() is
|
||||
// exempt from the connectedness requirement (HTML "cannot navigate"
|
||||
// only applies its connected clause to non-form elements).
|
||||
if (submit_opts.fire_event and !form.asElement().asNode().isConnected()) {
|
||||
if (submit_opts.fire_event and form.asNode().isConnected() == false) {
|
||||
// interactive submission (e.g. submit button) noop if the form is disconnected
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ fn hasClickActivationBehavior(node: *Node) bool {
|
||||
fn isEditingHost(node: *Node) bool {
|
||||
const element = node.is(Element) orelse return false;
|
||||
const value = element.getAttributeSafe(.wrap("contenteditable")) orelse return false;
|
||||
return !std.ascii.eqlIgnoreCase(value, "false");
|
||||
return std.ascii.eqlIgnoreCase(value, "false") == false;
|
||||
}
|
||||
|
||||
// A mousedown on editable content focuses its editing host: the outermost
|
||||
|
||||
@@ -107,11 +107,13 @@ const AddEventListenerOptions = union(enum) {
|
||||
// event types are passive by default on the window, the document, and the
|
||||
// html and body elements.
|
||||
fn defaultPassiveValue(self: *EventTarget, typ: []const u8) bool {
|
||||
const scroll_blocking = std.mem.eql(u8, typ, "touchstart") or
|
||||
std.mem.eql(u8, typ, "touchmove") or
|
||||
std.mem.eql(u8, typ, "wheel") or
|
||||
std.mem.eql(u8, typ, "mousewheel");
|
||||
if (!scroll_blocking) {
|
||||
const scroll_blocking_event_types = std.StaticStringMap(void).initComptime(.{
|
||||
.{"touchstart", {}},
|
||||
.{"touchmove", {}},
|
||||
.{"wheel", {}},
|
||||
.{"mousewheel", {}},
|
||||
});
|
||||
if (scroll_blocking_event_types.has(typ) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ pub fn getComputedLabel(_: *const WebDriver, element: *Element, frame: *Frame) !
|
||||
// synchronously so the events are observable when the testdriver promise
|
||||
// resolves.
|
||||
pub fn click(_: *const WebDriver, element: *Element, frame: *Frame) !void {
|
||||
// Disabled form controls don't receive real click events at all.
|
||||
if (element.is(Element.Html)) |html| {
|
||||
switch (html._type) {
|
||||
inline .button, .input, .textarea, .select => |i| {
|
||||
|
||||
Reference in new issue
Block a user