Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c49ecd8d6e2439f12fa4e7ae57452055cf33ab64
https://github.com/WebKit/WebKit/commit/c49ecd8d6e2439f12fa4e7ae57452055cf33ab64
Author: Dan Glastonbury <[email protected]>
Date: 2026-03-17 (Tue, 17 Mar 2026)
Changed paths:
M LayoutTests/compositing/tiling/backface-preserve-3d-tiled.html
M LayoutTests/compositing/tiling/rotated-tiled-clamped.html
M LayoutTests/compositing/tiling/rotated-tiled-preserve3d-clamped.html
M LayoutTests/compositing/tiling/tiled-reflection-inwindow-expected.txt
M LayoutTests/compositing/tiling/tiled-reflection-inwindow.html
M LayoutTests/compositing/tiling/transform-origin-tiled-expected.txt
M LayoutTests/compositing/tiling/transform-origin-tiled.html
M
LayoutTests/platform/glib/compositing/tiling/rotated-tiled-clamped-expected.txt
M
LayoutTests/platform/glib/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt
A
LayoutTests/platform/ios-simulator/compositing/tiling/backface-preserve-3d-tiled-expected.png
A
LayoutTests/platform/ios-simulator/compositing/tiling/rotated-tiled-clamped-expected.png
A
LayoutTests/platform/ios-simulator/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.png
A
LayoutTests/platform/ios-simulator/compositing/tiling/transform-origin-tiled-expected.png
M
LayoutTests/platform/ios/compositing/backing/layer-outside-tiled-parent-expected.txt
M
LayoutTests/platform/ios/compositing/canvas/hidpi-canvas-backing-store-invalidation-2-expected.txt
A
LayoutTests/platform/ios/compositing/contents-format/deep-color-backing-store-expected.txt
M
LayoutTests/platform/ios/compositing/geometry/limit-layer-bounds-clipping-ancestor-expected.txt
M
LayoutTests/platform/ios/compositing/repaint/scroller-repaints-once-expected.txt
M
LayoutTests/platform/ios/compositing/tiling/backface-preserve-3d-tiled-expected.txt
M
LayoutTests/platform/ios/compositing/tiling/rotated-tiled-clamped-expected.txt
M
LayoutTests/platform/ios/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt
M
LayoutTests/platform/ios/compositing/tiling/tiled-reflection-inwindow-expected.txt
M
LayoutTests/platform/ios/compositing/tiling/transform-origin-tiled-expected.txt
M
LayoutTests/platform/ios/compositing/visible-rect/flipped-preserve-3d-expected.txt
M
LayoutTests/platform/mac-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt
M
LayoutTests/platform/mac-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt
M
LayoutTests/platform/mac/compositing/tiling/backface-preserve-3d-tiled-expected.txt
M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Log Message:
-----------
Fix WebContent jetsam when pinch-zooming reddit.com
https://bugs.webkit.org/show_bug.cgi?id=305622
rdar://168278086
Reviewed by Matt Woodrow.
When pinch-zooming on image-heavy pages like reddit.com/r/homelab, WebContent
process gets jetsam'd on memory-constrained devices. This is due to this chain
of events:
1. Non-tiled layers (e.g., 398px image containers) scale their backing stores
based on pageScaleFactor × deviceScaleFactor without any limit to the
required
IOSurface allocation.
2. At high zoom (5x page scale on 3x device = 15x total), a 398×398 layer
attempts to
allocate 3612×3612 pixels = 65 MB per layer.
3. With 40+ such layers on screen, total IOSurface memory reaches ~2.6 GB,
exceeding
the jetsam threshold.
The problem is that GraphicsLayerCA::updateContentsScale() computes backing
store scale without considering the total memory footprint. While tiled layers
correctly cap at zoomedOutPageScaleFactor (3.0x), non-tiled layers scale
unbounded, causing exponential memory growth during pinch-zoom.
To fix this, we fix a bug in GraphicsLayerCA::requiresTiledLayer() which was
only checking pageScaleFactor without multiplying by deviceScaleFactor, causing
the system to try to allocation 3840x3840 (58.9 MB) IOSurfaces before switching
the layer to tile backing.
We limit non-tiled backing store allocations based on total byte size rather
than just pixel dimensions. By experimentation, we determined to cap allocations
at 16 MB (4 MP for RGBA8, 3.3 MP for RGBA10), which prevents individual layers
from consuming excessive memory while still maintaining quality at reasonable
zoom levels. On our reddit.com test page, this reduces peak IOSurface memory
from ~2.6 GB to ~1.4 GB, which is within the jetsam limit.
Tests in compositing/tiling have been updated to trigger tiling
use. Additionally, missing reference images at 2x resolution have been added for
iOS.
* LayoutTests/compositing/tiling/backface-preserve-3d-tiled.html:
* LayoutTests/compositing/tiling/rotated-tiled-clamped.html:
* LayoutTests/compositing/tiling/rotated-tiled-preserve3d-clamped.html:
* LayoutTests/compositing/tiling/tiled-reflection-inwindow-expected.txt:
* LayoutTests/compositing/tiling/tiled-reflection-inwindow.html:
* LayoutTests/compositing/tiling/transform-origin-tiled-expected.txt:
* LayoutTests/compositing/tiling/transform-origin-tiled.html:
*
LayoutTests/platform/glib/compositing/tiling/rotated-tiled-clamped-expected.txt:
*
LayoutTests/platform/glib/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt:
*
LayoutTests/platform/ios-simulator/compositing/tiling/backface-preserve-3d-tiled-expected.png:
Added.
*
LayoutTests/platform/ios-simulator/compositing/tiling/rotated-tiled-clamped-expected.png:
Added.
*
LayoutTests/platform/ios-simulator/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.png:
Added.
*
LayoutTests/platform/ios-simulator/compositing/tiling/transform-origin-tiled-expected.png:
Added.
*
LayoutTests/platform/ios/compositing/backing/layer-outside-tiled-parent-expected.txt:
*
LayoutTests/platform/ios/compositing/canvas/hidpi-canvas-backing-store-invalidation-2-expected.txt:
*
LayoutTests/platform/ios/compositing/contents-format/deep-color-backing-store-expected.txt:
Added.
*
LayoutTests/platform/ios/compositing/geometry/limit-layer-bounds-clipping-ancestor-expected.txt:
*
LayoutTests/platform/ios/compositing/repaint/scroller-repaints-once-expected.txt:
*
LayoutTests/platform/ios/compositing/tiling/backface-preserve-3d-tiled-expected.txt:
*
LayoutTests/platform/ios/compositing/tiling/rotated-tiled-clamped-expected.txt:
*
LayoutTests/platform/ios/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt:
*
LayoutTests/platform/ios/compositing/tiling/tiled-reflection-inwindow-expected.txt:
*
LayoutTests/platform/ios/compositing/tiling/transform-origin-tiled-expected.txt:
*
LayoutTests/platform/ios/compositing/visible-rect/flipped-preserve-3d-expected.txt:
*
LayoutTests/platform/mac-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt:
*
LayoutTests/platform/mac-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt:
*
LayoutTests/platform/mac/compositing/tiling/backface-preserve-3d-tiled-expected.txt:
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
Canonical link: https://commits.webkit.org/309435@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications