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

Issue 685174 link

Starred by 6 users

Issue metadata

Status: Fixed
Owner:
NOT IN USE
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

css class::selection doesn't fire repaint

Reported by r.min...@gmail.com, Jan 25 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

Steps to reproduce the problem:
1. Go to https://jsfiddle.net/rmindel/r3581ewt/
2. Check the css of the text under "Not Working"
3. Select some of the text - the background of the selection is blue (default)
3. Click the button
4. See in inspector that the ::selection has a background-color property but the actual selection is still with blue background

See the text below "Working" with a workaround.

What is the expected behavior?
After the button click the selection background color should turn to yellow.

What went wrong?
The added class didn't cause Chrome to repaint.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 55.0.2883.87  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 24.0 r0
 
Labels: Needs-Triage-M58
Labels: Needs-Bisect
Status: Untriaged (was: Unconfirmed)
Note that the 'workaround' case succeeds because it has color set on the class. This also works when font is set (and probably other properties), but doesn't work when background is set.

Comment 3 by r.min...@gmail.com, Jan 26 2017

I am using a very very slightly different color as a workaround in my project.
(black => #000001)

I doubt that if you set it to the same font it will work, it needs to force a repaint so it needs to be changed and font will be very noticeable :)

Red was just for the reproduction of the bug.

Comment 4 by ajha@chromium.org, Jan 27 2017

Cc: ajha@chromium.org
Labels: -Type-Bug -Pri-2 -Needs-Bisect -Needs-Triage-M58 M-58 hasbisect OS-Linux OS-Mac Pri-1 Type-Bug-Regression
Owner: r...@opera.com
Status: Assigned (was: Untriaged)
Able to reproduce the issue on the latest canary(58.0.2994.0) and the latest stable(56.0.2924.76) on Windows-10, Mac OS 10.12.2 and Linux Ubuntu 14.04.

This is regression issue broken in M-40.

Last good build: 40.0.2199.0
First bad build: 40.0.2200.0

Changelog:
==========
https://chromium.googlesource.com/chromium/src/+log/cb4d80cfd84967203b5881219048671910dc9b28..0e2deda3f0c59c8fc18323ede48a552bef341c24

Blink changelog:
================
https://chromium.googlesource.com/chromium/blink/+log/28d0729..833cfa6

Suspecting: https://codereview.chromium.org/669873003 from the above Blink changelog.

rune@: Could you please take a look at this and confirm if the change is related.

Thank you!

Comment 5 by r...@opera.com, Jan 27 2017

Sounds very likely.
+1 here is another example. It does not repaint everytime I change the ::selection color with setInterval()

https://jsfiddle.net/1g8xoc20/

As a workaround you can do any css changes that force a repaint as stated before.

Comment 7 by r...@opera.com, Feb 8 2017

See also 689979, which is similar.
Labels: Update-Quarterly

Comment 9 by r...@opera.com, Feb 21 2017

Status: Started (was: Assigned)
https://codereview.chromium.org/2709693003/
Project Member

Comment 10 by bugdroid1@chromium.org, Feb 22 2017

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

commit eff357ef3a21515a5bfaa487b687d7d7353024f2
Author: rune <rune@opera.com>
Date: Wed Feb 22 11:13:18 2017

Repaint selection when element with ::selection style is recalculated.

Selection was not repainted unless the selected text was repainted due
to other style changes. Now, if the ComputedStyle is recalculated for
an element and either the old or the new ComputedStyle had a bit set
for PseudoIdSelection, schedule paint invalidation for the selection
leaf children of that element.

Note that we don't need to traverse down the descendants because the
current implementation of ::selection in Blink only affects direct
children. The selection state is only propagated to containing block
ancestor, which is why we look for a containing block to check if any
of the children is selected.

R=mstensho@opera.com
BUG= 685174 

Review-Url: https://codereview.chromium.org/2709693003
Cr-Commit-Position: refs/heads/master@{#451992}

[add] https://crrev.com/eff357ef3a21515a5bfaa487b687d7d7353024f2/third_party/WebKit/LayoutTests/paint/invalidation/selection/selection-repaint-expected.html
[add] https://crrev.com/eff357ef3a21515a5bfaa487b687d7d7353024f2/third_party/WebKit/LayoutTests/paint/invalidation/selection/selection-repaint.html
[modify] https://crrev.com/eff357ef3a21515a5bfaa487b687d7d7353024f2/third_party/WebKit/Source/core/layout/LayoutObject.cpp
[modify] https://crrev.com/eff357ef3a21515a5bfaa487b687d7d7353024f2/third_party/WebKit/Source/core/layout/LayoutObject.h
[modify] https://crrev.com/eff357ef3a21515a5bfaa487b687d7d7353024f2/third_party/WebKit/Source/core/style/ComputedStyle.cpp
[modify] https://crrev.com/eff357ef3a21515a5bfaa487b687d7d7353024f2/third_party/WebKit/Source/core/style/ComputedStyle.h
[modify] https://crrev.com/eff357ef3a21515a5bfaa487b687d7d7353024f2/third_party/WebKit/Source/core/style/StyleDifference.h

Comment 11 by r...@opera.com, Feb 22 2017

Status: Fixed (was: Started)
Cc: rbasuvula@chromium.org
Labels: Needs-Feedback
Tested the issue on Windows-10, Ubuntu 14.04 and Mac OS 10.12.3 using chrome latest Dev M58-58.0.3025.5 by following steps mentioned in the original comment. Observed that Not Working CSS selection background color not changing to yellow color.

Please find the attached screen shot(Ubuntu 14.04) for reference.Could you please let me know i have missed any thing.

Thank you!
685174.ogv
4.9 MB View Download

Comment 13 by r...@opera.com, Feb 28 2017

Status: Started (was: Fixed)
You're right. That fix was not good enough.

Comment 14 by r...@opera.com, Mar 1 2017

Labels: -Needs-Feedback
rbasuvula@, Thank you for thorough testing.
 Issue 697337  has been merged into this issue.
Notes from duped bug:

Steps to reproduce the problem:
1 define styles for a:focus { }
2 define styles for ::selection { }
3 toggle the color of the anchor tag when clicked

(Minimal representation of the issue: http://codepen.io/anon/pen/OpyGdy)

What is the expected behavior?
The color of the anchor tag should toggle when clicked

What went wrong?
The color of the anchor tag is not changing even though the class is getting applied
Project Member

Comment 18 by bugdroid1@chromium.org, Mar 3 2017

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

commit aac53af022b711ae7d4db563221a06be9f070e82
Author: rune <rune@opera.com>
Date: Fri Mar 03 13:55:24 2017

Call getUncachedPseudoStyle on correct node for ::selection.

getUncachedSelectionStyle is typically called for the LayoutObject we
are currently painting. This might not be the node the ::selection
style is matched for. Specifically, we request getUncachedSelectionStyle
on LayoutText objects, but we need to match the ::selection style on its
parent element.

This already happened inside getUncachedPseudoStyle, but it's guarded by
a hasPseudoStyle() call for the pseudo element type. In the case where
we pass in a LayoutText, we are relying on the computed style with the
PseudoIdSelection bit set to be propagated down to the LayoutText object.
That does not happen if the style change for the element parent is
NoChange or NoInherit.

Instead find the element for which we are matching ::selection in
getUncachedSelectionStyle instead. The firstAncestorOrSelf() call is
still present in getUncachedPseudoStyle as there may be other pseudo
elements types where we rely on this.

R=mstensho@opera.com
BUG= 685174 

Review-Url: https://codereview.chromium.org/2727253004
Cr-Commit-Position: refs/heads/master@{#454575}

[modify] https://crrev.com/aac53af022b711ae7d4db563221a06be9f070e82/third_party/WebKit/LayoutTests/paint/invalidation/selection/selection-repaint.html
[modify] https://crrev.com/aac53af022b711ae7d4db563221a06be9f070e82/third_party/WebKit/Source/core/layout/LayoutObject.cpp
[modify] https://crrev.com/aac53af022b711ae7d4db563221a06be9f070e82/third_party/WebKit/Source/core/layout/LayoutObject.h

Comment 19 by r...@opera.com, Mar 3 2017

Status: Fixed (was: Started)

Sign in to add a comment