[Webkit-unassigned] [Bug 6680] New: DOMCSSStyleSheet not implemented but still reported as supported?

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Thu Jan 19 22:26:27 PST 2006


http://bugzilla.opendarwin.org/show_bug.cgi?id=6680

           Summary: DOMCSSStyleSheet not implemented but still reported as
                    supported?
           Product: WebKit
           Version: 417.x
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: XML DOM
        AssignedTo: webkit-unassigned at opendarwin.org
        ReportedBy: todd at ditchnet.org


I'm not really sure if this totally qualifies as a bug... I suspect it's just a matter of these features not yet 
being implemented just yet. Then again, WebKit's ObjC DOM implementation will <a href="http://
www.ditchnet.org/wp/2006/01/19/webkit-dom-conformance/">report that it fully supports 
"CSS","2.0"</a>. However, it appears to not even come close yet. Therefore, it's a bug worth reducing 
and reporting. Seems a bit odd that WebKit reports supporting this module although it doesn't.

Okay... here's my reduction in a nutshell.

I have a very simple XHTML document:

<div><pre><code>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" 
lang="en">
<head>
    <title>Untitled</title>
    <link type="text/css" rel="stylesheet" href="stylesheet.css" />
    <style type="text/css">
        
        html {
            border:1px solid lime;
        }
    
    </style>
</head>
<body>
<h1>dude</h1>
</body>
</html>

</code></pre></div>

And a very simple CSS stylesheet:

<div><pre><code>
body {
    border:1px solid orange;
}

</code></pre></div>

As you can see, my XHTML document has two associated stylesheets. One linked via a <code>link</
code> tag and one embedded via a <code>style</code> tag.

Here's what I'd like to do. 

I'd like to get a reference to the <code>DOMDocument</code> object representing my XHTML 
document. From this document object, I'd like to get references to its two <code>DOMStyleSheet</
code> objects. However, these two stylesheets (by virtue of the fact that they both contain 
<code>type="text/css"</code> attributes) should actually be instances of the more derived 
<code>DOMCSSStyleSheet</code> type. I should be able to cast these two <code>DOMStyleSheet</
code> instances down to the more specific <code>DOMCSSStyleSheet</code> interface. Again, this is 
due to my declaration that these two stylesheets are of type <code>"text/css"</code> <a 
href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-
CSSStyleSheet">according to the DOM Level 2 CSS spec</a>.

Unfortunately, if my tests are correct it doesn't look like WebKit DOM supports this basic type 
(<code>DOMCSSStyleSheet</code>) of the CSS Level 2 Module. This type is the most central interface 
of that Module, and claiming support without that type is pretty silly.

Here's the code from my reduction that fails:

<div><code><pre>
DOMDocument *doc = [[webView mainFrame] DOMDocument];    

DOMStyleSheetList *styleSheets = [doc styleSheets];
NSLog(@"num : %i",[styleSheets length]);

// get reference to first stylesheet. should be a CSS stylesheet, but its not
DOMStyleSheet *styleSheet1 = [styleSheets item:0];
DOMCSSStyleSheet *cssStyleSheet1 = (DOMCSSStyleSheet *)styleSheet1;

// get reference to second stylesheet. should be a CSS stylesheet, but its not
DOMStyleSheet *styleSheet2 = [styleSheets item:1];
DOMCSSStyleSheet *cssStyleSheet2 = (DOMCSSStyleSheet *)styleSheet2;

// check the type of first stylesheet, both should return YES
NSLog(@"styleSheet1 is DOMStyleSheet ? %i",
      [cssStyleSheet1 isKindOfClass:[DOMStyleSheet class]]);
NSLog(@"styleSheet1 is DOMCSSStyleSheet ? %i",
      [cssStyleSheet1 isKindOfClass:[DOMCSSStyleSheet class]]);

// check the type of second stylesheet, both should return YES
NSLog(@"styleSheet2 is DOMStyleSheet ? %i",
      [cssStyleSheet2 isKindOfClass:[DOMStyleSheet class]]);
NSLog(@"styleSheet2 is DOMCSSStyleSheet ? %i",
      [cssStyleSheet2 isKindOfClass:[DOMCSSStyleSheet class]]);

// these methods should exist, but will raise error
DOMCSSRuleList *ruleList1 = [cssStyleSheet1 cssRules];
DOMCSSRuleList *ruleList2 = [cssStyleSheet2 cssRules];

</code></pre></div>

And here is the output:

<div><code><pre>
36 -0600.]
num : 2
[styleSheet isKindOfClass:[DOMStyleSheet class]] ? 1
[styleSheet isKindOfClass:[DOMCSSStyleSheet class]] ? 0
*** -[DOMStyleSheet cssRules]: selector not recognized [self = 0x3a4580]
*** -[DOMStyleSheet cssRules]: selector not recognized [self = 0x3a4580]

</code></pre></div>

If my code is correct, appears that the stylesheets are not returned as specifically being CSS stylesheets 
as the DOM spec mandates. Apple really should report that DOM Level 2 CSS is not supported until this 
is implemented.

<a href="http://ditchnet.org/csstest/CSSTest.zip">Download Xcode project reduction</a>.

-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list