URL returned from getComputedStyle is sometimes wrong for pseudo-elements
Reported by
quanxunz...@gmail.com,
Nov 3 2016
|
||||
Issue descriptionUserAgent: 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)
,
Nov 4 2016
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!
,
Nov 4 2016
Sounds like this never works... The page being blank might be due to lack of support of template literals in those versions.
,
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.
,
Nov 4 2016
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?
,
Nov 4 2016
,
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
,
Nov 7 2016
|
||||
►
Sign in to add a comment |
||||
Comment 1 by manoranj...@chromium.org
, Nov 3 2016