Bug 1685926 - Group disconnected radio buttons together. r=saschanaz,smaug

Differential Revision: https://phabricator.services.mozilla.com/D162349
This commit is contained in:
Adam Vandolder
2023-09-25 14:39:08 +00:00
parent 6479d19081
commit 305c6a88bf
19 changed files with 388 additions and 423 deletions

View File

@@ -28,6 +28,7 @@
#include "mozilla/dom/ConstraintValidation.h"
#include "mozilla/dom/FileInputType.h"
#include "mozilla/dom/HiddenInputType.h"
#include "mozilla/dom/RadioGroupContainer.h"
#include "nsGenericHTMLElement.h"
#include "nsImageLoadingContent.h"
#include "nsCOMPtr.h"
@@ -35,7 +36,6 @@
#include "nsIContentPrefService2.h"
#include "nsContentUtils.h"
class nsIRadioGroupContainer;
class nsIRadioVisitor;
namespace mozilla {
@@ -277,8 +277,9 @@ class HTMLInputElement final : public TextControlElement,
void SetCheckedChangedInternal(bool aCheckedChanged);
bool GetCheckedChanged() const { return mCheckedChanged; }
void AddedToRadioGroup();
void WillRemoveFromRadioGroup();
void AddToRadioGroup();
void RemoveFromRadioGroup();
void DisconnectRadioGroupContainer();
/**
* Helper function returning the currently selected button in the radio group.
@@ -1144,12 +1145,15 @@ class HTMLInputElement final : public TextControlElement,
}
/**
* Returns the radio group container if the element has one, null otherwise.
* The radio group container will be the form owner if there is one.
* The current document otherwise.
* @return the radio group container if the element has one, null otherwise.
* Returns the radio group container within the DOM tree that the element
* is currently a member of, if one exists.
*/
nsIRadioGroupContainer* GetRadioGroupContainer() const;
RadioGroupContainer* GetCurrentRadioGroupContainer() const;
/**
* Returns the radio group container within the DOM tree that the element
* should be added into, if one exists.
*/
RadioGroupContainer* FindTreeRadioGroupContainer() const;
/**
* Parse a color string of the form #XXXXXX where X should be hexa characters
@@ -1633,6 +1637,12 @@ class HTMLInputElement final : public TextControlElement,
*/
static bool IsDateTimeTypeSupported(FormControlType);
/**
* The radio group container containing the group the element is a part of.
* This allows the element to only access a container it has been added to.
*/
RadioGroupContainer* mRadioGroupContainer;
struct nsFilePickerFilter {
nsFilePickerFilter() : mFilterMask(0) {}