Bug 74914 - :invalid style is not applied when a checked radio button is removed from its radio group
Summary: :invalid style is not applied when a checked radio button is removed from its...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kent Tamura
URL:
Keywords:
Depends on: 74909
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-19 22:05 PST by Kent Tamura
Modified: 2012-01-24 18:07 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2011-12-19 22:05:28 PST
Repro:

<style>
:valid {
  border: solid 2px lime;
}
:invalid {
  border: solid 2px red;
}
input[type="radio"] {
 -webkit-appearance: none;
 width: 16px;
 height: 16px;
}
input[type="radio"]:checked {
  background-color: blue;
}
</style>
<body>
<form id=f>
<input type=radio name=n1 value=a id=a required>
<input type=radio name=n1 value=b id=b checked>
</form>
<script>
function $(id) { return document.getElementById(id); }

$('b').parentNode.removeChild($('b'));

</script>
</body>


This HTML causes an assertion failure with a debug build:

ASSERTION FAILED: m_isValid == validity()->valid()
/Volumes/d2/WebKit/Source/WebCore/html/HTMLFormControlElement.cpp(433) : virtual bool WebCore::HTMLFormControlElement::isValidFormControlElement()
1   0x102fab0d8 WebCore::HTMLFormControlElement::isValidFormControlElement()
2   0x102b32304 WebCore::SelectorChecker::checkOneSelector(WebCore::CSSSelector*, WebCore::Element*, WebCore::PseudoId&, bool, WebCore::SelectorChecker::VisitedMatchType, WebCore::RenderStyle*, WebCore::RenderStyle*) const
3   0x102b2fcfb WebCore::SelectorChecker::checkSelector(WebCore::CSSSelector*, WebCore::Element*, WebCore::PseudoId&, bool, WebCore::SelectorChecker::VisitedMatchType, WebCore::RenderStyle*, WebCore::RenderStyle*) const
4   0x102c16ff0 WebCore::CSSStyleSelector::checkSelector(WebCore::RuleData const&)
5   0x102bf5a82 WebCore::CSSStyleSelector::matchRulesForList(WTF::Vector<WebCore::RuleData, 0ul> const*, int&, int&, bool)
6   0x102bf5fca WebCore::CSSStyleSelector::matchRules(WebCore::RuleSet*, int&, int&, bool)
7   0x102bf6f55 WebCore::CSSStyleSelector::matchAllRules(WebCore::CSSStyleSelector::MatchResult&)
8   0x102bf8809 WebCore::CSSStyleSelector::styleForElement(WebCore::Element*, WebCore::RenderStyle*, bool, bool, WebCore::RenderRegion*)
9   0x102e3afb9 WebCore::Element::styleForRenderer()
10  0x102e3b44d WebCore::Element::recalcStyle(WebCore::Node::StyleChange)
11 ...

We need to call HTMLInputElement::updateCheckedRadioButtons() when a checked radio button is removed from the group.
Comment 1 Kent Tamura 2011-12-19 22:10:59 PST
This happens when the "name" attribute value of the checked radio button is changed, too.
Comment 2 Kent Tamura 2012-01-24 18:07:35 PST
This was fixed by http://trac.webkit.org/changeset/105710