Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f4ce4a791de718846d261525231aab23542a6526
https://github.com/WebKit/WebKit/commit/f4ce4a791de718846d261525231aab23542a6526
Author: Said Abou-Hallawa <[email protected]>
Date: 2026-05-20 (Wed, 20 May 2026)
Changed paths:
M Source/WebCore/page/FrameSnapshotting.cpp
M Source/WebCore/page/FrameSnapshotting.h
M Source/WebCore/page/PageColorSampler.cpp
M
Source/WebCore/platform/graphics/coreimage/FEGaussianBlurCoreImageApplier.mm
M Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp
M Source/WebCore/platform/graphics/filters/FEGaussianBlur.h
M Source/WebCore/platform/graphics/filters/Filter.h
M
Source/WebCore/platform/graphics/filters/software/FEGaussianBlurSoftwareApplier.cpp
M Source/WebCore/rendering/PaintPhase.h
M Source/WebCore/rendering/RenderLayer.cpp
M Source/WebCore/rendering/RenderLayerFilters.cpp
M Source/WebCore/rendering/RenderLayerFilters.h
Log Message:
-----------
Opening or refreshing wasitai.com is extremely slow
https://bugs.webkit.org/show_bug.cgi?id=315118
rdar://172480480
Reviewed by Simon Fraser.
On macOS, the first paint of wasitai.com may take a few seconds. But opening or
refreshing it on iOS may take about 50 seconds.
This slow performance happens because the PageColorSampler tries to get five
pixels from the first row in the page by taking five snapshots. The size of
every snapshot is { 1 x 1 }.
In general this is very inefficient because snapshotFrameRect() can't know to
precisely clip the whole frame drawing to just one pixel. Many renderers will be
traversed although their drawing does not affect the required pixel.
By what makes this scenario extremely slow is the expensive blur in this page.
On iPhone, wasitai.com draws a blur filter with stdDeviation = { 200, 200 }.
This
is extremely large stdDeviation. Usually the stdDeviation does not exceed 20px.
So to fix this perf bug, the following fixes should be done:
(1) Instead of getting five snapshots from as single row, a single snapshot will
be taken for the whole row. Then pixels in this row will examined.
(2) Second a new `FilterRenderingOption` named `FastAndLowQuality` will be
introduced. This new option will allow clamping the blur stdDeviation to
20px
if applied. The PageColorSampler will propagate this flag to rendering code
in SnapshotFlags. `snapshotFrameRectWithClip()` will translate this
SnapshotFlags to PaintBehavior. RenderLayer will send the PaintBehaviors to
`RenderLayerFilters::beginFilterEffect()` which will examine paintBehavior.
If it has FastAndLowQualityFilters it will send FastAndLowQuality to
`CSSFilterRenderer::create()`. FEGaussianBlur will check for this flag and
clamp the stdDeviation when creating the appliers or the CGStyle.
* Source/WebCore/page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* Source/WebCore/page/FrameSnapshotting.h:
* Source/WebCore/page/PageColorSampler.cpp:
(WebCore::takeRowSnapshot):
(WebCore::sampleColor):
(WebCore::PageColorSampler::sampleTop):
* Source/WebCore/platform/graphics/coreimage/FEGaussianBlurCoreImageApplier.mm:
(WebCore::FEGaussianBlurCoreImageApplier::apply const):
* Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::effectiveStdDeviation const):
(WebCore::FEGaussianBlur::calculateImageRect const):
(WebCore::FEGaussianBlur::createGraphicsStyle const):
* Source/WebCore/platform/graphics/filters/FEGaussianBlur.h:
* Source/WebCore/platform/graphics/filters/Filter.h:
*
Source/WebCore/platform/graphics/filters/software/FEGaussianBlurSoftwareApplier.cpp:
(WebCore::FEGaussianBlurSoftwareApplier::apply const):
* Source/WebCore/rendering/PaintPhase.h:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::setupFilters):
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayerFilters.cpp:
(WebCore::RenderLayerFilters::beginFilterEffect):
* Source/WebCore/rendering/RenderLayerFilters.h:
Canonical link: https://commits.webkit.org/313563@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications