mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Inline CSSStyleValue::to_keyword()
Shaves 120 ms of loading time off of https://wpt.fyi/
This commit is contained in:
parent
30cbd4bcfb
commit
c53c781745
Notes:
github-actions[bot]
2025-01-28 11:25:40 +00:00
Author: https://github.com/awesomekling
Commit: c53c781745
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3377
9 changed files with 14 additions and 7 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibWeb/Bindings/KeyframeEffectPrototype.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
#include <LibWeb/Painting/Paintable.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
|
|
@ -364,13 +364,6 @@ bool CSSStyleValue::has_auto() const
|
|||
return is_keyword() && as_keyword().keyword() == Keyword::Auto;
|
||||
}
|
||||
|
||||
Keyword CSSStyleValue::to_keyword() const
|
||||
{
|
||||
if (is_keyword())
|
||||
return as_keyword().keyword();
|
||||
return Keyword::Invalid;
|
||||
}
|
||||
|
||||
int CSSStyleValue::to_font_weight() const
|
||||
{
|
||||
if (is_keyword()) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <LibWeb/CSS/FontFace.h>
|
||||
#include <LibWeb/CSS/FontFaceSet.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <LibWeb/CSS/CSSSupportsRule.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/PropertyName.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/IntegerStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/OpenTypeTaggedStyleValue.h>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
#include <LibWeb/CSS/StyleInvalidation.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "CSSColorValue.h"
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSRGB.h>
|
||||
#include <LibWeb/CSS/StyleValues/CalculatedStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
|
||||
|
|
|
@ -66,4 +66,11 @@ private:
|
|||
Keyword m_keyword { Keyword::Invalid };
|
||||
};
|
||||
|
||||
inline Keyword CSSStyleValue::to_keyword() const
|
||||
{
|
||||
if (is_keyword())
|
||||
return static_cast<CSSKeywordValue const&>(*this).keyword();
|
||||
return Keyword::Invalid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "CSSRGB.h"
|
||||
#include <AK/TypeCasts.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/CalculatedStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "ShorthandStyleValue.h"
|
||||
#include <LibWeb/CSS/PropertyID.h>
|
||||
#include <LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue