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)
|
2017-04-01 05:49:00 +03:00
|
|
|
: nsGenericHTMLFormElement(aNodeInfo, NS_FORM_FIELDSET)
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2017-09-01 02:29:22 +03:00
|
|
|
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement,
|
|
|
|
nsGenericHTMLFormElement,
|
|
|
|
nsIConstraintValidation)
|
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-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
|
2016-10-21 05:11:07 +03:00
|
|
|
HTMLFieldSetElement::GetEventTargetParent(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;
|
|
|
|
}
|
|
|
|
|
2016-10-21 05:11:07 +03:00
|
|
|
return nsGenericHTMLFormElement::GetEventTargetParent(aVisitor);
|
2010-09-19 01:24:58 +04:00
|
|
|
}
|
|
|
|
|
2010-09-19 01:33:16 +04:00
|
|
|
nsresult
|
2017-10-03 01:05:19 +03:00
|
|
|
HTMLFieldSetElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
2017-05-19 00:09:01 +03:00
|
|
|
const nsAttrValue* aValue,
|
2017-10-10 00:33:38 +03:00
|
|
|
const nsAttrValue* aOldValue,
|
|
|
|
nsIPrincipal* aSubjectPrincipal,
|
|
|
|
bool aNotify)
|
2010-09-19 01:33:16 +04:00
|
|
|
{
|
Bug 1375599 - Change IsDisabled() to look at NS_EVENT_STATE_DISABLED instead of the "disabled" attribute. r=bz
In order to speed up IsDisabled(), instead of querying for the @disabled
attribute, we're now using the NS_EVENT_STATE_DISABLED flag to know whether an
element is disabled.
It is safe to use the NS_EVENT_STATE_DISABLED flag for the following reasons:
- For form elements, nsGenericHTMLFormElement::IsDisabled() is only called on
form elements that can be disabled; form elements that can't be disabled
overrides IsDisabled() to return false directly.
And, before this patch, NS_EVENT_STATE_DISABLED flag is set by
nsGenericHTMLFormElement::IntrinsicState() if and only if IsDisabled() in all
cases when CanBeDisabled() is true, and when CanBeDisabled() is false then
IsDisabled() is always false and the flag is not set.
- For non form elements, optgroup and option have the flag matching
IsDisabled(). Note that option's IsDisabled() should also refer to optgroup's
(if it exists) disabled state, which was not done before this patch.
For this to work correctly, we need to set NS_EVENT_STATE_DISABLED earlier,
that is, in AfterSetAttr(), before any consumer of IsDisabled().
We also need to update the flag whenever the element's parent (e.g. fieldset or
optgroup) disabled state changes and when moving into/out of a parent
container.
Note that NS_EVENT_STATE_DISABLED/ENABLED is now part of the
EXTERNALLY_MANAGED_STATES.
MozReview-Commit-ID: KSceikeqvvU
2017-07-20 09:15:00 +03:00
|
|
|
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled) {
|
|
|
|
// This *has* to be called *before* calling FieldSetDisabledChanged on our
|
|
|
|
// controls, as they may depend on our disabled state.
|
|
|
|
UpdateDisabledState(aNotify);
|
|
|
|
|
|
|
|
if (nsINode::GetFirstChild()) {
|
|
|
|
if (!mElements) {
|
|
|
|
mElements = new nsContentList(this, MatchListedElements, nullptr, nullptr,
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t length = mElements->Length(true);
|
|
|
|
for (uint32_t i=0; i<length; ++i) {
|
|
|
|
static_cast<nsGenericHTMLFormElement*>(mElements->Item(i))
|
|
|
|
->FieldSetDisabledChanged(aNotify);
|
|
|
|
}
|
2010-09-19 01:33:16 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName,
|
2017-10-10 00:33:38 +03:00
|
|
|
aValue, aOldValue,
|
|
|
|
aSubjectPrincipal, aNotify);
|
2010-09-19 01:33:16 +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
|
2017-02-14 00:06:45 +03:00
|
|
|
HTMLFieldSetElement::MatchListedElements(Element* aElement, int32_t aNamespaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAtom, void* aData)
|
2010-09-15 11:55:48 +04:00
|
|
|
{
|
2017-02-14 00:06:45 +03:00
|
|
|
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aElement);
|
2016-05-27 02:39:03 +03:00
|
|
|
return formControl;
|
2010-09-15 11:55:48 +04:00
|
|
|
}
|
|
|
|
|
2013-02-08 20:34:48 +04:00
|
|
|
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
|
2016-06-16 10:24:16 +03:00
|
|
|
HTMLFieldSetElement::SubmitNamesValues(HTMLFormSubmission* 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
|
2018-01-03 16:01:03 +03:00
|
|
|
HTMLFieldSetElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
|
2010-09-19 05:47:15 +04:00
|
|
|
{
|
|
|
|
bool firstLegendHasChanged = false;
|
|
|
|
|
2018-01-03 15:59:54 +03:00
|
|
|
if (mFirstLegend && (GetChildAt_Deprecated(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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-03 16:01:03 +03:00
|
|
|
nsGenericHTMLFormElement::RemoveChildAt_Deprecated(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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-15 19:18:38 +03:00
|
|
|
void
|
|
|
|
HTMLFieldSetElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
|
|
|
|
{
|
|
|
|
bool firstLegendHasChanged = false;
|
|
|
|
|
|
|
|
if (mFirstLegend && aKid == mFirstLegend) {
|
|
|
|
// If we are removing the first legend we have to found another one.
|
|
|
|
nsIContent* child = mFirstLegend->GetNextSibling();
|
|
|
|
mFirstLegend = nullptr;
|
|
|
|
firstLegendHasChanged = true;
|
|
|
|
|
|
|
|
for (; child; child = child->GetNextSibling()) {
|
|
|
|
if (child->IsHTMLElement(nsGkAtoms::legend)) {
|
|
|
|
mFirstLegend = child;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsGenericHTMLFormElement::RemoveChildNode(aKid, aNotify);
|
|
|
|
|
|
|
|
if (firstLegendHasChanged) {
|
|
|
|
NotifyElementsForFirstLegendChange(aNotify);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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) {
|
2016-11-04 09:38:19 +03:00
|
|
|
for (int32_t i = 0; i < fieldSet->mInvalidElementsCount; i++) {
|
2013-10-16 20:43:37 +04:00
|
|
|
UpdateValidity(false);
|
|
|
|
}
|
|
|
|
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) {
|
2016-11-04 09:38:19 +03:00
|
|
|
for (int32_t i = 0; i < fieldSet->mInvalidElementsCount; i++) {
|
2013-10-16 20:43:37 +04:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|