WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 192671
CSS Typed OM should expose attributeStyleMap
https://bugs.webkit.org/show_bug.cgi?id=192671
Summary
CSS Typed OM should expose attributeStyleMap
Justin Michaud
Reported
2018-12-13 11:45:56 PST
CSS Typed OM should expose attributeStyleMap
Attachments
Patch
(36.17 KB, patch)
2018-12-13 11:52 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Patch
(35.37 KB, patch)
2018-12-13 11:56 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Patch
(38.88 KB, patch)
2018-12-13 17:00 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews103 for mac-sierra
(2.80 MB, application/zip)
2018-12-13 18:07 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews106 for mac-sierra-wk2
(3.52 MB, application/zip)
2018-12-13 18:41 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews116 for mac-sierra
(2.00 MB, application/zip)
2018-12-13 19:02 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews126 for ios-simulator-wk2
(2.41 MB, application/zip)
2018-12-13 19:03 PST
,
EWS Watchlist
no flags
Details
Patch
(52.60 KB, patch)
2018-12-13 19:37 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews103 for mac-sierra
(2.51 MB, application/zip)
2018-12-13 20:51 PST
,
EWS Watchlist
no flags
Details
Archive of layout-test-results from ews112 for mac-sierra
(2.24 MB, application/zip)
2018-12-13 21:32 PST
,
EWS Watchlist
no flags
Details
Patch
(74.46 KB, patch)
2018-12-14 14:18 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Patch
(73.79 KB, patch)
2018-12-14 15:10 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Patch
(73.86 KB, patch)
2018-12-14 15:16 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews206 for win-future
(12.83 MB, application/zip)
2018-12-14 18:11 PST
,
EWS Watchlist
no flags
Details
Patch
(67.69 KB, patch)
2018-12-17 22:41 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Patch
(68.48 KB, patch)
2018-12-17 22:49 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Patch
(68.47 KB, patch)
2018-12-18 10:01 PST
,
Justin Michaud
no flags
Details
Formatted Diff
Diff
Show Obsolete
(16)
View All
Add attachment
proposed patch, testcase, etc.
Justin Michaud
Comment 1
2018-12-13 11:52:03 PST
Created
attachment 357241
[details]
Patch
Justin Michaud
Comment 2
2018-12-13 11:56:19 PST
Created
attachment 357243
[details]
Patch
Ryosuke Niwa
Comment 3
2018-12-13 13:28:47 PST
Comment on
attachment 357243
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357243&action=review
> Source/WebCore/ChangeLog:7 > +
You should add a description as to what you're implementing.
> Source/WebCore/css/ElementCSSInlineStyle.idl:32 > + [SameObject, EnabledAtRuntime=CSSTypedOM, Conditional=CSS_TYPED_OM] readonly attribute StylePropertyMap attributeStyleMap;
SameObject isn't supported hence the FIXME right above. So that the same thing here.
> Source/WebCore/css/typedom/StylePropertyMap.idl:32 > +] interface StylePropertyMap : StylePropertyMapReadOnly {
You need GenerateIsReachable=ImplOwnerNodeRoot and make StylePropertyMapReadOnly reachable from GC when the element is alive to get the same effect as SameObject.
Ryosuke Niwa
Comment 4
2018-12-13 13:30:29 PST
Right now, your code has a bug that if you call element.attributeStyleMap, let GC run, and then access element.attributeStyleMap again, then we'd create a new JS wrapper. That is, if you had inserted element.attributeStyleMap into a WeakMap/WeakSet and/or you added a property onto it, then we'd lose that entry / property when GC runs.
Ryosuke Niwa
Comment 5
2018-12-13 13:34:00 PST
Comment on
attachment 357243
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357243&action=review
> Source/WebCore/css/typedom/StylePropertyMapReadOnly.h:46 > + struct StylePropertyMapImpl { > + virtual ~StylePropertyMapImpl() = default; > + virtual RefPtr<TypedOMCSSStyleValue> get(const String& property) const = 0; > + };
Why do we need a separate object for this? Why can't StylePropertyMapReadOnly simply provide some overridable virtual functions instead? Is the intent that multiple StylePropertyMapReadOnly would share a simple implementation? When would that happen?
> Source/WebCore/dom/StyledElement.cpp:124 > + if (!ensureElementRareData().attributeStyleMap()) > + elementRareData()->setAttributeStyleMap(StylePropertyMap::create(makeUniqueRef<StyledElementInlineStylePropertyMapImpl>(*this))); > + return *elementRareData()->attributeStyleMap();
Calling ensureElementRareData() three times is efficient. Store a reference to it the first time you call it.
Ryosuke Niwa
Comment 6
2018-12-13 13:34:27 PST
Comment on
attachment 357243
[details]
Patch r- because of the above issues and build failures.
Justin Michaud
Comment 7
2018-12-13 17:00:37 PST
Created
attachment 357272
[details]
Patch
EWS Watchlist
Comment 8
2018-12-13 18:07:18 PST
Comment hidden (obsolete)
Comment on
attachment 357272
[details]
Patch
Attachment 357272
[details]
did not pass mac-ews (mac): Output:
https://webkit-queues.webkit.org/results/10390020
New failing tests: css-typedom/sameobject.html css-typedom/attributeStyleMap.html
EWS Watchlist
Comment 9
2018-12-13 18:07:19 PST
Comment hidden (obsolete)
Created
attachment 357280
[details]
Archive of layout-test-results from ews103 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 10
2018-12-13 18:41:53 PST
Comment hidden (obsolete)
Comment on
attachment 357272
[details]
Patch
Attachment 357272
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
https://webkit-queues.webkit.org/results/10390423
New failing tests: imported/w3c/web-platform-tests/css/css-properties-values-api/typedom.tentative.html js/dom/dom-static-property-for-in-iteration.html imported/w3c/web-platform-tests/css/css-properties-values-api/unit-cycles.html
EWS Watchlist
Comment 11
2018-12-13 18:41:55 PST
Comment hidden (obsolete)
Created
attachment 357282
[details]
Archive of layout-test-results from ews106 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 12
2018-12-13 19:02:50 PST
Comment hidden (obsolete)
Comment on
attachment 357272
[details]
Patch
Attachment 357272
[details]
did not pass mac-debug-ews (mac): Output:
https://webkit-queues.webkit.org/results/10390266
New failing tests: css-typedom/sameobject.html css-typedom/attributeStyleMap.html
EWS Watchlist
Comment 13
2018-12-13 19:02:52 PST
Comment hidden (obsolete)
Created
attachment 357286
[details]
Archive of layout-test-results from ews116 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 14
2018-12-13 19:03:26 PST
Comment hidden (obsolete)
Comment on
attachment 357272
[details]
Patch
Attachment 357272
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
https://webkit-queues.webkit.org/results/10390282
New failing tests: imported/w3c/web-platform-tests/css/css-properties-values-api/typedom.tentative.html imported/w3c/web-platform-tests/css/css-properties-values-api/unit-cycles.html
EWS Watchlist
Comment 15
2018-12-13 19:03:28 PST
Comment hidden (obsolete)
Created
attachment 357287
[details]
Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
Justin Michaud
Comment 16
2018-12-13 19:22:11 PST
(In reply to Ryosuke Niwa from
comment #5
)
> > Why do we need a separate object for this? Why can't > StylePropertyMapReadOnly simply provide some overridable virtual functions > instead? > Is the intent that multiple StylePropertyMapReadOnly would share a simple > implementation? > When would that happen?
This is more for bindings. StylePropertyMap inherits from StylePropertyMapReadOnly, and I didn't want to have to disable bindings hardening or write my own toJS function. I think (?) that I would need to do at least one of those things if I tried to pass a subclass of StylePropertyMap to toJS.
Justin Michaud
Comment 17
2018-12-13 19:37:43 PST
Created
attachment 357289
[details]
Patch
Ryosuke Niwa
Comment 18
2018-12-13 19:41:44 PST
(In reply to Justin Michaud from
comment #16
)
> (In reply to Ryosuke Niwa from
comment #5
) > > > > Why do we need a separate object for this? Why can't > > StylePropertyMapReadOnly simply provide some overridable virtual functions > > instead? > > Is the intent that multiple StylePropertyMapReadOnly would share a simple > > implementation? > > When would that happen? > > This is more for bindings. StylePropertyMap inherits from > StylePropertyMapReadOnly, and I didn't want to have to disable bindings > hardening or write my own toJS function. I think (?) that I would need to do > at least one of those things if I tried to pass a subclass of > StylePropertyMap to toJS.
Just remove ImplementationLacksVTable from IDL then you should be able to use inheritance. There is no need to avoid using virtual function table for this.
EWS Watchlist
Comment 19
2018-12-13 20:51:09 PST
Comment hidden (obsolete)
Comment on
attachment 357289
[details]
Patch
Attachment 357289
[details]
did not pass mac-ews (mac): Output:
https://webkit-queues.webkit.org/results/10392035
New failing tests: js/dom/dom-static-property-for-in-iteration.html css-typedom/sameobject.html css-typedom/attributeStyleMap.html
EWS Watchlist
Comment 20
2018-12-13 20:51:11 PST
Comment hidden (obsolete)
Created
attachment 357296
[details]
Archive of layout-test-results from ews103 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 21
2018-12-13 21:32:06 PST
Comment hidden (obsolete)
Comment on
attachment 357289
[details]
Patch
Attachment 357289
[details]
did not pass mac-debug-ews (mac): Output:
https://webkit-queues.webkit.org/results/10392140
New failing tests: js/dom/dom-static-property-for-in-iteration.html css-typedom/sameobject.html css-typedom/attributeStyleMap.html
EWS Watchlist
Comment 22
2018-12-13 21:32:08 PST
Comment hidden (obsolete)
Created
attachment 357298
[details]
Archive of layout-test-results from ews112 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-sierra Platform: Mac OS X 10.12.6
Justin Michaud
Comment 23
2018-12-14 13:32:12 PST
(In reply to Ryosuke Niwa from
comment #18
)
> (In reply to Justin Michaud from
comment #16
) > > (In reply to Ryosuke Niwa from
comment #5
) > > > > > > Why do we need a separate object for this? Why can't > > > StylePropertyMapReadOnly simply provide some overridable virtual functions > > > instead? > > > Is the intent that multiple StylePropertyMapReadOnly would share a simple > > > implementation? > > > When would that happen? > > > > This is more for bindings. StylePropertyMap inherits from > > StylePropertyMapReadOnly, and I didn't want to have to disable bindings > > hardening or write my own toJS function. I think (?) that I would need to do > > at least one of those things if I tried to pass a subclass of > > StylePropertyMap to toJS. > > Just remove ImplementationLacksVTable from IDL then you should be able to > use inheritance. There is no need to avoid using virtual function table for > this.
I did need to disable binding hardening, although since there are no IDL subclasses, thankfully I don't need a custom toJS function like in TypedOMCSSStyleValue.
Justin Michaud
Comment 24
2018-12-14 14:18:41 PST
Created
attachment 357343
[details]
Patch
Justin Michaud
Comment 25
2018-12-14 14:21:00 PST
Once the bots pass, I am going to roll the bindings generator changes into a separate patch.
Justin Michaud
Comment 26
2018-12-14 15:10:46 PST
Created
attachment 357345
[details]
Patch
Justin Michaud
Comment 27
2018-12-14 15:16:01 PST
Created
attachment 357347
[details]
Patch
EWS Watchlist
Comment 28
2018-12-14 18:11:34 PST
Comment hidden (obsolete)
Comment on
attachment 357347
[details]
Patch
Attachment 357347
[details]
did not pass win-ews (win): Output:
https://webkit-queues.webkit.org/results/10404832
New failing tests: css-typedom/sameobject.html css-typedom/attributeStyleMap.html
EWS Watchlist
Comment 29
2018-12-14 18:11:45 PST
Comment hidden (obsolete)
Created
attachment 357368
[details]
Archive of layout-test-results from ews206 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews206 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Ryosuke Niwa
Comment 30
2018-12-17 13:04:10 PST
Huh, css-typedom/attributeStyleMap.html is failing on Windows. Do we know why what's happening here?
Justin Michaud
Comment 31
2018-12-17 14:44:44 PST
(In reply to Ryosuke Niwa from
comment #30
)
> Huh, css-typedom/attributeStyleMap.html is failing on Windows. Do we know > why what's happening here?
The feature flag only works with WK2, but I forgot to change the windows test expectations.
Ryosuke Niwa
Comment 32
2018-12-17 14:54:25 PST
Comment on
attachment 357347
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357347&action=review
> Source/WebCore/ChangeLog:18 > + * css/ElementCSSInlineStyle.idl:
You're missing an entry for CodeGeneratorJS.pm. Please add it with a description as to what you're changing.
> Source/WebCore/css/typedom/StylePropertyMap.h:38 > +public:
I don't think we need to have this access specifier.
> Source/WebCore/dom/StyledElement.cpp:89 > + auto* registered = element.document().getCSSRegisteredCustomPropertySet().get(name);
Nit: we should probably address this in a separate patch but our coding guideline mandates that this function, which doesn't have an out argument, to not have "get" prefix:
https://webkit.org/code-style-guidelines/#names-out-argument
> Source/WebCore/platform/graphics/CustomPaintImage.cpp:62 > +static RefPtr<TypedOMCSSStyleValue> extractComputedProperty(const String& name, Element& element)
Can we share this code with the one in StyledElement.cpp e.g. using a template? It's not great to duplicate this much code in two places.
Justin Michaud
Comment 33
2018-12-17 22:41:07 PST
Created
attachment 357538
[details]
Patch
Justin Michaud
Comment 34
2018-12-17 22:49:08 PST
Created
attachment 357539
[details]
Patch
Justin Michaud
Comment 35
2018-12-18 10:01:30 PST
Created
attachment 357574
[details]
Patch
WebKit Commit Bot
Comment 36
2018-12-18 10:51:14 PST
Comment on
attachment 357574
[details]
Patch Clearing flags on attachment: 357574 Committed
r239341
: <
https://trac.webkit.org/changeset/239341
>
WebKit Commit Bot
Comment 37
2018-12-18 10:51:16 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 38
2018-12-18 10:52:47 PST
<
rdar://problem/46815119
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug