New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 852098 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 3
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 2
Type: Bug

Blocking:
issue 738611



Sign in to add a comment

WebUI Polymer 2: Clearing search highlights not working, uses /deep/ in JS.

Project Member Reported by dpa...@chromium.org, Jun 12 2018

Issue description

WebUI currently uses a /deep/ selector in Javascript, see [1], in order to quickly find search highlights and remove them. This used to work in shadow DOM v0, but seems to not be working at all in Shadow DOM v1.

Originally I thought that /deep/ was being deprecated only when used in CSS, but based on the Intent to remove at [2], it seems that it is fully removed (for v1).

@hayato: Can you verify whether /deep/ not working in JS is expected for Shadow DOM v1?

If so, we need to find an alternative, with acceptable performance for WebUI.

[1] https://cs.chromium.org/chromium/src/ui/webui/resources/js/search_highlight_utils.js?l=65,83
[2] https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/HX5Y8Ykr5Ns
 

Comment 1 by dpa...@chromium.org, Jun 12 2018

Blocking: 738611

Comment 2 by hayato@chromium.org, Jun 13 2018

> @hayato: Can you verify whether /deep/ not working in JS is expected for Shadow DOM v1?

Correct. v1 doesn't support /deep/ even in JS.

The followings can be helpful to understand the situation:
- https://bugs.chromium.org/p/chromium/issues/detail?id=829713
- https://github.com/w3c/webcomponents/issues/78

Comment 3 by dpa...@chromium.org, Jun 14 2018

Owner: rbpotter@chromium.org
Status: Started (was: Available)
@hayato: Thanks for the context. One use-case that I don't think it was mentioned in the Github issue was the one used by Chrome, meaning using /deep/ to find and remove previously added text highlights (yellow rectangles) throughout the entire document for searching (see attachement).  I know native Find-in-page (Ctl+f) does a similar thing, but unfortunately that is also not sufficient (does not work with lazy-rendered elements).

It's unfortunate that there is no way to query the entire DOM anymore, even for static profile, and even though from the discussion it seems that this would not impose any overhead to dynamic profiles anyway.

I agree with comments on the Github issue that this will result in mulitple authors rolling their own solution for this.


Anyway, our custom solution for Chrome, is to manually keep track of all added highlights in memory so that they can be removed later without the need for searching. Essentially we are caching state that already exists on the DOM but it it not easily query-able. 

Candidate CL at https://chromium-review.googlesource.com/c/chromium/src/+/1100102.
clear_highlighs.png
63.3 KB View Download

Comment 4 by kochi@chromium.org, Jun 18 2018

Cc: fergal@chromium.org
+fergal@ FYI this case looks like CSS shadow parts (esp, ::theme) can be used.
CSS shadow parts: https://tabatkins.github.io/specs/css-shadow-parts/ or issue 805271
Project Member

Comment 5 by bugdroid1@chromium.org, Jun 18 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d3238d264746a58d6733abda0e7099a8666cfba6

commit d3238d264746a58d6733abda0e7099a8666cfba6
Author: rbpotter <rbpotter@chromium.org>
Date: Mon Jun 18 19:30:34 2018

WebUI Polymer2: Fix highlight removal (Settings and Print Preview)

Since /deep/ is deprecated in shadow DOM v1, track highlights and
search bubbles as they are added to avoid searching recursively to
remove them later.

Bug:  852098 
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: Iac61a1f340ae4029589556c3ad09e567126a1639
Reviewed-on: https://chromium-review.googlesource.com/1100102
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568108}
[modify] https://crrev.com/d3238d264746a58d6733abda0e7099a8666cfba6/chrome/browser/resources/print_preview/new/advanced_settings_dialog.js
[modify] https://crrev.com/d3238d264746a58d6733abda0e7099a8666cfba6/chrome/browser/resources/print_preview/new/advanced_settings_item.js
[modify] https://crrev.com/d3238d264746a58d6733abda0e7099a8666cfba6/chrome/browser/resources/print_preview/new/destination_list.js
[modify] https://crrev.com/d3238d264746a58d6733abda0e7099a8666cfba6/chrome/browser/resources/print_preview/new/destination_list_item.js
[modify] https://crrev.com/d3238d264746a58d6733abda0e7099a8666cfba6/chrome/browser/resources/print_preview/new/highlight_utils.js
[modify] https://crrev.com/d3238d264746a58d6733abda0e7099a8666cfba6/chrome/browser/resources/settings/search_settings.js
[modify] https://crrev.com/d3238d264746a58d6733abda0e7099a8666cfba6/ui/webui/resources/js/search_highlight_utils.js

Status: Fixed (was: Started)
Closing this bug since this particular issue is fixed. Having said that, there are a lot more places we need to stop using /deep/, which is going to be a challenge, tracked by issue 860069.

Sign in to add a comment