RESOLVED FIXED Bug 23668
CSS 'content' attribute does not work with window.getComputedStyle
https://bugs.webkit.org/show_bug.cgi?id=23668
Summary CSS 'content' attribute does not work with window.getComputedStyle
exfed
Reported 2009-01-31 17:35:53 PST
<div style="content: 'string'" onclick="alert([window.getComputedStyle(this, null).getPropertyValue('content'),this.style.content])"> displays ",string", correct should be "string,string"; </div>
Attachments
Test case (207 bytes, text/html)
2009-02-06 06:32 PST, David Kilzer (:ddkilzer)
no flags
Patch (12.88 KB, patch)
2011-02-23 12:42 PST, Emil A Eklund
simon.fraser: review-
Patch (11.66 KB, patch)
2011-02-23 14:03 PST, Emil A Eklund
no flags
exfed
Comment 1 2009-02-04 08:56:47 PST
Mark Rowe (bdash)
Comment 2 2009-02-06 03:20:40 PST
David Kilzer (:ddkilzer)
Comment 3 2009-02-06 06:32:39 PST
Created attachment 27395 [details] Test case
Eric Seidel (no email)
Comment 4 2009-02-06 10:45:15 PST
Seems like we're missing lots of these. Content in particular: http://trac.webkit.org/browser/trunk/WebCore/css/CSSComputedStyleDeclaration.cpp#L1206 This would be a trivial bug to fix for someone. Most important would be to write a nice test case, ideally one which tests a whole bunch of the missing properties, and is in the newer fast/js/ testing style.
Emil A Eklund
Comment 5 2011-02-23 12:42:52 PST
Created attachment 83526 [details] Patch Implements getComputedStyle for the content, counter, outline-offset, background-position-x and background-position-y properties. To correctly return content containing counters I added a new type to CSSPrimitiveValue, CSS_COUNTER_NAME. I'm not convinced this is the right thing to do but was the best option I could come up with. Any suggestions would be welcome.
Eric Seidel (no email)
Comment 6 2011-02-23 13:08:51 PST
Comment on attachment 83526 [details] Patch LGTM.
Eric Seidel (no email)
Comment 7 2011-02-23 13:09:28 PST
Comment on attachment 83526 [details] Patch Since you seem doubtful on the CSS_COUNTER_NAME thing I'll leave that for someone else to comment on.
Simon Fraser (smfr)
Comment 8 2011-02-23 13:40:33 PST
Comment on attachment 83526 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=83526&action=review > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:730 > +static PassRefPtr<CSSValue> contentToCSSValue(PassRefPtr<RenderStyle> style) The argument can be a const RenderStyle* > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:748 > +static PassRefPtr<CSSValue> counterToCSSValue(PassRefPtr<RenderStyle> style, int propertyID) Ditto. > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:852 > + case CSSPropertyBackgroundRepeatX: > + return CSSPrimitiveValue::create(style->backgroundRepeatX()); > + case CSSPropertyBackgroundRepeatY: > + return CSSPrimitiveValue::create(style->backgroundRepeatY()); There are no individual CSS properties for background-repeat-x and y (http://www.w3.org/TR/css3-background/#the-background-repeat), so I don't think we should be supporting computed style for them.
Emil A Eklund
Comment 9 2011-02-23 14:03:15 PST
Created attachment 83545 [details] Patch Thanks Simon! I made the changes you suggested and removed the background-repeat-x|y properties. Please take another look when you get a chance.
WebKit Commit Bot
Comment 10 2011-02-24 08:56:55 PST
The commit-queue encountered the following flaky tests while processing attachment 83545 [details]: http/tests/xmlhttprequest/failed-auth.html bug 51835 (author: ap@webkit.org) The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 11 2011-02-24 08:59:31 PST
Comment on attachment 83545 [details] Patch Clearing flags on attachment: 83545 Committed r79574: <http://trac.webkit.org/changeset/79574>
WebKit Commit Bot
Comment 12 2011-02-24 08:59:35 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.