summaryrefslogtreecommitdiffstats
path: root/dom/base/RadioGroupContainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/RadioGroupContainer.cpp')
-rw-r--r--dom/base/RadioGroupContainer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/dom/base/RadioGroupContainer.cpp b/dom/base/RadioGroupContainer.cpp
index 3bb4d7da20..988c8186f9 100644
--- a/dom/base/RadioGroupContainer.cpp
+++ b/dom/base/RadioGroupContainer.cpp
@@ -8,6 +8,7 @@
#include "mozilla/dom/RadioGroupContainer.h"
#include "mozilla/dom/TreeOrderedArrayInlines.h"
#include "mozilla/Assertions.h"
+#include "nsIFrame.h"
#include "nsIRadioVisitor.h"
#include "nsRadioVisitor.h"
@@ -125,7 +126,9 @@ nsresult RadioGroupContainer::GetNextRadioButton(
index = 0;
}
radio = radioGroup->mRadioButtons->ElementAt(index);
- } while (radio->Disabled() && radio != currentRadio);
+ } while ((radio->Disabled() || !radio->GetPrimaryFrame() ||
+ !radio->GetPrimaryFrame()->IsVisibleConsideringAncestors()) &&
+ radio != currentRadio);
radio.forget(aRadioOut);
return NS_OK;
@@ -135,7 +138,8 @@ HTMLInputElement* RadioGroupContainer::GetFirstRadioButton(
const nsAString& aName) {
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
for (HTMLInputElement* radio : radioGroup->mRadioButtons.AsList()) {
- if (!radio->Disabled()) {
+ if (!radio->Disabled() && radio->GetPrimaryFrame() &&
+ radio->GetPrimaryFrame()->IsVisibleConsideringAncestors()) {
return radio;
}
}