Bug 23203 - Multiple background properties are not retrievable via DOM method getComputedStyle
Summary: Multiple background properties are not retrievable via DOM method getComputed...
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Simon Fraser (smfr)
URL: http://farukat.es/bugs/webkit-multipl...
: 44853 (view as bug list)
Depends on:
Reported: 2009-01-08 18:29 PST by Faruk Ates
Modified: 2010-11-06 12:31 PDT (History)
7 users (show)

See Also:

Patch (25.14 KB, patch)
2010-11-01 12:51 PDT, Simon Fraser (smfr)
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Faruk Ates 2009-01-08 18:29:15 PST
Any element that has multiple backgrounds specified on it will not return any but the first background image's properties via DOM methods, though it does correctly return the background color (of which there can be only one anyway).

See URL for the testcase.

Testcase also shows the odd return value for the alpha property in rgba(); that bug is already filed here:
Comment 1 Faruk Ates 2009-03-23 17:04:51 PDT
Just to elaborate on this radar, the CSS 3 spec says that the Computed Value for multiple background images should be:

"as specified, but with URIs made absolute"

Comment 2 Faruk Ates 2009-03-24 16:57:37 PDT
New discovery: when setting multiple background images via el.style.cssText and retrieving them directly via el.style.backgroundImage, the value is correct: all images are listed with absolute paths, as per the spec.

So this is just not working in getComputedStyle, only. I've adjusted the Summary.
Comment 3 NovakP 2010-10-31 09:11:11 PDT
Hi, any progress on this bug? This still doesn't work in WebKit two years after reporting.
Comment 4 Simon Fraser (smfr) 2010-11-01 08:46:25 PDT
*** Bug 44853 has been marked as a duplicate of this bug. ***
Comment 5 Simon Fraser (smfr) 2010-11-01 08:46:41 PDT
I started working on a patch for this.
Comment 6 Simon Fraser (smfr) 2010-11-01 12:51:36 PDT
Created attachment 72543 [details]
Comment 7 Dave Hyatt 2010-11-01 12:54:22 PDT
Comment on attachment 72543 [details]

r=me, but do something about "size.size." heh.
Comment 8 Simon Fraser (smfr) 2010-11-01 13:40:17 PDT
Comment 9 WebKit Review Bot 2010-11-01 14:07:01 PDT
http://trac.webkit.org/changeset/71049 might have broken Qt Linux Release
The following tests are not passing:
Comment 10 Alexey Proskuryakov 2010-11-05 23:39:31 PDT
+++ trunk/LayoutTests/fast/backgrounds/script-tests/TEMPLATE.html	2010-11-01 20:39:48 UTC (rev 71049)

This is evil. Splitting tests into .html and .js only adds indirection and wastes time for the person investigating failures. Please see e.g. <http://trac.webkit.org/browser/trunk/LayoutTests/fast/speech/input-text-language-tag.html> for what I think is a better pattern for script tests.
Comment 11 Eric Seidel (no email) 2010-11-05 23:42:34 PDT
Evil might be a strong word.  It's been a historically recommended pattern.

I think someone should write a document on good layout test design, but I think using the existing script-test pattern doesn't count as "evil". :)
Comment 12 Simon Fraser (smfr) 2010-11-06 11:55:26 PDT
I don't really care if the JS in in the test file or a separate file, but I was just following (possibly outdated) convention.
Comment 13 Alexey Proskuryakov 2010-11-06 12:31:21 PDT
I don't think this was ever a common convention for tests outside fast/js, but it certainly did have vocal proponents.