Bug 164537 - CSSStyleRule.style / CSSPageRule.style / CSSKeyframeRule.style should be settable
Summary: CSSStyleRule.style / CSSPageRule.style / CSSKeyframeRule.style should be sett...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://drafts.csswg.org/cssom/#cssst...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-11-08 17:41 PST by Naina Raisinghani
Modified: 2017-06-07 20:32 PDT (History)
10 users (show)

See Also:


Attachments
testcase 1 (for CSSStyleRule) (570 bytes, text/html)
2017-06-07 14:34 PDT, Daniel Holbert
no flags Details
WIP Patch (1.28 KB, patch)
2017-06-07 16:35 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-elcapitan (999.31 KB, application/zip)
2017-06-07 17:33 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews116 for mac-elcapitan (1.86 MB, application/zip)
2017-06-07 17:35 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews106 for mac-elcapitan-wk2 (1.15 MB, application/zip)
2017-06-07 17:40 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews122 for ios-simulator-wk2 (927.27 KB, application/zip)
2017-06-07 18:02 PDT, Build Bot
no flags Details
Patch (14.36 KB, patch)
2017-06-07 19:22 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Naina Raisinghani 2016-11-08 17:41:13 PST
The spec here (https://drafts.csswg.org/cssom/#cssstylerule) states that the style attribute on Element has [PutForwards=cssText] in the CSSOM spec and cssText is of DOMString type. You should be able to modify the element.style variable by the following:

element.style = 'valid css'

The attached file shows
First:: 200
Second:: 0
on both FF and Chrome

It shows 
First:: 200
Second:: 200 
on Safari and IE. 

Also you can take a look at the relevant discussion on the Chrome bug here: https://bugs.chromium.org/p/chromium/issues/detail?id=662664
Comment 1 Radar WebKit Bug Importer 2016-11-09 10:33:40 PST
<rdar://problem/29181773>
Comment 2 Daniel Holbert 2017-06-07 14:34:59 PDT
Created attachment 312230 [details]
testcase 1 (for CSSStyleRule)

Here's a testcase that directly targets CSSStyleRule.style (no element involved).

Firefox and Chrome print out "AAA", then "BBB", then "CCC" in the web console.  

WebKit doesn't accept the CCC, though, due to the |rule.style| assignment failing, due to this bug.
Comment 3 Daniel Holbert 2017-06-07 15:24:19 PDT
Here's the relevant part of the spec for the element.style attribute, I think:
https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-interface
> interface ElementCSSInlineStyle {
>   [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
> };

And for the CSSStyleRule.style attribute:
https://drafts.csswg.org/cssom/#the-cssstylerule-interface
> interface CSSStyleRule : CSSRule {
>   attribute CSSOMString selectorText;
>  [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
> };
Comment 4 Chris Dumez 2017-06-07 15:50:27 PDT
Looks like I fixed part of this. element.style is settable after Bug 171795.

However, it looks like we still need to make CSSStyleRule.style settable.
Comment 5 Daniel Holbert 2017-06-07 16:07:52 PDT
Oh, nice! You're in the same camp as Edge, then. (See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12271447/ - they can set element.style but not rule.style, too.)
Comment 6 Chris Dumez 2017-06-07 16:20:24 PDT
(In reply to Daniel Holbert from comment #5)
> Oh, nice! You're in the same camp as Edge, then. (See
> https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/
> 12271447/ - they can set element.style but not rule.style, too.)

I'll fix the rest today. It is trivial.
Comment 7 Chris Dumez 2017-06-07 16:35:22 PDT
Created attachment 312250 [details]
WIP Patch
Comment 8 Build Bot 2017-06-07 17:33:54 PDT
Comment on attachment 312250 [details]
WIP Patch

Attachment 312250 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3890807

New failing tests:
imported/w3c/web-platform-tests/cssom/interfaces.html
imported/w3c/web-platform-tests/cssom/CSSStyleRule.html
Comment 9 Build Bot 2017-06-07 17:33:55 PDT
Created attachment 312257 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 10 Build Bot 2017-06-07 17:35:13 PDT
Comment on attachment 312250 [details]
WIP Patch

Attachment 312250 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3890761

New failing tests:
imported/w3c/web-platform-tests/cssom/interfaces.html
imported/w3c/web-platform-tests/cssom/CSSStyleRule.html
Comment 11 Build Bot 2017-06-07 17:35:14 PDT
Created attachment 312258 [details]
Archive of layout-test-results from ews116 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 12 Build Bot 2017-06-07 17:40:14 PDT
Comment on attachment 312250 [details]
WIP Patch

Attachment 312250 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3890818

New failing tests:
imported/w3c/web-platform-tests/cssom/interfaces.html
imported/w3c/web-platform-tests/cssom/CSSStyleRule.html
Comment 13 Build Bot 2017-06-07 17:40:15 PDT
Created attachment 312259 [details]
Archive of layout-test-results from ews106 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 14 Build Bot 2017-06-07 18:02:03 PDT
Comment on attachment 312250 [details]
WIP Patch

Attachment 312250 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3890873

New failing tests:
imported/w3c/web-platform-tests/cssom/interfaces.html
imported/w3c/web-platform-tests/cssom/CSSStyleRule.html
Comment 15 Build Bot 2017-06-07 18:02:04 PDT
Created attachment 312262 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.5
Comment 16 Chris Dumez 2017-06-07 19:22:10 PDT
Created attachment 312266 [details]
Patch
Comment 17 Sam Weinig 2017-06-07 20:04:51 PDT
Comment on attachment 312266 [details]
Patch

PutForwards on the mind?
Comment 18 Chris Dumez 2017-06-07 20:06:50 PDT
(In reply to Sam Weinig from comment #17)
> Comment on attachment 312266 [details]
> Patch
> 
> PutForwards on the mind?

:)
Comment 19 WebKit Commit Bot 2017-06-07 20:32:25 PDT
Comment on attachment 312266 [details]
Patch

Clearing flags on attachment: 312266

Committed r217917: <http://trac.webkit.org/changeset/217917>
Comment 20 WebKit Commit Bot 2017-06-07 20:32:27 PDT
All reviewed patches have been landed.  Closing bug.