[webkit-changes] [WebKit/WebKit] 6eebc8: Cleanup RenderLayer::updateLayerPosition()
Nikolas Zimmermann
noreply at github.com
Sat Nov 19 17:17:55 PST 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6eebc817120bbd8feeccb4d7fd74c5d948cfb908
https://github.com/WebKit/WebKit/commit/6eebc817120bbd8feeccb4d7fd74c5d948cfb908
Author: Nikolas Zimmermann <nzimmermann at igalia.com>
Date: 2022-11-19 (Sat, 19 Nov 2022)
Changed paths:
M Source/WebCore/rendering/RenderBox.cpp
M Source/WebCore/rendering/RenderBox.h
M Source/WebCore/rendering/RenderLayer.cpp
M Source/WebCore/rendering/svg/RenderSVGModelObject.h
Log Message:
-----------
Cleanup RenderLayer::updateLayerPosition()
https://bugs.webkit.org/show_bug.cgi?id=245363
Reviewed by Simon Fraser.
Apply several cleanups in RenderLayer:
- Use dynamicDowncast<> instead of if<>/downcast<> pairs, where possible.
- Re-use logic from RenderLayerCompositor to determine if a RenderWidget
requires accelerated compositing or not, instead of duplicating the check.
- Get rid of unused 'inlineBoundingBoxOffset' bookkeeping in updateLayerPosition().
'localPoint' needed this adjustment in the past to support multi-column related
computations, that are no longer present in updateLayerPosition(), thus the
special handling for inlines is obsolete.
- Move code that computes the layer location and layer size into its own helper
method, to make the code more readable and less error-prone.
- Remove the applyTopLeftLocationOffset() method from RenderBox, which was used
by RenderLayer::updateLayerPosition() to apply the box top-left location offset
to compute the layer location. Unlike topLeftLocation() / topLeftLocationOffset()
the applyTopLeftLocationOffset() method is used in a hot code-path, and therefore
inlined the most common case: returning frameRect().location(), if no coordinate
flipping due to writing-mode is necessary.
Extend that idea to the other accessors, and remove the need for
applyTopLeftLocationOffset() alltogther. One slow-path for both topLeftLocation()
and topLeftLocationOffset() is enough, as topLeftLocationOffsetWithFlipping() is
equal to toLayoutSize(topLeftLocationWithFlipping) -- the additional round-trip
is negligble compared to the work done for the coordinate flipping, so it's fine
to stay with one slow-path for both topLeftLocation() / topLeftLocationOffset().
No change in functionality, covered by existing tests
Canonical link: https://commits.webkit.org/256880@main
More information about the webkit-changes
mailing list