Bug 260253 - Slow updates on an element with a wheel event handler (updating event regions)
Summary: Slow updates on an element with a wheel event handler (updating event regions)
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari 16
Hardware: Mac (Intel) macOS 13
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-08-16 03:47 PDT by ezthang
Modified: 2023-08-23 03:48 PDT (History)
5 users (show)

See Also:


Attachments
The test html for reproducing the bug (54.56 KB, text/html)
2023-08-16 03:47 PDT, ezthang
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ezthang 2023-08-16 03:47:35 PDT
Created attachment 467287 [details]
The test html for reproducing the bug

If you are listening to the "wheel" event, changing the size of the element will take extremely long, even if the listener doesn't do anything.

Repro steps:

1. Open the attached HTML
2. Change the browser window width to the minimum size
3. Open the Web Inspector
4. Enable/disable the "margin-left" attribute of the div element with id "wide"
   (You'll notice the rendering took a long time)
5. Comment out the script tag in HTML
6. Repeat steps 1~4.
   (Rendering would be fast)
Comment 1 Simon Fraser (smfr) 2023-08-16 09:49:19 PDT
We're spending a lot of time in updating event regions (which we only need to do if there's a wheel handler present):

    +                                     2158 WebCore::RenderLayerBacking::updateEventRegion()  (in WebCore) + 404  [0x1a98d2ce8]
    +                                       2158 WebCore::RenderLayerBacking::updateEventRegion()::$_25::operator()(WebCore::GraphicsLayer&) const  (in WebCore) + 996  [0x1a98d34e8]
    +                                         2158 WebCore::RenderLayerBacking::paintIntoLayer(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&, WebCore::IntRect const&, WTF::OptionSet<WebCore::PaintBehavior>, WebCore::RegionContext*)  (in WebCore) + 252  [0x1a98d4f90]
    +                                           2158 WebCore::RenderLayerBacking::paintIntoLayer(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&, WebCore::IntRect const&, WTF::OptionSet<WebCore::PaintBehavior>, WebCore::RegionContext*)::$_31::operator()(WebCore::RenderLayer&, WTF::OptionSet<WebCore::RenderLayer::PaintLayerFlag>) const  (in WebCore) + 584  [0x1a98d5404]
    +                                             2158 WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, WTF::OptionSet<WebCore::RenderLayer::PaintLayerFlag>)  (in WebCore) + 8792  [0x1a98bca10]
    +                                               2158 WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, WTF::OptionSet<WebCore::RenderLayer::PaintLayerFlag>)  (in WebCore) + 7228  [0x1a98bc3f4]
    +                                                 2158 WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&)  (in WebCore) + 468  [0x1a7708994]
    +                                                   2158 WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&)  (in WebCore) + 1784  [0x1a7706578]
    +                                                     2158 WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::PaintInfo&, bool)  (in WebCore) + 276  [0x1a77077d4]
    +                                                       2158 WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&)  (in WebCore) + 468  [0x1a7708994]
    +                                                         2158 WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&)  (in WebCore) + 1784  [0x1a7706578]
    +                                                           2158 WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::PaintInfo&, bool)  (in WebCore) + 276  [0x1a77077d4]
    +                                                             2158 WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&)  (in WebCore) + 468  [0x1a7708994]
    +                                                               2158 WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&)  (in WebCore) + 508  [0x1a770607c]
    +                                                                 2158 WebCore::RenderBlockFlow::paintInlineChildren(WebCore::PaintInfo&, WebCore::LayoutPoint const&)  (in WebCore) + 196  [0x1a9839b1c]
    +                                                                   2149 WebCore::LayoutIntegration::InlineContentPainter::paint()  (in WebCore) + 1620  [0x1a92ad4d8]
    +                                                                   ! 2147 WebCore::TextBoxPainter<WebCore::InlineIterator::BoxModernPath>::paint()  (in WebCore) + 2128  [0x1a99711b8]
    +                                                                   ! : 1080 WebCore::EventRegionContext::unite(WebCore::Region const&, WebCore::RenderObject&, WebCore::RenderStyle const&, bool)  (in WebCore) + 536  [0x1a97b3900]
    +                                                                   ! : | 583 WebCore::Region::unite(WebCore::Region const&)  (in WebCore) + 1028  [0x1a77613ac]
    +                                                                   ! : | + 295 WebCore::Region::Shape::appendSpan(int, int const*, int const*)  (in WebCore) + 88,116,...  [0x1a77738a4,0x1a77738c0,...]
    +                                                                   ! : | + 192 WebCore::Region::Shape::appendSpan(int, int const*, int const*)  (in WebCore) + 264  [0x1a7773954]
    +                                                                   ! : | + ! 192 WTF::Vector<WebCore::Region::Span, 16ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::appendSlowCase<(WTF::FailureAction)0, WebCore::Region::Span>(WebCore::Region::Span&&)  (in WebCore) + 36  [0x1a9603dc8]
Comment 2 Radar WebKit Bug Importer 2023-08-23 03:48:14 PDT
<rdar://problem/114314565>