Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse misuse resistance #191

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Derive PartialEq, Eq impls
  • Loading branch information
sftse committed Dec 12, 2024
commit cfdadd9265b84e3d6d4b0be6b384c20e3e316b41
14 changes: 7 additions & 7 deletions src/css.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{

use self::parser::Importance;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum SelectorComponent {
Class(String),
Element(String),
Expand Down Expand Up @@ -46,7 +46,7 @@ impl std::fmt::Display for SelectorComponent {
}
}

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct Selector {
// List of components, right first so we match from the leaf.
components: Vec<SelectorComponent>,
Expand Down Expand Up @@ -189,7 +189,7 @@ impl Selector {
}
}

#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum Display {
/// display: none
None,
Expand All @@ -198,15 +198,15 @@ pub(crate) enum Display {
ExtRawDom,
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum Style {
Colour(Colour),
BgColour(Colour),
Display(Display),
WhiteSpace(WhiteSpace),
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) struct StyleDecl {
style: Style,
importance: Importance,
Expand All @@ -230,7 +230,7 @@ impl std::fmt::Display for StyleDecl {
}
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq, Eq)]
struct Ruleset {
selector: Selector,
styles: Vec<StyleDecl>,
Expand All @@ -248,7 +248,7 @@ impl std::fmt::Display for Ruleset {
}

/// Stylesheet data which can be used while building the render tree.
#[derive(Clone, Default, Debug)]
#[derive(Clone, Default, Debug, PartialEq, Eq)]
pub(crate) struct StyleData {
agent_rules: Vec<Ruleset>,
user_rules: Vec<Ruleset>,
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ use std::io;
use std::io::Write;
use std::iter::{once, repeat};

#[derive(Debug, Copy, Clone, Default, PartialEq)]
#[derive(Debug, Copy, Clone, Default, PartialEq, Eq)]
pub(crate) enum WhiteSpace {
#[default]
Normal,
Expand Down Expand Up @@ -1306,7 +1306,7 @@ where
}
}

#[derive(Default, Debug)]
#[derive(Default, Debug, PartialEq, Eq)]
struct HtmlContext {
#[cfg(feature = "css")]
style_data: css::StyleData,
Expand Down