Bug 200668 - Event region collection should take clipping into account
Summary: Event region collection should take clipping into account
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2019-08-13 06:44 PDT by Antti Koivisto
Modified: 2019-08-13 12:26 PDT (History)
2 users (show)

See Also:

patch (11.73 KB, patch)
2019-08-13 06:58 PDT, Antti Koivisto
simon.fraser: review+
Details | Formatted Diff | Diff
patch (11.95 KB, patch)
2019-08-13 11:31 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2019-08-13 06:44:12 PDT
Similar to paint.
Comment 1 Antti Koivisto 2019-08-13 06:44:29 PDT
Comment 2 Antti Koivisto 2019-08-13 06:58:42 PDT
Created attachment 376161 [details]
Comment 3 Simon Fraser (smfr) 2019-08-13 10:49:07 PDT
Comment on attachment 376161 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=376161&action=review

> Source/WebCore/rendering/EventRegion.cpp:63
> +    m_clipStack.removeLast();

If we have mismatched push/pop, this will do shrink(size() - 1); which will underflow and create a huge vector and probably crash. I think we should be defensive here and check for m_clipStack not being empty.

This is especially true since we don't have save/restore, so you're doing manual push/pop.

> Source/WebCore/rendering/RenderBox.cpp:1821
> +    if (paintInfo.phase == PaintPhase::EventRegion)
> +        paintInfo.eventRegionContext->popClip();
> +
>      paintInfo.context().restore();

This is a manual pop, but the painting code is doing a save/restore. Maybe in future it would be better to implement save/restore for the event region context.

If I'm changing painting code in future, it's going to be really hard to know how to change the event region code.

Also, there may be other code paths that save/clip/restore that need to also do something with the event region.
Comment 4 Antti Koivisto 2019-08-13 11:31:12 PDT
Created attachment 376185 [details]
Comment 5 WebKit Commit Bot 2019-08-13 12:26:28 PDT
Comment on attachment 376185 [details]

Clearing flags on attachment: 376185

Committed r248604: <https://trac.webkit.org/changeset/248604>
Comment 6 WebKit Commit Bot 2019-08-13 12:26:29 PDT
All reviewed patches have been landed.  Closing bug.