[webkit-changes] [WebKit/WebKit] 4ec904: Split ShorthandSerializer into its own file

Darin Adler noreply at github.com
Fri Jan 27 18:48:57 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4ec904bfc2b063e90dc20b40adfd76ab99f732a2
      https://github.com/WebKit/WebKit/commit/4ec904bfc2b063e90dc20b40adfd76ab99f732a2
  Author: Darin Adler <darin at apple.com>
  Date:   2023-01-27 (Fri, 27 Jan 2023)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Modules/highlight/Highlight.cpp
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/animation/DocumentTimeline.cpp
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/animation/KeyframeEffect.h
    M Source/WebCore/css/CSSComputedStyleDeclaration.cpp
    M Source/WebCore/css/CSSCounterStyleRule.cpp
    M Source/WebCore/css/CSSFontFace.h
    M Source/WebCore/css/CSSFontFaceSet.cpp
    M Source/WebCore/css/CSSKeyframeRule.h
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/ComputedStyleExtractor.h
    M Source/WebCore/css/FontSelectionValueInlines.h
    A Source/WebCore/css/ImmutableStyleProperties.cpp
    A Source/WebCore/css/ImmutableStyleProperties.h
    A Source/WebCore/css/MutableStyleProperties.cpp
    A Source/WebCore/css/MutableStyleProperties.h
    A Source/WebCore/css/ShorthandSerializer.cpp
    A Source/WebCore/css/ShorthandSerializer.h
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/StyleProperties.h
    A Source/WebCore/css/StylePropertiesInlines.h
    M Source/WebCore/css/StylePropertyShorthand.h
    M Source/WebCore/css/StyleRule.cpp
    M Source/WebCore/css/StyleRule.h
    M Source/WebCore/css/parser/CSSParser.cpp
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/css/parser/CSSParserMode.h
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/css/process-css-properties.py
    M Source/WebCore/css/typedom/CSSStyleValueFactory.cpp
    M Source/WebCore/css/typedom/InlineStylePropertyMap.cpp
    M Source/WebCore/css/typedom/MainThreadStylePropertyMapReadOnly.cpp
    M Source/WebCore/css/typedom/StylePropertyMap.cpp
    M Source/WebCore/dom/Attr.cpp
    M Source/WebCore/dom/ElementData.h
    M Source/WebCore/dom/StyledElement.cpp
    M Source/WebCore/dom/StyledElement.h
    M Source/WebCore/editing/EditingStyle.cpp
    M Source/WebCore/editing/EditingStyle.h
    M Source/WebCore/editing/Editor.cpp
    M Source/WebCore/editing/EditorCommand.cpp
    M Source/WebCore/editing/RemoveFormatCommand.cpp
    M Source/WebCore/editing/ReplaceSelectionCommand.cpp
    M Source/WebCore/editing/ios/EditorIOS.mm
    M Source/WebCore/editing/mac/EditorMac.mm
    M Source/WebCore/editing/markup.cpp
    M Source/WebCore/html/HTMLBodyElement.cpp
    M Source/WebCore/html/HTMLHRElement.cpp
    M Source/WebCore/html/HTMLPreElement.cpp
    M Source/WebCore/html/HTMLTableCellElement.cpp
    M Source/WebCore/html/HTMLTableCellElement.h
    M Source/WebCore/html/HTMLTableColElement.cpp
    M Source/WebCore/html/HTMLTableColElement.h
    M Source/WebCore/html/HTMLTableElement.cpp
    M Source/WebCore/html/HTMLTableElement.h
    M Source/WebCore/html/HTMLTableSectionElement.cpp
    M Source/WebCore/html/HTMLTableSectionElement.h
    M Source/WebCore/html/HTMLTextFormControlElement.cpp
    M Source/WebCore/html/track/WebVTTParser.cpp
    M Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp
    M Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
    M Source/WebCore/page/DragController.cpp
    M Source/WebCore/page/PageSerializer.cpp
    M Source/WebCore/platform/animation/TimingFunction.cpp
    M Source/WebCore/rendering/RenderTreeAsText.cpp
    M Source/WebCore/style/MatchResult.h
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/Styleable.cpp
    M Source/WebCore/svg/SVGElementRareData.h
    M Source/WebCore/svg/SVGFontFaceElement.cpp
    M Source/WebCore/svg/properties/SVGAttributeAnimator.cpp
    M Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm
    M Source/WebKitLegacy/mac/WebView/WebFrame.mm
    M Source/WebKitLegacy/mac/WebView/WebView.mm
    M Tools/TestWebKitAPI/Tests/WebCore/CSSParser.cpp

  Log Message:
  -----------
  Split ShorthandSerializer into its own file
https://bugs.webkit.org/show_bug.cgi?id=251064
rdar://problem/104586227

Reviewed by Tim Nguyen.

Split the StyleProperties.h/cpp file up so each file has only a single class.
Make a few changes tso there's enough encapsulation.

* Source/WebCore/Headers.cmake: Added ImmutableStyleProperties.h, MutableStyleProperties.h,
ShorthandSerializer.h, and StylePropertiesInlines.h.

* Source/WebCore/Modules/highlight/Highlight.cpp: Removed unneeded includes.

* Source/WebCore/Sources.txt: Added ImmutableStyleProperties.cpp, MutableStyleProperties.cpp,
and ShorthandSerializer.cpp.

* Source/WebCore/WebCore.xcodeproj/project.pbxproj: Added all the new files.

* Source/WebCore/animation/DocumentTimeline.cpp: Added an include.

* Source/WebCore/animation/KeyframeEffect.cpp: Added an include.
(WebCore::KeyframeEffect::ParsedKeyframe::ParsedKeyframe): Moved this out of the header so we can
compile without the definition of MutableStyleProperties.
(WebCore::KeyframeEffect::ParsedKeyframe::~ParsedKeyframe): Ditto.

* Source/WebCore/animation/KeyframeEffect.h: Removed include of StyleProperties.h and made
changes so everything can compile without it. Also tidied up a bit.

* Source/WebCore/css/CSSComputedStyleDeclaration.cpp: Updated includes.
* Source/WebCore/css/CSSFontFace.h: Ditto.
* Source/WebCore/css/CSSFontFaceSet.cpp: Ditto.
* Source/WebCore/css/CSSCounterStyleRule.cpp: Ditto.

* Source/WebCore/css/CSSCounterStyleRule.h: Removed include of StyleProperties.h and made
changes so everything can compile without it.
* Source/WebCore/css/CSSKeyframeRule.h: Ditto.

* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::ComputedStyleExtractor::copyProperties): Renamed from copyPropertiesInSet and updated
to take a Span.
* Source/WebCore/css/ComputedStyleExtractor.h: Ditto.

* Source/WebCore/css/FontSelectionValueInlines.h: Deleted unused isCSS21Weight and
fontWeightKeyword functions.

* Source/WebCore/css/ImmutableStyleProperties.cpp: Added.
* Source/WebCore/css/ImmutableStyleProperties.h: Added.
* Source/WebCore/css/MutableStyleProperties.cpp: Added.
* Source/WebCore/css/MutableStyleProperties.h: Added.
* Source/WebCore/css/ShorthandSerializer.cpp: Added.
* Source/WebCore/css/ShorthandSerializer.h: Added.
* Source/WebCore/css/StyleProperties.cpp: Moved code out of this file.
* Source/WebCore/css/StyleProperties.h: Removed most includes. Marked functions inline that need
inline definitions that depend on the immutable and mutable derived classes. Got rid of
StylePropertiesType and use a boolean m_isMutable instead. Changed copyProperties to take a Span.
* Source/WebCore/css/StylePropertiesInlines.h: Added.

* Source/WebCore/css/StylePropertyShorthand.h:
(WebCore::isShorthandCSSProperty): Deleted. This is now generated along with isLonghand and is
named isShorthand.

* Source/WebCore/css/StyleRule.cpp:
(WebCore::StyleRule::setProperties): Moved out of line so we can compile the header without
including StyleProperties.h.

* Source/WebCore/css/StyleRule.h: Removed include of StyleProperties.h and made changes so
everything can compile without it.

* Source/WebCore/css/parser/CSSParser.cpp: Updated includes.
* Source/WebCore/css/parser/CSSParserImpl.cpp: Ditto.

* Source/WebCore/css/parser/CSSParserMode.h: Give CSSParserMode an underlying integer type so
it can be forward declared.

* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::parseValueStart): Call isShorthand.
(WebCore::CSSPropertyParser::parseFontFaceDescriptor): Ditto.

* Source/WebCore/css/process-css-properties.py:
(GenerateCSSPropertyNames): Generate isShorthand alongside isLonghand.

* Source/WebCore/css/typedom/CSSStyleValueFactory.cpp: Updated includes.
(WebCore::CSSStyleValueFactory::parseStyleValue): Use isShorthand.

* Source/WebCore/css/typedom/InlineStylePropertyMap.cpp: Updated includes.

* Source/WebCore/css/typedom/MainThreadStylePropertyMapReadOnly.cpp:
(WebCore::MainThreadStylePropertyMapReadOnly::get const): Use isShorthand.
(WebCore::MainThreadStylePropertyMapReadOnly::getAll const): Ditto.
* Source/WebCore/css/typedom/StylePropertyMap.cpp:
(WebCore::StylePropertyMap::set): Ditto.

* Source/WebCore/dom/Attr.cpp: Updated includes.

* Source/WebCore/dom/ElementData.h: Use MutableStyleProperties instead of StyleProperties for
the types where possible. More specific class gives us more efficient code.

* Source/WebCore/dom/StyledElement.cpp: Updated includes.
* Source/WebCore/dom/StyledElement.h: Use MutableStyleProperties instead of StyleProperties for
the types where possible. More specific class gives us more efficient code.

* Source/WebCore/editing/EditingStyle.cpp: Updated includes.
(WebCore::copyEditingProperties): Use copyProperties.
(WebCore::EditingStyle::extractAndRemoveBlockProperties): Use copyProperties and removeProperties.
(WebCore::EditingStyle::removeBlockProperties): Use removeProperties.
(WebCore::EditingStyle::triStateOfStyle const): Ditto.
(WebCore::removePropertiesInStyle): Ditto.
(WebCore::StyleChange::~StyleChanged): Moved this here sot he header does not need the definition
of StyleProperties.

* Source/WebCore/editing/EditingStyle.h: Removed include of StyleProperties.h and made changes so
everything can compile without it.

* Source/WebCore/editing/Editor.cpp: Updated includes.
* Source/WebCore/editing/EditorCommand.cpp: Ditto.
* Source/WebCore/editing/RemoveFormatCommand.cpp: Ditto.
* Source/WebCore/editing/ReplaceSelectionCommand.cpp: Ditto.
* Source/WebCore/editing/ios/EditorIOS.mm: Ditto.
* Source/WebCore/editing/mac/EditorMac.mm: Ditto.
* Source/WebCore/editing/markup.cpp: Ditto.
* Source/WebCore/html/HTMLBodyElement.cpp: Ditto.
* Source/WebCore/html/HTMLHRElement.cpp: Ditto.
* Source/WebCore/html/HTMLPreElement.cpp: Ditto
..
* Source/WebCore/html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::additionalPresentationalHintStyle const): Use
MutableStyleProperties.
* Source/WebCore/html/HTMLTableCellElement.h: Ditto.
* Source/WebCore/html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::additionalPresentationalHintStyle const): Ditto.
* Source/WebCore/html/HTMLTableColElement.h: Ditto.

* Source/WebCore/html/HTMLTableElement.cpp: Updated includes.
(WebCore::leakBorderStyle): Use MutableStyleProperties.
(WebCore::HTMLTableElement::additionalPresentationalHintStyle const): Ditto.
(WebCore::HTMLTableElement::createSharedCellStyle const): Ditto.
(WebCore::HTMLTableElement::additionalCellStyle const): Ditto.
(WebCore::leakGroupBorderStyle): Ditto.
(WebCore::HTMLTableElement::additionalGroupStyle const): Ditto.
* Source/WebCore/html/HTMLTableElement.h: Ditto.
* Source/WebCore/html/HTMLTableSectionElement.cpp:
(WebCore::HTMLTableSectionElement::additionalPresentationalHintStyle const): DItto.
* Source/WebCore/html/HTMLTableSectionElement.h: Ditto.

* Source/WebCore/html/HTMLTextFormControlElement.cpp: Updated includes.
(WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const): Use auto.

* Source/WebCore/html/track/WebVTTParser.cpp: Updated includes.
* Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp: Ditto.

* Source/WebCore/inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::buildObjectForAttributesStyle): Use
MutableStyleProperties.

* Source/WebCore/loader/cache/CachedScript.h: Export some symbols used for testing.

* Source/WebCore/page/DragController.cpp: Updated includes.
* Source/WebCore/page/PageSerializer.cpp: Ditto.
* Source/WebCore/platform/animation/TimingFunction.cpp: Ditto.
* Source/WebCore/rendering/RenderTreeAsText.cpp: Ditto.
* Source/WebCore/style/MatchResult.h: Ditto.

* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyProperty): Use isShorthand.
* Source/WebCore/style/Styleable.cpp:
(WebCore::compileTransitionPropertiesInStyle): Ditto.

* Source/WebCore/svg/SVGElementRareData.h: Update includes.
* Source/WebCore/svg/SVGFontFaceElement.cpp: Ditto.
* Source/WebCore/svg/properties/SVGAttributeAnimator.cpp: Ditto.
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: Ditto.
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm: Ditto.
* Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm: Ditto.
* Source/WebKitLegacy/mac/WebView/WebFrame.mm: Ditto.
* Source/WebKitLegacy/mac/WebView/WebView.mm: Ditto.
* Tools/TestWebKitAPI/Tests/WebCore/CSSParser.cpp: Ditto.

Canonical link: https://commits.webkit.org/259519@main




More information about the webkit-changes mailing list