Bug 12384 - getComputedStyle with td.style.display='none' reports '' for all properties except display
Summary: getComputedStyle with td.style.display='none' reports '' for all properties e...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords: GoogleBug, InRadar
Depends on:
Blocks:
 
Reported: 2007-01-23 11:41 PST by Steven Saviano
Modified: 2007-07-08 14:13 PDT (History)
3 users (show)

See Also:


Attachments
Test Case (685 bytes, text/html)
2007-01-23 11:42 PST, Steven Saviano
no flags Details
[WIP] return rich computed style declarations for elements without renderers (14.05 KB, patch)
2007-07-07 17:27 PDT, mitz
no flags Details | Formatted Diff | Diff
Return rich computed style declarations for elements without renderers (24.58 KB, patch)
2007-07-08 00:24 PDT, mitz
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Saviano 2007-01-23 11:41:15 PST
Summary:
1) Make a table with td's
2) Set one of the td's display to "none"
3) getComputedStyle on that td will report that element's display as "" (empty string)

This was tested with TOT Webkit (r19043).
Comment 1 Steven Saviano 2007-01-23 11:42:15 PST
Created attachment 12631 [details]
Test Case
Comment 2 mitz 2007-01-23 11:51:56 PST

*** This bug has been marked as a duplicate of 4125 ***
Comment 3 mitz 2007-01-23 11:54:08 PST
Sorry, this is not a duplicate of bug 4125.
Comment 4 mitz 2007-01-23 11:55:03 PST
True for all properties of all objects that do not have a renderer.
Comment 5 Darin Adler 2007-01-25 08:41:11 PST
Hyatt and I discussed how to fix this a long time ago.

We need to change the CSS style selector so it can create a style for a DOM element that does not have a RenderObject, which should be relatively straightforward. Then we need to create a cache of these RenderStyle objects for elements they have been computed for -- presumably a HashMap. We need to invalidate the styles in the cache when changes are made to the element. And we need to make the computed style look up the RenderStyle in this cache.
Comment 6 Mark Rowe (bdash) 2007-01-28 15:43:49 PST
<rdar://problem/4960104>
Comment 7 Maciej Stachowiak 2007-02-07 01:19:05 PST
Although an annoying bug, this has workarounds and is not a regression, thus not P1.
Comment 8 mitz 2007-03-31 09:05:59 PDT
(In reply to comment #4)
> True for all properties of all objects that do not have a renderer.
> 

Starting with <http://trac.webkit.org/projects/webkit/changeset/20570>, this is true for all properties *except* display.
Comment 9 mitz 2007-07-07 17:27:34 PDT
Created attachment 15441 [details]
[WIP] return rich computed style declarations for elements without renderers

Still not thoroughly tested. I am also worried that I missed something:

> We need to change the CSS style selector so it can create a style for a DOM
> element that does not have a RenderObject.
Comment 10 mitz 2007-07-08 00:24:36 PDT
Created attachment 15442 [details]
Return rich computed style declarations for elements without renderers

Added a test and a change log.

Still wondering what needs changed in CSSStyleSelector.
Comment 11 Darin Adler 2007-07-08 04:58:44 PDT
Comment on attachment 15442 [details]
Return rich computed style declarations for elements without renderers

+    virtual RenderStyle* computedStyle() { return parent() ? parent()->computedStyle() : 0; }

I don't think it's helpful to define a virtual function like this one as an inline in the header. It's easier to modify it if it's even needed if you keep it in the .cpp file instead, and it would only actually get inlined if it was a non-virtual call, which should never happen in this case.

But that's a nitpick. This looks great!

I guess I was wrong about CSSStyleSelector needing a change!

r=me
Comment 12 Sam Weinig 2007-07-08 10:53:37 PDT
Landed in r24099 with Darin's suggestion.
Comment 13 mitz 2007-07-08 14:13:09 PDT
Leaks fixed in r24103, which introduced bug 14563.