forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebUI NTP: use clip-path to show OneGoogleBar overlays
The OneGoogleBar loads in an iframe. It has content that can appear outside the top bar that we're calling overlays. The overlays include tooltips, app launcher and accounts management. These overlays need to be layered on top of all other content on the page. Using a MutationObserver, we can examine all elements that undergo a change. If an element extends outside of the top bar, it can be an overlay or a descendent of an overlay. The descendent elements of overlays are ignored and the remaining overlays are tracked. When mutation occurs or the window is resized, the tracked overlays are each checked to determine if they are shown. The prior approach would send a message to the top frame indicating if any overlays are shown. When an overlay is shown, the top frame would layer the OneGoogleBar iframe on top of everything on the page. The content underneath (search box, most-visited etc.) would be visible but they would not receive pointer events since they would be handled by the iframe on top of them. In order to communicate this to the user, a backdrop similar to the the dialog backdrop was shown. This introduced an issue with the call-out promo which can be shown on load. The NTP would load and show the OneGoogleBar in a modal dialog-like state. If it was possible to resize the OneGoogleBar iframe dynamically such it only covers the minimum region needed to display the top bar and overlays, that would be ideal. This CL implements that ideal. Now when a mutation or resize occurs, the bounding rects of the shown overlays are sent to the top frame. clip-path is used in the top frame to only show parts of the OneGoogleBar that should layer on top of the NTP content area. A clip-path rect is defined for the top bar and every shown overlay. Bug: 1039913, b/154811950 Change-Id: Ifcd55d45523297a918e725f8620b6f60214f504b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2193913 Commit-Queue: Esmael Elmoslimany <aee@chromium.org> Reviewed-by: Tibor Goldschwendt <tiborg@chromium.org> Cr-Commit-Position: refs/heads/master@{#768033}
- Loading branch information
Esmael El-Moslimany
authored and
Commit Bot
committed
May 12, 2020
1 parent
d4f2b2c
commit 38b31e9
Showing
5 changed files
with
88 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters