| Index: Source/core/dom/CheckedRadioButtons.cpp
|
| diff --git a/Source/core/dom/CheckedRadioButtons.cpp b/Source/core/dom/CheckedRadioButtons.cpp
|
| index c377b7a2988ba207f3f06055adce0856abc8cb23..aaaf1fb45579de4d8955007cce7e29cee224020a 100644
|
| --- a/Source/core/dom/CheckedRadioButtons.cpp
|
| +++ b/Source/core/dom/CheckedRadioButtons.cpp
|
| @@ -32,19 +32,20 @@ public:
|
| static PassOwnPtr<RadioButtonGroup> create();
|
| bool isEmpty() const { return m_members.isEmpty(); }
|
| bool isRequired() const { return m_requiredCount; }
|
| - HTMLInputElement* checkedButton() const { return m_checkedButton; }
|
| - void add(HTMLInputElement*);
|
| - void updateCheckedState(HTMLInputElement*);
|
| - void requiredAttributeChanged(HTMLInputElement*);
|
| - void remove(HTMLInputElement*);
|
| - bool contains(HTMLInputElement*) const;
|
| + Result<HTMLInputElement> checkedButton() const { return Handle<HTMLInputElement>(m_checkedButton); } // FIXME(oilpan): Remove Handle<>().
|
| + void add(Handle<HTMLInputElement>);
|
| + void updateCheckedState(Handle<HTMLInputElement>);
|
| + void requiredAttributeChanged(Handle<HTMLInputElement>);
|
| + void remove(Handle<HTMLInputElement>);
|
| + bool contains(Handle<HTMLInputElement>) const;
|
|
|
| private:
|
| RadioButtonGroup();
|
| void setNeedsValidityCheckForAllButtons();
|
| bool isValid() const;
|
| - void setCheckedButton(HTMLInputElement*);
|
| + void setCheckedButton(Handle<HTMLInputElement>);
|
|
|
| + // FIXME(oilpan): Move RadioButtonGroup to the heap and use Members.
|
| HashSet<HTMLInputElement*> m_members;
|
| HTMLInputElement* m_checkedButton;
|
| size_t m_requiredCount;
|
| @@ -66,20 +67,20 @@ inline bool RadioButtonGroup::isValid() const
|
| return !isRequired() || m_checkedButton;
|
| }
|
|
|
| -void RadioButtonGroup::setCheckedButton(HTMLInputElement* button)
|
| +void RadioButtonGroup::setCheckedButton(Handle<HTMLInputElement> button)
|
| {
|
| - HTMLInputElement* oldCheckedButton = m_checkedButton;
|
| + Handle<HTMLInputElement> oldCheckedButton = Handle<HTMLInputElement>(m_checkedButton); // FIXME(oilpan): Remove Handle<>().
|
| if (oldCheckedButton == button)
|
| return;
|
| - m_checkedButton = button;
|
| + m_checkedButton = button.raw();
|
| if (oldCheckedButton)
|
| oldCheckedButton->setChecked(false);
|
| }
|
|
|
| -void RadioButtonGroup::add(HTMLInputElement* button)
|
| +void RadioButtonGroup::add(Handle<HTMLInputElement> button)
|
| {
|
| ASSERT(button->isRadioButton());
|
| - if (!m_members.add(button).isNewEntry)
|
| + if (!m_members.add(button.raw()).isNewEntry)
|
| return;
|
| bool groupWasValid = isValid();
|
| if (button->isRequired())
|
| @@ -97,25 +98,25 @@ void RadioButtonGroup::add(HTMLInputElement* button)
|
| }
|
| }
|
|
|
| -void RadioButtonGroup::updateCheckedState(HTMLInputElement* button)
|
| +void RadioButtonGroup::updateCheckedState(Handle<HTMLInputElement> button)
|
| {
|
| ASSERT(button->isRadioButton());
|
| - ASSERT(m_members.contains(button));
|
| + ASSERT(m_members.contains(button.raw()));
|
| bool wasValid = isValid();
|
| if (button->checked())
|
| setCheckedButton(button);
|
| else {
|
| - if (m_checkedButton == button)
|
| + if (m_checkedButton == button.raw())
|
| m_checkedButton = 0;
|
| }
|
| if (wasValid != isValid())
|
| setNeedsValidityCheckForAllButtons();
|
| }
|
|
|
| -void RadioButtonGroup::requiredAttributeChanged(HTMLInputElement* button)
|
| +void RadioButtonGroup::requiredAttributeChanged(Handle<HTMLInputElement> button)
|
| {
|
| ASSERT(button->isRadioButton());
|
| - ASSERT(m_members.contains(button));
|
| + ASSERT(m_members.contains(button.raw()));
|
| bool wasValid = isValid();
|
| if (button->isRequired())
|
| ++m_requiredCount;
|
| @@ -127,10 +128,10 @@ void RadioButtonGroup::requiredAttributeChanged(HTMLInputElement* button)
|
| setNeedsValidityCheckForAllButtons();
|
| }
|
|
|
| -void RadioButtonGroup::remove(HTMLInputElement* button)
|
| +void RadioButtonGroup::remove(Handle<HTMLInputElement> button)
|
| {
|
| ASSERT(button->isRadioButton());
|
| - HashSet<HTMLInputElement*>::iterator it = m_members.find(button);
|
| + HashSet<HTMLInputElement*>::iterator it = m_members.find(button.raw());
|
| if (it == m_members.end())
|
| return;
|
| bool wasValid = isValid();
|
| @@ -139,7 +140,7 @@ void RadioButtonGroup::remove(HTMLInputElement* button)
|
| ASSERT(m_requiredCount);
|
| --m_requiredCount;
|
| }
|
| - if (m_checkedButton == button)
|
| + if (m_checkedButton == button.raw())
|
| m_checkedButton = 0;
|
|
|
| if (m_members.isEmpty()) {
|
| @@ -159,15 +160,15 @@ void RadioButtonGroup::setNeedsValidityCheckForAllButtons()
|
| typedef HashSet<HTMLInputElement*>::const_iterator Iterator;
|
| Iterator end = m_members.end();
|
| for (Iterator it = m_members.begin(); it != end; ++it) {
|
| - HTMLInputElement* button = *it;
|
| + Handle<HTMLInputElement> button = Handle<HTMLInputElement>(*it); // FIXME(oilpan): Remove Handle<>().
|
| ASSERT(button->isRadioButton());
|
| button->setNeedsValidityCheck();
|
| }
|
| }
|
|
|
| -bool RadioButtonGroup::contains(HTMLInputElement* button) const
|
| +bool RadioButtonGroup::contains(Handle<HTMLInputElement> button) const
|
| {
|
| - return m_members.contains(button);
|
| + return m_members.contains(button.raw());
|
| }
|
|
|
| // ----------------------------------------------------------------
|
| @@ -183,7 +184,7 @@ CheckedRadioButtons::~CheckedRadioButtons()
|
| {
|
| }
|
|
|
| -void CheckedRadioButtons::addButton(HTMLInputElement* element)
|
| +void CheckedRadioButtons::addButton(Handle<HTMLInputElement> element)
|
| {
|
| ASSERT(element->isRadioButton());
|
| if (element->name().isEmpty())
|
| @@ -198,7 +199,7 @@ void CheckedRadioButtons::addButton(HTMLInputElement* element)
|
| group->add(element);
|
| }
|
|
|
| -void CheckedRadioButtons::updateCheckedState(HTMLInputElement* element)
|
| +void CheckedRadioButtons::updateCheckedState(Handle<HTMLInputElement> element)
|
| {
|
| ASSERT(element->isRadioButton());
|
| if (element->name().isEmpty())
|
| @@ -211,7 +212,7 @@ void CheckedRadioButtons::updateCheckedState(HTMLInputElement* element)
|
| group->updateCheckedState(element);
|
| }
|
|
|
| -void CheckedRadioButtons::requiredAttributeChanged(HTMLInputElement* element)
|
| +void CheckedRadioButtons::requiredAttributeChanged(Handle<HTMLInputElement> element)
|
| {
|
| ASSERT(element->isRadioButton());
|
| if (element->name().isEmpty())
|
| @@ -224,16 +225,16 @@ void CheckedRadioButtons::requiredAttributeChanged(HTMLInputElement* element)
|
| group->requiredAttributeChanged(element);
|
| }
|
|
|
| -HTMLInputElement* CheckedRadioButtons::checkedButtonForGroup(const AtomicString& name) const
|
| +Result<HTMLInputElement> CheckedRadioButtons::checkedButtonForGroup(const AtomicString& name) const
|
| {
|
| if (!m_nameToGroupMap)
|
| - return 0;
|
| + return nullptr;
|
| m_nameToGroupMap->checkConsistency();
|
| RadioButtonGroup* group = m_nameToGroupMap->get(name.impl());
|
| - return group ? group->checkedButton() : 0;
|
| + return group ? group->checkedButton() : nullptr;
|
| }
|
|
|
| -bool CheckedRadioButtons::isInRequiredGroup(HTMLInputElement* element) const
|
| +bool CheckedRadioButtons::isInRequiredGroup(Handle<HTMLInputElement> element) const
|
| {
|
| ASSERT(element->isRadioButton());
|
| if (element->name().isEmpty())
|
| @@ -244,7 +245,7 @@ bool CheckedRadioButtons::isInRequiredGroup(HTMLInputElement* element) const
|
| return group && group->isRequired() && group->contains(element);
|
| }
|
|
|
| -void CheckedRadioButtons::removeButton(HTMLInputElement* element)
|
| +void CheckedRadioButtons::removeButton(Handle<HTMLInputElement> element)
|
| {
|
| ASSERT(element->isRadioButton());
|
| if (element->name().isEmpty())
|
|
|