- Revision
- 294016
- Author
- [email protected]
- Date
- 2022-05-10 14:15:45 -0700 (Tue, 10 May 2022)
Log Message
Remove the unneeded StylePropertiesBase after Bug 240244
https://bugs.webkit.org/show_bug.cgi?id=240282
Reviewed by Antti Koivisto.
Now that we have removed the abandoned CSSDeferredParser, we no longer need the
StylePropertiesBase class. This patch removes this layer to simplify the code.
* css/StyleProperties.h:
(WebCore::StyleProperties::type const):
(WebCore::StyleProperties::cssParserMode const):
(WebCore::StyleProperties::StyleProperties):
(WebCore::StyleProperties::deref const):
(isType):
(WebCore::StylePropertiesBase::type const): Deleted.
(WebCore::StylePropertiesBase::cssParserMode const): Deleted.
(WebCore::StylePropertiesBase::StylePropertiesBase): Deleted.
(WebCore::StylePropertiesBase::deref const): Deleted.
* css/StyleRule.cpp:
(WebCore::StyleRule::StyleRule):
(WebCore::StyleRule::create):
(WebCore::StyleRule::properties const): Deleted.
* css/StyleRule.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (294015 => 294016)
--- trunk/Source/WebCore/ChangeLog 2022-05-10 20:52:34 UTC (rev 294015)
+++ trunk/Source/WebCore/ChangeLog 2022-05-10 21:15:45 UTC (rev 294016)
@@ -1,3 +1,29 @@
+2022-05-10 Brent Fulgham <[email protected]>
+
+ Remove the unneeded StylePropertiesBase after Bug 240244
+ https://bugs.webkit.org/show_bug.cgi?id=240282
+
+ Reviewed by Antti Koivisto.
+
+ Now that we have removed the abandoned CSSDeferredParser, we no longer need the
+ StylePropertiesBase class. This patch removes this layer to simplify the code.
+
+ * css/StyleProperties.h:
+ (WebCore::StyleProperties::type const):
+ (WebCore::StyleProperties::cssParserMode const):
+ (WebCore::StyleProperties::StyleProperties):
+ (WebCore::StyleProperties::deref const):
+ (isType):
+ (WebCore::StylePropertiesBase::type const): Deleted.
+ (WebCore::StylePropertiesBase::cssParserMode const): Deleted.
+ (WebCore::StylePropertiesBase::StylePropertiesBase): Deleted.
+ (WebCore::StylePropertiesBase::deref const): Deleted.
+ * css/StyleRule.cpp:
+ (WebCore::StyleRule::StyleRule):
+ (WebCore::StyleRule::create):
+ (WebCore::StyleRule::properties const): Deleted.
+ * css/StyleRule.h:
+
2022-05-10 Said Abou-Hallawa <[email protected]>
[GPU Process] [Filters] FilterImages can be leaked
Modified: trunk/Source/WebCore/css/StyleProperties.h (294015 => 294016)
--- trunk/Source/WebCore/css/StyleProperties.h 2022-05-10 20:52:34 UTC (rev 294015)
+++ trunk/Source/WebCore/css/StyleProperties.h 2022-05-10 21:15:45 UTC (rev 294016)
@@ -45,39 +45,15 @@
enum StylePropertiesType { ImmutablePropertiesType, MutablePropertiesType };
-class StylePropertiesBase : public RefCounted<StylePropertiesBase> {
+DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(StyleProperties);
+class StyleProperties : public RefCounted<StyleProperties> {
+ WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(StyleProperties);
+ friend class PropertyReference;
public:
// Override RefCounted's deref() to ensure operator delete is called on
// the appropriate subclass type.
void deref() const;
- StylePropertiesType type() const { return static_cast<StylePropertiesType>(m_type); }
-
- CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cssParserMode); }
-
-protected:
- StylePropertiesBase(CSSParserMode cssParserMode, StylePropertiesType type)
- : m_cssParserMode(cssParserMode)
- , m_type(type)
- , m_arraySize(0)
- { }
-
- StylePropertiesBase(CSSParserMode cssParserMode, unsigned immutableArraySize)
- : m_cssParserMode(cssParserMode)
- , m_type(ImmutablePropertiesType)
- , m_arraySize(immutableArraySize)
- { }
-
- unsigned m_cssParserMode : 3;
- mutable unsigned m_type : 2;
- unsigned m_arraySize : 27;
-};
-
-DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(StyleProperties);
-class StyleProperties : public StylePropertiesBase {
- WTF_MAKE_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(StyleProperties);
- friend class PropertyReference;
-public:
class PropertyReference {
public:
PropertyReference(const StylePropertyMetadata& metadata, const CSSValue* value)
@@ -107,6 +83,8 @@
const CSSValue* m_value;
};
+ StylePropertiesType type() const { return static_cast<StylePropertiesType>(m_type); }
+
unsigned propertyCount() const;
bool isEmpty() const { return !propertyCount(); }
PropertyReference propertyAt(unsigned) const;
@@ -127,6 +105,8 @@
Ref<MutableStyleProperties> copyBlockProperties() const;
+ CSSParserMode cssParserMode() const { return static_cast<CSSParserMode>(m_cssParserMode); }
+
WEBCORE_EXPORT Ref<MutableStyleProperties> mutableCopy() const;
Ref<ImmutableStyleProperties> immutableCopyIfNeeded() const;
@@ -150,16 +130,24 @@
protected:
StyleProperties(CSSParserMode cssParserMode, StylePropertiesType type)
- : StylePropertiesBase(cssParserMode, type)
+ : m_cssParserMode(cssParserMode)
+ , m_type(type)
+ , m_arraySize(0)
{ }
StyleProperties(CSSParserMode cssParserMode, unsigned immutableArraySize)
- : StylePropertiesBase(cssParserMode, immutableArraySize)
+ : m_cssParserMode(cssParserMode)
+ , m_type(ImmutablePropertiesType)
+ , m_arraySize(immutableArraySize)
{ }
int findPropertyIndex(CSSPropertyID) const;
int findCustomPropertyIndex(const String& propertyName) const;
+ unsigned m_cssParserMode : 3;
+ mutable unsigned m_type : 2;
+ unsigned m_arraySize : 27;
+
private:
String getGridShorthandValue(const StylePropertyShorthand&) const;
String getGridTemplateValue() const;
@@ -305,7 +293,7 @@
return downcast<ImmutableStyleProperties>(*this).propertyCount();
}
-inline void StylePropertiesBase::deref() const
+inline void StyleProperties::deref() const
{
if (!derefBase())
return;
@@ -314,6 +302,8 @@
delete downcast<MutableStyleProperties>(this);
else if (is<ImmutableStyleProperties>(*this))
delete downcast<ImmutableStyleProperties>(this);
+ else
+ RELEASE_ASSERT_NOT_REACHED();
}
inline int StyleProperties::findPropertyIndex(CSSPropertyID propertyID) const
@@ -332,15 +322,11 @@
} // namespace WebCore
-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleProperties)
- static bool isType(const WebCore::StylePropertiesBase&) { return true; }
-SPECIALIZE_TYPE_TRAITS_END()
-
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::MutableStyleProperties)
- static bool isType(const WebCore::StylePropertiesBase& set) { return set.type() == WebCore::MutablePropertiesType; }
+ static bool isType(const WebCore::StyleProperties& set) { return set.type() == WebCore::MutablePropertiesType; }
SPECIALIZE_TYPE_TRAITS_END()
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ImmutableStyleProperties)
- static bool isType(const WebCore::StylePropertiesBase& set) { return set.type() == WebCore::ImmutablePropertiesType; }
+ static bool isType(const WebCore::StyleProperties& set) { return set.type() == WebCore::ImmutablePropertiesType; }
SPECIALIZE_TYPE_TRAITS_END()
Modified: trunk/Source/WebCore/css/StyleRule.cpp (294015 => 294016)
--- trunk/Source/WebCore/css/StyleRule.cpp 2022-05-10 20:52:34 UTC (rev 294015)
+++ trunk/Source/WebCore/css/StyleRule.cpp 2022-05-10 21:15:45 UTC (rev 294016)
@@ -215,7 +215,7 @@
return sizeof(StyleRule) + sizeof(CSSSelector) + StyleProperties::averageSizeInBytes();
}
-StyleRule::StyleRule(Ref<StylePropertiesBase>&& properties, bool hasDocumentSecurityOrigin, CSSSelectorList&& selectors)
+StyleRule::StyleRule(Ref<StyleProperties>&& properties, bool hasDocumentSecurityOrigin, CSSSelectorList&& selectors)
: StyleRuleBase(StyleRuleType::Style, hasDocumentSecurityOrigin)
, m_properties(WTFMove(properties))
, m_selectorList(WTFMove(selectors))
@@ -233,7 +233,7 @@
StyleRule::~StyleRule() = default;
-Ref<StyleRule> StyleRule::create(Ref<StylePropertiesBase>&& properties, bool hasDocumentSecurityOrigin, CSSSelectorList&& selectors)
+Ref<StyleRule> StyleRule::create(Ref<StyleProperties>&& properties, bool hasDocumentSecurityOrigin, CSSSelectorList&& selectors)
{
return adoptRef(*new StyleRule(WTFMove(properties), hasDocumentSecurityOrigin, WTFMove(selectors)));
}
@@ -243,11 +243,6 @@
return adoptRef(*new StyleRule(*this));
}
-const StyleProperties& StyleRule::properties() const
-{
- return downcast<StyleProperties>(m_properties.get());
-}
-
MutableStyleProperties& StyleRule::mutableProperties()
{
if (!is<MutableStyleProperties>(m_properties))
Modified: trunk/Source/WebCore/css/StyleRule.h (294015 => 294016)
--- trunk/Source/WebCore/css/StyleRule.h 2022-05-10 20:52:34 UTC (rev 294015)
+++ trunk/Source/WebCore/css/StyleRule.h 2022-05-10 21:15:45 UTC (rev 294016)
@@ -96,13 +96,13 @@
class StyleRule final : public StyleRuleBase {
WTF_MAKE_STRUCT_FAST_ALLOCATED_WITH_HEAP_IDENTIFIER(StyleRule);
public:
- static Ref<StyleRule> create(Ref<StylePropertiesBase>&&, bool hasDocumentSecurityOrigin, CSSSelectorList&&);
+ static Ref<StyleRule> create(Ref<StyleProperties>&&, bool hasDocumentSecurityOrigin, CSSSelectorList&&);
Ref<StyleRule> copy() const;
~StyleRule();
const CSSSelectorList& selectorList() const { return m_selectorList; }
- const StyleProperties& properties() const;
+ const StyleProperties& properties() const { return m_properties.get(); }
MutableStyleProperties& mutableProperties();
bool isSplitRule() const { return m_isSplitRule; }
@@ -124,12 +124,12 @@
static unsigned averageSizeInBytes();
private:
- StyleRule(Ref<StylePropertiesBase>&&, bool hasDocumentSecurityOrigin, CSSSelectorList&&);
+ StyleRule(Ref<StyleProperties>&&, bool hasDocumentSecurityOrigin, CSSSelectorList&&);
StyleRule(const StyleRule&);
static Ref<StyleRule> createForSplitting(const Vector<const CSSSelector*>&, Ref<StyleProperties>&&, bool hasDocumentSecurityOrigin);
- mutable Ref<StylePropertiesBase> m_properties;
+ mutable Ref<StyleProperties> m_properties;
CSSSelectorList m_selectorList;
#if ENABLE(CSS_SELECTOR_JIT)