[webkit-changes] [WebKit/WebKit] 747e83: General cleanup of TransformOperations

Sam Weinig noreply at github.com
Sat Jun 1 14:50:42 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 747e839981525e26209151149e110e2ab07b4ded
      https://github.com/WebKit/WebKit/commit/747e839981525e26209151149e110e2ab07b4ded
  Author: Sam Weinig <weinig at apple.com>
  Date:   2024-06-01 (Sat, 01 Jun 2024)

  Changed paths:
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/animation/BlendingKeyframes.cpp
    M Source/WebCore/animation/CSSPropertyAnimation.cpp
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/css/CSSCustomPropertyValue.cpp
    M Source/WebCore/css/CSSCustomPropertyValue.h
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/DOMMatrixReadOnly.cpp
    M Source/WebCore/css/TransformFunctions.cpp
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/platform/animation/AcceleratedEffectValues.cpp
    M Source/WebCore/platform/animation/AcceleratedEffectValues.h
    M Source/WebCore/platform/graphics/GraphicsLayer.h
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
    M Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp
    M Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h
    M Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h
    M Source/WebCore/platform/graphics/transforms/TransformOperations.cpp
    M Source/WebCore/platform/graphics/transforms/TransformOperations.h
    A Source/WebCore/platform/graphics/transforms/TransformOperationsSharedPrimitivesPrefix.cpp
    A Source/WebCore/platform/graphics/transforms/TransformOperationsSharedPrimitivesPrefix.h
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/RenderStyleInlines.h
    M Source/WebCore/rendering/style/RenderStyleSetters.h
    M Source/WebCore/style/StyleBuilderCustom.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in

  Log Message:
  -----------
  General cleanup of TransformOperations
https://bugs.webkit.org/show_bug.cgi?id=274851

Reviewed by Darin Adler.

Makes some small improvements to the TransformOperations type:

- Use Ref instead of RefPtr in operations vector.
- Made immutable. All construction already happened in one shot in the builder
  or blend functions, or was a full replacement, so this just meant removing
  non-const accessors and removing the clear() function.
- Expose iterators directly to avoid clients accessing the underlying vector.

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/transforms/TransformOperationsSharedPrimitivesPrefix.cpp: Added.
* Source/WebCore/platform/graphics/transforms/TransformOperationsSharedPrimitivesPrefix.h: Added.
    - Split SharedPrimitivesPrefix class into its own file.

* Source/WebCore/platform/graphics/transforms/TransformOperations.cpp:
* Source/WebCore/platform/graphics/transforms/TransformOperations.h:
    - Convert to use a Vector<Ref<TransformOperation>> for the implementation,
      remove all mutating functionality, and add some helpers to make call sites
      more clear.
    - Swap the size and matrix arguments in apply to match individual transforms.

* Source/WebCore/animation/BlendingKeyframes.cpp:
    - Update to use new direct iteration.

* Source/WebCore/animation/CSSPropertyAnimation.cpp:
    - Use an explicit construction of a Vector<Ref<TransformOperation>> to build the
      TransformOperations, this allows for an exactly sized result.
    - Specialize the property wrapper for TransformOperations to allow moving in the
      result to the setter, avoiding a Vector copy.

* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::checkForMatchingTransformFunctionLists):
(WebCore::KeyframeEffect::computeTransformedExtentViaTransformList const):
(WebCore::containsRotation): Deleted.
    - Use new helpers to simplify use.

* Source/WebCore/css/CSSCustomPropertyValue.cpp:
* Source/WebCore/css/CSSCustomPropertyValue.h:
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
    - Made TransformSyntaxValue store a Ref, allowing for removing some
      null checks that were never possibly null.

* Source/WebCore/css/ComputedStyleExtractor.cpp:
* Source/WebCore/css/DOMMatrixReadOnly.cpp:
    - Update to use new direct iteration.

* Source/WebCore/css/TransformFunctions.cpp:
    - Use an explicit construction of a Vector<Ref<TransformOperation>> to build the
      TransformOperations using a failable generator constructor.

* Source/WebCore/platform/animation/AcceleratedEffectValues.cpp:
* Source/WebCore/platform/animation/AcceleratedEffectValues.h:
    - Use initialization syntax in copy constructor to avoid unnecessary
      re-initialization. Use new helpers to simplify use.

* Source/WebCore/platform/graphics/GraphicsLayer.h:
    - Use new helpers to simplify use.

* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::hasBig3DRotation):
    - Update for new, more clear, name of SharedPrimitivesPrefix.

* Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h:
* Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h:
    - Mark final overrides final, and make them public so callers that have
      the specific type can avoid a virtual call (RenderStyle makes use of
      this below).

* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):
    - Use an explicit construction of a Vector<Ref<TransformOperation>> to build the
      TransformOperations. By using the initialization_list constructor, the vector
      is perfectly sized.

* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::transformMatrixForProperty const):
    - Update for swapped apply arguments.

* Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:
    - Remove unused includes.

* Source/WebCore/rendering/style/RenderStyle.cpp:
    - Use existing accessors rather than writing full path out each time.
    - Use auto* rather than TransformOperation* to allow for de-virtualization
      of the calls to apply().

* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleSetters.h:
    - Take TransformOperations by r-value to avoid all sets causing a copy. Like
      with Length, StyleBuilder will do an explicit copy when forwarding.

* Source/WebCore/style/StyleBuilderCustom.h:
(WebCore::Style::forwardInheritedValue):
    - Add overload of forwardInheritedValue for TransformOperations that copies
      before moving into RenderStyle.

* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::hasTransform const):
    - Call isEmpty() directly on the container.

* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
    - Update to directly access operations via the member variable, necessary
      now that there is no operations() function.

* Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp:
(Nicosia::applyTransformAnimation):
    - Update for swapped apply arguments.

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list