[webkit-changes] [WebKit/WebKit] 435426: Use destroying delete for StyleRule
Darin Adler
noreply at github.com
Thu Oct 6 20:15:19 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 435426cf4b3bc0f9f62a2c6f9c1306efc2b54083
https://github.com/WebKit/WebKit/commit/435426cf4b3bc0f9f62a2c6f9c1306efc2b54083
Author: Darin Adler <darin at apple.com>
Date: 2022-10-06 (Thu, 06 Oct 2022)
Changed paths:
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/css/CSSCounterStyleRule.cpp
M Source/WebCore/css/CSSCounterStyleRule.h
M Source/WebCore/css/CSSFontFace.h
M Source/WebCore/css/CSSFontFaceSet.h
M Source/WebCore/css/CSSFontPaletteValuesRule.cpp
M Source/WebCore/css/CSSFontPaletteValuesRule.h
M Source/WebCore/css/CSSFontSelector.h
M Source/WebCore/css/CSSGroupingRule.cpp
M Source/WebCore/css/CSSImportRule.h
M Source/WebCore/css/CSSKeyframeRule.h
M Source/WebCore/css/CSSKeyframesRule.cpp
M Source/WebCore/css/CSSLayerBlockRule.h
M Source/WebCore/css/CSSLayerStatementRule.cpp
M Source/WebCore/css/CSSLayerStatementRule.h
M Source/WebCore/css/CSSPropertySourceData.h
M Source/WebCore/css/CSSStyleSheet.cpp
M Source/WebCore/css/CSSSupportsRule.h
M Source/WebCore/css/StyleRule.cpp
M Source/WebCore/css/StyleRule.h
M Source/WebCore/css/StyleRuleImport.h
M Source/WebCore/css/parser/CSSParserImpl.h
M Source/WebCore/css/parser/CSSParserObserver.h
M Source/WebCore/css/parser/CSSPropertyParser.h
M Source/WebCore/css/typedom/CSSStyleValueFactory.cpp
M Source/WebCore/html/track/WebVTTParser.cpp
M Source/WebCore/svg/properties/SVGAttributeAnimator.cpp
Log Message:
-----------
Use destroying delete for StyleRule
https://bugs.webkit.org/show_bug.cgi?id=245886
rdar://problem/100624114
Reviewed by Sam Weinig.
* Source/WebCore/css/CSSCounterStyleRule.h: Added a
StyleRuleCounterStyle::copy function that asserts it is never reached,
replacing code that was previously in StyleRuleBase::copy.
* Source/WebCore/css/CSSCounterStyleRule.cpp:
(WebCore::CSSCounterStyleRule::reattach): Use downcast.
* Source/WebCore/css/CSSFontFace.h: Removed unnecessary include of
StyleRule.h, updated other includes and forward declarations as needed.
* Source/WebCore/css/CSSFontFaceSet.h: Ditto.
* Source/WebCore/css/CSSFontPaletteValuesRule.cpp:
(WebCore::CSSFontPaletteValuesRule::reattach): Use downcast.
* Source/WebCore/css/CSSFontPaletteValuesRule.h: Removed unnecessary
include of StyleRule.h, updated other includes and forward declarations
as needed.
* Source/WebCore/css/CSSFontSelector.h: Ditto.
* Source/WebCore/css/CSSGroupingRule.cpp:
(WebCore::CSSGroupingRule::item const): Pass reference to createCSSOMWrapper.
(WebCore::CSSGroupingRule::reattach): Use downcast.
* Source/WebCore/css/CSSImportRule.h: Removed unnecessary include of
StyleRule.h, updated other includes and forward declarations as needed.
* Source/WebCore/css/CSSKeyframeRule.h: Added a
StyleRuleKeyframe::copy function that asserts it is never reached,
replacing code that was previously in StyleRuleBase::copy.
* Source/WebCore/css/CSSKeyframesRule.cpp:
(WebCore::CSSKeyframesRule::reattach): Use downcast.
* Source/WebCore/css/CSSLayerBlockRule.h: Removed unnecessary include of
StyleRule.h, updated other includes and forward declarations as needed.
* Source/WebCore/css/CSSLayerStatementRule.cpp:
(WebCore::CSSLayerStatementRule::~CSSLayerStatementRule): Defined this
virtual destructor explicitly here so we can compile the header file
without including StyleRule.h.
(WebCore::CSSLayerStatementRule::reattach): Use downcast.
* Source/WebCore/css/CSSLayerStatementRule.h: Removed unnecessary include of
StyleRule.h, updated other includes and forward declarations as needed.
* Source/WebCore/css/CSSPropertySourceData.h: Ditto.
* Source/WebCore/css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::item): Pass reference to createCSSOMWrapper.
* Source/WebCore/css/CSSSupportsRule.h: Removed unneeded forward declaration.
* Source/WebCore/css/StyleRule.cpp:
(WebCore::StyleRuleBase::visitDerived): Added. This is now the only function
that needs the mapping of type to the correct derived class.
(WebCore::StyleRuleBase::visitDerived const): Added.
(WebCore::StyleRuleBase::operator delete): Added a destroying delete, using
visitDerived in its implementation, to replace the destroy function.
(WebCore::StyleRuleBase::copy const): Use visitDerived.
(WebCore::StyleRuleBase::createCSSOMWrapper const): Ditto.
(WebCore::StyleRuleFontPaletteValues::create): Moved here from the header.
* Source/WebCore/css/StyleRule.h: Use RefCounted for StyleRuleBase and
removed the custom deref function. Improved the comment about why we
allow createCSSOMWrapper with no parent and refactored to take references
rather than pointers since we we are passing "this". Added a destroying
delete to replace the destroy function. Added a private visitDerived
function for use in functions that involve polymorphism. Fixed the
formatting of all the one-liner functions in StyleRuleFontPaletteValues,
following our informal rule that larger functions should be outside the
class definition to keep it readable. Removed explicit implementations
of various copy constructors and destructors where the automatically
generated ones work correctly and can compile in the header without
introducing additional dependencies. Removed include of StyleProperties.h,
which isn't needed for the header and can be included by implementation
files instead.
* Source/WebCore/css/StyleRuleImport.h: Added a
StyleRuleKeyframe::copy function that asserts it is never reached,
replacing code that was previously in StyleRuleBase::copy.
* Source/WebCore/css/parser/CSSParserImpl.h: Removed unnecessary include
of StyleRule.h, updated other includes and forward declarations as needed.
* Source/WebCore/css/parser/CSSParserObserver.h: Ditto.
* Source/WebCore/css/parser/CSSPropertyParser.h: Ditto.
* Source/WebCore/css/typedom/CSSStyleValueFactory.cpp: Added include of
StyleProperties.h that is now needed.
* Source/WebCore/html/track/WebVTTParser.cpp: Removed unnecessary include
of StyleRule.h, updated other includes and forward declarations as needed.
* Source/WebCore/svg/properties/SVGAttributeAnimator.cpp: Added include of
StyleProperties.h that is now needed.
Canonical link: https://commits.webkit.org/255252@main
More information about the webkit-changes
mailing list