Changeset 202197 in webkit


Ignore:
Timestamp:
Jun 17, 2016 10:53:28 PM (8 years ago)
Author:
benjamin@webkit.org
Message:

:indeterminate pseudo-class should match radios whose group has no checked radio
https://bugs.webkit.org/show_bug.cgi?id=156270

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

  • web-platform-tests/html/semantics/selectors/pseudo-classes/indeterminate-expected.txt:

One more pass on official tests :)

Source/WebCore:

The pseudo-class ":indeterminate" is supposed to match radio buttons
for which the entire group has no checked button.
Spec: https://html.spec.whatwg.org/#pseudo-classes:selector-indeterminate

The change is straightforward with one non-obvious choice:
I added matchesIndeterminatePseudoClass() in addition to shouldAppearIndeterminate().

The reason is shouldAppearIndeterminate() is used for styling and AX of elements
with an indeterminate states (check boxes and progress element). There is no such
UI for radio boxes.
I could have extended shouldAppearIndeterminate() to radio box
then filter out this case in RenderTheme. The problem is doing that would also requires
changes to the repaint logic to match :indeterminate. It seemed overkill to me to
change repaint() for a case that is never used in practice.

Tests: fast/css/pseudo-indeterminate-radio-buttons-basics.html

fast/css/pseudo-indeterminate-with-radio-buttons-style-invalidation.html
fast/selectors/detached-radio-button-checked-and-indeterminate-states.html
fast/selectors/pseudo-indeterminate-with-radio-buttons-style-update.html

  • css/SelectorCheckerTestFunctions.h:

(WebCore::shouldAppearIndeterminate):

  • dom/Element.cpp:

(WebCore::Element::matchesIndeterminatePseudoClass):

  • dom/Element.h:
  • dom/RadioButtonGroups.cpp:

(WebCore::RadioButtonGroup::setCheckedButton):
(WebCore::RadioButtonGroup::updateCheckedState):
(WebCore::RadioButtonGroup::remove):
(WebCore::RadioButtonGroup::setNeedsStyleRecalcForAllButtons):
(WebCore::RadioButtonGroups::hasCheckedButton):

  • dom/RadioButtonGroups.h:
  • html/CheckboxInputType.cpp:

(WebCore::CheckboxInputType::matchesIndeterminatePseudoClass):
(WebCore::CheckboxInputType::shouldAppearIndeterminate):
(WebCore::CheckboxInputType::supportsIndeterminateAppearance): Deleted.

  • html/CheckboxInputType.h:
  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::setChecked):
(WebCore::HTMLInputElement::matchesIndeterminatePseudoClass):
(WebCore::HTMLInputElement::shouldAppearIndeterminate):
(WebCore::HTMLInputElement::radioButtonGroups):

  • html/HTMLInputElement.h:
  • html/InputType.cpp:

(WebCore::InputType::matchesIndeterminatePseudoClass):
(WebCore::InputType::shouldAppearIndeterminate):
(WebCore::InputType::supportsIndeterminateAppearance): Deleted.

  • html/InputType.h:
  • html/RadioInputType.cpp:

(WebCore::RadioInputType::matchesIndeterminatePseudoClass):
(WebCore::RadioInputType::willDispatchClick): Deleted.
(WebCore::RadioInputType::didDispatchClick): Deleted.
(WebCore::RadioInputType::supportsIndeterminateAppearance): Deleted.
The iOS specific code is just plain wrong.
It was changing the indeterminate state of the input element.
The spec clearly says that state is only used by checkbox:
https://html.spec.whatwg.org/#dom-input-indeterminate

Moreover, the style update would not change the indeterminate state
of other buttons in the Button Group, which is just bizarre.
RenderThemeIOS does not make use of any of this with the current style.

  • html/RadioInputType.h:
  • style/StyleSharingResolver.cpp:

(WebCore::Style::SharingResolver::canShareStyleWithElement):
(WebCore::Style::canShareStyleWithControl): Deleted.
(WebCore::Style::SharingResolver::sharingCandidateHasIdenticalStyleAffectingAttributes): Deleted.
Style sharing is unified behind the selector matching which is neat.

LayoutTests:

There are two important aspect to cover for this change:
1) The style is updated correctly when a Button Group composition change.
2) When the checkness changes for a Button Group, all its elements

are invalidated to match :indeterminate.

  • fast/forms/radio/indeterminate-radio.html:

This test was verifying that the property "indeterminate" of the input element
is not reflected to the style through :indeterminate.
I updated the test to still verify that except that we now match :indeterminate
before changing the property.

  • fast/css/pseudo-indeterminate-radio-buttons-basics-expected.html: Added.
  • fast/css/pseudo-indeterminate-radio-buttons-basics.html: Added.
  • fast/css/pseudo-indeterminate-with-radio-buttons-style-invalidation-expected.txt: Added.
  • fast/css/pseudo-indeterminate-with-radio-buttons-style-invalidation.html: Added.

Verify that we don't invalidate everything when the checked button changes.
We only need to invalidate everything if the checked state of the whole group changes.

  • fast/selectors/detached-radio-button-checked-and-indeterminate-states-expected.txt: Added.
  • fast/selectors/detached-radio-button-checked-and-indeterminate-states.html: Added.
  • fast/selectors/pseudo-indeterminate-with-radio-buttons-style-update-expected.txt: Added.
  • fast/selectors/pseudo-indeterminate-with-radio-buttons-style-update.html: Added.
Location:
trunk
Files:
8 added
1 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202196 r202197  
     12016-06-17  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        :indeterminate pseudo-class should match radios whose group has no checked radio
     4        https://bugs.webkit.org/show_bug.cgi?id=156270
     5
     6        Reviewed by Simon Fraser.
     7
     8        There are two important aspect to cover for this change:
     9        1) The style is updated correctly when a Button Group composition change.
     10        2) When the checkness changes for a Button Group, all its elements
     11           are invalidated to match :indeterminate.
     12
     13        * fast/forms/radio/indeterminate-radio.html:
     14        This test was verifying that the property "indeterminate" of the input element
     15        is not reflected to the style through :indeterminate.
     16        I updated the test to still verify that except that we now match :indeterminate
     17        before changing the property.
     18
     19        * fast/css/pseudo-indeterminate-radio-buttons-basics-expected.html: Added.
     20        * fast/css/pseudo-indeterminate-radio-buttons-basics.html: Added.
     21
     22        * fast/css/pseudo-indeterminate-with-radio-buttons-style-invalidation-expected.txt: Added.
     23        * fast/css/pseudo-indeterminate-with-radio-buttons-style-invalidation.html: Added.
     24        Verify that we don't invalidate everything when the checked button changes.
     25        We only need to invalidate everything if the checked state of the whole group changes.
     26
     27        * fast/selectors/detached-radio-button-checked-and-indeterminate-states-expected.txt: Added.
     28        * fast/selectors/detached-radio-button-checked-and-indeterminate-states.html: Added.
     29        * fast/selectors/pseudo-indeterminate-with-radio-buttons-style-update-expected.txt: Added.
     30        * fast/selectors/pseudo-indeterminate-with-radio-buttons-style-update.html: Added.
     31
    1322016-06-17  Commit Queue  <commit-queue@webkit.org>
    233
  • trunk/LayoutTests/fast/forms/radio/indeterminate-radio.html

    r121008 r202197  
    2828        try
    2929        {
    30 
    31         document.getElementsByTagName("input")[0].indeterminate = true;
    32 
    3330        function ArrayContains(array, value, ci)
    3431        {
     
    4744            return false;
    4845        }
     46
    4947        var target = document.getElementById("test");
    5048        var val = getComputedStyle(target, null).getPropertyValue("color");
    51         var aExpectedValues = new Array("green", "#008000", "rgb(0, 128, 0)");
     49        var aExpectedValues = new Array("red", "#FF0000", "rgb(255, 0, 0)");
     50        let wasIndeterminate = ArrayContains(aExpectedValues, val, true);
    5251
    53         if (ArrayContains(aExpectedValues, val, true))
     52        document.getElementsByTagName("input")[0].indeterminate = true;
     53
     54        if (wasIndeterminate && ArrayContains(aExpectedValues, val, true))
    5455        {
    5556
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r202162 r202197  
     12016-06-17  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        :indeterminate pseudo-class should match radios whose group has no checked radio
     4        https://bugs.webkit.org/show_bug.cgi?id=156270
     5
     6        Reviewed by Simon Fraser.
     7
     8        * web-platform-tests/html/semantics/selectors/pseudo-classes/indeterminate-expected.txt:
     9        One more pass on official tests :)
     10
    1112016-06-17  Youenn Fablet  <youenn.fablet@crf.canon.fr>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/indeterminate-expected.txt

    r189476 r202197  
    11       
    22
    3 FAIL ':progress' matches <input>s radio buttons whose radio button group contains no checked input and <progress> elements without value attribute assert_array_equals: lengths differ, expected 5 got 1
    4 FAIL dynamically check a radio input in a radio button group assert_array_equals: lengths differ, expected 3 got 1
     3PASS ':progress' matches <input>s radio buttons whose radio button group contains no checked input and <progress> elements without value attribute
     4PASS dynamically check a radio input in a radio button group
    55FAIL click on radio4 which is in the indeterminate state assert_array_equals: lengths differ, expected 2 got 1
    66PASS adding a value to progress1 should put it in a determinate state
  • trunk/Source/WebCore/ChangeLog

    r202196 r202197  
     12016-06-17  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        :indeterminate pseudo-class should match radios whose group has no checked radio
     4        https://bugs.webkit.org/show_bug.cgi?id=156270
     5
     6        Reviewed by Simon Fraser.
     7
     8        The pseudo-class ":indeterminate" is supposed to match radio buttons
     9        for which the entire group has no checked button.
     10        Spec: https://html.spec.whatwg.org/#pseudo-classes:selector-indeterminate
     11
     12        The change is straightforward with one non-obvious choice:
     13        I added matchesIndeterminatePseudoClass() in addition to shouldAppearIndeterminate().
     14
     15        The reason is shouldAppearIndeterminate() is used for styling and AX of elements
     16        with an indeterminate states (check boxes and progress element). There is no such
     17        UI for radio boxes.
     18        I could have extended shouldAppearIndeterminate() to radio box
     19        then filter out this case in RenderTheme. The problem is doing that would also requires
     20        changes to the repaint logic to match :indeterminate. It seemed overkill to me to
     21        change repaint() for a case that is never used in practice.
     22
     23        Tests: fast/css/pseudo-indeterminate-radio-buttons-basics.html
     24               fast/css/pseudo-indeterminate-with-radio-buttons-style-invalidation.html
     25               fast/selectors/detached-radio-button-checked-and-indeterminate-states.html
     26               fast/selectors/pseudo-indeterminate-with-radio-buttons-style-update.html
     27
     28        * css/SelectorCheckerTestFunctions.h:
     29        (WebCore::shouldAppearIndeterminate):
     30        * dom/Element.cpp:
     31        (WebCore::Element::matchesIndeterminatePseudoClass):
     32        * dom/Element.h:
     33        * dom/RadioButtonGroups.cpp:
     34        (WebCore::RadioButtonGroup::setCheckedButton):
     35        (WebCore::RadioButtonGroup::updateCheckedState):
     36        (WebCore::RadioButtonGroup::remove):
     37        (WebCore::RadioButtonGroup::setNeedsStyleRecalcForAllButtons):
     38        (WebCore::RadioButtonGroups::hasCheckedButton):
     39        * dom/RadioButtonGroups.h:
     40        * html/CheckboxInputType.cpp:
     41        (WebCore::CheckboxInputType::matchesIndeterminatePseudoClass):
     42        (WebCore::CheckboxInputType::shouldAppearIndeterminate):
     43        (WebCore::CheckboxInputType::supportsIndeterminateAppearance): Deleted.
     44        * html/CheckboxInputType.h:
     45        * html/HTMLInputElement.cpp:
     46        (WebCore::HTMLInputElement::setChecked):
     47        (WebCore::HTMLInputElement::matchesIndeterminatePseudoClass):
     48        (WebCore::HTMLInputElement::shouldAppearIndeterminate):
     49        (WebCore::HTMLInputElement::radioButtonGroups):
     50        * html/HTMLInputElement.h:
     51        * html/InputType.cpp:
     52        (WebCore::InputType::matchesIndeterminatePseudoClass):
     53        (WebCore::InputType::shouldAppearIndeterminate):
     54        (WebCore::InputType::supportsIndeterminateAppearance): Deleted.
     55        * html/InputType.h:
     56        * html/RadioInputType.cpp:
     57        (WebCore::RadioInputType::matchesIndeterminatePseudoClass):
     58        (WebCore::RadioInputType::willDispatchClick): Deleted.
     59        (WebCore::RadioInputType::didDispatchClick): Deleted.
     60        (WebCore::RadioInputType::supportsIndeterminateAppearance): Deleted.
     61        The iOS specific code is just plain wrong.
     62        It was changing the indeterminate state of the input element.
     63        The spec clearly says that state is only used by checkbox:
     64        https://html.spec.whatwg.org/#dom-input-indeterminate
     65
     66        Moreover, the style update would not change the indeterminate state
     67        of other buttons in the Button Group, which is just bizarre.
     68        RenderThemeIOS does not make use of any of this with the current style.
     69
     70        * html/RadioInputType.h:
     71        * style/StyleSharingResolver.cpp:
     72        (WebCore::Style::SharingResolver::canShareStyleWithElement):
     73        (WebCore::Style::canShareStyleWithControl): Deleted.
     74        (WebCore::Style::SharingResolver::sharingCandidateHasIdenticalStyleAffectingAttributes): Deleted.
     75        Style sharing is unified behind the selector matching which is neat.
     76
    1772016-06-17  Commit Queue  <commit-queue@webkit.org>
    278
  • trunk/Source/WebCore/css/SelectorChecker.cpp

    r202091 r202197  
    984984            return isChecked(element);
    985985        case CSSSelector::PseudoClassIndeterminate:
    986             return shouldAppearIndeterminate(element);
     986            return matchesIndeterminatePseudoClass(element);
    987987        case CSSSelector::PseudoClassRoot:
    988988            if (&element == element.document().documentElement())
  • trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h

    r197952 r202197  
    11/*
    2  * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
    33 * Copyright (C) 2014 Dhi Aurrahman <diorahman@rockybars.com>
    44 *
     
    222222}
    223223
    224 ALWAYS_INLINE bool shouldAppearIndeterminate(const Element& element)
    225 {
    226     return element.shouldAppearIndeterminate();
     224ALWAYS_INLINE bool matchesIndeterminatePseudoClass(const Element& element)
     225{
     226    return element.matchesIndeterminatePseudoClass();
    227227}
    228228
  • trunk/Source/WebCore/cssjit/SelectorCompiler.cpp

    r202091 r202197  
    559559        return FunctionType::SimpleSelectorChecker;
    560560    case CSSSelector::PseudoClassIndeterminate:
    561         fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(shouldAppearIndeterminate));
     561        fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(matchesIndeterminatePseudoClass));
    562562        return FunctionType::SimpleSelectorChecker;
    563563    case CSSSelector::PseudoClassInvalid:
  • trunk/Source/WebCore/dom/Element.cpp

    r202160 r202197  
    55 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    66 *           (C) 2007 David Smith (catfish.man@gmail.com)
    7  * Copyright (C) 2004-2015 Apple Inc. All rights reserved.
     7 * Copyright (C) 2004-2016 Apple Inc. All rights reserved.
    88 *           (C) 2007 Eric Seidel (eric@webkit.org)
    99 *
     
    27562756}
    27572757
     2758bool Element::matchesIndeterminatePseudoClass() const
     2759{
     2760    return shouldAppearIndeterminate();
     2761}
     2762
    27582763bool Element::matches(const String& selector, ExceptionCode& ec)
    27592764{
  • trunk/Source/WebCore/dom/Element.h

    r202091 r202197  
    44 *           (C) 2001 Peter Kelly (pmk@post.com)
    55 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    6  * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013, 2014 Apple Inc. All rights reserved.
     6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013, 2014, 2016 Apple Inc. All rights reserved.
    77 *
    88 * This library is free software; you can redistribute it and/or
     
    387387
    388388    virtual bool matchesReadWritePseudoClass() const;
     389    virtual bool matchesIndeterminatePseudoClass() const;
    389390    bool matches(const String& selectors, ExceptionCode&);
    390391    Element* closest(const String& selectors, ExceptionCode&);
  • trunk/Source/WebCore/dom/RadioButtonGroups.cpp

    r201659 r202197  
    11/*
    2  * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2008, 2009, 2016 Apple Inc. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    4343
    4444private:
     45    void setNeedsStyleRecalcForAllButtons();
    4546    void updateValidityForAllButtons();
    4647    bool isValid() const;
     48    void changeCheckedButton(HTMLInputElement*);
    4749    void setCheckedButton(HTMLInputElement*);
    4850
     
    7678    if (oldCheckedButton == button)
    7779        return;
     80
     81    bool hadCheckedButton = m_checkedButton;
     82    bool willHaveCheckedButton = button;
     83    if (hadCheckedButton != willHaveCheckedButton)
     84        setNeedsStyleRecalcForAllButtons();
     85
    7886    m_checkedButton = button;
    7987    if (oldCheckedButton)
     
    111119    else {
    112120        if (m_checkedButton == button)
    113             m_checkedButton = nullptr;
     121            setCheckedButton(nullptr);
    114122    }
    115123    if (wasValid != isValid())
     
    138146    if (it == m_members.end())
    139147        return;
     148
    140149    bool wasValid = isValid();
    141150    m_members.remove(it);
     
    144153        --m_requiredCount;
    145154    }
    146     if (m_checkedButton == button)
    147         m_checkedButton = nullptr;
     155    if (m_checkedButton) {
     156        button->setNeedsStyleRecalc();
     157        if (m_checkedButton == button) {
     158            m_checkedButton = nullptr;
     159            setNeedsStyleRecalcForAllButtons();
     160        }
     161    }
    148162
    149163    if (m_members.isEmpty()) {
     
    159173}
    160174
     175void RadioButtonGroup::setNeedsStyleRecalcForAllButtons()
     176{
     177    for (auto& button : m_members) {
     178        ASSERT(button->isRadioButton());
     179        button->setNeedsStyleRecalc();
     180    }
     181}
     182
    161183void RadioButtonGroup::updateValidityForAllButtons()
    162184{
     
    249271    RadioButtonGroup* group = m_nameToGroupMap->get(name.impl());
    250272    return group ? group->checkedButton() : nullptr;
     273}
     274
     275bool RadioButtonGroups::hasCheckedButton(const HTMLInputElement* element) const
     276{
     277    ASSERT(element->isRadioButton());
     278    const AtomicString& name = element->name();
     279    if (name.isEmpty() || !m_nameToGroupMap)
     280        return element->checked();
     281
     282    const RadioButtonGroup* group = m_nameToGroupMap->get(name.impl());
     283    return group->checkedButton();
    251284}
    252285
  • trunk/Source/WebCore/dom/RadioButtonGroups.h

    r201659 r202197  
    4040    void removeButton(HTMLInputElement*);
    4141    HTMLInputElement* checkedButtonForGroup(const AtomicString& groupName) const;
     42    bool hasCheckedButton(const HTMLInputElement*) const;
    4243    bool isInRequiredGroup(HTMLInputElement*) const;
    4344    Vector<HTMLInputElement*> groupMembers(const HTMLInputElement&) const;
  • trunk/Source/WebCore/html/CheckboxInputType.cpp

    r158171 r202197  
    9393}
    9494
    95 bool CheckboxInputType::supportsIndeterminateAppearance() const
     95bool CheckboxInputType::matchesIndeterminatePseudoClass() const
    9696{
    97     return true;
     97    return shouldAppearIndeterminate();
     98}
     99
     100bool CheckboxInputType::shouldAppearIndeterminate() const
     101{
     102    return element().indeterminate();
    98103}
    99104
  • trunk/Source/WebCore/html/CheckboxInputType.h

    r197563 r202197  
    4848    void didDispatchClick(Event*, const InputElementClickState&) override;
    4949    bool isCheckbox() const override;
    50     bool supportsIndeterminateAppearance() const override;
     50    bool matchesIndeterminatePseudoClass() const override;
     51    bool shouldAppearIndeterminate() const override;
    5152};
    5253
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r202159 r202197  
    862862
    863863    if (RadioButtonGroups* buttons = radioButtonGroups())
    864             buttons->updateCheckedState(this);
     864        buttons->updateCheckedState(this);
    865865    if (renderer() && renderer()->style().hasAppearance())
    866866        renderer()->theme().stateChanged(*renderer(), ControlStates::CheckedState);
     
    17641764}
    17651765
     1766bool HTMLInputElement::matchesIndeterminatePseudoClass() const
     1767{
     1768    // For input elements, matchesIndeterminatePseudoClass()
     1769    // is not equivalent to shouldAppearIndeterminate() because of radio button.
     1770    //
     1771    // A group of radio button without any checked button is indeterminate
     1772    // for the :indeterminate selector. On the other hand, RenderTheme
     1773    // currently only supports single element being indeterminate.
     1774    // Because of this, radio is indetermindate for CSS but not for render theme.
     1775    return m_inputType->matchesIndeterminatePseudoClass();
     1776}
     1777
    17661778bool HTMLInputElement::shouldAppearIndeterminate() const
    17671779{
    1768     return m_inputType->supportsIndeterminateAppearance() && indeterminate();
     1780    return m_inputType->shouldAppearIndeterminate();
    17691781}
    17701782
     
    18021814{
    18031815    if (!isRadioButton())
    1804         return 0;
     1816        return nullptr;
    18051817    if (HTMLFormElement* formElement = form())
    18061818        return &formElement->radioButtonGroups();
    18071819    if (inDocument())
    18081820        return &document().formController().radioButtonGroups();
    1809     return 0;
     1821    return nullptr;
    18101822}
    18111823
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r201942 r202197  
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    44 *           (C) 2000 Dirk Mueller (mueller@kde.org)
    5  * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
     5 * Copyright (C) 2004, 2005, 2006, 2007, 2010, 2016 Apple Inc. All rights reserved.
    66 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
    77 *
     
    163163    // shouldAppearChecked is used by the rendering tree/CSS while checked() is used by JS to determine checked state
    164164    bool shouldAppearChecked() const;
     165    bool matchesIndeterminatePseudoClass() const final;
    165166    bool shouldAppearIndeterminate() const final;
    166167
     
    275276    HTMLInputElement* checkedRadioButtonForGroup() const;
    276277    bool isInRequiredRadioButtonGroup();
     278    // Returns null if this isn't associated with any radio button group.
     279    RadioButtonGroups* radioButtonGroups() const;
    277280
    278281    // Functions for InputType classes.
     
    423426    void updateValueIfNeeded();
    424427
    425     // Returns null if this isn't associated with any radio button group.
    426     RadioButtonGroups* radioButtonGroups() const;
    427428    void addToRadioButtonGroup();
    428429    void removeFromRadioButtonGroup();
  • trunk/Source/WebCore/html/InputType.cpp

    r202143 r202197  
    967967#endif
    968968
    969 bool InputType::supportsIndeterminateAppearance() const
     969bool InputType::matchesIndeterminatePseudoClass() const
     970{
     971    return false;
     972}
     973
     974bool InputType::shouldAppearIndeterminate() const
    970975{
    971976    return false;
  • trunk/Source/WebCore/html/InputType.h

    r200041 r202197  
    268268    virtual void updateAutoFillButton();
    269269    virtual String defaultToolTip() const;
    270     virtual bool supportsIndeterminateAppearance() const;
     270    virtual bool matchesIndeterminatePseudoClass() const;
     271    virtual bool shouldAppearIndeterminate() const;
    271272    virtual bool supportsSelectionAPI() const;
    272273    virtual Color valueAsColor() const;
  • trunk/Source/WebCore/html/RadioInputType.cpp

    r195524 r202197  
    11/*
    2  * Copyright (C) 2005, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2011, 2016 Apple Inc. All rights reserved.
    33 * Copyright (C) 2010 Google Inc. All rights reserved.
    44 *
     
    152152    state.checkedRadioButton = element().checkedRadioButtonForGroup();
    153153
    154 #if PLATFORM(IOS)
    155     state.indeterminate = element().indeterminate();
    156 
    157     if (element().indeterminate())
    158         element().setIndeterminate(false);
    159 #endif
    160 
    161154    element().setChecked(true, DispatchChangeEvent);
    162155}
     
    174167            checkedRadioButton->setChecked(true);
    175168        }
    176 
    177 #if PLATFORM(IOS)       
    178         element().setIndeterminate(state.indeterminate);
    179 #endif
    180 
    181169    }
    182170
     
    190178}
    191179
    192 bool RadioInputType::supportsIndeterminateAppearance() const
     180bool RadioInputType::matchesIndeterminatePseudoClass() const
    193181{
    194 #if PLATFORM(IOS)
    195     return true;
    196 #else
    197     return false;
    198 #endif
     182    const HTMLInputElement& element = this->element();
     183    if (const RadioButtonGroups* radioButtonGroups = element.radioButtonGroups())
     184        return !radioButtonGroups->hasCheckedButton(&element);
     185    return !element.checked();
    199186}
    200187
  • trunk/Source/WebCore/html/RadioInputType.h

    r197563 r202197  
    11/*
    22 * Copyright (C) 2010 Google Inc. All rights reserved.
     3 * Copyright (C) 2016 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    5253    void didDispatchClick(Event*, const InputElementClickState&) override;
    5354    bool isRadioButton() const override;
    54     bool supportsIndeterminateAppearance() const override;
     55    bool matchesIndeterminatePseudoClass() const override;
    5556};
    5657
  • trunk/Source/WebCore/style/StyleSharingResolver.cpp

    r202091 r202197  
    180180    if (thisInputElement.shouldAppearChecked() != otherInputElement.shouldAppearChecked())
    181181        return false;
    182     if (thisInputElement.shouldAppearIndeterminate() != otherInputElement.shouldAppearIndeterminate())
    183         return false;
    184182    if (thisInputElement.isRequired() != otherInputElement.isRequired())
    185183        return false;
     
    282280
    283281    if (element.matchesInvalidPseudoClass() != element.matchesValidPseudoClass())
     282        return false;
     283
     284    if (candidateElement.matchesIndeterminatePseudoClass() != element.matchesIndeterminatePseudoClass())
    284285        return false;
    285286
     
    330331        return false;
    331332
    332     if (element.hasTagName(HTMLNames::progressTag)) {
    333         if (element.shouldAppearIndeterminate() != sharingCandidate.shouldAppearIndeterminate())
    334             return false;
    335     }
    336 
    337333    return true;
    338334}
Note: See TracChangeset for help on using the changeset viewer.