Bug 231358 - REGRESSION(r272201): Safari showed red distortion on webview after using Web Inspector, returning from another app
Summary: REGRESSION(r272201): Safari showed red distortion on webview after using Web ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-07 06:11 PDT by Antoine Quint
Modified: 2022-03-18 06:26 PDT (History)
8 users (show)

See Also:


Attachments
Patch for EWS (13.02 KB, patch)
2021-10-07 06:17 PDT, Antoine Quint
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch for EWS (13.04 KB, patch)
2021-10-07 06:21 PDT, Antoine Quint
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch for EWS (13.07 KB, patch)
2021-10-07 06:53 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Layout Test and Plumbing v1.0 (11.72 KB, patch)
2021-10-07 14:41 PDT, Patrick Angle
no flags Details | Formatted Diff | Diff
Patch (16.76 KB, patch)
2021-11-03 07:28 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (16.98 KB, patch)
2021-11-04 02:34 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (16.84 KB, patch)
2021-11-04 02:37 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Address test-related feedback (18.55 KB, patch)
2021-11-08 16:10 PST, Patrick Angle
no flags Details | Formatted Diff | Diff
Patch for landing (18.53 KB, patch)
2021-11-09 11:55 PST, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2021-10-07 06:11:04 PDT
Safari showed red distortion on webview after using Web Inspector, returning from another app
Comment 1 Antoine Quint 2021-10-07 06:17:23 PDT
Created attachment 440496 [details]
Patch for EWS
Comment 2 Antoine Quint 2021-10-07 06:17:30 PDT
<rdar://problem/81505208>
Comment 3 Antoine Quint 2021-10-07 06:21:35 PDT
Created attachment 440498 [details]
Patch for EWS
Comment 4 Antoine Quint 2021-10-07 06:53:49 PDT
Created attachment 440499 [details]
Patch for EWS
Comment 5 Patrick Angle 2021-10-07 14:41:47 PDT
Created attachment 440538 [details]
Layout Test and Plumbing v1.0
Comment 7 Patrick Angle 2021-10-07 14:51:53 PDT
Right now the test still fails, even with the patch applied – If I add a breakpoint inside RepaintIndicatorLayerClient::notifyAnimationEnded in WebInspectorClient.cpp, I don’t hit the breakpoint until I do something like open a new tab, which hides the page (which solves the user facing issue since at that point we will clean everything up) - I’d expect to get the notifications 0.25s after the animation starts, though. My test checks if there are currently repaint rects, but I’m expecting the repaint rects to have been cleared out once their animation finishes. I think once notifyAnimationEnded fires when the animation actually ends, it should work.
Comment 8 Antoine Quint 2021-11-03 07:28:39 PDT
Created attachment 443198 [details]
Patch
Comment 9 Devin Rousso 2021-11-03 11:34:12 PDT
Comment on attachment 443198 [details]
Patch

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

r=me

> Source/WebCore/inspector/InspectorOverlay.h:209
> +    unsigned paintRectCount() const { return m_paintRects.size(); }

NIT: please move this next to `setShowPaintRects` and `showPaintRect since it's more related to those than grid overlays :)

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:3090
> +        animation.m_beginTime = *animation.m_beginTime + animationGroupBeginTime;

Would `*animation.m_beginTime += animationGroupBeginTime;` also work?

> LayoutTests/inspector/page/setShowPaintRects.html:14
> +        let hasPaintRects = !!await InspectorTest.evaluateInPage(`window.internals.inspectorPaintRectCount()`);
> +        InspectorTest.expectEqual(hasPaintRects, expected, `Should ${expected ? "" : "not "}have paint rects displayed.`);

NIT: I personally try to avoid using operators in conjunction with `await` as I find it not super easy to read.  I think renaming this to `paintRectsCount` and then using it as `!!paintRectsCount` would be clearer.

> LayoutTests/inspector/page/setShowPaintRects.html:23
> +            PageAgent.setShowPaintRects(true);

NIT: you could/should also `await` this just in case there's an error

> LayoutTests/inspector/page/setShowPaintRects.html:26
> +            InspectorTest.evaluateInPage(`document.getElementById("test").style.backgroundColor = "papayawhip"`);

ditto (:23)

> LayoutTests/inspector/page/setShowPaintRects.html:28
> +                setTimeout(() => {

Is there no better way to do this than just having a `setTimeout`?  Perhaps we could/should have a `setInterval` loop in the page that constantly checks and `TestPage.dispatchEventToFrontend` when it notices a change so that we're at least way less likely to miss anything?

> LayoutTests/inspector/page/setShowPaintRects.html:45
> +            PageAgent.setShowPaintRects(false);

ditto :(23)

> LayoutTests/inspector/page/setShowPaintRects.html:48
> +            InspectorTest.evaluateInPage(`document.getElementById("test").style.width = "rebeccapurple"`);

ditto (:23)
Comment 10 Antoine Quint 2021-11-04 02:31:24 PDT
(In reply to Devin Rousso from comment #9)
> Comment on attachment 443198 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=443198&action=review
> 
> r=me
> 
> > Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:3090
> > +        animation.m_beginTime = *animation.m_beginTime + animationGroupBeginTime;
> 
> Would `*animation.m_beginTime += animationGroupBeginTime;` also work?

I wasn't sure that it would and didn't bother trying… but it does work! I'm uploading a new patch with this change just to make sure there's no funny stuff.

I'll let Patrick Angle answer your other comments as this is the part he wrote.
Comment 11 Antoine Quint 2021-11-04 02:34:33 PDT
Created attachment 443288 [details]
Patch
Comment 12 Antoine Quint 2021-11-04 02:37:16 PDT
Created attachment 443289 [details]
Patch
Comment 13 Joseph Pecoraro 2021-11-04 13:16:18 PDT
Comment on attachment 443289 [details]
Patch

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

> LayoutTests/inspector/page/setShowPaintRects.html:6
> +<script src="resources/search-script.js"></script>

Needed? (Maybe it is!)

> LayoutTests/inspector/page/setShowPaintRects.html:48
> +            InspectorTest.evaluateInPage(`document.getElementById("test").style.width = "rebeccapurple"`);

Err, should this attempt to change the backgroundColor and not width to `rebeccapurple`?

> LayoutTests/inspector/page/setShowPaintRects.html:69
> +    width:  100px;
> +    height:  100px;

Odd spacing.
Comment 14 Patrick Angle 2021-11-08 16:10:38 PST
Created attachment 443626 [details]
Address test-related feedback
Comment 15 Antoine Quint 2021-11-09 11:55:11 PST
Created attachment 443713 [details]
Patch for landing
Comment 16 EWS 2021-11-09 13:25:37 PST
Committed r285529 (244046@main): <https://commits.webkit.org/244046@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 443713 [details].