зеркало из https://github.com/mozilla/pjs.git
Bug 629200 part 3 - Make AfterSetAttr take an nsAttrValue; r=bz
This commit is contained in:
Родитель
10b5960bdb
Коммит
f7939a2c38
|
@ -5073,7 +5073,7 @@ nsGenericElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
|
|
||||||
return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue,
|
return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue,
|
||||||
attrValue, modType, hasListeners, aNotify,
|
attrValue, modType, hasListeners, aNotify,
|
||||||
&aValue);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -5111,7 +5111,7 @@ nsGenericElement::SetParsedAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
|
|
||||||
return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue,
|
return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue,
|
||||||
aParsedValue, modType, hasListeners, aNotify,
|
aParsedValue, modType, hasListeners, aNotify,
|
||||||
&value.String());
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -5123,7 +5123,7 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
|
||||||
PRUint8 aModType,
|
PRUint8 aModType,
|
||||||
bool aFireMutation,
|
bool aFireMutation,
|
||||||
bool aNotify,
|
bool aNotify,
|
||||||
const nsAString* aValueForAfterSetAttr)
|
bool aCallAfterSetAttr)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
|
@ -5132,6 +5132,13 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
|
||||||
|
|
||||||
nsMutationGuard::DidMutate();
|
nsMutationGuard::DidMutate();
|
||||||
|
|
||||||
|
// Copy aParsedValue for later use since it will be lost when we call
|
||||||
|
// SetAndTakeMappedAttr below
|
||||||
|
nsAttrValue aValueForAfterSetAttr;
|
||||||
|
if (aCallAfterSetAttr) {
|
||||||
|
aValueForAfterSetAttr.SetTo(aParsedValue);
|
||||||
|
}
|
||||||
|
|
||||||
if (aNamespaceID == kNameSpaceID_None) {
|
if (aNamespaceID == kNameSpaceID_None) {
|
||||||
// XXXbz Perhaps we should push up the attribute mapping function
|
// XXXbz Perhaps we should push up the attribute mapping function
|
||||||
// stuff to nsGenericElement?
|
// stuff to nsGenericElement?
|
||||||
|
@ -5169,8 +5176,8 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
|
||||||
aName == nsGkAtoms::event && mNodeInfo->GetDocument()) {
|
aName == nsGkAtoms::event && mNodeInfo->GetDocument()) {
|
||||||
mNodeInfo->GetDocument()->AddXMLEventsContent(this);
|
mNodeInfo->GetDocument()->AddXMLEventsContent(this);
|
||||||
}
|
}
|
||||||
if (aValueForAfterSetAttr) {
|
if (aCallAfterSetAttr) {
|
||||||
rv = AfterSetAttr(aNamespaceID, aName, aValueForAfterSetAttr, aNotify);
|
rv = AfterSetAttr(aNamespaceID, aName, &aValueForAfterSetAttr, aNotify);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -653,8 +653,7 @@ protected:
|
||||||
* needed if aFireMutation or aNotify is true.
|
* needed if aFireMutation or aNotify is true.
|
||||||
* @param aFireMutation should mutation-events be fired?
|
* @param aFireMutation should mutation-events be fired?
|
||||||
* @param aNotify should we notify document-observers?
|
* @param aNotify should we notify document-observers?
|
||||||
* @param aValueForAfterSetAttr If not null, AfterSetAttr will be called
|
* @param aCallAfterSetAttr should we call AfterSetAttr?
|
||||||
* with the value pointed by this parameter.
|
|
||||||
*/
|
*/
|
||||||
nsresult SetAttrAndNotify(PRInt32 aNamespaceID,
|
nsresult SetAttrAndNotify(PRInt32 aNamespaceID,
|
||||||
nsIAtom* aName,
|
nsIAtom* aName,
|
||||||
|
@ -664,7 +663,7 @@ protected:
|
||||||
PRUint8 aModType,
|
PRUint8 aModType,
|
||||||
bool aFireMutation,
|
bool aFireMutation,
|
||||||
bool aNotify,
|
bool aNotify,
|
||||||
const nsAString* aValueForAfterSetAttr);
|
bool aCallAfterSetAttr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert an attribute string value to attribute type based on the type of
|
* Convert an attribute string value to attribute type based on the type of
|
||||||
|
@ -738,7 +737,7 @@ protected:
|
||||||
// Note that this is inlined so that when subclasses call it it gets
|
// Note that this is inlined so that when subclasses call it it gets
|
||||||
// inlined. Those calls don't go through a vtable.
|
// inlined. Those calls don't go through a vtable.
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ nsStyledElementNotElementCSSInlineStyle::UnsetAttr(PRInt32 aNameSpaceID,
|
||||||
nsresult
|
nsresult
|
||||||
nsStyledElementNotElementCSSInlineStyle::AfterSetAttr(PRInt32 aNamespaceID,
|
nsStyledElementNotElementCSSInlineStyle::AfterSetAttr(PRInt32 aNamespaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
const nsAString* aValue,
|
const nsAttrValue* aValue,
|
||||||
bool aNotify)
|
bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNamespaceID == kNameSpaceID_None && !aValue &&
|
if (aNamespaceID == kNameSpaceID_None && !aValue &&
|
||||||
|
@ -202,7 +202,7 @@ nsStyledElementNotElementCSSInlineStyle::SetInlineStyleRule(css::StyleRule* aSty
|
||||||
|
|
||||||
return SetAttrAndNotify(kNameSpaceID_None, nsGkAtoms::style, nsnull,
|
return SetAttrAndNotify(kNameSpaceID_None, nsGkAtoms::style, nsnull,
|
||||||
oldValue, attrValue, modType, hasListeners,
|
oldValue, attrValue, modType, hasListeners,
|
||||||
aNotify, nsnull);
|
aNotify, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
css::StyleRule*
|
css::StyleRule*
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
nsIDOMCSSStyleDeclaration* GetStyle(nsresult* retval);
|
nsIDOMCSSStyleDeclaration* GetStyle(nsresult* retval);
|
||||||
|
|
||||||
|
|
|
@ -1283,11 +1283,14 @@ nsGenericHTMLElement::GetHrefURIForAnchors() const
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericHTMLElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
nsGenericHTMLElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNamespaceID == kNameSpaceID_None) {
|
if (aNamespaceID == kNameSpaceID_None) {
|
||||||
if (nsContentUtils::IsEventAttributeName(aName, EventNameType_HTML) && aValue) {
|
if (nsContentUtils::IsEventAttributeName(aName, EventNameType_HTML) &&
|
||||||
nsresult rv = AddScriptEventListener(aName, *aValue);
|
aValue) {
|
||||||
|
NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eString,
|
||||||
|
"Expected string value for script body");
|
||||||
|
nsresult rv = AddScriptEventListener(aName, aValue->GetStringValue());
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
else if (aNotify && aName == nsGkAtoms::spellcheck) {
|
else if (aNotify && aName == nsGkAtoms::spellcheck) {
|
||||||
|
@ -2800,16 +2803,17 @@ nsGenericHTMLFormElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsGenericHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNameSpaceID == kNameSpaceID_None) {
|
if (aNameSpaceID == kNameSpaceID_None) {
|
||||||
// add the control to the hashtable as needed
|
// add the control to the hashtable as needed
|
||||||
|
|
||||||
if (mForm && (aName == nsGkAtoms::name || aName == nsGkAtoms::id) &&
|
if (mForm && (aName == nsGkAtoms::name || aName == nsGkAtoms::id) &&
|
||||||
aValue) {
|
aValue && !aValue->IsEmptyString()) {
|
||||||
if (!aValue->IsEmpty()) {
|
NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eAtom,
|
||||||
mForm->AddElementToTable(this, *aValue);
|
"Expected atom value for name/id");
|
||||||
}
|
mForm->AddElementToTable(this,
|
||||||
|
nsDependentAtomString(aValue->GetAtomValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mForm && aName == nsGkAtoms::type) {
|
if (mForm && aName == nsGkAtoms::type) {
|
||||||
|
@ -2841,7 +2845,7 @@ nsGenericHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
nsIDocument* doc = GetCurrentDoc();
|
nsIDocument* doc = GetCurrentDoc();
|
||||||
if (doc) {
|
if (doc) {
|
||||||
Element* formIdElement = nsnull;
|
Element* formIdElement = nsnull;
|
||||||
if (aValue && !aValue->IsEmpty()) {
|
if (aValue && !aValue->IsEmptyString()) {
|
||||||
formIdElement = AddFormIdObserver();
|
formIdElement = AddFormIdObserver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -631,7 +631,7 @@ protected:
|
||||||
bool IsEventName(nsIAtom* aName);
|
bool IsEventName(nsIAtom* aName);
|
||||||
|
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
virtual nsEventListenerManager*
|
virtual nsEventListenerManager*
|
||||||
GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer);
|
GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer);
|
||||||
|
@ -954,7 +954,7 @@ protected:
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
|
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
void UpdateEditableFormControlState(bool aNotify);
|
void UpdateEditableFormControlState(bool aNotify);
|
||||||
|
|
||||||
|
|
|
@ -141,8 +141,8 @@ public:
|
||||||
* Called when an attribute has just been changed
|
* Called when an attribute has just been changed
|
||||||
*/
|
*/
|
||||||
nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
// nsIContent overrides...
|
// nsIContent overrides...
|
||||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, PRInt32 *aTabIndex);
|
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, PRInt32 *aTabIndex);
|
||||||
virtual bool ParseAttribute(PRInt32 aNamespaceID,
|
virtual bool ParseAttribute(PRInt32 aNamespaceID,
|
||||||
|
@ -613,7 +613,7 @@ nsHTMLButtonElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLButtonElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsHTMLButtonElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNameSpaceID == kNameSpaceID_None) {
|
if (aNameSpaceID == kNameSpaceID_None) {
|
||||||
if (aName == nsGkAtoms::type) {
|
if (aName == nsGkAtoms::type) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ nsHTMLFieldSetElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLFieldSetElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsHTMLFieldSetElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled &&
|
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled &&
|
||||||
nsINode::GetFirstChild()) {
|
nsINode::GetFirstChild()) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
// nsIContent
|
// nsIContent
|
||||||
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
virtual nsresult InsertChildAt(nsIContent* aChild, PRUint32 aIndex,
|
virtual nsresult InsertChildAt(nsIContent* aChild, PRUint32 aIndex,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
|
|
|
@ -378,7 +378,7 @@ nsHTMLFormElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aName == nsGkAtoms::novalidate && aNameSpaceID == kNameSpaceID_None) {
|
if (aName == nsGkAtoms::novalidate && aNameSpaceID == kNameSpaceID_None) {
|
||||||
// Update all form elements states because they might be [no longer]
|
// Update all form elements states because they might be [no longer]
|
||||||
|
|
|
@ -176,7 +176,7 @@ public:
|
||||||
nsIAtom* aPrefix, const nsAString& aValue,
|
nsIAtom* aPrefix, const nsAString& aValue,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forget all information about the current submission (and the fact that we
|
* Forget all information about the current submission (and the fact that we
|
||||||
|
|
|
@ -756,8 +756,7 @@ nsHTMLInputElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue,
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
bool aNotify)
|
|
||||||
{
|
{
|
||||||
if (aNameSpaceID == kNameSpaceID_None) {
|
if (aNameSpaceID == kNameSpaceID_None) {
|
||||||
//
|
//
|
||||||
|
|
|
@ -385,7 +385,7 @@ protected:
|
||||||
* Called when an attribute has just been changed
|
* Called when an attribute has just been changed
|
||||||
*/
|
*/
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch a select event. Returns true if the event was not cancelled.
|
* Dispatch a select event. Returns true if the event was not cancelled.
|
||||||
|
|
|
@ -417,7 +417,7 @@ nsHTMLMenuItemElement::GetText(nsAString& aText)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLMenuItemElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsHTMLMenuItemElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNameSpaceID == kNameSpaceID_None) {
|
if (aNameSpaceID == kNameSpaceID_None) {
|
||||||
if ((aName == nsGkAtoms::radiogroup || aName == nsGkAtoms::type) &&
|
if ((aName == nsGkAtoms::radiogroup || aName == nsGkAtoms::type) &&
|
||||||
|
|
|
@ -106,7 +106,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
void WalkRadioGroup(Visitor* aVisitor);
|
void WalkRadioGroup(Visitor* aVisitor);
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ public:
|
||||||
|
|
||||||
// nsGenericElement
|
// nsGenericElement
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
virtual nsXPCClassInfo* GetClassInfo();
|
virtual nsXPCClassInfo* GetClassInfo();
|
||||||
protected:
|
protected:
|
||||||
|
@ -241,7 +241,7 @@ nsHTMLScriptElement::SetAsync(bool aValue)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLScriptElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
nsHTMLScriptElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (nsGkAtoms::async == aName && kNameSpaceID_None == aNamespaceID) {
|
if (nsGkAtoms::async == aName && kNameSpaceID_None == aNamespaceID) {
|
||||||
mForceAsync = false;
|
mForceAsync = false;
|
||||||
|
|
|
@ -1385,7 +1385,7 @@ nsHTMLSelectElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLSelectElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsHTMLSelectElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNameSpaceID == kNameSpaceID_None) {
|
if (aNameSpaceID == kNameSpaceID_None) {
|
||||||
if (aName == nsGkAtoms::disabled) {
|
if (aName == nsGkAtoms::disabled) {
|
||||||
|
|
|
@ -395,7 +395,7 @@ public:
|
||||||
const nsAttrValueOrString* aValue,
|
const nsAttrValueOrString* aValue,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
|
|
||||||
|
|
|
@ -1277,7 +1277,7 @@ nsHTMLTableElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLTableElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsHTMLTableElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue,
|
const nsAttrValue* aValue,
|
||||||
bool aNotify)
|
bool aNotify)
|
||||||
{
|
{
|
||||||
if (aName == nsGkAtoms::cellpadding && aNameSpaceID == kNameSpaceID_None) {
|
if (aName == nsGkAtoms::cellpadding && aNameSpaceID == kNameSpaceID_None) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
* Called when an attribute has just been changed
|
* Called when an attribute has just been changed
|
||||||
*/
|
*/
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLTableElement,
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLTableElement,
|
||||||
nsGenericHTMLElement)
|
nsGenericHTMLElement)
|
||||||
|
|
|
@ -285,7 +285,7 @@ protected:
|
||||||
void ContentChanged(nsIContent* aContent);
|
void ContentChanged(nsIContent* aContent);
|
||||||
|
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom *aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom *aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return if an element should have a specific validity UI
|
* Return if an element should have a specific validity UI
|
||||||
|
@ -1278,7 +1278,7 @@ nsHTMLTextAreaElement::ContentChanged(nsIContent* aContent)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLTextAreaElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
nsHTMLTextAreaElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNameSpaceID == kNameSpaceID_None) {
|
if (aNameSpaceID == kNameSpaceID_None) {
|
||||||
if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled ||
|
if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled ||
|
||||||
|
|
|
@ -376,7 +376,7 @@ nsSVGAnimationElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGAnimationElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
nsSVGAnimationElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
nsSVGAnimationElementBase::AfterSetAttr(aNamespaceID, aName, aValue,
|
nsSVGAnimationElementBase::AfterSetAttr(aNamespaceID, aName, aValue,
|
||||||
|
@ -389,7 +389,9 @@ nsSVGAnimationElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
mHrefTarget.Unlink();
|
mHrefTarget.Unlink();
|
||||||
AnimationTargetChanged();
|
AnimationTargetChanged();
|
||||||
} else if (IsInDoc()) {
|
} else if (IsInDoc()) {
|
||||||
UpdateHrefTarget(this, *aValue);
|
NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eString,
|
||||||
|
"Expected href attribute to be string type");
|
||||||
|
UpdateHrefTarget(this, aValue->GetStringValue());
|
||||||
} // else: we're not yet in a document -- we'll update the target on
|
} // else: we're not yet in a document -- we'll update the target on
|
||||||
// next BindToTree call.
|
// next BindToTree call.
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
const nsAString& aValue,
|
const nsAString& aValue,
|
||||||
nsAttrValue& aResult);
|
nsAttrValue& aResult);
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
// nsISMILAnimationElement interface
|
// nsISMILAnimationElement interface
|
||||||
virtual const Element& AsElement() const;
|
virtual const Element& AsElement() const;
|
||||||
|
|
|
@ -260,8 +260,8 @@ nsSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
nsSVGElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
// If this is an svg presentation attribute we need to map it into
|
// If this is an svg presentation attribute we need to map it into
|
||||||
// the content stylerule.
|
// the content stylerule.
|
||||||
// XXX For some reason incremental mapping doesn't work, so for now
|
// XXX For some reason incremental mapping doesn't work, so for now
|
||||||
|
@ -272,7 +272,10 @@ nsSVGElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsEventName(aName) && aValue) {
|
if (IsEventName(aName) && aValue) {
|
||||||
nsresult rv = AddScriptEventListener(GetEventNameForAttr(aName), *aValue);
|
NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eString,
|
||||||
|
"Expected string value for script body");
|
||||||
|
nsresult rv = AddScriptEventListener(GetEventNameForAttr(aName),
|
||||||
|
aValue->GetStringValue());
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
virtual bool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
|
virtual bool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
|
||||||
const nsAString& aValue, nsAttrValue& aResult);
|
const nsAString& aValue, nsAttrValue& aResult);
|
||||||
static nsresult ReportAttributeParseFailure(nsIDocument* aDocument,
|
static nsresult ReportAttributeParseFailure(nsIDocument* aDocument,
|
||||||
|
|
|
@ -5561,7 +5561,7 @@ nsSVGFEImageElement::IsAttributeMapped(const nsIAtom* name) const
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGFEImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
nsSVGFEImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
|
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,7 @@ public:
|
||||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||||
|
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
nsIContent* aBindingParent,
|
nsIContent* aBindingParent,
|
||||||
bool aCompileEventHandlers);
|
bool aCompileEventHandlers);
|
||||||
|
|
|
@ -170,7 +170,7 @@ nsSVGImageElement::LoadSVGImage(bool aForce, bool aNotify)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
|
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
|
|
||||||
// nsIContent interface
|
// nsIContent interface
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
nsIContent* aBindingParent,
|
nsIContent* aBindingParent,
|
||||||
bool aCompileEventHandlers);
|
bool aCompileEventHandlers);
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
nsIContent* aBindingParent,
|
nsIContent* aBindingParent,
|
||||||
bool aCompileEventHandlers);
|
bool aCompileEventHandlers);
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ nsSVGScriptElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsSVGScriptElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
nsSVGScriptElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
|
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
|
||||||
MaybeProcessScript();
|
MaybeProcessScript();
|
||||||
|
|
|
@ -1097,7 +1097,7 @@ nsXULElement::BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify)
|
const nsAttrValue* aValue, bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNamespaceID == kNameSpaceID_None) {
|
if (aNamespaceID == kNameSpaceID_None) {
|
||||||
// XXX UnsetAttr handles more attributes than we do. See bug 233642.
|
// XXX UnsetAttr handles more attributes than we do. See bug 233642.
|
||||||
|
@ -1113,17 +1113,24 @@ nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
// nsXULPrototypeAttribute is expensive!)
|
// nsXULPrototypeAttribute is expensive!)
|
||||||
bool defer = mPrototype == nsnull ||
|
bool defer = mPrototype == nsnull ||
|
||||||
mPrototype->mScriptTypeID == GetScriptTypeID();
|
mPrototype->mScriptTypeID == GetScriptTypeID();
|
||||||
AddScriptEventListener(aName, *aValue, defer);
|
if (aValue->Type() == nsAttrValue::eString) {
|
||||||
|
AddScriptEventListener(aName, aValue->GetStringValue(), defer);
|
||||||
|
} else {
|
||||||
|
nsAutoString body;
|
||||||
|
aValue->ToString(body);
|
||||||
|
AddScriptEventListener(aName, body, defer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide chrome if needed
|
// Hide chrome if needed
|
||||||
if (mNodeInfo->Equals(nsGkAtoms::window) && aValue) {
|
if (mNodeInfo->Equals(nsGkAtoms::window) && aValue) {
|
||||||
if (aName == nsGkAtoms::hidechrome) {
|
if (aName == nsGkAtoms::hidechrome) {
|
||||||
HideWindowChrome(aValue->EqualsLiteral("true"));
|
HideWindowChrome(
|
||||||
}
|
aValue->Equals(NS_LITERAL_STRING("true"), eCaseMatters));
|
||||||
else if (aName == nsGkAtoms::chromemargin) {
|
}
|
||||||
SetChromeMargins(aValue);
|
else if (aName == nsGkAtoms::chromemargin) {
|
||||||
}
|
SetChromeMargins(aValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// title, (in)activetitlebarcolor and drawintitlebar are settable on
|
// title, (in)activetitlebarcolor and drawintitlebar are settable on
|
||||||
|
@ -1134,15 +1141,22 @@ nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
document->NotifyPossibleTitleChange(false);
|
document->NotifyPossibleTitleChange(false);
|
||||||
}
|
}
|
||||||
else if ((aName == nsGkAtoms::activetitlebarcolor ||
|
else if ((aName == nsGkAtoms::activetitlebarcolor ||
|
||||||
aName == nsGkAtoms::inactivetitlebarcolor)) {
|
aName == nsGkAtoms::inactivetitlebarcolor) && aValue) {
|
||||||
nscolor color = NS_RGBA(0, 0, 0, 0);
|
nscolor color = NS_RGBA(0, 0, 0, 0);
|
||||||
nsAttrValue attrValue;
|
if (aValue->Type() == nsAttrValue::eColor) {
|
||||||
attrValue.ParseColor(*aValue);
|
aValue->GetColorValue(color);
|
||||||
attrValue.GetColorValue(color);
|
} else {
|
||||||
|
nsAutoString tmp;
|
||||||
|
nsAttrValue attrValue;
|
||||||
|
aValue->ToString(tmp);
|
||||||
|
attrValue.ParseColor(tmp);
|
||||||
|
attrValue.GetColorValue(color);
|
||||||
|
}
|
||||||
SetTitlebarColor(color, aName == nsGkAtoms::activetitlebarcolor);
|
SetTitlebarColor(color, aName == nsGkAtoms::activetitlebarcolor);
|
||||||
}
|
}
|
||||||
else if (aName == nsGkAtoms::drawintitlebar) {
|
else if (aName == nsGkAtoms::drawintitlebar) {
|
||||||
SetDrawsInTitlebar(aValue && aValue->EqualsLiteral("true"));
|
SetDrawsInTitlebar(aValue &&
|
||||||
|
aValue->Equals(NS_LITERAL_STRING("true"), eCaseMatters));
|
||||||
}
|
}
|
||||||
else if (aName == nsGkAtoms::localedir) {
|
else if (aName == nsGkAtoms::localedir) {
|
||||||
// if the localedir changed on the root element, reset the document direction
|
// if the localedir changed on the root element, reset the document direction
|
||||||
|
@ -2435,7 +2449,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
nsXULElement::SetChromeMargins(const nsAString* aValue)
|
nsXULElement::SetChromeMargins(const nsAttrValue* aValue)
|
||||||
{
|
{
|
||||||
if (!aValue)
|
if (!aValue)
|
||||||
return;
|
return;
|
||||||
|
@ -2445,13 +2459,17 @@ nsXULElement::SetChromeMargins(const nsAString* aValue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// top, right, bottom, left - see nsAttrValue
|
// top, right, bottom, left - see nsAttrValue
|
||||||
nsAttrValue attrValue;
|
|
||||||
nsIntMargin margins;
|
nsIntMargin margins;
|
||||||
|
bool gotMargins = false;
|
||||||
|
|
||||||
nsAutoString data;
|
if (aValue->Type() == nsAttrValue::eIntMarginValue) {
|
||||||
data.Assign(*aValue);
|
gotMargins = aValue->GetIntMarginValue(margins);
|
||||||
if (attrValue.ParseIntMarginValue(data) &&
|
} else {
|
||||||
attrValue.GetIntMarginValue(margins)) {
|
nsAutoString tmp;
|
||||||
|
aValue->ToString(tmp);
|
||||||
|
gotMargins = nsContentUtils::ParseIntMarginValue(tmp, margins);
|
||||||
|
}
|
||||||
|
if (gotMargins) {
|
||||||
nsContentUtils::AddScriptRunner(new MarginSetter(mainWidget, margins));
|
nsContentUtils::AddScriptRunner(new MarginSetter(mainWidget, margins));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -629,7 +629,7 @@ protected:
|
||||||
const nsAttrValueOrString* aValue,
|
const nsAttrValueOrString* aValue,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
const nsAString* aValue, bool aNotify);
|
const nsAttrValue* aValue, bool aNotify);
|
||||||
|
|
||||||
virtual void UpdateEditableState(bool aNotify);
|
virtual void UpdateEditableState(bool aNotify);
|
||||||
|
|
||||||
|
@ -657,7 +657,7 @@ protected:
|
||||||
|
|
||||||
// attribute setters for widget
|
// attribute setters for widget
|
||||||
nsresult HideWindowChrome(bool aShouldHide);
|
nsresult HideWindowChrome(bool aShouldHide);
|
||||||
void SetChromeMargins(const nsAString* aValue);
|
void SetChromeMargins(const nsAttrValue* aValue);
|
||||||
void ResetChromeMargins();
|
void ResetChromeMargins();
|
||||||
void SetTitlebarColor(nscolor aColor, bool aActive);
|
void SetTitlebarColor(nscolor aColor, bool aActive);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче