Summary: | Radio button groups are not scoped by shadow boundaries | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jonathan Lin <jonathan> | ||||||
Component: | Forms | Assignee: | Ryosuke Niwa <rniwa> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | cdumez, dbates, esprehn+autocc, ews-watchlist, gyuyoung.kim, hubert.sablonniere, kangil.han, koivisto, mifenton, mjs, rniwa, timothy, tkent, webkit-bug-importer, wenson_hsieh | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | Safari 12 | ||||||||
Hardware: | Mac | ||||||||
OS: | macOS 10.14 | ||||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=202942 | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 148695 | ||||||||
Attachments: |
|
Description
Jonathan Lin
2019-07-08 01:00:33 PDT
Hi Webkit team, I may have the same bug. I created a reduced test case here: https://jsbin.com/wequqojaca/1/edit?html,css,js,output The thing is, if I have a custom element with shadow DOM and if this component contains input[type=radio], all the inputs (cross shadow DOM) are in the same group. It is not the case in Chrome and Firefox. Anyone knows what the spec says and if it's a bug? Created attachment 380182 [details]
Fixes the bug
Comment on attachment 380182 [details] Fixes the bug View in context: https://bugs.webkit.org/attachment.cgi?id=380182&action=review This patch looks good. > Source/WebCore/dom/RadioButtonGroups.h:34 > + WTF_MAKE_FAST_ALLOCATED; Ok as-is, Because of comment below there is no need make this change. No harm in doing so though the optimal Solution would be to defer making this change until a fix needs it. > Source/WebCore/dom/TreeScope.h:142 > + std::unique_ptr<RadioButtonGroups> m_radioButtonGroups; The optimal solution is to not use a std::unique_ptr and just use the type because: 1. Sizeof(RadioButtonGroups) == sizeof(void*) == "small data type". 2. Avoids cost of dereference. 3. m_radioButoonGroup is never re-assigned. 4. Makes the code easier to understand since no need to reason about nullptr or lazy alloc strategy. Comment on attachment 380182 [details] Fixes the bug View in context: https://bugs.webkit.org/attachment.cgi?id=380182&action=review >> Source/WebCore/dom/TreeScope.h:142 >> + std::unique_ptr<RadioButtonGroups> m_radioButtonGroups; > > The optimal solution is to not use a std::unique_ptr and just use the type because: > > 1. Sizeof(RadioButtonGroups) == sizeof(void*) == "small data type". > 2. Avoids cost of dereference. > 3. m_radioButoonGroup is never re-assigned. > 4. Makes the code easier to understand since no need to reason about nullptr or lazy alloc strategy. Oh, that's a good point for this patch. My plan is to get rid of unique_ptr in RadioButtonGroups, and I really don't want to include RadioButtonGroups.h here. Created attachment 380183 [details]
Fix GTK+/WPT builds
Comment on attachment 380183 [details] Fix GTK+/WPT builds Clearing flags on attachment: 380183 Committed r250708: <https://trac.webkit.org/changeset/250708> All reviewed patches have been landed. Closing bug. Great news, thanks team!! I hope my jsbin helped :p |