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

Issue 661998 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
NOT IN USE
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , All
Pri: 2
Type: Bug



Sign in to add a comment

URL returned from getComputedStyle is sometimes wrong for pseudo-elements

Reported by quanxunz...@gmail.com, Nov 3 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0

Steps to reproduce the problem:
open the testcase

What is the expected behavior?
The url value for ::before and ::after should be different. The former should be "url(...#before)", and the latter should be "url(...#after)".

What went wrong?
Both url becomes "url(...#before)".

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 56.0.2908.0 (正式版本) canary (64 位)  Channel: canary
OS Version: OS X 10.12
Flash Version: Shockwave Flash 23.0 r0

There are several conditions to trigger this bug:
1. the url value must not be local file. I choose localhost as the host because it is usually the fastest
2. the pseudo-element must generate CSS box (has content value)
 
chrome-bug.html
643 bytes View Download
Labels: Needs-Bisect OS-Windows
Cc: hdodda@chromium.org
Labels: -Needs-Bisect M-56 OS-Linux
Status: Untriaged (was: Unconfirmed)
Tested on Mac 10.11.6 using chrome M56 #56.0.2908.0 and issue is reproduced.

Issue is seen from M52 and hence marking it as Untriaged.

Behavior of the Issue :

From M30 to M49 , when html file is opened , page is blank.

In M50, #50.0.2624.0
::before  url("http://localhost/test.svg")
::after  url("http://localhost/test.svg")

Attached screenshot for reference.

From M52 , #52.0.2705.0

::before  url("http://localhost/test.svg#before")
::after  url("http://localhost/test.svg#before")

Thanks!
661998.png
45.6 KB View Download
Sounds like this never works... The page being blank might be due to lack of support of template literals in those versions.

Comment 4 by phistuck@gmail.com, Nov 4 2016

Oh, right, I did not notice that, "let" caught my attention and I moved along, feeling happy I found the cause. ;)

@hdodda -
Can you retest previous versions (49 and earlier) with the attached test case, please?

Thank you.
chrome-bug.html
775 bytes View Download

Comment 5 by r...@opera.com, Nov 4 2016

Labels: -OS-Windows -OS-Mac OS-All
Owner: r...@opera.com
Status: Assigned (was: Untriaged)
In StyleFetchedImage, the m_url is correct for ::after while the m_image (ImageResource) url points to the #before fragment. The ImageResource url is returned as the computed value. It seems like the ImageResource is shared between the same url with different fragment identifiers and that the first url that created the resource is used, including the fragment. The question is if we should just use the m_url instead?

Comment 6 by r...@opera.com, Nov 4 2016

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

Comment 7 by bugdroid1@chromium.org, Nov 7 2016

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

commit 9ed43348266eeba34ed331c5ebcd42ca3407e93d
Author: rune <rune@opera.com>
Date: Mon Nov 07 10:18:11 2016

Don't use url from ImageResource for computed style.

ImageResource objects are shared between urls which only differ in
fragment identifier. The fragment identifier of the first requested url
is stored on ImageResource. That gave incorrect results when requesting
computed style values of backgroundImage for pseudo elements.

Use the url which is stored on StyleFetchedImage instead.

R=timloh@chromium.org
BUG= 661998 

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

[add] https://crrev.com/9ed43348266eeba34ed331c5ebcd42ca3407e93d/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-backgroundImage-expected.txt
[add] https://crrev.com/9ed43348266eeba34ed331c5ebcd42ca3407e93d/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-backgroundImage.html
[modify] https://crrev.com/9ed43348266eeba34ed331c5ebcd42ca3407e93d/third_party/WebKit/Source/core/style/StyleFetchedImage.cpp

Comment 8 by r...@opera.com, Nov 7 2016

Status: Fixed (was: Started)

Sign in to add a comment