Revert "Remove `will_cause_resize` from WebContents::ExitFullscreen()"
This reverts commit 1abc874e14b8148de9451e7983ed05eedfa7a810.
Reason for revert: Causing resize janks crbug.com/1506034
Original change's description:
> Remove `will_cause_resize` from WebContents::ExitFullscreen()
>
> This CL fixes a regression on Mac that if a web page enters the tab
> fullscreen mode and then exits fullscreen by system controls (keyboard
> shortcuts or window control buttons), the page becomes
> fullscreen-in-tab. This issue was caused by the browser not sending
> a resize message to the renderer after browser has exited fullscreen.
> Specifically, the resize message isn't sent because the browser
> is told that there will by another resize event and skips this message
> when `will_cause_resize` is True.
>
> This issue can be solved by removing the `will_cause_resize` parameter
> from WebContents::ExitFullscreen() so that a resize message is sent
> every time this function is called to exit fullscreen.
>
> The `will_cause_resize` flag was initially added to restore the
> scroll position when toggling fullscreen mode crrev.com/1488653002
> However, the scroll restoration was later removed because of its
> complexity by crrev.com/c/1195714 and this flag wasn't cleaned up
> at that time.
>
> There are several places where a True value is passed to
> `will_cause_resize` i.e. exit fullscreen when showing a printer pop
> up dialog. These use cases shouldn't be affected by having another
> page resize.
>
> Bug: 1469462
> Change-Id: I5c522121ea6eae847c2816f0239ff8f0fa97f8ae
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5031312
> Reviewed-by: Alexander Cooper <[email protected]>
> Commit-Queue: Muyao Xu <[email protected]>
> Reviewed-by: Avi Drissman <[email protected]>
> Reviewed-by: Kevin McNee <[email protected]>
> Cr-Commit-Position: refs/heads/main@{#1224651}
Bug: 1469462
Change-Id: Id5ed791ea63ff9e9c0fb07eaec07d1a999f4cfcf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5074445
Reviewed-by: Kevin McNee <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Muyao Xu <[email protected]>
Reviewed-by: Alexander Cooper <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1231733}
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 80b89568..668d080 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -1268,8 +1268,11 @@
// changed so that it can be recomputed and sent to the renderer.
virtual void OnWebPreferencesChanged() = 0;
- // Requests the renderer to exit fullscreen and sends a resize message.
- virtual void ExitFullscreen() = 0;
+ // Requests the renderer to exit fullscreen.
+ // |will_cause_resize| indicates whether the fullscreen change causes a
+ // view resize. e.g. This will be false when going from tab fullscreen to
+ // browser fullscreen.
+ virtual void ExitFullscreen(bool will_cause_resize) = 0;
// The WebContents is trying to take some action that would cause user
// confusion if taken while in fullscreen. If this WebContents or any outer