Meta/LibWeb: Use correct shorthand range in is_inherited_property

This commit is contained in:
Pavel Shliak 2024-12-20 02:04:02 +04:00 committed by Andreas Kling
commit 78595f05d8
Notes: github-actions[bot] 2024-12-22 11:35:07 +00:00
3 changed files with 31 additions and 1 deletions

View file

@ -595,7 +595,7 @@ bool is_animatable_property(PropertyID property_id)
bool is_inherited_property(PropertyID property_id)
{
if (property_id >= first_inherited_shorthand_property_id && property_id <= last_inherited_longhand_property_id)
if (property_id >= first_inherited_shorthand_property_id && property_id <= last_inherited_shorthand_property_id)
return true;
if (property_id >= first_inherited_longhand_property_id && property_id <= last_inherited_longhand_property_id)
return true;

View file

@ -2,6 +2,7 @@ set(TEST_SOURCES
TestCSSIDSpeed.cpp
TestCSSPixels.cpp
TestCSSTokenStream.cpp
TestCSSInheritedProperty.cpp
TestFetchInfrastructure.cpp
TestFetchURL.cpp
TestHTMLTokenizer.cpp

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2024, Pavel Shliak <shlyakpavel@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibTest/TestCase.h>
#include <LibWeb/CSS/PropertyID.h>
namespace Web {
TEST_CASE(is_inherited_property_test)
{
// Test inherited properties
EXPECT(CSS::is_inherited_property(CSS::PropertyID::Color));
EXPECT(CSS::is_inherited_property(CSS::PropertyID::FontSize));
EXPECT(CSS::is_inherited_property(CSS::PropertyID::Visibility));
// Test non-inherited properties
EXPECT(!CSS::is_inherited_property(CSS::PropertyID::Margin));
EXPECT(!CSS::is_inherited_property(CSS::PropertyID::Padding));
EXPECT(!CSS::is_inherited_property(CSS::PropertyID::Border));
// Edge cases
EXPECT(!CSS::is_inherited_property(CSS::PropertyID::Invalid));
EXPECT(!CSS::is_inherited_property(CSS::PropertyID::All));
}
}