Bug 1236991 - part 5: <output> elements don't submit, and so shouldn't get form validation errors in tooltips, r?enndeakin
MozReview-Commit-ID: 9tUxAeiidYA
--- a/embedding/browser/nsDocShellTreeOwner.cpp
+++ b/embedding/browser/nsDocShellTreeOwner.cpp
@@ -1104,26 +1104,28 @@ nsDefaultTooltipTextProvider::GetNodeTex
// If the element implement the constraint validation API and has no title,
// show the validation message, if any.
nsCOMPtr<nsIConstraintValidation> cvElement = do_QueryInterface(current);
if (cvElement) {
nsCOMPtr<nsIContent> content = do_QueryInterface(cvElement);
nsCOMPtr<nsIAtom> titleAtom = NS_Atomize("title");
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(content);
- bool formHasNoValidate = false;
- mozilla::dom::Element* form = formControl->GetFormElement();
- if (form) {
- nsCOMPtr<nsIAtom> noValidateAtom = NS_Atomize("novalidate");
- formHasNoValidate = form->HasAttr(kNameSpaceID_None, noValidateAtom);
- }
+ if (formControl->IsSubmittableControl()) {
+ bool formHasNoValidate = false;
+ mozilla::dom::Element* form = formControl->GetFormElement();
+ if (form) {
+ nsCOMPtr<nsIAtom> noValidateAtom = NS_Atomize("novalidate");
+ formHasNoValidate = form->HasAttr(kNameSpaceID_None, noValidateAtom);
+ }
- if (!content->HasAttr(kNameSpaceID_None, titleAtom) && !formHasNoValidate) {
- cvElement->GetValidationMessage(outText);
- found = !outText.IsEmpty();
+ if (!content->HasAttr(kNameSpaceID_None, titleAtom) && !formHasNoValidate) {
+ cvElement->GetValidationMessage(outText);
+ found = !outText.IsEmpty();
+ }
}
}
while (!found && current) {
nsCOMPtr<nsIDOMElement> currElement(do_QueryInterface(current));
if (currElement) {
nsCOMPtr<nsIContent> content(do_QueryInterface(currElement));
if (content) {