Bug 629200 part 3 - Make AfterSetAttr take an nsAttrValue; r=bz

This commit is contained in:
Brian Birtles 2012-02-14 11:00:56 +09:00
Родитель 10b5960bdb
Коммит f7939a2c38
32 изменённых файлов: 109 добавлений и 77 удалений

Просмотреть файл

@ -5073,7 +5073,7 @@ nsGenericElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue,
attrValue, modType, hasListeners, aNotify,
&aValue);
true);
}
nsresult
@ -5111,7 +5111,7 @@ nsGenericElement::SetParsedAttr(PRInt32 aNamespaceID, nsIAtom* aName,
return SetAttrAndNotify(aNamespaceID, aName, aPrefix, oldValue,
aParsedValue, modType, hasListeners, aNotify,
&value.String());
true);
}
nsresult
@ -5123,7 +5123,7 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
PRUint8 aModType,
bool aFireMutation,
bool aNotify,
const nsAString* aValueForAfterSetAttr)
bool aCallAfterSetAttr)
{
nsresult rv;
@ -5132,6 +5132,13 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
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) {
// XXXbz Perhaps we should push up the attribute mapping function
// stuff to nsGenericElement?
@ -5169,8 +5176,8 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
aName == nsGkAtoms::event && mNodeInfo->GetDocument()) {
mNodeInfo->GetDocument()->AddXMLEventsContent(this);
}
if (aValueForAfterSetAttr) {
rv = AfterSetAttr(aNamespaceID, aName, aValueForAfterSetAttr, aNotify);
if (aCallAfterSetAttr) {
rv = AfterSetAttr(aNamespaceID, aName, &aValueForAfterSetAttr, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
}

Просмотреть файл

@ -653,8 +653,7 @@ protected:
* needed if aFireMutation or aNotify is true.
* @param aFireMutation should mutation-events be fired?
* @param aNotify should we notify document-observers?
* @param aValueForAfterSetAttr If not null, AfterSetAttr will be called
* with the value pointed by this parameter.
* @param aCallAfterSetAttr should we call AfterSetAttr?
*/
nsresult SetAttrAndNotify(PRInt32 aNamespaceID,
nsIAtom* aName,
@ -664,7 +663,7 @@ protected:
PRUint8 aModType,
bool aFireMutation,
bool aNotify,
const nsAString* aValueForAfterSetAttr);
bool aCallAfterSetAttr);
/**
* 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
// inlined. Those calls don't go through a vtable.
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
return NS_OK;
}

Просмотреть файл

@ -146,7 +146,7 @@ nsStyledElementNotElementCSSInlineStyle::UnsetAttr(PRInt32 aNameSpaceID,
nsresult
nsStyledElementNotElementCSSInlineStyle::AfterSetAttr(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString* aValue,
const nsAttrValue* aValue,
bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None && !aValue &&
@ -202,7 +202,7 @@ nsStyledElementNotElementCSSInlineStyle::SetInlineStyleRule(css::StyleRule* aSty
return SetAttrAndNotify(kNameSpaceID_None, nsGkAtoms::style, nsnull,
oldValue, attrValue, modType, hasListeners,
aNotify, nsnull);
aNotify, false);
}
css::StyleRule*

Просмотреть файл

@ -89,7 +89,7 @@ public:
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
bool aNotify);
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
nsIDOMCSSStyleDeclaration* GetStyle(nsresult* retval);

Просмотреть файл

@ -1283,11 +1283,14 @@ nsGenericHTMLElement::GetHrefURIForAnchors() const
nsresult
nsGenericHTMLElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None) {
if (nsContentUtils::IsEventAttributeName(aName, EventNameType_HTML) && aValue) {
nsresult rv = AddScriptEventListener(aName, *aValue);
if (nsContentUtils::IsEventAttributeName(aName, EventNameType_HTML) &&
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);
}
else if (aNotify && aName == nsGkAtoms::spellcheck) {
@ -2800,16 +2803,17 @@ nsGenericHTMLFormElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsGenericHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
// add the control to the hashtable as needed
if (mForm && (aName == nsGkAtoms::name || aName == nsGkAtoms::id) &&
aValue) {
if (!aValue->IsEmpty()) {
mForm->AddElementToTable(this, *aValue);
}
aValue && !aValue->IsEmptyString()) {
NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eAtom,
"Expected atom value for name/id");
mForm->AddElementToTable(this,
nsDependentAtomString(aValue->GetAtomValue()));
}
if (mForm && aName == nsGkAtoms::type) {
@ -2841,7 +2845,7 @@ nsGenericHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIDocument* doc = GetCurrentDoc();
if (doc) {
Element* formIdElement = nsnull;
if (aValue && !aValue->IsEmpty()) {
if (aValue && !aValue->IsEmptyString()) {
formIdElement = AddFormIdObserver();
}

Просмотреть файл

@ -631,7 +631,7 @@ protected:
bool IsEventName(nsIAtom* aName);
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
virtual nsEventListenerManager*
GetEventListenerManagerForAttr(nsIAtom* aAttrName, bool* aDefer);
@ -954,7 +954,7 @@ protected:
bool aNotify);
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
void UpdateEditableFormControlState(bool aNotify);

Просмотреть файл

@ -141,8 +141,8 @@ public:
* Called when an attribute has just been changed
*/
nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
// nsIContent overrides...
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, PRInt32 *aTabIndex);
virtual bool ParseAttribute(PRInt32 aNamespaceID,
@ -613,7 +613,7 @@ nsHTMLButtonElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsHTMLButtonElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::type) {

Просмотреть файл

@ -119,7 +119,7 @@ nsHTMLFieldSetElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
nsresult
nsHTMLFieldSetElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled &&
nsINode::GetFirstChild()) {

Просмотреть файл

@ -80,7 +80,7 @@ public:
// nsIContent
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
virtual nsresult InsertChildAt(nsIContent* aChild, PRUint32 aIndex,
bool aNotify);

Просмотреть файл

@ -378,7 +378,7 @@ nsHTMLFormElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsHTMLFormElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aName == nsGkAtoms::novalidate && aNameSpaceID == kNameSpaceID_None) {
// Update all form elements states because they might be [no longer]

Просмотреть файл

@ -176,7 +176,7 @@ public:
nsIAtom* aPrefix, const nsAString& aValue,
bool aNotify);
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

Просмотреть файл

@ -756,8 +756,7 @@ nsHTMLInputElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue,
bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
//

Просмотреть файл

@ -385,7 +385,7 @@ protected:
* Called when an attribute has just been changed
*/
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.

Просмотреть файл

@ -417,7 +417,7 @@ nsHTMLMenuItemElement::GetText(nsAString& aText)
nsresult
nsHTMLMenuItemElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if ((aName == nsGkAtoms::radiogroup || aName == nsGkAtoms::type) &&

Просмотреть файл

@ -106,7 +106,7 @@ public:
protected:
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
void WalkRadioGroup(Visitor* aVisitor);

Просмотреть файл

@ -118,7 +118,7 @@ public:
// nsGenericElement
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
virtual nsXPCClassInfo* GetClassInfo();
protected:
@ -241,7 +241,7 @@ nsHTMLScriptElement::SetAsync(bool aValue)
nsresult
nsHTMLScriptElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (nsGkAtoms::async == aName && kNameSpaceID_None == aNamespaceID) {
mForceAsync = false;

Просмотреть файл

@ -1385,7 +1385,7 @@ nsHTMLSelectElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsHTMLSelectElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::disabled) {

Просмотреть файл

@ -395,7 +395,7 @@ public:
const nsAttrValueOrString* aValue,
bool aNotify);
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
bool aNotify);

Просмотреть файл

@ -1277,7 +1277,7 @@ nsHTMLTableElement::BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsresult
nsHTMLTableElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue,
const nsAttrValue* aValue,
bool aNotify)
{
if (aName == nsGkAtoms::cellpadding && aNameSpaceID == kNameSpaceID_None) {

Просмотреть файл

@ -90,7 +90,7 @@ public:
* Called when an attribute has just been changed
*/
virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLTableElement,
nsGenericHTMLElement)

Просмотреть файл

@ -285,7 +285,7 @@ protected:
void ContentChanged(nsIContent* aContent);
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
@ -1278,7 +1278,7 @@ nsHTMLTextAreaElement::ContentChanged(nsIContent* aContent)
nsresult
nsHTMLTextAreaElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled ||

Просмотреть файл

@ -376,7 +376,7 @@ nsSVGAnimationElement::ParseAttribute(PRInt32 aNamespaceID,
nsresult
nsSVGAnimationElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
nsresult rv =
nsSVGAnimationElementBase::AfterSetAttr(aNamespaceID, aName, aValue,
@ -389,7 +389,9 @@ nsSVGAnimationElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
mHrefTarget.Unlink();
AnimationTargetChanged();
} 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
// next BindToTree call.

Просмотреть файл

@ -84,7 +84,7 @@ public:
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
// nsISMILAnimationElement interface
virtual const Element& AsElement() const;

Просмотреть файл

@ -260,8 +260,8 @@ nsSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsresult
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
// the content stylerule.
// 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) {
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);
}

Просмотреть файл

@ -250,7 +250,7 @@ public:
protected:
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
virtual bool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult);
static nsresult ReportAttributeParseFailure(nsIDocument* aDocument,

Просмотреть файл

@ -5561,7 +5561,7 @@ nsSVGFEImageElement::IsAttributeMapped(const nsIAtom* name) const
nsresult
nsSVGFEImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {

Просмотреть файл

@ -288,7 +288,7 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers);

Просмотреть файл

@ -170,7 +170,7 @@ nsSVGImageElement::LoadSVGImage(bool aForce, bool aNotify)
nsresult
nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {

Просмотреть файл

@ -78,7 +78,7 @@ public:
// nsIContent interface
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers);

Просмотреть файл

@ -95,7 +95,7 @@ public:
nsIContent* aBindingParent,
bool aCompileEventHandlers);
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;
@ -280,7 +280,7 @@ nsSVGScriptElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsresult
nsSVGScriptElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
MaybeProcessScript();

Просмотреть файл

@ -1097,7 +1097,7 @@ nsXULElement::BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
nsresult
nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify)
const nsAttrValue* aValue, bool aNotify)
{
if (aNamespaceID == kNameSpaceID_None) {
// XXX UnsetAttr handles more attributes than we do. See bug 233642.
@ -1113,17 +1113,24 @@ nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
// nsXULPrototypeAttribute is expensive!)
bool defer = mPrototype == nsnull ||
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
if (mNodeInfo->Equals(nsGkAtoms::window) && aValue) {
if (aName == nsGkAtoms::hidechrome) {
HideWindowChrome(aValue->EqualsLiteral("true"));
}
else if (aName == nsGkAtoms::chromemargin) {
SetChromeMargins(aValue);
}
if (aName == nsGkAtoms::hidechrome) {
HideWindowChrome(
aValue->Equals(NS_LITERAL_STRING("true"), eCaseMatters));
}
else if (aName == nsGkAtoms::chromemargin) {
SetChromeMargins(aValue);
}
}
// title, (in)activetitlebarcolor and drawintitlebar are settable on
@ -1134,15 +1141,22 @@ nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
document->NotifyPossibleTitleChange(false);
}
else if ((aName == nsGkAtoms::activetitlebarcolor ||
aName == nsGkAtoms::inactivetitlebarcolor)) {
aName == nsGkAtoms::inactivetitlebarcolor) && aValue) {
nscolor color = NS_RGBA(0, 0, 0, 0);
nsAttrValue attrValue;
attrValue.ParseColor(*aValue);
attrValue.GetColorValue(color);
if (aValue->Type() == nsAttrValue::eColor) {
aValue->GetColorValue(color);
} else {
nsAutoString tmp;
nsAttrValue attrValue;
aValue->ToString(tmp);
attrValue.ParseColor(tmp);
attrValue.GetColorValue(color);
}
SetTitlebarColor(color, aName == nsGkAtoms::activetitlebarcolor);
}
else if (aName == nsGkAtoms::drawintitlebar) {
SetDrawsInTitlebar(aValue && aValue->EqualsLiteral("true"));
SetDrawsInTitlebar(aValue &&
aValue->Equals(NS_LITERAL_STRING("true"), eCaseMatters));
}
else if (aName == nsGkAtoms::localedir) {
// if the localedir changed on the root element, reset the document direction
@ -2435,7 +2449,7 @@ private:
};
void
nsXULElement::SetChromeMargins(const nsAString* aValue)
nsXULElement::SetChromeMargins(const nsAttrValue* aValue)
{
if (!aValue)
return;
@ -2445,13 +2459,17 @@ nsXULElement::SetChromeMargins(const nsAString* aValue)
return;
// top, right, bottom, left - see nsAttrValue
nsAttrValue attrValue;
nsIntMargin margins;
bool gotMargins = false;
nsAutoString data;
data.Assign(*aValue);
if (attrValue.ParseIntMarginValue(data) &&
attrValue.GetIntMarginValue(margins)) {
if (aValue->Type() == nsAttrValue::eIntMarginValue) {
gotMargins = aValue->GetIntMarginValue(margins);
} else {
nsAutoString tmp;
aValue->ToString(tmp);
gotMargins = nsContentUtils::ParseIntMarginValue(tmp, margins);
}
if (gotMargins) {
nsContentUtils::AddScriptRunner(new MarginSetter(mainWidget, margins));
}
}

Просмотреть файл

@ -629,7 +629,7 @@ protected:
const nsAttrValueOrString* aValue,
bool aNotify);
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, bool aNotify);
const nsAttrValue* aValue, bool aNotify);
virtual void UpdateEditableState(bool aNotify);
@ -657,7 +657,7 @@ protected:
// attribute setters for widget
nsresult HideWindowChrome(bool aShouldHide);
void SetChromeMargins(const nsAString* aValue);
void SetChromeMargins(const nsAttrValue* aValue);
void ResetChromeMargins();
void SetTitlebarColor(nscolor aColor, bool aActive);