Skip to content

Commit 758532d

Browse files
author
bors-servo
authored
Auto merge of servo#187 - servo:bye-looking-for-viewport-percentages, r=SimonSapin
parser: Remove ability to look for viewport percentages. The only user of it is going away in servo/servo#18267. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/187) <!-- Reviewable:end -->
2 parents cf3d20d + 15166c9 commit 758532d

File tree

3 files changed

+1
-43
lines changed

3 files changed

+1
-43
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cssparser"
3-
version = "0.19.6"
3+
version = "0.20.0"
44
authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]
55

66
description = "Rust implementation of CSS Syntax Level 3"

src/parser.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -353,20 +353,6 @@ impl<'i: 't, 't> Parser<'i, 't> {
353353
self.input.tokenizer.seen_var_functions()
354354
}
355355

356-
/// Start looking for viewport percentage lengths. (See the `seen_viewport_percentages`
357-
/// method.)
358-
#[inline]
359-
pub fn look_for_viewport_percentages(&mut self) {
360-
self.input.tokenizer.look_for_viewport_percentages()
361-
}
362-
363-
/// Return whether a `vh`, `vw`, `vmin`, or `vmax` dimension has been seen by the tokenizer
364-
/// since `look_for_viewport_percentages` was called, and stop looking.
365-
#[inline]
366-
pub fn seen_viewport_percentages(&mut self) -> bool {
367-
self.input.tokenizer.seen_viewport_percentages()
368-
}
369-
370356
/// Execute the given closure, passing it the parser.
371357
/// If the result (returned unchanged) is `Err`,
372358
/// the internal state of the parser (including position within the input)
@@ -445,7 +431,6 @@ impl<'i: 't, 't> Parser<'i, 't> {
445431
if cached_token.start_position == token_start_position => {
446432
self.input.tokenizer.reset(&cached_token.end_state);
447433
match cached_token.token {
448-
Token::Dimension { ref unit, .. } => self.input.tokenizer.see_dimension(unit),
449434
Token::Function(ref name) => self.input.tokenizer.see_function(name),
450435
_ => {}
451436
}

src/tokenizer.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ pub struct Tokenizer<'a> {
208208
current_line_start_position: usize,
209209
current_line_number: u32,
210210
var_functions: SeenStatus,
211-
viewport_percentages: SeenStatus,
212211
source_map_url: Option<&'a str>,
213212
}
214213

@@ -234,7 +233,6 @@ impl<'a> Tokenizer<'a> {
234233
current_line_start_position: 0,
235234
current_line_number: first_line_number,
236235
var_functions: SeenStatus::DontCare,
237-
viewport_percentages: SeenStatus::DontCare,
238236
source_map_url: None,
239237
}
240238
}
@@ -260,30 +258,6 @@ impl<'a> Tokenizer<'a> {
260258
}
261259
}
262260

263-
#[inline]
264-
pub fn look_for_viewport_percentages(&mut self) {
265-
self.viewport_percentages = SeenStatus::LookingForThem;
266-
}
267-
268-
#[inline]
269-
pub fn seen_viewport_percentages(&mut self) -> bool {
270-
let seen = self.viewport_percentages == SeenStatus::SeenAtLeastOne;
271-
self.viewport_percentages = SeenStatus::DontCare;
272-
seen
273-
}
274-
275-
#[inline]
276-
pub fn see_dimension(&mut self, unit: &str) {
277-
if self.viewport_percentages == SeenStatus::LookingForThem {
278-
if unit.eq_ignore_ascii_case("vh") ||
279-
unit.eq_ignore_ascii_case("vw") ||
280-
unit.eq_ignore_ascii_case("vmin") ||
281-
unit.eq_ignore_ascii_case("vmax") {
282-
self.viewport_percentages = SeenStatus::SeenAtLeastOne;
283-
}
284-
}
285-
}
286-
287261
#[inline]
288262
pub fn next(&mut self) -> Result<Token<'a>, ()> {
289263
next_token(self)
@@ -1045,7 +1019,6 @@ fn consume_numeric<'a>(tokenizer: &mut Tokenizer<'a>) -> Token<'a> {
10451019
let value = value as f32;
10461020
if is_ident_start(tokenizer) {
10471021
let unit = consume_name(tokenizer);
1048-
tokenizer.see_dimension(&unit);
10491022
Dimension {
10501023
value: value,
10511024
int_value: int_value,

0 commit comments

Comments
 (0)