RESOLVED FIXED 156230
:default CSS pseudo-class should match checkboxes+radios with a `checked` attribute
https://bugs.webkit.org/show_bug.cgi?id=156230
Summary :default CSS pseudo-class should match checkboxes+radios with a `checked` att...
Chris Rebert
Reported 2016-04-04 22:41:34 PDT
Created attachment 275642 [details] Testcase demonstrating the bug Per https://html.spec.whatwg.org/multipage/scripting.html#selector-default , the `:default:` CSS pseudo-class should match (among other things): > * <input> elements to which the `checked` attribute applies and that have a `checked` attribute But WebKit doesn't currently seem to make :default match in such cases. Steps to reproduce: 1. Open the attached testcase in WebKit Nightly. Expected result: The text "Green", adjacent to the pre-checked checkbox and the pre-checked radio button, should have a green outline. Actual result: The text "Green" has a red outline.
Attachments
Testcase demonstrating the bug (645 bytes, text/html)
2016-04-04 22:41 PDT, Chris Rebert
no flags
Screenshot of incorrect rendering in WebKit Nightly (122.94 KB, image/png)
2016-04-04 22:44 PDT, Chris Rebert
no flags
Screenshot of correct rendering in Firefox (420.82 KB, image/png)
2016-04-04 22:47 PDT, Chris Rebert
no flags
Patch (73.10 KB, patch)
2016-06-19 15:53 PDT, Benjamin Poulain
no flags
Patch for landing (73.13 KB, patch)
2016-06-20 14:28 PDT, Benjamin Poulain
benjamin: commit-queue+
Chris Rebert
Comment 1 2016-04-04 22:44:03 PDT
Created attachment 275643 [details] Screenshot of incorrect rendering in WebKit Nightly
Chris Rebert
Comment 2 2016-04-04 22:47:04 PDT
Created attachment 275644 [details] Screenshot of correct rendering in Firefox
Chris Rebert
Comment 3 2016-04-04 22:48:03 PDT
(Chrome Canary and Firefox both render the testcase correctly.)
Radar WebKit Bug Importer
Comment 4 2016-04-06 08:32:14 PDT
Benjamin Poulain
Comment 6 2016-06-19 15:53:47 PDT
Alex Christensen
Comment 7 2016-06-20 09:56:16 PDT
Comment on attachment 281624 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=281624&action=review > Source/WebCore/html/HTMLInputElement.cpp:828 > + if (m_inputType->canBeSuccessfulSubmitButton()) Should we assert m_inputType here like we do in parseAttribute? Same in isSuccessfulSubmitButton.
Alex Christensen
Comment 8 2016-06-20 10:05:19 PDT
Comment on attachment 281624 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=281624&action=review > LayoutTests/fast/selectors/default-style-update-expected.txt:130 > +PASS elementsStyledWithDefaultSelector() is ["button3", "input2", "input8", "option1", "option2", "option4"] Chrome canary fails here. Firefox developer edition fails much earlier. Please look into these differences.
Benjamin Poulain
Comment 9 2016-06-20 10:39:20 PDT
(In reply to comment #8) > Comment on attachment 281624 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=281624&action=review > > > LayoutTests/fast/selectors/default-style-update-expected.txt:130 > > +PASS elementsStyledWithDefaultSelector() is ["button3", "input2", "input8", "option1", "option2", "option4"] > > Chrome canary fails here. Firefox developer edition fails much earlier. > Please look into these differences. Firefox fails here because it does not style radio and checkbox properly. You can see that their selector matching is fine but not styling. Chrome fails because its CSS implementation is incredibly buggy. It rarely handles style update properly.
Benjamin Poulain
Comment 10 2016-06-20 14:28:04 PDT
Created attachment 281678 [details] Patch for landing
Benjamin Poulain
Comment 11 2016-06-20 14:30:45 PDT
Note You need to log in before you can comment on or make changes to this bug.