New issue
Advanced search Search tips

Issue 702493 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 687462



Sign in to add a comment

:read-write and :read-only pseudo class incorrectly uses style information inside selector matching

Project Member Reported by esprehn@chromium.org, Mar 17 2017

Issue description

Google Chrome	59.0.3043.0 (Official Build) canary (64-bit)
Revision	fe785a58e31217e1ef0e1c8946a4e853829371f8-refs/heads/master@{#457297}
OS	Mac OS X

bool HTMLElement::matchesReadWritePseudoClass() const {
  if (fastHasAttribute(contenteditableAttr)) {
    ...
  }

  return parentElement() && hasEditableStyle(*parentElement());
}

There's two problems in this code:

1) It's using parentElement() instead of the composed tree to look up style of an ancestor, which is wrong for shadow dom.

2) This is using hasEditableStyle inside selector matching to figure out if the pseudos match, but that violates the requirement that selectors must not use style information as that's a backwards data flow in the system:

Selectors -> Style -> Rebuild layout tree -> Compute geometry.

Indeed this produces very strange behavior, for example:

<script>
var e = document.createElement("div");
document.body.appendChild(e);
document.body.style.webkitUserModify = "read-write";
console.log(document.querySelector(":read-write")); // prints null
e.offsetTop;
console.log(document.querySelector(":read-write")); // prints <div>
</script>

Where computing style changes which selectors match.

Firefox implements these selectors too, but does not consult the style when matching the pseudo classes.
 

Comment 1 by tkent@chromium.org, Mar 17 2017

So we should remove -webkit-user-modify CSS property :(


We might remove :read-write and :read-only. https://github.com/w3c/csswg-drafts/issues/127

Labels: -Pri-3 Pri-2
Status: Available (was: Untriaged)
Labels: Hotlist-Interop
Labels: Update-Quarterly
Blockedon: 687462
Labels: Code-Resolver
Labels: BlockedBug Standards
Labels: -Update-Quarterly
Project Member

Comment 9 by sheriffbot@chromium.org, Dec 6

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Hotlist-Recharge-Cold
Status: Available (was: Untriaged)

Sign in to add a comment