mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 00:42:54 +00:00
LibWeb/CSS: Treat 'mask' as a longhand property
Before this change, an element masked with 'mask-image: url(...)' would show the mask, but 'mask: url(...)' would not. On e.g. dialogic.nl it would show white boxes instead of the actual images in the top navigation bar. We still do not support many of the other mask properties, but with this change at least the masks show up in both cases.
This commit is contained in:
parent
4bf197872b
commit
056205aa76
Notes:
github-actions[bot]
2025-03-05 12:11:03 +00:00
Author: https://github.com/pixelspark
Commit: 056205aa76
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3748
Reviewed-by: https://github.com/AtkinsSJ ✅
9 changed files with 127 additions and 86 deletions
|
@ -15,6 +15,7 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/PropertyName.h>
|
||||
#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
|
||||
|
@ -1925,8 +1926,19 @@ RefPtr<StringStyleValue> Parser::parse_string_value(TokenStream<ComponentValue>&
|
|||
|
||||
RefPtr<AbstractImageStyleValue> Parser::parse_image_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
if (auto url = parse_url_function(tokens); url.has_value())
|
||||
return ImageStyleValue::create(url.value());
|
||||
tokens.mark();
|
||||
auto url = parse_url_function(tokens);
|
||||
if (url.has_value()) {
|
||||
// If the value is a 'url(..)' parse as image, but if it is just a reference 'url(#xx)', leave it alone,
|
||||
// so we can parse as URL further on. These URLs are used as references inside SVG documents for masks.
|
||||
if (!url.value().equals(m_url, URL::ExcludeFragment::Yes)) {
|
||||
tokens.discard_a_mark();
|
||||
return ImageStyleValue::create(url.value());
|
||||
}
|
||||
tokens.restore_a_mark();
|
||||
return nullptr;
|
||||
}
|
||||
tokens.discard_a_mark();
|
||||
|
||||
if (auto linear_gradient = parse_linear_gradient_function(tokens))
|
||||
return linear_gradient;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue