Skip to content

Commit 123a3db

Browse files
committed
LibWeb/CSS: Handle whitespace properly in mask properties
1 parent fd68238 commit 123a3db

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3750,13 +3750,15 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
37503750
remaining_layer_properties.unchecked_append(PropertyID::MaskMode);
37513751
};
37523752

3753+
tokens.discard_whitespace();
37533754
while (tokens.has_next_token()) {
37543755
if (tokens.next_token().is(Token::Type::Comma)) {
37553756
has_multiple_layers = true;
37563757
if (!mask_layer_is_valid())
37573758
return nullptr;
37583759
complete_mask_layer();
3759-
tokens.discard_a_token();
3760+
tokens.discard_a_token(); // ,
3761+
tokens.discard_whitespace();
37603762
continue;
37613763
}
37623764

@@ -3772,6 +3774,7 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
37723774
case PropertyID::MaskImage:
37733775
VERIFY(!mask_image);
37743776
mask_image = value.release_nonnull();
3777+
tokens.discard_whitespace();
37753778
continue;
37763779
// <position> [ / <bg-size> ]?
37773780
case PropertyID::MaskPosition: {
@@ -3780,15 +3783,18 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
37803783

37813784
// Attempt to parse `/ <bg-size>`
37823785
auto mask_size_transaction = tokens.begin_transaction();
3783-
auto const& maybe_slash = tokens.consume_a_token();
3784-
if (maybe_slash.is_delim('/')) {
3786+
tokens.discard_whitespace();
3787+
if (auto const& maybe_slash = tokens.consume_a_token(); maybe_slash.is_delim('/')) {
3788+
tokens.discard_whitespace();
37853789
if (auto maybe_mask_size = parse_single_background_size_value(PropertyID::MaskSize, tokens)) {
37863790
mask_size_transaction.commit();
3791+
tokens.discard_whitespace();
37873792
mask_size = maybe_mask_size.release_nonnull();
37883793
continue;
37893794
}
37903795
return nullptr;
37913796
}
3797+
tokens.discard_whitespace();
37923798
continue;
37933799
}
37943800
// <repeat-style>
@@ -3797,6 +3803,7 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
37973803
tokens.reconsume_current_input_token();
37983804
if (auto maybe_repeat = parse_single_repeat_style_value(property, tokens)) {
37993805
mask_repeat = maybe_repeat.release_nonnull();
3806+
tokens.discard_whitespace();
38003807
continue;
38013808
}
38023809
return nullptr;
@@ -3820,17 +3827,20 @@ RefPtr<StyleValue const> Parser::parse_mask_value(TokenStream<ComponentValue>& t
38203827
} else {
38213828
VERIFY_NOT_REACHED();
38223829
}
3830+
tokens.discard_whitespace();
38233831
continue;
38243832
}
38253833
// <compositing-operator>
38263834
case PropertyID::MaskComposite:
38273835
VERIFY(!mask_composite);
38283836
mask_composite = value.release_nonnull();
3837+
tokens.discard_whitespace();
38293838
continue;
38303839
// <masking-mode>
38313840
case PropertyID::MaskMode:
38323841
VERIFY(!mask_mode);
38333842
mask_mode = value.release_nonnull();
3843+
tokens.discard_whitespace();
38343844
continue;
38353845
default:
38363846
VERIFY_NOT_REACHED();

Libraries/LibWeb/CSS/Properties.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,7 +2697,6 @@
26972697
"needs-layout-for-getcomputedstyle": true
26982698
},
26992699
"mask": {
2700-
"strip-whitespace": true,
27012700
"__comment": "FIXME: reset mask-border",
27022701
"inherited": false,
27032702
"affects-layout": false,
@@ -2715,7 +2714,6 @@
27152714
]
27162715
},
27172716
"mask-clip": {
2718-
"strip-whitespace": true,
27192717
"animation-type": "discrete",
27202718
"inherited": false,
27212719
"affects-layout": false,
@@ -2729,7 +2727,6 @@
27292727
"initial": "border-box"
27302728
},
27312729
"mask-composite": {
2732-
"strip-whitespace": true,
27332730
"animation-type": "discrete",
27342731
"inherited": false,
27352732
"affects-layout": false,
@@ -2740,7 +2737,6 @@
27402737
"initial": "add"
27412738
},
27422739
"mask-image": {
2743-
"strip-whitespace": true,
27442740
"animation-type": "discrete",
27452741
"inherited": false,
27462742
"affects-layout": false,
@@ -2756,7 +2752,6 @@
27562752
"initial": "none"
27572753
},
27582754
"mask-mode": {
2759-
"strip-whitespace": true,
27602755
"animation-type": "discrete",
27612756
"inherited": false,
27622757
"affects-layout": false,
@@ -2767,7 +2762,6 @@
27672762
"initial": "match-source"
27682763
},
27692764
"mask-origin": {
2770-
"strip-whitespace": true,
27712765
"animation-type": "discrete",
27722766
"inherited": false,
27732767
"affects-layout": false,
@@ -2778,7 +2772,6 @@
27782772
"initial": "border-box"
27792773
},
27802774
"mask-position": {
2781-
"strip-whitespace": true,
27822775
"animation-type": "repeatable-list",
27832776
"affects-layout": false,
27842777
"inherited": false,
@@ -2790,7 +2783,6 @@
27902783
"percentages-resolve-to": "length"
27912784
},
27922785
"mask-repeat": {
2793-
"strip-whitespace": true,
27942786
"affects-layout": false,
27952787
"animation-type": "discrete",
27962788
"inherited": false,
@@ -2806,7 +2798,6 @@
28062798
]
28072799
},
28082800
"mask-size": {
2809-
"strip-whitespace": true,
28102801
"affects-layout": false,
28112802
"animation-type": "repeatable-list",
28122803
"inherited": false,
@@ -2825,7 +2816,6 @@
28252816
"percentages-resolve-to": "length"
28262817
},
28272818
"mask-type": {
2828-
"strip-whitespace": true,
28292819
"animation-type": "discrete",
28302820
"inherited": false,
28312821
"affects-layout": false,

0 commit comments

Comments
 (0)