2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-09-19 05:47:15 +04:00
|
|
|
|
2013-09-25 15:21:22 +04:00
|
|
|
#include "mozilla/BasicEvents.h"
|
2014-03-18 08:48:21 +04:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-04-03 08:18:36 +04:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-02-08 20:34:47 +04:00
|
|
|
#include "mozilla/dom/HTMLFieldSetElement.h"
|
2013-02-08 20:34:48 +04:00
|
|
|
#include "mozilla/dom/HTMLFieldSetElementBinding.h"
|
2013-03-17 11:55:11 +04:00
|
|
|
#include "nsContentList.h"
|
2015-04-15 19:47:03 +03:00
|
|
|
#include "nsQueryObject.h"
|
1998-09-30 03:22:42 +04:00
|
|
|
|
2004-05-19 02:23:49 +04:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2013-02-08 20:34:47 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
HTMLFieldSetElement::HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2004-05-19 00:58:12 +04:00
|
|
|
: nsGenericHTMLFormElement(aNodeInfo)
|
2015-05-15 17:01:29 +03:00
|
|
|
, mElements(nullptr)
|
|
|
|
, mFirstLegend(nullptr)
|
2013-08-17 04:32:47 +04:00
|
|
|
, mInvalidElementsCount(0)
|
1998-09-30 03:22:42 +04:00
|
|
|
{
|
2010-09-10 09:08:56 +04:00
|
|
|
// <fieldset> is always barred from constraint validation.
|
2011-10-17 18:59:28 +04:00
|
|
|
SetBarredFromConstraintValidation(true);
|
2011-06-01 05:46:57 +04:00
|
|
|
|
2013-08-17 04:32:47 +04:00
|
|
|
// We start out enabled and valid.
|
|
|
|
AddStatesSilently(NS_EVENT_STATE_ENABLED | NS_EVENT_STATE_VALID);
|
1998-09-30 03:22:42 +04:00
|
|
|
}
|
|
|
|
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::~HTMLFieldSetElement()
|
1998-09-30 03:22:42 +04:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t length = mDependentElements.Length();
|
|
|
|
for (uint32_t i = 0; i < length; ++i) {
|
2010-11-05 20:15:05 +03:00
|
|
|
mDependentElements[i]->ForgetFieldSet(this);
|
|
|
|
}
|
1998-09-30 03:22:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
|
2014-04-25 20:49:00 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement, nsGenericHTMLFormElement,
|
2015-05-15 17:01:29 +03:00
|
|
|
mValidity, mElements)
|
2010-09-15 11:55:48 +04:00
|
|
|
|
2013-02-08 20:34:47 +04:00
|
|
|
NS_IMPL_ADDREF_INHERITED(HTMLFieldSetElement, Element)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(HTMLFieldSetElement, Element)
|
2010-01-12 16:08:43 +03:00
|
|
|
|
2013-02-08 20:34:47 +04:00
|
|
|
// QueryInterface implementation for HTMLFieldSetElement
|
|
|
|
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement)
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_INTERFACE_TABLE_INHERITED(HTMLFieldSetElement,
|
|
|
|
nsIDOMHTMLFieldSetElement,
|
|
|
|
nsIConstraintValidation)
|
2013-08-08 00:23:08 +04:00
|
|
|
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElement)
|
1998-09-30 03:22:42 +04:00
|
|
|
|
2013-02-08 20:34:47 +04:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLFieldSetElement)
|
1998-09-30 03:22:42 +04:00
|
|
|
|
2010-09-15 11:54:20 +04:00
|
|
|
|
2013-02-08 20:34:47 +04:00
|
|
|
NS_IMPL_BOOL_ATTR(HTMLFieldSetElement, Disabled, disabled)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLFieldSetElement, Name, name)
|
1998-09-30 03:22:42 +04:00
|
|
|
|
2010-08-21 22:52:49 +04:00
|
|
|
// nsIConstraintValidation
|
2013-02-08 20:34:47 +04:00
|
|
|
NS_IMPL_NSICONSTRAINTVALIDATION(HTMLFieldSetElement)
|
2000-06-23 18:12:24 +04:00
|
|
|
|
2013-01-03 19:17:36 +04:00
|
|
|
bool
|
2015-08-26 15:56:59 +03:00
|
|
|
HTMLFieldSetElement::IsDisabledForEvents(EventMessage aMessage)
|
2013-01-03 19:17:36 +04:00
|
|
|
{
|
|
|
|
return IsElementDisabledForEvents(aMessage, nullptr);
|
|
|
|
}
|
|
|
|
|
2010-09-19 01:24:58 +04:00
|
|
|
// nsIContent
|
|
|
|
nsresult
|
2014-03-18 08:48:19 +04:00
|
|
|
HTMLFieldSetElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
2010-09-19 01:24:58 +04:00
|
|
|
{
|
|
|
|
// Do not process any DOM events if the element is disabled.
|
2011-10-17 18:59:28 +04:00
|
|
|
aVisitor.mCanHandle = false;
|
2015-08-22 04:34:51 +03:00
|
|
|
if (IsDisabledForEvents(aVisitor.mEvent->mMessage)) {
|
2010-09-19 01:24:58 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLFormElement::PreHandleEvent(aVisitor);
|
|
|
|
}
|
|
|
|
|
2010-09-19 01:33:16 +04:00
|
|
|
nsresult
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
const nsAttrValue* aValue, bool aNotify)
|
2010-09-19 01:33:16 +04:00
|
|
|
{
|
|
|
|
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled &&
|
|
|
|
nsINode::GetFirstChild()) {
|
|
|
|
if (!mElements) {
|
2012-07-30 18:20:58 +04:00
|
|
|
mElements = new nsContentList(this, MatchListedElements, nullptr, nullptr,
|
2011-10-17 18:59:28 +04:00
|
|
|
true);
|
2010-09-19 01:33:16 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t length = mElements->Length(true);
|
|
|
|
for (uint32_t i=0; i<length; ++i) {
|
2012-10-13 16:50:24 +04:00
|
|
|
static_cast<nsGenericHTMLFormElement*>(mElements->Item(i))
|
2011-06-01 05:46:57 +04:00
|
|
|
->FieldSetDisabledChanged(aNotify);
|
2010-09-19 01:33:16 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName,
|
|
|
|
aValue, aNotify);
|
|
|
|
}
|
|
|
|
|
2002-08-07 03:50:08 +04:00
|
|
|
// nsIDOMHTMLFieldSetElement
|
1998-09-30 03:22:42 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
1998-09-30 03:22:42 +04:00
|
|
|
{
|
2004-02-10 22:36:43 +03:00
|
|
|
return nsGenericHTMLFormElement::GetForm(aForm);
|
1998-09-30 03:22:42 +04:00
|
|
|
}
|
|
|
|
|
2010-09-15 11:55:06 +04:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::GetType(nsAString& aType)
|
2010-09-15 11:55:06 +04:00
|
|
|
{
|
|
|
|
aType.AssignLiteral("fieldset");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2010-09-15 11:55:48 +04:00
|
|
|
/* static */
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::MatchListedElements(nsIContent* aContent, int32_t aNamespaceID,
|
|
|
|
nsIAtom* aAtom, void* aData)
|
2010-09-15 11:55:48 +04:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aContent);
|
2012-06-11 03:44:50 +04:00
|
|
|
return formControl && formControl->GetType() != NS_FORM_LABEL;
|
2010-09-15 11:55:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::GetElements(nsIDOMHTMLCollection** aElements)
|
2013-02-08 20:34:48 +04:00
|
|
|
{
|
|
|
|
NS_ADDREF(*aElements = Elements());
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIHTMLCollection*
|
|
|
|
HTMLFieldSetElement::Elements()
|
2010-09-15 11:55:48 +04:00
|
|
|
{
|
|
|
|
if (!mElements) {
|
2012-07-30 18:20:58 +04:00
|
|
|
mElements = new nsContentList(this, MatchListedElements, nullptr, nullptr,
|
2011-10-17 18:59:28 +04:00
|
|
|
true);
|
2010-09-15 11:55:48 +04:00
|
|
|
}
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
return mElements;
|
2010-09-15 11:55:48 +04:00
|
|
|
}
|
|
|
|
|
1998-09-30 03:22:42 +04:00
|
|
|
// nsIFormControl
|
|
|
|
|
2001-11-02 10:40:01 +03:00
|
|
|
nsresult
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::Reset()
|
2001-11-02 10:40:01 +03:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-02-16 04:19:24 +03:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
|
2001-11-02 10:40:01 +03:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2010-09-19 05:47:15 +04:00
|
|
|
|
|
|
|
nsresult
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::InsertChildAt(nsIContent* aChild, uint32_t aIndex,
|
|
|
|
bool aNotify)
|
2010-09-19 05:47:15 +04:00
|
|
|
{
|
|
|
|
bool firstLegendHasChanged = false;
|
|
|
|
|
2015-03-03 14:08:59 +03:00
|
|
|
if (aChild->IsHTMLElement(nsGkAtoms::legend)) {
|
2010-09-19 05:47:15 +04:00
|
|
|
if (!mFirstLegend) {
|
|
|
|
mFirstLegend = aChild;
|
|
|
|
// We do not want to notify the first time mFirstElement is set.
|
|
|
|
} else {
|
|
|
|
// If mFirstLegend is before aIndex, we do not change it.
|
|
|
|
// Otherwise, mFirstLegend is now aChild.
|
2012-08-22 19:56:38 +04:00
|
|
|
if (int32_t(aIndex) <= IndexOf(mFirstLegend)) {
|
2010-09-19 05:47:15 +04:00
|
|
|
mFirstLegend = aChild;
|
|
|
|
firstLegendHasChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult rv = nsGenericHTMLFormElement::InsertChildAt(aChild, aIndex, aNotify);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
if (firstLegendHasChanged) {
|
2010-10-08 14:19:34 +04:00
|
|
|
NotifyElementsForFirstLegendChange(aNotify);
|
2010-09-19 05:47:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2012-03-30 01:09:07 +04:00
|
|
|
void
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
|
2010-09-19 05:47:15 +04:00
|
|
|
{
|
|
|
|
bool firstLegendHasChanged = false;
|
|
|
|
|
2010-10-21 15:11:01 +04:00
|
|
|
if (mFirstLegend && (GetChildAt(aIndex) == mFirstLegend)) {
|
2010-09-19 05:47:15 +04:00
|
|
|
// If we are removing the first legend we have to found another one.
|
2010-10-21 15:11:01 +04:00
|
|
|
nsIContent* child = mFirstLegend->GetNextSibling();
|
2012-07-30 18:20:58 +04:00
|
|
|
mFirstLegend = nullptr;
|
2010-10-21 15:11:01 +04:00
|
|
|
firstLegendHasChanged = true;
|
|
|
|
|
|
|
|
for (; child; child = child->GetNextSibling()) {
|
2015-03-03 14:08:59 +03:00
|
|
|
if (child->IsHTMLElement(nsGkAtoms::legend)) {
|
2010-09-19 05:47:15 +04:00
|
|
|
mFirstLegend = child;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-30 01:09:07 +04:00
|
|
|
nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify);
|
2010-09-19 05:47:15 +04:00
|
|
|
|
|
|
|
if (firstLegendHasChanged) {
|
2010-10-08 14:19:34 +04:00
|
|
|
NotifyElementsForFirstLegendChange(aNotify);
|
2010-09-19 05:47:15 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-17 04:32:47 +04:00
|
|
|
void
|
|
|
|
HTMLFieldSetElement::AddElement(nsGenericHTMLFormElement* aElement)
|
|
|
|
{
|
|
|
|
mDependentElements.AppendElement(aElement);
|
|
|
|
|
2013-10-16 20:43:37 +04:00
|
|
|
// If the element that we are adding aElement is a fieldset, then all the
|
|
|
|
// invalid elements in aElement are also invalid elements of this.
|
|
|
|
HTMLFieldSetElement* fieldSet = FromContent(aElement);
|
|
|
|
if (fieldSet) {
|
|
|
|
if (fieldSet->mInvalidElementsCount > 0) {
|
|
|
|
// The order we call UpdateValidity and adjust mInvalidElementsCount is
|
|
|
|
// important. We need to first call UpdateValidity in case
|
|
|
|
// mInvalidElementsCount was 0 before the call and will be incremented to
|
|
|
|
// 1 and so we need to change state to invalid. After that is done, we
|
|
|
|
// are free to increment mInvalidElementsCount to the correct amount.
|
|
|
|
UpdateValidity(false);
|
|
|
|
mInvalidElementsCount += fieldSet->mInvalidElementsCount - 1;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-08-17 04:32:47 +04:00
|
|
|
// We need to update the validity of the fieldset.
|
|
|
|
nsCOMPtr<nsIConstraintValidation> cvElmt = do_QueryObject(aElement);
|
|
|
|
if (cvElmt &&
|
|
|
|
cvElmt->IsCandidateForConstraintValidation() && !cvElmt->IsValid()) {
|
|
|
|
UpdateValidity(false);
|
|
|
|
}
|
2013-10-16 20:43:37 +04:00
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
int32_t debugInvalidElementsCount = 0;
|
|
|
|
for (uint32_t i = 0; i < mDependentElements.Length(); i++) {
|
|
|
|
HTMLFieldSetElement* fieldSet = FromContent(mDependentElements[i]);
|
|
|
|
if (fieldSet) {
|
|
|
|
debugInvalidElementsCount += fieldSet->mInvalidElementsCount;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIConstraintValidation>
|
|
|
|
cvElmt = do_QueryObject(mDependentElements[i]);
|
|
|
|
if (cvElmt &&
|
|
|
|
cvElmt->IsCandidateForConstraintValidation() &&
|
|
|
|
!(cvElmt->IsValid())) {
|
|
|
|
debugInvalidElementsCount += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(debugInvalidElementsCount == mInvalidElementsCount);
|
|
|
|
#endif
|
2013-08-17 04:32:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HTMLFieldSetElement::RemoveElement(nsGenericHTMLFormElement* aElement)
|
|
|
|
{
|
|
|
|
mDependentElements.RemoveElement(aElement);
|
|
|
|
|
2013-10-16 20:43:37 +04:00
|
|
|
// If the element that we are removing aElement is a fieldset, then all the
|
|
|
|
// invalid elements in aElement are also removed from this.
|
|
|
|
HTMLFieldSetElement* fieldSet = FromContent(aElement);
|
|
|
|
if (fieldSet) {
|
|
|
|
if (fieldSet->mInvalidElementsCount > 0) {
|
|
|
|
// The order we update mInvalidElementsCount and call UpdateValidity is
|
|
|
|
// important. We need to first decrement mInvalidElementsCount and then
|
|
|
|
// call UpdateValidity, in case mInvalidElementsCount hits 0 in the call
|
|
|
|
// of UpdateValidity and we have to change state to valid.
|
|
|
|
mInvalidElementsCount -= fieldSet->mInvalidElementsCount - 1;
|
|
|
|
UpdateValidity(true);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-08-17 04:32:47 +04:00
|
|
|
// We need to update the validity of the fieldset.
|
|
|
|
nsCOMPtr<nsIConstraintValidation> cvElmt = do_QueryObject(aElement);
|
|
|
|
if (cvElmt &&
|
|
|
|
cvElmt->IsCandidateForConstraintValidation() && !cvElmt->IsValid()) {
|
|
|
|
UpdateValidity(true);
|
|
|
|
}
|
2013-10-16 20:43:37 +04:00
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
int32_t debugInvalidElementsCount = 0;
|
|
|
|
for (uint32_t i = 0; i < mDependentElements.Length(); i++) {
|
|
|
|
HTMLFieldSetElement* fieldSet = FromContent(mDependentElements[i]);
|
|
|
|
if (fieldSet) {
|
|
|
|
debugInvalidElementsCount += fieldSet->mInvalidElementsCount;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIConstraintValidation>
|
|
|
|
cvElmt = do_QueryObject(mDependentElements[i]);
|
|
|
|
if (cvElmt &&
|
|
|
|
cvElmt->IsCandidateForConstraintValidation() &&
|
|
|
|
!(cvElmt->IsValid())) {
|
|
|
|
debugInvalidElementsCount += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(debugInvalidElementsCount == mInvalidElementsCount);
|
|
|
|
#endif
|
2013-08-17 04:32:47 +04:00
|
|
|
}
|
|
|
|
|
2010-09-19 05:47:15 +04:00
|
|
|
void
|
2013-02-08 20:34:47 +04:00
|
|
|
HTMLFieldSetElement::NotifyElementsForFirstLegendChange(bool aNotify)
|
2010-09-19 05:47:15 +04:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* NOTE: this could be optimized if only call when the fieldset is currently
|
|
|
|
* disabled.
|
|
|
|
* This should also make sure that mElements is set when we happen to be here.
|
|
|
|
* However, this method shouldn't be called very often in normal use cases.
|
|
|
|
*/
|
|
|
|
if (!mElements) {
|
2012-07-30 18:20:58 +04:00
|
|
|
mElements = new nsContentList(this, MatchListedElements, nullptr, nullptr,
|
2011-10-17 18:59:28 +04:00
|
|
|
true);
|
2010-09-19 05:47:15 +04:00
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t length = mElements->Length(true);
|
|
|
|
for (uint32_t i = 0; i < length; ++i) {
|
2012-10-13 16:50:24 +04:00
|
|
|
static_cast<nsGenericHTMLFormElement*>(mElements->Item(i))
|
2010-10-08 14:19:34 +04:00
|
|
|
->FieldSetFirstLegendChanged(aNotify);
|
2010-09-19 05:47:15 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-17 04:32:47 +04:00
|
|
|
void
|
|
|
|
HTMLFieldSetElement::UpdateValidity(bool aElementValidity)
|
|
|
|
{
|
|
|
|
if (aElementValidity) {
|
|
|
|
--mInvalidElementsCount;
|
|
|
|
} else {
|
|
|
|
++mInvalidElementsCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(mInvalidElementsCount >= 0);
|
|
|
|
|
|
|
|
// The fieldset validity has just changed if:
|
|
|
|
// - there are no more invalid elements ;
|
|
|
|
// - or there is one invalid elmement and an element just became invalid.
|
|
|
|
if (!mInvalidElementsCount || (mInvalidElementsCount == 1 && !aElementValidity)) {
|
|
|
|
UpdateState(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// We should propagate the change to the fieldset parent chain.
|
|
|
|
if (mFieldSet) {
|
|
|
|
mFieldSet->UpdateValidity(aElementValidity);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-04-03 08:18:36 +04:00
|
|
|
EventStates
|
2013-08-17 04:32:47 +04:00
|
|
|
HTMLFieldSetElement::IntrinsicState() const
|
|
|
|
{
|
2014-04-03 08:18:36 +04:00
|
|
|
EventStates state = nsGenericHTMLFormElement::IntrinsicState();
|
2013-08-17 04:32:47 +04:00
|
|
|
|
|
|
|
if (mInvalidElementsCount) {
|
|
|
|
state |= NS_EVENT_STATE_INVALID;
|
|
|
|
} else {
|
|
|
|
state |= NS_EVENT_STATE_VALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
HTMLFieldSetElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-02-08 20:34:48 +04:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
return HTMLFieldSetElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 20:34:48 +04:00
|
|
|
}
|
|
|
|
|
2013-02-08 20:34:47 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|