Bug 156270 - :indeterminate pseudo-class should match radios whose group has no checked radio
Summary: :indeterminate pseudo-class should match radios whose group has no checked radio
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Benjamin Poulain
URL: http://codepen.io/cvrebert/pen/RajYgY
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2016-04-05 17:56 PDT by Chris Rebert
Modified: 2016-06-17 22:53 PDT (History)
4 users (show)

See Also:


Attachments
Screenshot of incorrect rendering in WebKit Nightly (282.49 KB, image/png)
2016-04-05 17:56 PDT, Chris Rebert
no flags Details
Screenshot of correct rendering in Chrome (87.02 KB, image/png)
2016-04-05 17:56 PDT, Chris Rebert
no flags Details
Patch (90.50 KB, patch)
2016-06-17 19:05 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews125 for ios-simulator-wk2 (585.52 KB, application/zip)
2016-06-17 20:06 PDT, Build Bot
no flags Details
Patch (91.28 KB, patch)
2016-06-17 20:41 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Rebert 2016-04-05 17:56:03 PDT
Created attachment 275732 [details]
Screenshot of incorrect rendering in WebKit Nightly

Per the HTML spec, the :indeterminate CSS pseudo-class should match (among other cases) when:
> * <input> elements whose `type` attribute is in the Radio Button state and whose
>       radio button group contains no elements whose checkedness state is true.

But WebKit doesn't currently make :indeterminate match in that case.


Steps to reproduce:
1. Open the testcase in WebKit Nightly.
2. Observe both instances of the word "Green".

Expected result:
Both words should have a green background-color.
(See attached Chrome screenshot.)

Actual result:
Both words have a white background-color.
(See attached WebKit Nightly screenshot.)
Comment 1 Chris Rebert 2016-04-05 17:56:50 PDT
Created attachment 275733 [details]
Screenshot of correct rendering in Chrome
Comment 2 Benjamin Poulain 2016-06-17 19:05:34 PDT
Created attachment 281601 [details]
Patch
Comment 3 Simon Fraser (smfr) 2016-06-17 19:26:04 PDT
Comment on attachment 281601 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=281601&action=review

> Source/WebCore/dom/RadioButtonGroups.cpp:82
> +    bool hadCheckedButton = !!m_checkedButton;
> +    bool willHaveCheckedButton = !!button;

No need for !! in C++

> Source/WebCore/dom/RadioButtonGroups.cpp:283
> +    return !!group->checkedButton();

No need for !!
Comment 4 Benjamin Poulain 2016-06-17 19:59:38 PDT
Thanks for the review.

> > Source/WebCore/dom/RadioButtonGroups.cpp:82
> > +    bool hadCheckedButton = !!m_checkedButton;
> > +    bool willHaveCheckedButton = !!button;
> 
> No need for !! in C++

It is just to make the conversion explicit.
Especially in this case where
    m_checkedButton == button
is incorrect but 
    !!m_checkedButton == !!button
is correct.
Comment 5 Build Bot 2016-06-17 20:06:15 PDT
Comment on attachment 281601 [details]
Patch

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

New failing tests:
imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/indeterminate-radio.html
Comment 6 Build Bot 2016-06-17 20:06:18 PDT
Created attachment 281602 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.4
Comment 7 Benjamin Poulain 2016-06-17 20:41:54 PDT
Created attachment 281605 [details]
Patch
Comment 8 WebKit Commit Bot 2016-06-17 22:53:31 PDT
Comment on attachment 281605 [details]
Patch

Clearing flags on attachment: 281605

Committed r202197: <http://trac.webkit.org/changeset/202197>
Comment 9 WebKit Commit Bot 2016-06-17 22:53:35 PDT
All reviewed patches have been landed.  Closing bug.