mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Change the parsing order of border shorthands.
It's not ambiguous, and <width> <style> <color> seems like a more common order. This is just a minor perf tweak, as the CSS parser token cache will most often kick in to avoid re-tokenizing values. Also remove a redundant continue statement. Differential Revision: https://phabricator.services.mozilla.com/D67224
This commit is contained in:
parent
ccc41dd89d
commit
ece146988c
1 changed files with 6 additions and 7 deletions
|
@ -70,11 +70,10 @@ pub fn parse_border<'i, 't>(
|
||||||
let mut width = None;
|
let mut width = None;
|
||||||
let mut any = false;
|
let mut any = false;
|
||||||
loop {
|
loop {
|
||||||
if color.is_none() {
|
if width.is_none() {
|
||||||
if let Ok(value) = input.try(|i| Color::parse(context, i)) {
|
if let Ok(value) = input.try(|i| BorderSideWidth::parse(context, i)) {
|
||||||
color = Some(value);
|
width = Some(value);
|
||||||
any = true;
|
any = true;
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if style.is_none() {
|
if style.is_none() {
|
||||||
|
@ -84,9 +83,9 @@ pub fn parse_border<'i, 't>(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if width.is_none() {
|
if color.is_none() {
|
||||||
if let Ok(value) = input.try(|i| BorderSideWidth::parse(context, i)) {
|
if let Ok(value) = input.try(|i| Color::parse(context, i)) {
|
||||||
width = Some(value);
|
color = Some(value);
|
||||||
any = true;
|
any = true;
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue