1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

LibWeb: Add an enum for !important

This commit is contained in:
Sam Atkins 2022-02-12 14:53:59 +00:00 committed by Linus Groh
parent c08a52dd97
commit a99d02e14d
8 changed files with 21 additions and 15 deletions

View file

@ -1611,7 +1611,7 @@ Optional<StyleDeclarationRule> Parser::consume_a_declaration(TokenStream<T>& tok
if (bang_index.has_value()) {
declaration.m_values.remove(important_index.value());
declaration.m_values.remove(bang_index.value());
declaration.m_important = true;
declaration.m_important = Important::Yes;
}
}
}

View file

@ -8,6 +8,7 @@
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
namespace Web::CSS {
@ -24,7 +25,7 @@ public:
private:
String m_name;
Vector<StyleComponentValueRule> m_values;
bool m_important { false };
Important m_important { Important::No };
};
}

View file

@ -171,7 +171,7 @@ String StyleDeclarationRule::to_string() const
builder.append(": ");
append_with_to_string(builder, " ", m_values);
if (m_important)
if (m_important == Important::Yes)
builder.append(" !important");
return builder.to_string();