Bug 605277 - Do not show the form validation error message in the tooltip if title is set. r+a=sicking

This commit is contained in:
Mounir Lamouri
2010-11-15 23:56:01 +01:00
parent 202fa008e1
commit 1b47c42ebc
3 changed files with 19 additions and 10 deletions

View File

@@ -1105,12 +1105,16 @@ DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnichar **aText,
PRBool found = PR_FALSE;
nsCOMPtr<nsIDOMNode> current ( aNode );
// If the element implement the constraint validation API,
// show the validation message, if any, instead of the title.
// 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) {
cvElement->GetValidationMessage(outText);
found = !outText.IsEmpty();
nsCOMPtr<nsIContent> content = do_QueryInterface(cvElement);
nsCOMPtr<nsIAtom> titleAtom = do_GetAtom("title");
if (content->HasAttr(kNameSpaceID_None, titleAtom)) {
cvElement->GetValidationMessage(outText);
found = !outText.IsEmpty();
}
}
while ( !found && current ) {