mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
Merge pull request #877 from lightpanda-io/visible-pseudoclass
Visible Psuedoclass
This commit is contained in:
@@ -582,6 +582,7 @@ pub const Parser = struct {
|
|||||||
.only_of_type => return .{ .pseudo_class_only_child = true },
|
.only_of_type => return .{ .pseudo_class_only_child = true },
|
||||||
.input, .empty, .root, .link => return .{ .pseudo_class = pseudo_class },
|
.input, .empty, .root, .link => return .{ .pseudo_class = pseudo_class },
|
||||||
.enabled, .disabled, .checked => return .{ .pseudo_class = pseudo_class },
|
.enabled, .disabled, .checked => return .{ .pseudo_class = pseudo_class },
|
||||||
|
.visible => return .{ .pseudo_class = pseudo_class },
|
||||||
.lang => {
|
.lang => {
|
||||||
if (!p.consumeParenthesis()) return ParseError.ExpectedParenthesis;
|
if (!p.consumeParenthesis()) return ParseError.ExpectedParenthesis;
|
||||||
if (p.i == p.s.len) return ParseError.UnmatchParenthesis;
|
if (p.i == p.s.len) return ParseError.UnmatchParenthesis;
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ pub const PseudoClass = enum {
|
|||||||
spelling_error,
|
spelling_error,
|
||||||
modal,
|
modal,
|
||||||
popover_open,
|
popover_open,
|
||||||
|
visible,
|
||||||
|
|
||||||
pub const Error = error{
|
pub const Error = error{
|
||||||
InvalidPseudoClass,
|
InvalidPseudoClass,
|
||||||
@@ -157,6 +158,7 @@ pub const PseudoClass = enum {
|
|||||||
asUint(u56, "enabled") => return .enabled,
|
asUint(u56, "enabled") => return .enabled,
|
||||||
asUint(u56, "matches") => return .matches,
|
asUint(u56, "matches") => return .matches,
|
||||||
asUint(u56, "visited") => return .visited,
|
asUint(u56, "visited") => return .visited,
|
||||||
|
asUint(u56, "visible") => return .visible,
|
||||||
else => {},
|
else => {},
|
||||||
},
|
},
|
||||||
8 => switch (@as(u64, @bitCast(selector[0..8].*))) {
|
8 => switch (@as(u64, @bitCast(selector[0..8].*))) {
|
||||||
@@ -567,6 +569,8 @@ pub const Selector = union(enum) {
|
|||||||
// TODO implement using the url fragment.
|
// TODO implement using the url fragment.
|
||||||
// see https://developer.mozilla.org/en-US/docs/Web/CSS/:target
|
// see https://developer.mozilla.org/en-US/docs/Web/CSS/:target
|
||||||
.target => return false,
|
.target => return false,
|
||||||
|
// visible always returns true.
|
||||||
|
.visible => return true,
|
||||||
|
|
||||||
// all others pseudo class are handled by specialized
|
// all others pseudo class are handled by specialized
|
||||||
// pseudo_class_X selectors.
|
// pseudo_class_X selectors.
|
||||||
|
|||||||
Reference in New Issue
Block a user