Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cssparser"
version = "0.19.6"
version = "0.20.0"
authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]

description = "Rust implementation of CSS Syntax Level 3"
Expand Down
15 changes: 0 additions & 15 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,20 +353,6 @@ impl<'i: 't, 't> Parser<'i, 't> {
self.input.tokenizer.seen_var_functions()
}

/// Start looking for viewport percentage lengths. (See the `seen_viewport_percentages`
/// method.)
#[inline]
pub fn look_for_viewport_percentages(&mut self) {
self.input.tokenizer.look_for_viewport_percentages()
}

/// Return whether a `vh`, `vw`, `vmin`, or `vmax` dimension has been seen by the tokenizer
/// since `look_for_viewport_percentages` was called, and stop looking.
#[inline]
pub fn seen_viewport_percentages(&mut self) -> bool {
self.input.tokenizer.seen_viewport_percentages()
}

/// Execute the given closure, passing it the parser.
/// If the result (returned unchanged) is `Err`,
/// the internal state of the parser (including position within the input)
Expand Down Expand Up @@ -445,7 +431,6 @@ impl<'i: 't, 't> Parser<'i, 't> {
if cached_token.start_position == token_start_position => {
self.input.tokenizer.reset(&cached_token.end_state);
match cached_token.token {
Token::Dimension { ref unit, .. } => self.input.tokenizer.see_dimension(unit),
Token::Function(ref name) => self.input.tokenizer.see_function(name),
_ => {}
}
Expand Down
27 changes: 0 additions & 27 deletions src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ pub struct Tokenizer<'a> {
current_line_start_position: usize,
current_line_number: u32,
var_functions: SeenStatus,
viewport_percentages: SeenStatus,
source_map_url: Option<&'a str>,
}

Expand All @@ -234,7 +233,6 @@ impl<'a> Tokenizer<'a> {
current_line_start_position: 0,
current_line_number: first_line_number,
var_functions: SeenStatus::DontCare,
viewport_percentages: SeenStatus::DontCare,
source_map_url: None,
}
}
Expand All @@ -260,30 +258,6 @@ impl<'a> Tokenizer<'a> {
}
}

#[inline]
pub fn look_for_viewport_percentages(&mut self) {
self.viewport_percentages = SeenStatus::LookingForThem;
}

#[inline]
pub fn seen_viewport_percentages(&mut self) -> bool {
let seen = self.viewport_percentages == SeenStatus::SeenAtLeastOne;
self.viewport_percentages = SeenStatus::DontCare;
seen
}

#[inline]
pub fn see_dimension(&mut self, unit: &str) {
if self.viewport_percentages == SeenStatus::LookingForThem {
if unit.eq_ignore_ascii_case("vh") ||
unit.eq_ignore_ascii_case("vw") ||
unit.eq_ignore_ascii_case("vmin") ||
unit.eq_ignore_ascii_case("vmax") {
self.viewport_percentages = SeenStatus::SeenAtLeastOne;
}
}
}

#[inline]
pub fn next(&mut self) -> Result<Token<'a>, ()> {
next_token(self)
Expand Down Expand Up @@ -1045,7 +1019,6 @@ fn consume_numeric<'a>(tokenizer: &mut Tokenizer<'a>) -> Token<'a> {
let value = value as f32;
if is_ident_start(tokenizer) {
let unit = consume_name(tokenizer);
tokenizer.see_dimension(&unit);
Dimension {
value: value,
int_value: int_value,
Expand Down