Bug 31224 - [V8] Return StyleSheet object instead of HTMLStyleElement w/document.styleSheets named property getter.
Summary: [V8] Return StyleSheet object instead of HTMLStyleElement w/document.styleShe...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://soren.qzone.qq.com/cgi-bin/sor...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-07 08:01 PST by johnnyding
Modified: 2009-11-08 21:52 PST (History)
2 users (show)

See Also:


Attachments
patch to fix this issue. (1.46 KB, patch)
2009-11-07 08:41 PST, johnnyding
dglazkov: review-
Details | Formatted Diff | Diff
patch v2 for fix (3.58 KB, patch)
2009-11-07 10:09 PST, johnnyding
no flags Details | Formatted Diff | Diff
patch v3 for fix (4.39 KB, patch)
2009-11-07 11:16 PST, johnnyding
no flags Details | Formatted Diff | Diff
patch v3 for fix (4.39 KB, patch)
2009-11-07 11:18 PST, johnnyding
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description johnnyding 2009-11-07 08:01:05 PST
In page http://soren.qzone.qq.com/cgi-bin/soren/cgi_userinfo_search?bSimple=0&ptlang=2052, it uses document.styleSheets["CssId"].rules to get style css rule list.

In safari, the page run well, but in Google Chrome, accessing document.styleSheets["CssId"].rules got "undefined".

After investigation, Safari returns a [CSSStyleSheet] object when accessing document.styleSheets["CssId"], so the "rules" can be gotten. Chrome returns a [HTMLStyleElement] object when accessing document.styleSheets["CssId"], so the "rules" can not be gotten.

I believe it's v8 binding's fault. See JS binding (JSStyleSheetListCustom.cpp, line 60), it returns stylesheet instead of returning style element.
Comment 1 johnnyding 2009-11-07 08:41:18 PST
Created attachment 42694 [details]
patch to fix this issue.
Comment 2 Dimitri Glazkov (Google) 2009-11-07 08:45:05 PST
Comment on attachment 42694 [details]
patch to fix this issue.

Thanks for tackling this! We just need a layout test and one small nit:

> Index: WebCore/ChangeLog
> ===================================================================
> --- WebCore/ChangeLog	(revision 50615)
> +++ WebCore/ChangeLog	(working copy)
> @@ -1,3 +1,16 @@
> +2009-11-07  Johnny Ding  <johnnyding.webkit@gmail.com>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        https://bugs.webkit.org/show_bug.cgi?id=31224
> +        Returns a StyleSheet object instead of HTMLStyleElement when using

Please update this to match the subject of the bug (including [V8] prefix).

> +        V8 engine to retrieve style sheet by a name from document.styleSheets


.
> +
> +        No new tests since it is only V8 binding issue.(JS binding is OK)

Well, this is an easily testable case, so I would say a layout test is in order, regardless
of whether it's a bindings issue for one engine and not another.
Comment 3 Dimitri Glazkov (Google) 2009-11-07 10:01:04 PST
I wonder if there's already a layout test that we're failing that tests this.
Comment 4 johnnyding 2009-11-07 10:09:08 PST
Created attachment 42696 [details]
patch v2 for fix

Thanks, patch v2 is coming:)
Comment 5 johnnyding 2009-11-07 11:16:01 PST
Created attachment 42698 [details]
patch v3 for fix
Comment 6 johnnyding 2009-11-07 11:18:09 PST
Created attachment 42699 [details]
patch v3 for fix
Comment 7 Dimitri Glazkov (Google) 2009-11-08 21:38:30 PST
Comment on attachment 42699 [details]
patch v3 for fix

Lovely. r=me.
Comment 8 WebKit Commit Bot 2009-11-08 21:52:47 PST
Comment on attachment 42699 [details]
patch v3 for fix

Clearing flags on attachment: 42699

Committed r50637: <http://trac.webkit.org/changeset/50637>
Comment 9 WebKit Commit Bot 2009-11-08 21:52:52 PST
All reviewed patches have been landed.  Closing bug.