New issue
Advanced search Search tips

Issue 787337 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 657748



Sign in to add a comment

Should chrome.declarativeContent API match display:contents elements

Project Member Reported by futhark@chromium.org, Nov 21 2017

Issue description

Need to decide if display:contents elements should be included as matching CSS rules as described in [1], or ignored like display:none elements. Most likely they should be included.

[1] https://developer.chrome.com/extensions/declarativeContent

 
Cc: jyasskin@chromium.org rdevlin....@chromium.org
Since the children of display:contents elements are rendered, I think they should be included in the matching CSS rules.  display:none elements are omitted because they are not rendered.

+also jyasskin@ who originally wrote the declarativeContent API as FYI in case he has any other thoughts.

Comment 2 by shend@chromium.org, Nov 21 2017

Labels: Hotlist-Interop
Status: Started (was: Assigned)
Just to make it clear, children of display:contents elements which are rendered should clearly be included. The question was if the display:contents elements themselves should be included.

This is currently what the code does. I've implemented a unit test:

https://chromium-review.googlesource.com/c/chromium/src/+/784930

Comment 4 by jyasskin@google.com, Nov 22 2017

I omitted display:none elements and their children so that extensions wouldn't take action based on stuff that wasn't visible to the user. display:contents doesn't seem like that case, so my instinct would be to include it, as you've done.
Project Member

Comment 5 by bugdroid1@chromium.org, Nov 22 2017

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

commit 910a824266ff9c6e912ee664cfd93c2754ec1b61
Author: Rune Lillesveen <futhark@chromium.org>
Date: Wed Nov 22 22:42:07 2017

Unit tests for WatchCSSSelectors and display:contents.

Include elements which are display:contents and their rendered
descendants when matching selectors for the chrome.declarativeContent
API.

Bug:  787337 
Change-Id: I16bc7604dea573555fd5071e96c8194bdb0054b2
Reviewed-on: https://chromium-review.googlesource.com/784930
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518777}
[modify] https://crrev.com/910a824266ff9c6e912ee664cfd93c2754ec1b61/third_party/WebKit/Source/core/exported/WebFrameTest.cpp

rdevlin@ said in review:

"Ideally, we'd also add a brief end-to-end test exercising this with the declarativeContent API, but that's definitely something we can save for a later CL."

I tried codesearch to see if there were any tests testing declarativeContent with actual page content, but couldn't find any examples.

Labels: Needs-Feedback
Status: Fixed (was: Started)
Closing as the Blink work's done.

Sign in to add a comment