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 any = false;
|
||||
loop {
|
||||
if color.is_none() {
|
||||
if let Ok(value) = input.try(|i| Color::parse(context, i)) {
|
||||
color = Some(value);
|
||||
if width.is_none() {
|
||||
if let Ok(value) = input.try(|i| BorderSideWidth::parse(context, i)) {
|
||||
width = Some(value);
|
||||
any = true;
|
||||
continue
|
||||
}
|
||||
}
|
||||
if style.is_none() {
|
||||
|
@ -84,9 +83,9 @@ pub fn parse_border<'i, 't>(
|
|||
continue
|
||||
}
|
||||
}
|
||||
if width.is_none() {
|
||||
if let Ok(value) = input.try(|i| BorderSideWidth::parse(context, i)) {
|
||||
width = Some(value);
|
||||
if color.is_none() {
|
||||
if let Ok(value) = input.try(|i| Color::parse(context, i)) {
|
||||
color = Some(value);
|
||||
any = true;
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue