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.
Created attachment 275643 [details] Screenshot of incorrect rendering in WebKit Nightly
Created attachment 275644 [details] Screenshot of correct rendering in Firefox
(Chrome Canary and Firefox both render the testcase correctly.)
<rdar://problem/25576746>
See also http://w3c-test.org/html/semantics/selectors/pseudo-classes/default.html
Created attachment 281624 [details] Patch
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.
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.
(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.
Created attachment 281678 [details] Patch for landing
Committed r202245: <http://trac.webkit.org/changeset/202245>