Bug 870787 - Improve named getter for form, r=bz

This commit is contained in:
Andrea Marchesini
2013-06-18 08:53:23 -04:00
parent 605387888b
commit 2c1e22a84a
16 changed files with 568 additions and 266 deletions

View File

@@ -32,6 +32,7 @@
#include "nsEscape.h"
#include "mozilla/dom/Comment.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/HTMLTemplateElement.h"
#include "nsHtml5SVGLoadDispatcher.h"
#include "nsIURI.h"
@@ -441,6 +442,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
nsIContent* node = *(mOne.node);
nsIContent* parent = *(mTwo.node);
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(node));
nsCOMPtr<nsIDOMHTMLImageElement> domImageElement = do_QueryInterface(node);
// NS_ASSERTION(formControl, "Form-associated element did not implement nsIFormControl.");
// TODO: uncomment the above line when <keygen> (bug 101019) is supported by Gecko
nsCOMPtr<nsIDOMHTMLFormElement> formElement(do_QueryInterface(parent));
@@ -449,7 +451,13 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
if (formControl &&
!node->HasAttr(kNameSpaceID_None, nsGkAtoms::form)) {
formControl->SetForm(formElement);
} else if (domImageElement) {
nsRefPtr<dom::HTMLImageElement> imageElement =
static_cast<dom::HTMLImageElement*>(domImageElement.get());
MOZ_ASSERT(imageElement);
imageElement->SetForm(formElement);
}
return rv;
}
case eTreeOpAppendText: {