Skip to content

Commit

Permalink
CSS3DTransformInteroperabilityEnabled preference removal follow-up
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271141

Reviewed by Matt Woodrow.

This removes the remaining CSS 3D transform interoperability branches
where it is a little less apparent whether they are always true.

* Source/WebCore/platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::useGiantTiles const):
(WebCore::GraphicsLayerClient::useCSS3DTransformInteroperability const): Deleted.
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::flushCompositingState):
(WebCore::GraphicsLayerCA::visibleRectChangeRequiresFlush const):
(WebCore::GraphicsLayerCA::platformCALayerUseCSS3DTransformInteroperability const): Deleted.
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h:
(WebCore::PlatformCALayerClient::platformCALayerUseGiantTiles const):
(WebCore::PlatformCALayerClient::platformCALayerUseCSS3DTransformInteroperability const): Deleted.
* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::commonInit):
* Source/WebCore/platform/graphics/transforms/TransformState.cpp:
(WebCore::TransformState::operator=):
(WebCore::TransformState::shouldFlattenBefore):
(WebCore::TransformState::shouldFlattenAfter):
* Source/WebCore/platform/graphics/transforms/TransformState.h:
(WebCore::TransformState::TransformState):
* Source/WebCore/rendering/LayerOverlapMap.cpp:
(WebCore::LayerOverlapMap::LayerOverlapMap):
* Source/WebCore/rendering/RenderGeometryMap.cpp:
(WebCore::RenderGeometryMap::RenderGeometryMap):
(WebCore::RenderGeometryMap::mapToContainer const):
* Source/WebCore/rendering/RenderGeometryMap.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateTransformFlatteningLayer):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::localToAbsolute const):
(WebCore::RenderObject::absoluteToLocal const):
(WebCore::RenderObject::absoluteToLocalQuad const):
(WebCore::RenderObject::localToContainerQuad const):
(WebCore::RenderObject::localToContainerPoint const):
* Source/WebCore/rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::mapLocalToContainer const):
* Source/WebCore/rendering/svg/SVGLayerTransformComputation.h:
(WebCore::SVGLayerTransformComputation::computeAccumulatedTransform const):
* Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp:
(WebKit::GraphicsLayerWC::flushCompositingState):

Canonical link: https://commits.webkit.org/276296@main
  • Loading branch information
annevk committed Mar 18, 2024
1 parent 35b9037 commit 787725b
Show file tree
Hide file tree
Showing 16 changed files with 22 additions and 42 deletions.
1 change: 0 additions & 1 deletion Source/WebCore/platform/graphics/GraphicsLayerClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class GraphicsLayerClient {
virtual bool shouldTemporarilyRetainTileCohorts(const GraphicsLayer*) const { return true; }

virtual bool useGiantTiles() const { return false; }
virtual bool useCSS3DTransformInteroperability() const { return false; }

virtual bool needsPixelAligment() const { return false; }

Expand Down
9 changes: 2 additions & 7 deletions Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ FloatPoint GraphicsLayerCA::computePositionRelativeToBase(float& pageScale) cons

void GraphicsLayerCA::flushCompositingState(const FloatRect& visibleRect)
{
TransformState state(client().useCSS3DTransformInteroperability(), TransformState::UnapplyInverseTransformDirection, FloatQuad(visibleRect));
TransformState state(TransformState::UnapplyInverseTransformDirection, FloatQuad(visibleRect));
state.setSecondaryQuad(FloatQuad { visibleRect });

CommitState commitState;
Expand Down Expand Up @@ -1539,7 +1539,7 @@ bool GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush(const CommitState&

bool GraphicsLayerCA::visibleRectChangeRequiresFlush(const FloatRect& clipRect) const
{
TransformState state(client().useCSS3DTransformInteroperability(), TransformState::UnapplyInverseTransformDirection, FloatQuad(clipRect));
TransformState state(TransformState::UnapplyInverseTransformDirection, FloatQuad(clipRect));
CommitState commitState;
return recursiveVisibleRectChangeRequiresFlush(commitState, state);
}
Expand Down Expand Up @@ -1974,11 +1974,6 @@ bool GraphicsLayerCA::platformCALayerUseGiantTiles() const
return client().useGiantTiles();
}

bool GraphicsLayerCA::platformCALayerUseCSS3DTransformInteroperability() const
{
return client().useCSS3DTransformInteroperability();
}

void GraphicsLayerCA::platformCALayerLogFilledVisibleFreshTile(unsigned blankPixelCount)
{
client().logFilledVisibleFreshTile(blankPixelCount);
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ class GraphicsLayerCA : public GraphicsLayer, public PlatformCALayerClient {
WEBCORE_EXPORT bool platformCALayerShouldAggressivelyRetainTiles(PlatformCALayer*) const override;
WEBCORE_EXPORT bool platformCALayerShouldTemporarilyRetainTileCohorts(PlatformCALayer*) const override;
WEBCORE_EXPORT bool platformCALayerUseGiantTiles() const override;
WEBCORE_EXPORT bool platformCALayerUseCSS3DTransformInteroperability() const override;
WEBCORE_EXPORT void platformCALayerLogFilledVisibleFreshTile(unsigned) override;
WEBCORE_EXPORT bool platformCALayerNeedsPlatformContext(const PlatformCALayer*) const override;
bool platformCALayerContainsBitmapOnly(const PlatformCALayer*) const override { return client().layerContainsBitmapOnly(this); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class PlatformCALayerClient {
virtual bool platformCALayerShouldTemporarilyRetainTileCohorts(PlatformCALayer*) const { return true; }

virtual bool platformCALayerUseGiantTiles() const { return false; }
virtual bool platformCALayerUseCSS3DTransformInteroperability() const { return false; }

virtual bool isCommittingChanges() const { return false; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ - (void)setOwner:(WebCore::PlatformCALayer*)owner
m_customSublayers = makeUnique<PlatformCALayerList>(tileController->containerLayers());
}

if (m_owner && m_owner->platformCALayerUseCSS3DTransformInteroperability() && [m_layer respondsToSelector:@selector(setUsesWebKitBehavior:)]) {
if ([m_layer respondsToSelector:@selector(setUsesWebKitBehavior:)]) {
[m_layer setUsesWebKitBehavior:YES];
if (m_layerType == PlatformCALayer::LayerType::LayerTypeTransformLayer) {
[m_layer setSortsSublayers:YES];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ TransformState& TransformState::operator=(const TransformState& other)
m_lastPlanarSecondaryQuad = other.m_lastPlanarSecondaryQuad;
}
m_accumulatingTransform = other.m_accumulatingTransform;
m_useCSS3DTransformInterop = other.m_useCSS3DTransformInterop;
m_direction = other.m_direction;

m_accumulatedTransform = nullptr;
Expand Down Expand Up @@ -123,16 +122,12 @@ void TransformState::applyAccumulatedOffset()

bool TransformState::shouldFlattenBefore(TransformAccumulation accumulate)
{
if (m_useCSS3DTransformInterop)
return accumulate == FlattenTransform && m_direction != ApplyTransformDirection;
return false;
return accumulate == FlattenTransform && m_direction != ApplyTransformDirection;
}

bool TransformState::shouldFlattenAfter(TransformAccumulation accumulate)
{
if (m_useCSS3DTransformInterop)
return accumulate == FlattenTransform && m_direction == ApplyTransformDirection;
return accumulate == FlattenTransform;
return accumulate == FlattenTransform && m_direction == ApplyTransformDirection;
}

// FIXME: We transform AffineTransform to TransformationMatrix. This is rather inefficient.
Expand Down
10 changes: 3 additions & 7 deletions Source/WebCore/platform/graphics/transforms/TransformState.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,27 @@ class TransformState {
enum TransformAccumulation { FlattenTransform, AccumulateTransform };
enum TransformMatrixTracking { DoNotTrackTransformMatrix, TrackSVGCTMMatrix, TrackSVGScreenCTMMatrix };

TransformState(bool useCSS3DTransformInterop, TransformDirection mappingDirection, const FloatPoint& p, const FloatQuad& quad)
TransformState(TransformDirection mappingDirection, const FloatPoint& p, const FloatQuad& quad)
: m_lastPlanarPoint(p)
, m_lastPlanarQuad(quad)
, m_mapPoint(true)
, m_mapQuad(true)
, m_useCSS3DTransformInterop(useCSS3DTransformInterop)
, m_direction(mappingDirection)
{
}

TransformState(bool useCSS3DTransformInterop, TransformDirection mappingDirection, const FloatPoint& p)
TransformState(TransformDirection mappingDirection, const FloatPoint& p)
: m_lastPlanarPoint(p)
, m_mapPoint(true)
, m_mapQuad(false)
, m_useCSS3DTransformInterop(useCSS3DTransformInterop)
, m_direction(mappingDirection)
{
}

TransformState(bool useCSS3DTransformInterop, TransformDirection mappingDirection, const FloatQuad& quad)
TransformState(TransformDirection mappingDirection, const FloatQuad& quad)
: m_lastPlanarQuad(quad)
, m_mapPoint(false)
, m_mapQuad(true)
, m_useCSS3DTransformInterop(useCSS3DTransformInterop)
, m_direction(mappingDirection)
{
}
Expand Down Expand Up @@ -144,7 +141,6 @@ class TransformState {
bool m_accumulatingTransform { false };
bool m_mapPoint;
bool m_mapQuad;
bool m_useCSS3DTransformInterop;
TransformMatrixTracking m_tracking { DoNotTrackTransformMatrix };
TransformDirection m_direction;
};
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/LayerOverlapMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ String OverlapMapContainer::dump(unsigned indent) const
}

LayerOverlapMap::LayerOverlapMap(const RenderLayer& rootLayer)
: m_geometryMap(UseTransforms, true)
: m_geometryMap(UseTransforms)
, m_rootLayer(rootLayer)
{
// Begin assuming the root layer will be composited so that there is
Expand Down
7 changes: 3 additions & 4 deletions Source/WebCore/rendering/RenderGeometryMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@

namespace WebCore {

RenderGeometryMap::RenderGeometryMap(OptionSet<MapCoordinatesMode> flags, bool useCSS3DTransformInterop)
RenderGeometryMap::RenderGeometryMap(OptionSet<MapCoordinatesMode> flags)
: m_mapCoordinatesFlags(flags)
, m_useCSS3DTransformInterop(useCSS3DTransformInterop)
{
}

Expand Down Expand Up @@ -110,7 +109,7 @@ FloatPoint RenderGeometryMap::mapToContainer(const FloatPoint& p, const RenderLa
result.move(m_accumulatedOffset);
ASSERT(m_accumulatedOffsetMightBeSaturated || areEssentiallyEqual(rendererMappedResult, result));
} else {
TransformState transformState(m_useCSS3DTransformInterop, TransformState::ApplyTransformDirection, p);
TransformState transformState(TransformState::ApplyTransformDirection, p);
mapToContainer(transformState, container);
result = transformState.lastPlanarPoint();
ASSERT(m_accumulatedOffsetMightBeSaturated || areEssentiallyEqual(rendererMappedResult, result));
Expand All @@ -127,7 +126,7 @@ FloatQuad RenderGeometryMap::mapToContainer(const FloatRect& rect, const RenderL
result = rect;
result.move(m_accumulatedOffset);
} else {
TransformState transformState(m_useCSS3DTransformInterop, TransformState::ApplyTransformDirection, rect.center(), rect);
TransformState transformState(TransformState::ApplyTransformDirection, rect.center(), rect);
mapToContainer(transformState, container);
result = transformState.lastPlanarQuad();
}
Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/rendering/RenderGeometryMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct RenderGeometryMapStep {
class RenderGeometryMap {
WTF_MAKE_NONCOPYABLE(RenderGeometryMap);
public:
explicit RenderGeometryMap(OptionSet<MapCoordinatesMode> = UseTransforms, bool useCSS3DTransformInterop = false);
explicit RenderGeometryMap(OptionSet<MapCoordinatesMode> = UseTransforms);
~RenderGeometryMap();

OptionSet<MapCoordinatesMode> mapCoordinatesFlags() const { return m_mapCoordinatesFlags; }
Expand Down Expand Up @@ -130,7 +130,6 @@ class RenderGeometryMap {
RenderGeometryMapSteps m_mapping;
LayoutSize m_accumulatedOffset;
OptionSet<MapCoordinatesMode> m_mapCoordinatesFlags;
bool m_useCSS3DTransformInterop { false };
#if ASSERT_ENABLED
bool m_accumulatedOffsetMightBeSaturated { false };
#endif
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderLayerBacking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2400,7 +2400,7 @@ bool RenderLayerBacking::updateTransformFlatteningLayer(const RenderLayer* compo
{
bool needsFlatteningLayer = false;
// If our parent layer has preserve-3d or perspective, and it's not our DOM parent, then we need a flattening layer to block that from being applied in 3d.
if (useCSS3DTransformInteroperability() && ancestorLayerWillCombineTransform(compositingAncestor) && !ancestorLayerIsDOMParent(m_owningLayer, compositingAncestor))
if (ancestorLayerWillCombineTransform(compositingAncestor) && !ancestorLayerIsDOMParent(m_owningLayer, compositingAncestor))
needsFlatteningLayer = true;

bool layerChanged = false;
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/rendering/RenderLayerBacking.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ class RenderLayerBacking final : public GraphicsLayerClient {
bool shouldAggressivelyRetainTiles(const GraphicsLayer*) const override;
bool shouldTemporarilyRetainTileCohorts(const GraphicsLayer*) const override;
bool useGiantTiles() const override;
bool useCSS3DTransformInteroperability() const override { return true; }
void logFilledVisibleFreshTile(unsigned) override;
bool needsPixelAligment() const override { return !m_isMainFrameRenderViewLayer; }

Expand Down
10 changes: 5 additions & 5 deletions Source/WebCore/rendering/RenderObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ void RenderObject::outputRenderSubTreeAndMark(TextStream& stream, const RenderOb

FloatPoint RenderObject::localToAbsolute(const FloatPoint& localPoint, OptionSet<MapCoordinatesMode> mode, bool* wasFixed) const
{
TransformState transformState(true, TransformState::ApplyTransformDirection, localPoint);
TransformState transformState(TransformState::ApplyTransformDirection, localPoint);
mapLocalToContainer(nullptr, transformState, mode | ApplyContainerFlip, wasFixed);
transformState.flatten();

Expand All @@ -1472,7 +1472,7 @@ FloatPoint RenderObject::localToAbsolute(const FloatPoint& localPoint, OptionSet

FloatPoint RenderObject::absoluteToLocal(const FloatPoint& containerPoint, OptionSet<MapCoordinatesMode> mode) const
{
TransformState transformState(true, TransformState::UnapplyInverseTransformDirection, containerPoint);
TransformState transformState(TransformState::UnapplyInverseTransformDirection, containerPoint);
mapAbsoluteToLocalPoint(mode, transformState);
transformState.flatten();

Expand All @@ -1481,7 +1481,7 @@ FloatPoint RenderObject::absoluteToLocal(const FloatPoint& containerPoint, Optio

FloatQuad RenderObject::absoluteToLocalQuad(const FloatQuad& quad, OptionSet<MapCoordinatesMode> mode) const
{
TransformState transformState(true, TransformState::UnapplyInverseTransformDirection, quad.boundingBox().center(), quad);
TransformState transformState(TransformState::UnapplyInverseTransformDirection, quad.boundingBox().center(), quad);
mapAbsoluteToLocalPoint(mode, transformState);
transformState.flatten();
return transformState.lastPlanarQuad();
Expand Down Expand Up @@ -1619,7 +1619,7 @@ FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, const R
{
// Track the point at the center of the quad's bounding box. As mapLocalToContainer() calls offsetFromContainer(),
// it will use that point as the reference point to decide which column's transform to apply in multiple-column blocks.
TransformState transformState(true, TransformState::ApplyTransformDirection, localQuad.boundingBox().center(), localQuad);
TransformState transformState(TransformState::ApplyTransformDirection, localQuad.boundingBox().center(), localQuad);
mapLocalToContainer(container, transformState, mode | ApplyContainerFlip, wasFixed);
transformState.flatten();

Expand All @@ -1628,7 +1628,7 @@ FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, const R

FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, const RenderLayerModelObject* container, OptionSet<MapCoordinatesMode> mode, bool* wasFixed) const
{
TransformState transformState(true, TransformState::ApplyTransformDirection, localPoint);
TransformState transformState(TransformState::ApplyTransformDirection, localPoint);
mapLocalToContainer(container, transformState, mode | ApplyContainerFlip, wasFixed);
transformState.flatten();

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon
// For getCTM/getScreenCTM computations the result must be independent of the page zoom factor.
// To compute these matrices within a non-SVG context (e.g. SVG embedded in HTML -- inline SVG)
// the scaling needs to be removed from the CSS transform state.
TransformState transformStateAboveSVGFragment(true, transformState.direction(), transformState.mappedPoint());
TransformState transformStateAboveSVGFragment(transformState.direction(), transformState.mappedPoint());
transformStateAboveSVGFragment.setTransformMatrixTracking(transformState.transformMatrixTracking());
container->mapLocalToContainer(repaintContainer, transformStateAboveSVGFragment, mode, wasFixed);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SVGLayerTransformComputation {
ancestorContainer = ancestorsOfType<RenderLayerModelObject>(*stopAtRenderer).first();
}

TransformState transformState(true, TransformState::ApplyTransformDirection, FloatPoint { });
TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint { });
transformState.setTransformMatrixTracking(trackingMode);

renderer->mapLocalToContainer(ancestorContainer, transformState, { UseTransforms, ApplyContainerFlip });
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/WebProcess/WebPage/wc/GraphicsLayerWC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ void GraphicsLayerWC::flushCompositingState(const FloatRect& passedVisibleRect)
// passedVisibleRect doesn't contain the scrollbar area. Inflate it.
FloatRect visibleRect = passedVisibleRect;
visibleRect.inflate(20.f);
TransformState state(client().useCSS3DTransformInteroperability(), TransformState::UnapplyInverseTransformDirection, FloatQuad(visibleRect));
TransformState state(TransformState::UnapplyInverseTransformDirection, FloatQuad(visibleRect));
state.setSecondaryQuad(FloatQuad { visibleRect });
recursiveCommitChanges(state);
}
Expand Down

0 comments on commit 787725b

Please sign in to comment.