Remove hint parameter from AttributeChanged methods and simplify style hint mechanism. b=211308 r+sr=bzbarsky

This commit is contained in:
dbaron%dbaron.org 2003-07-11 21:16:12 +00:00
Родитель 345bd22f8b
Коммит d85698fd40
185 изменённых файлов: 986 добавлений и 1369 удалений

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

@ -400,8 +400,7 @@ public:
NS_IMETHOD AttributeChanged(nsIContent* aChild, NS_IMETHOD AttributeChanged(nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType) = 0;
nsChangeHint aHint) = 0;
NS_IMETHOD ContentAppended(nsIContent* aContainer, NS_IMETHOD ContentAppended(nsIContent* aContainer,
PRInt32 aNewIndexInContainer) = 0; PRInt32 aNewIndexInContainer) = 0;
NS_IMETHOD ContentInserted(nsIContent* aContainer, NS_IMETHOD ContentInserted(nsIContent* aContainer,

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

@ -153,14 +153,12 @@ public:
* @param aAttribute the atom name of the attribute * @param aAttribute the atom name of the attribute
* @param aModType Whether or not the attribute was added, changed, or removed. * @param aModType Whether or not the attribute was added, changed, or removed.
* The constants are defined in nsIDOMMutationEvent.h. * The constants are defined in nsIDOMMutationEvent.h.
* @param aHint The style hint.
*/ */
NS_IMETHOD AttributeChanged(nsIDocument *aDocument, NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType) = 0;
nsChangeHint aHint) = 0;
/** /**
* Notifcation that the content model has had data appended to the * Notifcation that the content model has had data appended to the
@ -362,8 +360,7 @@ public:
nsIContent* aContent, \ nsIContent* aContent, \
PRInt32 aNameSpaceID, \ PRInt32 aNameSpaceID, \
nsIAtom* aAttribute, \ nsIAtom* aAttribute, \
PRInt32 aModType, \ PRInt32 aModType); \
nsChangeHint aHint); \
NS_IMETHOD ContentAppended(nsIDocument* aDocument, \ NS_IMETHOD ContentAppended(nsIDocument* aDocument, \
nsIContent* aContainer, \ nsIContent* aContainer, \
PRInt32 aNewIndexInContainer); \ PRInt32 aNewIndexInContainer); \
@ -466,8 +463,7 @@ _class::AttributeChanged(nsIDocument* aDocument, \
nsIContent* aContent, \ nsIContent* aContent, \
PRInt32 aNameSpaceID, \ PRInt32 aNameSpaceID, \
nsIAtom* aAttribute, \ nsIAtom* aAttribute, \
PRInt32 aModType, \ PRInt32 aModType) \
nsChangeHint aHint) \
{ \ { \
return NS_OK; \ return NS_OK; \
} \ } \

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

@ -67,14 +67,21 @@ public:
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) = 0; NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) = 0;
NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule) = 0; NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule) = 0;
/** NRA *** /**
* Get a hint that tells the style system what to do when * Does the list of style rules walked by |WalkContentStyleRules|
* an attribute on this node changes. * depend on the attribute?
* This only applies to attributes that map their value
* DIRECTLY into style contexts via NON-CSS style rules
* All other attributes return NS_STYLE_HINT_CONTENT
*/ */
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const = 0;
/**
* Get a hint that tells the style system what to do when
* an attribute on this node changes, if something needs to happen
* in response to the change *other* than the result of what is
* mapped into style data via any type of style rule.
*/
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const = 0; nsChangeHint& aHint) const = 0;
}; };

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

@ -624,7 +624,7 @@ nsContentList::ContentChanged(nsIDocument* aDocument, nsIContent* aContent,
NS_IMETHODIMP NS_IMETHODIMP
nsContentList::AttributeChanged(nsIDocument* aDocument, nsIContent* aContent, nsContentList::AttributeChanged(nsIDocument* aDocument, nsIContent* aContent,
PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aModType, nsChangeHint aHint) PRInt32 aModType)
{ {
return NS_OK; return NS_OK;
} }

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

@ -2146,8 +2146,7 @@ nsDocument::AttributeWillChange(nsIContent* aChild, PRInt32 aNameSpaceID,
NS_IMETHODIMP NS_IMETHODIMP
nsDocument::AttributeChanged(nsIContent* aChild, PRInt32 aNameSpaceID, nsDocument::AttributeChanged(nsIContent* aChild, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, PRInt32 aModType, nsIAtom* aAttribute, PRInt32 aModType)
nsChangeHint aHint)
{ {
NS_ABORT_IF_FALSE(aChild, "Null child!"); NS_ABORT_IF_FALSE(aChild, "Null child!");
@ -2158,7 +2157,7 @@ nsDocument::AttributeChanged(nsIContent* aChild, PRInt32 aNameSpaceID,
NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i)); NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(i));
nsresult rv2 = observer->AttributeChanged(this, aChild, aNameSpaceID, nsresult rv2 = observer->AttributeChanged(this, aChild, aNameSpaceID,
aAttribute, aModType, aHint); aAttribute, aModType);
if (NS_FAILED(rv2) && NS_SUCCEEDED(rv)) if (NS_FAILED(rv2) && NS_SUCCEEDED(rv))
rv = rv2; rv = rv2;
} }

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

@ -167,8 +167,7 @@ public:
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType) { return NS_OK; }
nsChangeHint aHint) { return NS_OK; }
NS_IMETHOD ContentAppended(nsIDocument *aDocument, NS_IMETHOD ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer, nsIContent* aContainer,
PRInt32 aNewIndexInContainer) PRInt32 aNewIndexInContainer)
@ -461,8 +460,7 @@ public:
NS_IMETHOD AttributeChanged(nsIContent* aChild, NS_IMETHOD AttributeChanged(nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
nsChangeHint aHint);
NS_IMETHOD ContentAppended(nsIContent* aContainer, NS_IMETHOD ContentAppended(nsIContent* aContainer,
PRInt32 aNewIndexInContainer); PRInt32 aNewIndexInContainer);
NS_IMETHOD ContentInserted(nsIContent* aContainer, NS_IMETHOD ContentInserted(nsIContent* aContainer,

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

@ -2185,14 +2185,20 @@ nsGenericElement::GetInlineStyleRule(nsIStyleRule** aStyleRule)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsGenericElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsGenericElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
aHint = NS_STYLE_HINT_CONTENT; // by default, never map attributes to style return PR_FALSE;
return NS_OK;
} }
NS_IMETHODIMP
nsGenericElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
{
aHint = nsChangeHint(0);
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsGenericElement::Compact() nsGenericElement::Compact()
@ -3590,8 +3596,7 @@ nsGenericContainerElement::SetAttr(nsINodeInfo* aNodeInfo,
if (aNotify) { if (aNotify) {
PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION)
: PRInt32(nsIDOMMutationEvent::ADDITION); : PRInt32(nsIDOMMutationEvent::ADDITION);
mDocument->AttributeChanged(this, nameSpaceID, name, modHint, mDocument->AttributeChanged(this, nameSpaceID, name, modHint);
NS_STYLE_HINT_UNKNOWN);
mDocument->EndUpdate(); mDocument->EndUpdate();
} }
} }
@ -3745,8 +3750,8 @@ nsGenericContainerElement::UnsetAttr(PRInt32 aNameSpaceID,
binding->AttributeChanged(aName, aNameSpaceID, PR_TRUE, aNotify); binding->AttributeChanged(aName, aNameSpaceID, PR_TRUE, aNotify);
if (aNotify) { if (aNotify) {
mDocument->AttributeChanged(this, aNameSpaceID, aName, nsIDOMMutationEvent::REMOVAL, mDocument->AttributeChanged(this, aNameSpaceID, aName,
NS_STYLE_HINT_UNKNOWN); nsIDOMMutationEvent::REMOVAL);
mDocument->EndUpdate(); mDocument->EndUpdate();
} }
} }

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

@ -429,8 +429,11 @@ public:
NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const; NS_IMETHOD_(PRBool) HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule); NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, NS_IMETHOD_(PRBool)
PRInt32 aModType, nsChangeHint& aHint) const; HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
// nsIXMLContent interface methods // nsIXMLContent interface methods
NS_IMETHOD MaybeTriggerAutoLink(nsIDocShell *aShell); NS_IMETHOD MaybeTriggerAutoLink(nsIDocShell *aShell);

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

@ -237,8 +237,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
nsChangeHint aHint); // See nsStyleConsts fot hint values
// Notification that we were unable to render a replaced element. // Notification that we were unable to render a replaced element.
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext, NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
@ -1685,11 +1684,11 @@ StyleSetImpl::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
return mFrameConstructor->AttributeChanged(aPresContext, aContent, return mFrameConstructor->AttributeChanged(aPresContext, aContent,
aNameSpaceID, aAttribute, aModType, aHint); aNameSpaceID, aAttribute,
aModType);
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -1726,10 +1726,7 @@ nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID,
} }
// set as string value to avoid another string copy // set as string value to avoid another string copy
nsChangeHint impact = NS_STYLE_HINT_NONE; PRBool mapped = HasAttributeDependentStyle(aAttribute);
PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION)
: PRInt32(nsIDOMMutationEvent::ADDITION);
GetMappedAttributeImpact(aAttribute, modHint, impact);
nsCOMPtr<nsIHTMLStyleSheet> sheet = nsCOMPtr<nsIHTMLStyleSheet> sheet =
dont_AddRef(GetAttrStyleSheet(mDocument)); dont_AddRef(GetAttrStyleSheet(mDocument));
@ -1738,9 +1735,7 @@ nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID,
result = NS_NewHTMLAttributes(&mAttributes); result = NS_NewHTMLAttributes(&mAttributes);
NS_ENSURE_SUCCESS(result, result); NS_ENSURE_SUCCESS(result, result);
} }
result = mAttributes->SetAttributeFor(aAttribute, aValue, result = mAttributes->SetAttributeFor(aAttribute, aValue, mapped,
(impact & ~(nsChangeHint_AttrChange | nsChangeHint_Aural
| nsChangeHint_Content)) != 0,
this, sheet); this, sheet);
} }
@ -1785,8 +1780,7 @@ nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID,
modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) : modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) :
PRInt32(nsIDOMMutationEvent::ADDITION); PRInt32(nsIDOMMutationEvent::ADDITION);
mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, modHint, mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, modHint);
NS_STYLE_HINT_UNKNOWN);
mDocument->EndUpdate(); mDocument->EndUpdate();
} }
} }
@ -1880,8 +1874,7 @@ nsGenericHTMLElement::SetAttr(nsINodeInfo* aNodeInfo,
PRInt32 modHint = PRInt32 modHint =
modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION)
: PRInt32(nsIDOMMutationEvent::ADDITION); : PRInt32(nsIDOMMutationEvent::ADDITION);
mDocument->AttributeChanged(this, namespaceID, localName, modHint, mDocument->AttributeChanged(this, namespaceID, localName, modHint);
NS_STYLE_HINT_UNKNOWN);
mDocument->EndUpdate(); mDocument->EndUpdate();
} }
} }
@ -1964,9 +1957,7 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute,
} }
} }
nsChangeHint impact = NS_STYLE_HINT_NONE; PRBool mapped = HasAttributeDependentStyle(aAttribute);
GetMappedAttributeImpact(aAttribute, nsIDOMMutationEvent::MODIFICATION,
impact);
nsCOMPtr<nsIHTMLStyleSheet> sheet; nsCOMPtr<nsIHTMLStyleSheet> sheet;
if (mDocument) { if (mDocument) {
PRBool modification = PR_TRUE; PRBool modification = PR_TRUE;
@ -1990,9 +1981,7 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
PRInt32 count; PRInt32 count;
result = mAttributes->SetAttributeFor(aAttribute, aValue, result = mAttributes->SetAttributeFor(aAttribute, aValue, mapped,
(impact & ~(nsChangeHint_AttrChange | nsChangeHint_Aural
| nsChangeHint_Content)) != 0,
this, sheet, count); this, sheet, count);
if (0 == count) { if (0 == count) {
delete mAttributes; delete mAttributes;
@ -2038,7 +2027,7 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute,
} }
if (aNotify) { if (aNotify) {
mDocument->AttributeChanged(this, kNameSpaceID_None, aAttribute, nsIDOMMutationEvent::MODIFICATION, impact); mDocument->AttributeChanged(this, kNameSpaceID_None, aAttribute, nsIDOMMutationEvent::MODIFICATION);
mDocument->EndUpdate(); mDocument->EndUpdate();
} }
} }
@ -2048,9 +2037,7 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
PRInt32 count; PRInt32 count;
result = mAttributes->SetAttributeFor(aAttribute, aValue, result = mAttributes->SetAttributeFor(aAttribute, aValue, mapped,
(impact & ~(nsChangeHint_AttrChange | nsChangeHint_Aural
| nsChangeHint_Content)) != 0,
this, sheet, count); this, sheet, count);
if (0 == count) { if (0 == count) {
delete mAttributes; delete mAttributes;
@ -2134,8 +2121,7 @@ nsGenericHTMLElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
if (aNotify) { if (aNotify) {
mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, mDocument->AttributeChanged(this, aNameSpaceID, aAttribute,
nsIDOMMutationEvent::REMOVAL, nsIDOMMutationEvent::REMOVAL);
NS_STYLE_HINT_UNKNOWN);
mDocument->EndUpdate(); mDocument->EndUpdate();
} }
} }
@ -2322,15 +2308,9 @@ nsresult
nsGenericHTMLElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker) nsGenericHTMLElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
{ {
nsresult result = NS_OK; nsresult result = NS_OK;
if (aRuleWalker) {
if (mAttributes) { if (mAttributes) {
result = mAttributes->WalkMappedAttributeStyleRules(aRuleWalker); result = mAttributes->WalkMappedAttributeStyleRules(aRuleWalker);
} }
}
else {
result = NS_ERROR_NULL_POINTER;
}
return result; return result;
} }
@ -2600,18 +2580,14 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute,
return NS_CONTENT_ATTR_NOT_THERE; return NS_CONTENT_ATTR_NOT_THERE;
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsGenericHTMLElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, nsGenericHTMLElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
PRInt32 aModType,
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
sCommonAttributeMap sCommonAttributeMap
}; };
FindAttributeImpact(aAttribute, aHint, return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
/** /**
@ -3245,68 +3221,67 @@ nsGenericHTMLElement::MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAt
const nsGenericHTMLElement::AttributeImpactEntry /* static */ const nsGenericHTMLElement::AttributeDependenceEntry
nsGenericHTMLElement::sCommonAttributeMap[] = { nsGenericHTMLElement::sCommonAttributeMap[] = {
{ &nsHTMLAtoms::dir, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::dir },
{ &nsHTMLAtoms::lang, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::lang },
{ &nsHTMLAtoms::_baseHref, NS_STYLE_HINT_VISUAL }, { nsnull }
{ nsnull, NS_STYLE_HINT_NONE }
}; };
const /* static */ const nsGenericHTMLElement::AttributeDependenceEntry
nsGenericHTMLElement::AttributeImpactEntry nsGenericHTMLElement::sImageMarginSizeAttributeMap[] = {
nsGenericHTMLElement::sImageAttributeMap[] = { { &nsHTMLAtoms::width },
{ &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::height },
{ &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::hspace },
{ &nsHTMLAtoms::hspace, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::vspace },
{ &nsHTMLAtoms::vspace, NS_STYLE_HINT_REFLOW }, { nsnull }
{ nsnull, NS_STYLE_HINT_NONE }
}; };
const nsGenericHTMLElement::AttributeImpactEntry /* static */ const nsGenericHTMLElement::AttributeDependenceEntry
nsGenericHTMLElement::sImageAlignAttributeMap[] = { nsGenericHTMLElement::sImageAlignAttributeMap[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, { &nsHTMLAtoms::align },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
const nsGenericHTMLElement::AttributeImpactEntry /* static */ const nsGenericHTMLElement::AttributeDependenceEntry
nsGenericHTMLElement::sDivAlignAttributeMap[] = {
{ &nsHTMLAtoms::align },
{ nsnull }
};
/* static */ const nsGenericHTMLElement::AttributeDependenceEntry
nsGenericHTMLElement::sImageBorderAttributeMap[] = { nsGenericHTMLElement::sImageBorderAttributeMap[] = {
{ &nsHTMLAtoms::border, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::border },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
/* static */ const nsGenericHTMLElement::AttributeDependenceEntry
const nsGenericHTMLElement::AttributeImpactEntry
nsGenericHTMLElement::sBackgroundAttributeMap[] = { nsGenericHTMLElement::sBackgroundAttributeMap[] = {
{ &nsHTMLAtoms::background, NS_STYLE_HINT_VISUAL }, { &nsHTMLAtoms::background },
{ &nsHTMLAtoms::bgcolor, NS_STYLE_HINT_VISUAL }, { &nsHTMLAtoms::bgcolor },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
void PRBool
nsGenericHTMLElement::FindAttributeImpact(const nsIAtom* aAttribute, nsGenericHTMLElement::FindAttributeDependence(const nsIAtom* aAttribute,
nsChangeHint& aHint, const AttributeDependenceEntry* const aMaps[],
const AttributeImpactEntry* const aMaps[],
PRUint32 aMapCount) PRUint32 aMapCount)
{ {
for (PRUint32 mapindex = 0; mapindex < aMapCount; ++mapindex) { for (PRUint32 mapindex = 0; mapindex < aMapCount; ++mapindex) {
const AttributeImpactEntry* map = aMaps[mapindex]; for (const AttributeDependenceEntry* map = aMaps[mapindex];
while (map->attribute) { map->attribute; ++map) {
if (aAttribute == *map->attribute) { if (aAttribute == *map->attribute) {
aHint = map->hint; return PR_TRUE;
return;
} }
map++;
} }
} }
// fall-through return PR_FALSE;
aHint = NS_STYLE_HINT_CONTENT;
} }
void void
nsGenericHTMLElement::MapAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, nsGenericHTMLElement::MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
nsRuleData* aRuleData) nsRuleData* aRuleData)
{ {
if (aRuleData->mSID == eStyleStruct_Display || aRuleData->mSID == eStyleStruct_TextReset) { if (aRuleData->mSID == eStyleStruct_Display || aRuleData->mSID == eStyleStruct_TextReset) {
@ -3393,7 +3368,7 @@ nsGenericHTMLElement::MapImageMarginAttributeInto(const nsIHTMLMappedAttributes*
} }
void void
nsGenericHTMLElement::MapImagePositionAttributeInto(const nsIHTMLMappedAttributes* aAttributes, nsGenericHTMLElement::MapImageSizeAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsRuleData* aData) nsRuleData* aData)
{ {
if (!aAttributes || aData->mSID != eStyleStruct_Position || !aData->mPositionData) if (!aAttributes || aData->mSID != eStyleStruct_Position || !aData->mPositionData)

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

@ -233,8 +233,7 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
#ifdef DEBUG #ifdef DEBUG
@ -493,31 +492,26 @@ public:
*/ */
static void MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes, static void MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsRuleData* aRuleData); nsRuleData* aRuleData);
struct AttributeImpactEntry { struct AttributeDependenceEntry {
nsIAtom** attribute; nsIAtom** attribute;
nsChangeHint hint;
}; };
static const AttributeImpactEntry sCommonAttributeMap[]; static const AttributeDependenceEntry sCommonAttributeMap[];
static const AttributeImpactEntry sImageAttributeMap[]; static const AttributeDependenceEntry sImageMarginSizeAttributeMap[];
static const AttributeImpactEntry sImageBorderAttributeMap[]; static const AttributeDependenceEntry sImageBorderAttributeMap[];
static const AttributeImpactEntry sImageAlignAttributeMap[]; static const AttributeDependenceEntry sImageAlignAttributeMap[];
static const AttributeImpactEntry sBackgroundAttributeMap[]; static const AttributeDependenceEntry sDivAlignAttributeMap[];
static const AttributeDependenceEntry sBackgroundAttributeMap[];
/** /**
* A common method where you can just pass in a list of maps to * A common method where you can just pass in a list of maps to check
* check for impact. Most implementations of GetMappedAttributeImpact * for attribute dependence. Most implementations of
* should use this function as a default handler. * HasAttributeDependentStyle should use this function as a default
* * handler.
* @param aAttribute attribute that we care about
* @param aHint the resulting hint
* @param aImpactFlags the types of attributes that we care about - see the
* NS_*_ATTRIBUTE_IMPACT flags
*/ */
static PRBool
static void FindAttributeDependence(const nsIAtom* aAttribute,
FindAttributeImpact(const nsIAtom* aAttribute, nsChangeHint& aHint, const AttributeDependenceEntry* const aMaps[],
const AttributeImpactEntry* const aMaps[],
PRUint32 aMapCount); PRUint32 aMapCount);
/** /**
* Helper to map the align attribute into a style struct. * Helper to map the align attribute into a style struct.
@ -526,7 +520,7 @@ public:
* @param aData the returned rule data [INOUT] * @param aData the returned rule data [INOUT]
* @see GetAttributeMappingFunction * @see GetAttributeMappingFunction
*/ */
static void MapAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, static void MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
nsRuleData* aData); nsRuleData* aData);
/** /**
@ -565,7 +559,7 @@ public:
* @param aData the returned rule data [INOUT] * @param aData the returned rule data [INOUT]
* @see GetAttributeMappingFunction * @see GetAttributeMappingFunction
*/ */
static void MapImagePositionAttributeInto(const nsIHTMLMappedAttributes* aAttributes, static void MapImageSizeAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsRuleData* aData); nsRuleData* aData);
/** /**
* Helper to map the background attributes (currently background and bgcolor) * Helper to map the background attributes (currently background and bgcolor)

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

@ -83,8 +83,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
protected: protected:
PRBool mReflectedApplet; PRBool mReflectedApplet;
}; };
@ -222,25 +221,22 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLAppletElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLAppletElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
sCommonAttributeMap, sCommonAttributeMap,
sImageAttributeMap, sImageMarginSizeAttributeMap,
sImageAlignAttributeMap, sImageAlignAttributeMap,
sImageBorderAttributeMap sImageBorderAttributeMap
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -73,8 +73,7 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -211,22 +210,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLBRElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::clear, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::clear },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -65,9 +65,6 @@ public:
// nsIDOMHTMLBaseElement // nsIDOMHTMLBaseElement
NS_DECL_NSIDOMHTMLBASEFONTELEMENT NS_DECL_NSIDOMHTMLBASEFONTELEMENT
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -202,25 +199,3 @@ nsHTMLBaseFontElement::SetSize(PRInt32 aSize)
return SetHTMLAttribute(nsHTMLAtoms::size, value, PR_TRUE); return SetHTMLAttribute(nsHTMLAtoms::size, value, PR_TRUE);
} }
NS_IMETHODIMP
nsHTMLBaseFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
static const AttributeImpactEntry attributes[] = {
// XXX this seems a bit harsh, perhaps we need a reflow_all?
{ &nsHTMLAtoms::color, NS_STYLE_HINT_RECONSTRUCT_ALL },
{ &nsHTMLAtoms::face, NS_STYLE_HINT_RECONSTRUCT_ALL },
{ &nsHTMLAtoms::size, NS_STYLE_HINT_RECONSTRUCT_ALL },
{ nsnull, NS_STYLE_HINT_NONE }
};
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -121,8 +121,7 @@ public:
PRBool aCompileEventHandlers); PRBool aCompileEventHandlers);
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
protected: protected:
BodyRule* mContentStyleRule; BodyRule* mContentStyleRule;
@ -627,27 +626,28 @@ nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLBodyElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLBodyElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::link, NS_STYLE_HINT_VISUAL }, { &nsHTMLAtoms::link },
{ &nsHTMLAtoms::vlink, NS_STYLE_HINT_VISUAL }, { &nsHTMLAtoms::vlink },
{ &nsHTMLAtoms::alink, NS_STYLE_HINT_VISUAL }, { &nsHTMLAtoms::alink },
{ &nsHTMLAtoms::text, NS_STYLE_HINT_VISUAL }, { &nsHTMLAtoms::text },
{ &nsHTMLAtoms::marginwidth, NS_STYLE_HINT_REFLOW }, // These aren't mapped through attribute mapping, but they are
{ &nsHTMLAtoms::marginheight, NS_STYLE_HINT_REFLOW }, // mapped through a style rule, so it is attribute dependent style.
{ nsnull, NS_STYLE_HINT_NONE }, // XXXldb But we don't actually replace the body rule when we have
// dynamic changes...
{ &nsHTMLAtoms::marginwidth },
{ &nsHTMLAtoms::marginheight },
{ nsnull },
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
sBackgroundAttributeMap, sBackgroundAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -71,8 +71,7 @@ public:
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAString& aValue, const nsAString& aValue,
nsHTMLValue& aResult); nsHTMLValue& aResult);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -174,23 +173,22 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLDListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLDListElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { #if 0
{ &nsHTMLAtoms::compact, NS_STYLE_HINT_CONTENT }, // handled by ua.css? static const AttributeDependenceEntry attributes[] = {
// { &nsHTMLAtoms::compact }, // handled by ua.css?
{ nsnull, NS_STYLE_HINT_NONE }, { nsnull, NS_STYLE_HINT_NONE },
}; };
#endif
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, // attributes,
sCommonAttributeMap sCommonAttributeMap
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -78,8 +78,7 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -218,24 +217,21 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLDirectoryElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLDirectoryElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::type },
{ &nsHTMLAtoms::compact, NS_STYLE_HINT_CONTENT}, // XXX // { &nsHTMLAtoms::compact }, // XXX
{ nsnull, NS_STYLE_HINT_NONE} { nsnull}
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -76,8 +76,7 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -216,23 +215,15 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLDivElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLDivElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry* const map[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, sDivAlignAttributeMap,
{ nsnull, NS_STYLE_HINT_NONE }
};
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap sCommonAttributeMap
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -77,8 +77,7 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -316,27 +315,24 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLFontElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::face, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::face },
{ &nsHTMLAtoms::pointSize, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::pointSize },
{ &nsHTMLAtoms::size, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::size },
{ &nsHTMLAtoms::fontWeight, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::fontWeight },
{ &nsHTMLAtoms::color, NS_STYLE_HINT_VISUAL }, { &nsHTMLAtoms::color },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -87,7 +87,8 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const; nsChangeHint& aHint) const;
private: private:
nsresult ParseRowCol(const nsAString& aValue, nsresult ParseRowCol(const nsAString& aValue,
@ -107,7 +108,7 @@ private:
PRInt32 mNumCols; PRInt32 mNumCols;
/** /**
* The style hint to return for the rows/cols attrs in * The style hint to return for the rows/cols attrs in
* GetMappedAttributeImpact * GetAttributeChangeHint
*/ */
nsChangeHint mCurrentRowColHint; nsChangeHint mCurrentRowColHint;
/** /**
@ -220,7 +221,7 @@ nsHTMLFrameSetElement::SetAttr(PRInt32 aNameSpaceID,
* columns has changed. If it has, we need to reframe; otherwise * columns has changed. If it has, we need to reframe; otherwise
* we want to reflow. So we set mCurrentRowColHint here, then call * we want to reflow. So we set mCurrentRowColHint here, then call
* nsGenericHTMLContainerElement::SetAttr, which will end up * nsGenericHTMLContainerElement::SetAttr, which will end up
* calling GetMappedAttributeImpact and notifying layout with that * calling GetAttributeChangeHint and notifying layout with that
* hint. Once nsGenericHTMLContainerElement::SetAttr returns, we * hint. Once nsGenericHTMLContainerElement::SetAttr returns, we
* want to go back to our normal hint, which is * want to go back to our normal hint, which is
* NS_STYLE_HINT_REFLOW. * NS_STYLE_HINT_REFLOW.
@ -384,24 +385,18 @@ nsHTMLFrameSetElement::AttributeToString(nsIAtom* aAttribute,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLFrameSetElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLFrameSetElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
// can't be static const because it uses mCurrentRowColHint nsresult rv =
const AttributeImpactEntry attributes[] = { nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute,
{ &nsHTMLAtoms::rows, mCurrentRowColHint }, aModType, aHint);
{ &nsHTMLAtoms::cols, mCurrentRowColHint }, if (aAttribute == nsHTMLAtoms::rows ||
{ nsnull, NS_STYLE_HINT_NONE }, aAttribute == nsHTMLAtoms::cols) {
}; NS_UpdateHint(aHint, mCurrentRowColHint);
}
const AttributeImpactEntry* const map[] = { return rv;
attributes,
sCommonAttributeMap
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
nsresult nsresult

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

@ -73,8 +73,10 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const; nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -270,25 +272,35 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLHRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLHRElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { nsresult rv =
{ &nsHTMLAtoms::noshade, NS_STYLE_HINT_VISUAL }, nsGenericHTMLLeafElement::GetAttributeChangeHint(aAttribute,
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, aModType, aHint);
{ &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, if (aAttribute == nsHTMLAtoms::noshade) {
{ &nsHTMLAtoms::size, NS_STYLE_HINT_REFLOW }, NS_UpdateHint(aHint, NS_STYLE_HINT_VISUAL);
{ nsnull, NS_STYLE_HINT_NONE }, }
return rv;
}
NS_IMETHODIMP_(PRBool)
nsHTMLHRElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::align },
{ &nsHTMLAtoms::width },
{ &nsHTMLAtoms::size },
{ nsnull },
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -73,8 +73,7 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -198,24 +197,15 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLHeadingElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, nsHTMLHeadingElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
PRInt32 aModType,
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry* const map[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, sDivAlignAttributeMap,
{ nsnull, NS_STYLE_HINT_NONE }, sCommonAttributeMap
}; };
static const AttributeImpactEntry* const map[] = { return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -119,8 +119,7 @@ public:
return nsGenericHTMLContainerElement::SetAttr(aNodeInfo, aValue, aNotify); return nsGenericHTMLContainerElement::SetAttr(aNodeInfo, aValue, aNotify);
} }
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
protected: protected:
@ -485,31 +484,27 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
} }
} }
nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLIFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, nsHTMLIFrameElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
PRInt32 aModType,
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::width },
{ &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::height },
{ &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, { &nsHTMLAtoms::frameborder },
{ &nsHTMLAtoms::frameborder, NS_STYLE_HINT_REFLOW }, { nsnull },
{ nsnull, NS_STYLE_HINT_NONE },
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sImageAlignAttributeMap,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -122,9 +122,10 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType,
nsChangeHint& aHint) const; nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
@ -549,36 +550,39 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
{ {
if (!aData || !aAttributes) if (!aData || !aAttributes)
return; return;
nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLImageElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, nsHTMLImageElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { nsresult rv =
{ &nsHTMLAtoms::usemap, NS_STYLE_HINT_FRAMECHANGE }, nsGenericHTMLLeafElement::GetAttributeChangeHint(aAttribute,
{ &nsHTMLAtoms::ismap, NS_STYLE_HINT_FRAMECHANGE }, aModType, aHint);
{ &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, if (aAttribute == nsHTMLAtoms::usemap ||
{ nsnull, NS_STYLE_HINT_NONE }, aAttribute == nsHTMLAtoms::ismap) {
}; NS_UpdateHint(aHint, NS_STYLE_HINT_FRAMECHANGE);
}
return rv;
}
static const AttributeImpactEntry* const map[] = { NS_IMETHODIMP_(PRBool)
attributes, nsHTMLImageElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
static const AttributeDependenceEntry* const map[] = {
sCommonAttributeMap, sCommonAttributeMap,
sImageAttributeMap, sImageMarginSizeAttributeMap,
sImageBorderAttributeMap sImageBorderAttributeMap,
sImageAlignAttributeMap
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -181,8 +181,10 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const; nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
@ -1955,9 +1957,9 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
value.GetIntValue() == NS_FORM_INPUT_IMAGE) { value.GetIntValue() == NS_FORM_INPUT_IMAGE) {
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
// Images treat align as "float" // Images treat align as "float"
nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
} else { } else {
// Everything else treats align as "text-align" // Everything else treats align as "text-align"
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
@ -1967,34 +1969,44 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLInputElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLInputElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
nsChangeHint valueHint = (mType == NS_FORM_INPUT_BUTTON || nsresult rv =
mType == NS_FORM_INPUT_RESET || nsGenericHTMLLeafFormElement::GetAttributeChangeHint(aAttribute,
mType == NS_FORM_INPUT_SUBMIT) ? aModType, aHint);
NS_STYLE_HINT_CONTENT : NS_STYLE_HINT_ATTRCHANGE; if (aAttribute == nsHTMLAtoms::type) {
NS_UpdateHint(aHint, NS_STYLE_HINT_FRAMECHANGE);
} else if (aAttribute == nsHTMLAtoms::value) {
NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
} else if (aAttribute == nsHTMLAtoms::size &&
(mType == NS_FORM_INPUT_TEXT ||
mType == NS_FORM_INPUT_PASSWORD)) {
NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
}
return rv;
}
const AttributeImpactEntry attributes[] = { NS_IMETHODIMP_(PRBool)
{ &nsHTMLAtoms::value, valueHint }, nsHTMLInputElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{ &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, {
{ &nsHTMLAtoms::type, NS_STYLE_HINT_FRAMECHANGE }, static const AttributeDependenceEntry attributes[] = {
{ nsnull, NS_STYLE_HINT_NONE }, { &nsHTMLAtoms::align },
{ &nsHTMLAtoms::type },
{ nsnull },
}; };
const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
sImageAttributeMap, sImageMarginSizeAttributeMap,
sImageBorderAttributeMap, sImageBorderAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLInputElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const nsHTMLInputElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
{ {

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

@ -73,8 +73,7 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -236,23 +235,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLLIElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLLIElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::type },
{ nsnull, NS_STYLE_HINT_NONE }, { nsnull },
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -70,7 +70,8 @@ public:
// nsIDOMHTMLMapElement // nsIDOMHTMLMapElement
NS_DECL_NSIDOMHTMLMAPELEMENT NS_DECL_NSIDOMHTMLMAPELEMENT
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const; nsChangeHint& aHint) const;
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
PRBool aCompileEventHandlers); PRBool aCompileEventHandlers);
@ -212,20 +213,15 @@ NS_IMPL_STRING_ATTR(nsHTMLMapElement, Name, name)
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLMapElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLMapElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { nsresult rv =
{ &nsHTMLAtoms::name, NS_STYLE_HINT_RECONSTRUCT_ALL }, nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute,
{ nsnull, NS_STYLE_HINT_NONE } aModType, aHint);
}; if (aAttribute == nsHTMLAtoms::name) {
NS_UpdateHint(aHint, NS_STYLE_HINT_RECONSTRUCT_ALL);
static const AttributeImpactEntry* const map[] = { }
attributes, return rv;
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -80,8 +80,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -218,23 +217,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLMenuElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLMenuElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::type },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -74,8 +74,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -254,23 +253,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLOListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLOListElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::type },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -86,8 +86,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -288,27 +287,24 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (!aData) if (!aData)
return; return;
nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLObjectElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
sCommonAttributeMap, sCommonAttributeMap,
sImageAttributeMap, sImageMarginSizeAttributeMap,
sImageBorderAttributeMap, sImageBorderAttributeMap,
sImageAlignAttributeMap, sImageAlignAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -109,7 +109,7 @@ public:
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAString& aValue, const nsAString& aValue,
nsHTMLValue& aResult); nsHTMLValue& aResult);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType,
nsChangeHint& aHint) const; nsChangeHint& aHint) const;
@ -491,35 +491,19 @@ nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLOptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLOptionElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
nsIFormControlFrame* fcFrame = GetSelectFrame(); nsresult rv =
nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute,
aModType, aHint);
if (fcFrame) { if (aAttribute == nsHTMLAtoms::label ||
static const AttributeImpactEntry attributes[] = { aAttribute == nsHTMLAtoms::text) {
{ &nsHTMLAtoms::label, NS_STYLE_HINT_REFLOW }, NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
{ &nsHTMLAtoms::text, NS_STYLE_HINT_REFLOW },
{ nsnull, NS_STYLE_HINT_NONE }
};
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
} else {
// XXX don't we want to try common attributes here?
if (aAttribute == nsXULAtoms::menuactive) {
aHint = NS_STYLE_HINT_CONTENT;
} else {
aHint = NS_STYLE_HINT_NONE;
} }
} return rv;
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -76,8 +76,7 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -200,23 +199,15 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLParagraphElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLParagraphElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry* const map[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, sDivAlignAttributeMap,
{ nsnull, NS_STYLE_HINT_NONE }
};
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -75,8 +75,10 @@ public:
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute, NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAString& aValue, const nsAString& aValue,
nsHTMLValue& aResult); nsHTMLValue& aResult);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const; nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -252,30 +254,38 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLPreElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLPreElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { nsresult rv =
{ &nsHTMLAtoms::variable, NS_STYLE_HINT_REFLOW}, nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute,
{ &nsHTMLAtoms::wrap, NS_STYLE_HINT_REFLOW}, aModType, aHint);
{ &nsHTMLAtoms::cols, NS_STYLE_HINT_REFLOW}, if (aAttribute == nsHTMLAtoms::tabstop) {
{ &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW}, NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
{ &nsHTMLAtoms::tabstop, NS_STYLE_HINT_REFLOW}, }
{ nsnull, NS_STYLE_HINT_NONE }, return rv;
}
NS_IMETHODIMP_(PRBool)
nsHTMLPreElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::variable },
{ &nsHTMLAtoms::wrap },
{ &nsHTMLAtoms::cols },
{ &nsHTMLAtoms::width },
{ nsnull },
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLPreElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const nsHTMLPreElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
{ {

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

@ -257,8 +257,10 @@ public:
const nsAString& aValue, const nsAString& aValue,
nsHTMLValue& aResult); nsHTMLValue& aResult);
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType, nsChangeHint& aHint) const; PRInt32 aModType,
nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
protected: protected:
@ -1873,30 +1875,34 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (!aData || !aAttributes) if (!aData || !aAttributes)
return; return;
nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLSelectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, nsHTMLSelectElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { nsresult rv =
{ &nsHTMLAtoms::multiple, NS_STYLE_HINT_FRAMECHANGE }, nsGenericHTMLContainerFormElement::GetAttributeChangeHint(aAttribute,
{ &nsHTMLAtoms::size, NS_STYLE_HINT_FRAMECHANGE }, aModType, aHint);
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, if (aAttribute == nsHTMLAtoms::multiple ||
{ nsnull, NS_STYLE_HINT_NONE } aAttribute == nsHTMLAtoms::size) {
}; NS_UpdateHint(aHint, NS_STYLE_HINT_FRAMECHANGE);
}
return rv;
}
static const AttributeImpactEntry* const map[] = { NS_IMETHODIMP_(PRBool)
attributes, nsHTMLSelectElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
static const AttributeDependenceEntry* const map[] = {
sCommonAttributeMap, sCommonAttributeMap,
sImageAlignAttributeMap
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -95,9 +95,7 @@ public:
NS_IMETHOD AttributeToString(nsIAtom* aAttribute, NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
PRInt32 aModType,
PRInt32& aHint) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
}; };
@ -324,29 +322,26 @@ nsHTMLSharedContainerElement::AttributeToString(nsIAtom* aAttribute,
aResult); aResult);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLSharedContainerElement::GetMappedAttributeImpact(const nsIAtom* aAttr, nsHTMLSharedContainerElement::HasAttributeDependentStyle(const nsIAtom* aAttr) const
PRInt32 aModType,
PRInt32& aHint) const
{ {
if (nsGenericHTMLContainerElement::HasAttributeDependentStyle(aAttr)) {
return PR_TRUE;
}
if (mNodeInfo->Equals(nsHTMLAtoms::dir) || if (mNodeInfo->Equals(nsHTMLAtoms::dir) ||
mNodeInfo->Equals(nsHTMLAtoms::menu) || mNodeInfo->Equals(nsHTMLAtoms::menu) ||
mNodeInfo->Equals(nsHTMLAtoms::ol)) { mNodeInfo->Equals(nsHTMLAtoms::ol)) {
if (aAttr == nsHTMLAtoms::type) { if (aAttr == nsHTMLAtoms::type) {
aHint = NS_STYLE_HINT_REFLOW; return PR_TRUE;
} else if (mNodeInfo->Equals(nsHTMLAtoms::dir) &&
aAttr == nsHTMLAtoms::compact) {
aHint = NS_STYLE_HINT_CONTENT; // XXX
} }
} else if (mNodeInfo->Equals(nsHTMLAtoms::caption)) { } else if (mNodeInfo->Equals(nsHTMLAtoms::caption)) {
if (aAttr == nsHTMLAtoms::align) { if (aAttr == nsHTMLAtoms::align) {
aHint = NS_STYLE_HINT_REFLOW; return PR_TRUE;
} }
} }
return nsGenericHTMLContainerElement::GetMappedAttributeImpact(aAttr, return PR_FALSE;
aModType,
aHint);
} }
static void static void

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

@ -103,8 +103,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
PRInt32 aModType, nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -301,7 +300,7 @@ SpacerMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
return; return;
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
if (aData->mPositionData) { if (aData->mPositionData) {
nsHTMLValue value; nsHTMLValue value;
@ -390,8 +389,8 @@ EmbedMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
@ -404,45 +403,40 @@ PlainMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLSharedLeafElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, nsHTMLSharedLeafElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
PRInt32 aModType,
nsChangeHint& aHint) const
{ {
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
sCommonAttributeMap, sCommonAttributeMap,
sImageAttributeMap, sImageMarginSizeAttributeMap,
sImageAlignAttributeMap, sImageAlignAttributeMap,
sImageBorderAttributeMap sImageBorderAttributeMap
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::usemap, NS_STYLE_HINT_FRAMECHANGE }, // XXXldb This is just wrong.
{ &nsHTMLAtoms::ismap, NS_STYLE_HINT_FRAMECHANGE }, { &nsHTMLAtoms::usemap },
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::ismap },
{ nsnull, NS_STYLE_HINT_NONE } { &nsHTMLAtoms::align },
{ nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
sImageAttributeMap, sImageMarginSizeAttributeMap,
sImageBorderAttributeMap, sImageBorderAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
return nsGenericHTMLLeafElement::GetMappedAttributeImpact(aAttribute, return nsGenericHTMLLeafElement::HasAttributeDependentStyle(aAttribute);
aModType, aHint);
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -103,8 +103,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
PRInt32 aModType, nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -301,7 +300,7 @@ SpacerMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
return; return;
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
if (aData->mPositionData) { if (aData->mPositionData) {
nsHTMLValue value; nsHTMLValue value;
@ -390,8 +389,8 @@ EmbedMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
@ -404,45 +403,40 @@ PlainMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLSharedLeafElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, nsHTMLSharedLeafElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
PRInt32 aModType,
nsChangeHint& aHint) const
{ {
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) { if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
sCommonAttributeMap, sCommonAttributeMap,
sImageAttributeMap, sImageMarginSizeAttributeMap,
sImageAlignAttributeMap, sImageAlignAttributeMap,
sImageBorderAttributeMap sImageBorderAttributeMap
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) { if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::usemap, NS_STYLE_HINT_FRAMECHANGE }, // XXXldb This is just wrong.
{ &nsHTMLAtoms::ismap, NS_STYLE_HINT_FRAMECHANGE }, { &nsHTMLAtoms::usemap },
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::ismap },
{ nsnull, NS_STYLE_HINT_NONE } { &nsHTMLAtoms::align },
{ nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
sImageAttributeMap, sImageMarginSizeAttributeMap,
sImageBorderAttributeMap, sImageBorderAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
return nsGenericHTMLLeafElement::GetMappedAttributeImpact(aAttribute, return nsGenericHTMLLeafElement::HasAttributeDependentStyle(aAttribute);
aModType, aHint);
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -86,8 +86,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -288,27 +287,24 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (!aData) if (!aData)
return; return;
nsGenericHTMLElement::MapAlignAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImagePositionAttributeInto(aAttributes, aData); nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLObjectElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
sCommonAttributeMap, sCommonAttributeMap,
sImageAttributeMap, sImageMarginSizeAttributeMap,
sImageBorderAttributeMap, sImageBorderAttributeMap,
sImageAlignAttributeMap, sImageAlignAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -74,8 +74,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -213,23 +212,20 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLTableCaptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLTableCaptionElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::align },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -84,8 +84,7 @@ public:
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
protected: protected:
// This does not return a nsresult since all we care about is if we // This does not return a nsresult since all we care about is if we
@ -247,6 +246,8 @@ nsHTMLTableCellElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
{ {
// get table, add its rules too // get table, add its rules too
// XXX can we safely presume structure or do we need to QI on the way up? // XXX can we safely presume structure or do we need to QI on the way up?
// XXXldb This needs to handle the possibility (for XHTML) that
// there's no row-group.
nsCOMPtr<nsIContent> row; nsCOMPtr<nsIContent> row;
GetParent(getter_AddRefs(row)); GetParent(getter_AddRefs(row));
@ -510,32 +511,33 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLTableCellElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLTableCellElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::align },
{ &nsHTMLAtoms::valign, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::valign },
{ &nsHTMLAtoms::nowrap, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::nowrap },
{ &nsHTMLAtoms::abbr, NS_STYLE_HINT_REFLOW }, #if 0
{ &nsHTMLAtoms::axis, NS_STYLE_HINT_REFLOW }, // XXXldb If these are implemented, they might need to move to
{ &nsHTMLAtoms::headers, NS_STYLE_HINT_REFLOW }, // GetAttributeChangeHint (depending on how, and preferably not).
{ &nsHTMLAtoms::scope, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::abbr },
{ &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::axis },
{ &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::headers },
{ nsnull, NS_STYLE_HINT_NONE } { &nsHTMLAtoms::scope },
#endif
{ &nsHTMLAtoms::width },
{ &nsHTMLAtoms::height },
{ nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
sBackgroundAttributeMap, sBackgroundAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -83,8 +83,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -251,10 +250,9 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat
if (!aAttributes || !aData) if (!aAttributes || !aData)
return; return;
nsHTMLValue value;
if (aData->mPositionData && aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) { if (aData->mPositionData && aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
// width // width
nsHTMLValue value;
aAttributes->GetAttribute(nsHTMLAtoms::width, value); aAttributes->GetAttribute(nsHTMLAtoms::width, value);
if (value.GetUnit() != eHTMLUnit_Null) { if (value.GetUnit() != eHTMLUnit_Null) {
switch (value.GetUnit()) { switch (value.GetUnit()) {
@ -306,8 +304,6 @@ void ColMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (!aAttributes || !aData) if (!aAttributes || !aData)
return; return;
nsHTMLValue value;
if (aData->mSID == eStyleStruct_Table && if (aData->mSID == eStyleStruct_Table &&
aData->mTableData && aData->mTableData &&
aData->mTableData->mSpan.GetUnit() == eCSSUnit_Null) { aData->mTableData->mSpan.GetUnit() == eCSSUnit_Null) {
@ -322,31 +318,38 @@ void ColMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
MapAttributesIntoRule(aAttributes, aData); MapAttributesIntoRule(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLTableColElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, nsHTMLTableColElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
PRInt32 aModType,
nsChangeHint& aHint) const
{ {
// we don't match "span" if we're a <col> static const AttributeDependenceEntry attributes[] = {
nsIAtom** matchSpan = mNodeInfo->Equals(nsHTMLAtoms::col) ? { &nsHTMLAtoms::width },
nsnull : &nsHTMLAtoms::span; { &nsHTMLAtoms::align },
{ &nsHTMLAtoms::valign },
const AttributeImpactEntry attributes[] = { { nsnull }
{ &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::valign, NS_STYLE_HINT_REFLOW },
{ matchSpan, NS_STYLE_HINT_REFLOW },
{ nsnull, NS_STYLE_HINT_NONE }
}; };
const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry span_attribute[] = {
{ &nsHTMLAtoms::span }
};
static const AttributeDependenceEntry* const col_map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); static const AttributeDependenceEntry* const colspan_map[] = {
attributes,
span_attribute,
sCommonAttributeMap,
};
return NS_OK; // we don't match "span" if we're a <col>
// XXXldb Should this be reflected in the mapping function?
if (mNodeInfo->Equals(nsHTMLAtoms::col))
return FindAttributeDependence(aAttribute, col_map,
NS_ARRAY_LENGTH(col_map));
return FindAttributeDependence(aAttribute, colspan_map,
NS_ARRAY_LENGTH(colspan_map));
} }

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

@ -90,8 +90,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
protected: protected:
GenericElementCollection *mTBodies; GenericElementCollection *mTBodies;
@ -1231,6 +1230,16 @@ static void
MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsRuleData* aData) nsRuleData* aData)
{ {
// XXX Bug 211636: This function is used by a single style rule
// that's used to match two different type of elements -- tables, and
// table cells. (nsHTMLTableCellElement overrides
// WalkContentStyleRules so that this happens.) This violates the
// nsIStyleRule contract, since it's the same style rule object doing
// the mapping in two different ways. It's also incorrect since it's
// testing the display type of the style context rather than checking
// which *element* it's matching (style rules should not stop matching
// when the display type is changed).
if (!aData) if (!aData)
return; return;
@ -1492,41 +1501,38 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
} }
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLTableElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLTableElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::layout, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::layout },
{ &nsHTMLAtoms::cellpadding, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::cellpadding },
{ &nsHTMLAtoms::cellspacing, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::cellspacing },
{ &nsHTMLAtoms::cols, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::cols },
{ &nsHTMLAtoms::border, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::border },
{ &nsHTMLAtoms::frame, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::frame },
{ &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::width },
{ &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::height },
{ &nsHTMLAtoms::hspace, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::hspace },
{ &nsHTMLAtoms::vspace, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::vspace },
{ &nsHTMLAtoms::bordercolor, NS_STYLE_HINT_VISUAL }, { &nsHTMLAtoms::bordercolor },
// Changing to rules will force border-collapse. Unfortunately, if // Changing to rules will force border-collapse. Unfortunately, if
// border-collapse was already in effect, then a frame change is // border-collapse was already in effect, then a frame change is
// not necessary. // not necessary.
{ &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE }, { &nsHTMLAtoms::align },
{ &nsHTMLAtoms::rules, NS_STYLE_HINT_FRAMECHANGE }, { &nsHTMLAtoms::rules },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
sBackgroundAttributeMap, sBackgroundAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -185,8 +185,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
protected: protected:
nsresult GetSection(nsIDOMHTMLTableSectionElement** aSection); nsresult GetSection(nsIDOMHTMLTableSectionElement** aSection);
@ -641,26 +640,23 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLTableRowElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLTableRowElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::align },
{ &nsHTMLAtoms::valign, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::valign },
{ &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::height },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
sBackgroundAttributeMap, sBackgroundAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -80,8 +80,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
protected: protected:
GenericElementCollection *mRows; GenericElementCollection *mRows;
@ -395,25 +394,23 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLTableSectionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLTableSectionElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::align },
{ &nsHTMLAtoms::valign, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::valign },
{ &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::height },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
sBackgroundAttributeMap, sBackgroundAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -129,8 +129,10 @@ public:
const nsAString& aValue, const nsAString& aValue,
nsHTMLValue& aResult); nsHTMLValue& aResult);
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const; nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
nsIDOMEvent** aDOMEvent, PRUint32 aFlags, nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
nsEventStatus* aEventStatus); nsEventStatus* aEventStatus);
@ -631,27 +633,33 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLTextAreaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLTextAreaElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
// XXX Bug 50280 - It is unclear why we need to do this here for // XXX Bug 50280 - It is unclear why we need to do this here for
// rows and cols and why the AttributeChanged method in // rows and cols and why the AttributeChanged method in
// nsTextControlFrame does take care of the entire problem, but // nsTextControlFrame does take care of the entire problem, but
// it doesn't and this makes things better // it doesn't and this makes things better
static const AttributeImpactEntry attributes[] = { nsresult rv =
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW }, nsGenericHTMLContainerFormElement::GetAttributeChangeHint(aAttribute,
{ &nsHTMLAtoms::rows, NS_STYLE_HINT_REFLOW }, aModType, aHint);
{ &nsHTMLAtoms::cols, NS_STYLE_HINT_REFLOW }, if (aAttribute == nsHTMLAtoms::rows ||
{ nsnull, NS_STYLE_HINT_NONE } aAttribute == nsHTMLAtoms::cols) {
}; NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
}
return rv;
}
static const AttributeImpactEntry* const map[] = { NS_IMETHODIMP_(PRBool)
attributes, nsHTMLTextAreaElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
static const AttributeDependenceEntry* const map[] = {
sDivAlignAttributeMap,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -77,8 +77,7 @@ public:
const nsHTMLValue& aValue, const nsHTMLValue& aValue,
nsAString& aResult) const; nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const; NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
nsChangeHint& aHint) const;
}; };
nsresult nsresult
@ -235,23 +234,20 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
} }
NS_IMETHODIMP NS_IMETHODIMP_(PRBool)
nsHTMLUListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsHTMLUListElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
nsChangeHint& aHint) const
{ {
static const AttributeImpactEntry attributes[] = { static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW }, { &nsHTMLAtoms::type },
{ nsnull, NS_STYLE_HINT_NONE } { nsnull }
}; };
static const AttributeImpactEntry* const map[] = { static const AttributeDependenceEntry* const map[] = {
attributes, attributes,
sCommonAttributeMap, sCommonAttributeMap,
}; };
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map)); return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
return NS_OK;
} }

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

@ -204,23 +204,20 @@ nsHTMLUnknownElement::SetAttribute(PRInt32 aNameSpaceID,
} }
// set as string value to avoid another string copy // set as string value to avoid another string copy
nsChangeHint impact = NS_STYLE_HINT_NONE; PRBool mapped = HasAttributeDependentStyle(aAttribute);
GetMappedAttributeImpact(aAttribute, nsIDOMMutationEvent::MODIFICATION, impact);
nsCOMPtr<nsIHTMLStyleSheet> sheet(dont_AddRef(GetAttrStyleSheet(mDocument))); nsCOMPtr<nsIHTMLStyleSheet> sheet(dont_AddRef(GetAttrStyleSheet(mDocument)));
if (!mAttributes) { if (!mAttributes) {
result = NS_NewHTMLAttributes(&mAttributes); result = NS_NewHTMLAttributes(&mAttributes);
NS_ENSURE_SUCCESS(result, result); NS_ENSURE_SUCCESS(result, result);
} }
result = mAttributes->SetAttributeFor(aAttribute, aValue, result = mAttributes->SetAttributeFor(aAttribute, aValue, mapped,
(impact & ~(nsChangeHint_AttrChange | nsChangeHint_Aural
| nsChangeHint_Content)) != 0,
this, sheet); this, sheet);
} }
if (aNotify && (mDocument)) { if (aNotify && (mDocument)) {
result = mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, nsIDOMMutationEvent::MODIFICATION, result = mDocument->AttributeChanged(this, aNameSpaceID, aAttribute,
NS_STYLE_HINT_UNKNOWN); nsIDOMMutationEvent::MODIFICATION);
mDocument->EndUpdate(); mDocument->EndUpdate();
} }

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

@ -1468,8 +1468,7 @@ nsHTMLDocument::AttributeWillChange(nsIContent* aContent, PRInt32 aNameSpaceID,
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLDocument::AttributeChanged(nsIContent* aContent, PRInt32 aNameSpaceID, nsHTMLDocument::AttributeChanged(nsIContent* aContent, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, PRInt32 aModType, nsIAtom* aAttribute, PRInt32 aModType)
nsChangeHint aHint)
{ {
NS_ABORT_IF_FALSE(aContent, "Null content!"); NS_ABORT_IF_FALSE(aContent, "Null content!");
@ -1503,7 +1502,7 @@ nsHTMLDocument::AttributeChanged(nsIContent* aContent, PRInt32 aNameSpaceID,
} }
return nsDocument::AttributeChanged(aContent, aNameSpaceID, aAttribute, return nsDocument::AttributeChanged(aContent, aNameSpaceID, aAttribute,
aModType, aHint); aModType);
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -145,8 +145,7 @@ public:
NS_IMETHOD AttributeChanged(nsIContent* aChild, NS_IMETHOD AttributeChanged(nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
nsChangeHint aHint);
NS_IMETHOD AttributeWillChange(nsIContent* aChild, NS_IMETHOD AttributeWillChange(nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute); nsIAtom* aAttribute);

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

@ -874,12 +874,7 @@ HTMLStyleSheetImpl::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
// Handle the content style rules. // Handle the content style rules.
if (styledContent) { if (styledContent) {
nsChangeHint hint = NS_STYLE_HINT_NONE; nsChangeHint hint = NS_STYLE_HINT_NONE;
styledContent->GetMappedAttributeImpact(aData->mAttribute, if (styledContent->HasAttributeDependentStyle(aData->mAttribute)) {
aData->mModType, hint);
// This is the same test that nsGenericHTMLElement uses when calling
// nsHTMLAttributes::SetAttributeFor.
if ((hint & ~(nsChangeHint_AttrChange | nsChangeHint_Aural |
nsChangeHint_Content)) != 0) {
*aResult = PR_TRUE; *aResult = PR_TRUE;
return NS_OK; return NS_OK;
} }

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

@ -42,17 +42,12 @@
// Defines for various style related constants // Defines for various style related constants
enum nsChangeHint { enum nsChangeHint {
nsChangeHint_None = 0, // change has no impact nsChangeHint_RepaintFrame = 0x01, // change was visual only (e.g., COLOR=)
nsChangeHint_Unknown = 0x01, // change has unknown impact nsChangeHint_ReflowFrame = 0x02, // change requires reflow (e.g., WIDTH=)
nsChangeHint_AttrChange = 0x02, // change should cause notification to frame but nothing else nsChangeHint_SyncFrameView = 0x04, // change requires view to be updated, if there is one (e.g., clip:)
nsChangeHint_Aural = 0x04, // change was aural nsChangeHint_ReconstructFrame = 0x08, // change requires frame change (e.g., display:)
nsChangeHint_Content = 0x08, // change was contentual (e.g., SRC=)
nsChangeHint_RepaintFrame = 0x10, // change was visual only (e.g., COLOR=)
nsChangeHint_ReflowFrame = 0x20, // change requires reflow (e.g., WIDTH=)
nsChangeHint_SyncFrameView = 0x40, // change requires view to be updated, if there is one (e.g., clip:)
nsChangeHint_ReconstructFrame = 0x80, // change requires frame change (e.g., display:)
// This subsumes all the above // This subsumes all the above
nsChangeHint_ReconstructDoc = 0x100 nsChangeHint_ReconstructDoc = 0x10
// change requires reconstruction of entire document (e.g., style sheet change) // change requires reconstruction of entire document (e.g., style sheet change)
// This subsumes all the above // This subsumes all the above
@ -99,25 +94,15 @@ inline PRBool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) {
} }
// Redefine the old NS_STYLE_HINT constants in terms of the new hint structure // Redefine the old NS_STYLE_HINT constants in terms of the new hint structure
const nsChangeHint NS_STYLE_HINT_UNKNOWN = nsChangeHint_Unknown; #define NS_STYLE_HINT_NONE \
const nsChangeHint NS_STYLE_HINT_NONE = nsChangeHint_None; nsChangeHint(0)
const nsChangeHint NS_STYLE_HINT_ATTRCHANGE = nsChangeHint_AttrChange; #define NS_STYLE_HINT_VISUAL \
const nsChangeHint NS_STYLE_HINT_AURAL = (nsChangeHint) nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)
(nsChangeHint_AttrChange | nsChangeHint_Aural); #define NS_STYLE_HINT_REFLOW \
const nsChangeHint NS_STYLE_HINT_CONTENT = (nsChangeHint) nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_ReflowFrame)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content); #define NS_STYLE_HINT_FRAMECHANGE \
const nsChangeHint NS_STYLE_HINT_VISUAL = (nsChangeHint) nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame #define NS_STYLE_HINT_RECONSTRUCT_ALL \
| nsChangeHint_SyncFrameView); nsChangeHint(NS_STYLE_HINT_FRAMECHANGE | nsChangeHint_ReconstructDoc)
const nsChangeHint NS_STYLE_HINT_REFLOW = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame
| nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame);
const nsChangeHint NS_STYLE_HINT_FRAMECHANGE = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame
| nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame | nsChangeHint_ReconstructFrame);
const nsChangeHint NS_STYLE_HINT_RECONSTRUCT_ALL = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame
| nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame | nsChangeHint_ReconstructFrame
| nsChangeHint_ReconstructDoc);
#endif /* nsChangeHint_h___ */ #endif /* nsChangeHint_h___ */

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

@ -1083,7 +1083,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const nsChangeHint nsStyleDisplay::CalcDifference(const nsStyleDisplay& aOther) const
{ {
nsChangeHint hint = nsChangeHint_None; nsChangeHint hint = nsChangeHint(0);
if (mBinding != aOther.mBinding if (mBinding != aOther.mBinding
|| mPosition != aOther.mPosition || mPosition != aOther.mPosition
@ -1395,11 +1395,9 @@ nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aO
if (mUserInput == aOther.mUserInput) { if (mUserInput == aOther.mUserInput) {
if (mUserModify == aOther.mUserModify) { if (mUserModify == aOther.mUserModify) {
if (mUserFocus == aOther.mUserFocus) { // ignore mUserFocus
return NS_STYLE_HINT_NONE; return NS_STYLE_HINT_NONE;
} }
return NS_STYLE_HINT_CONTENT;
}
return NS_STYLE_HINT_VISUAL; return NS_STYLE_HINT_VISUAL;
} }
@ -1441,11 +1439,9 @@ nsChangeHint nsStyleUIReset::CalcDifference(const nsStyleUIReset& aOther) const
if (mForceBrokenImageIcon == aOther.mForceBrokenImageIcon) { if (mForceBrokenImageIcon == aOther.mForceBrokenImageIcon) {
if (mResizer == aOther.mResizer && if (mResizer == aOther.mResizer &&
mUserSelect == aOther.mUserSelect) { mUserSelect == aOther.mUserSelect) {
if (mKeyEquivalent == aOther.mKeyEquivalent) { // ignore mKeyEquivalent
return NS_STYLE_HINT_NONE; return NS_STYLE_HINT_NONE;
} }
return NS_STYLE_HINT_CONTENT;
}
return NS_STYLE_HINT_VISUAL; return NS_STYLE_HINT_VISUAL;
} }
return NS_STYLE_HINT_FRAMECHANGE; return NS_STYLE_HINT_FRAMECHANGE;

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

@ -670,7 +670,7 @@ nsSVGAttributes::SetAttr(nsINodeInfo* aNodeInfo,
PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION)
: PRInt32(nsIDOMMutationEvent::ADDITION); : PRInt32(nsIDOMMutationEvent::ADDITION);
document->AttributeChanged(mContent, nameSpaceID, name, document->AttributeChanged(mContent, nameSpaceID, name,
modHint, NS_STYLE_HINT_UNKNOWN); modHint);
document->EndUpdate(); document->EndUpdate();
} }
} }
@ -746,8 +746,7 @@ nsSVGAttributes::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
if (aNotify) { if (aNotify) {
document->AttributeChanged(mContent, aNameSpaceID, aName, document->AttributeChanged(mContent, aNameSpaceID, aName,
nsIDOMMutationEvent::REMOVAL, nsIDOMMutationEvent::REMOVAL);
NS_STYLE_HINT_UNKNOWN);
document->EndUpdate(); document->EndUpdate();
} }
} }

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

@ -1415,8 +1415,7 @@ nsBindingManager::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
return NS_OK; return NS_OK;
} }

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

@ -266,8 +266,7 @@ nsXMLPrettyPrinter::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
MaybeUnhook(aContent); MaybeUnhook(aContent);
return NS_OK; return NS_OK;

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

@ -405,22 +405,6 @@ static PRBool HasMutationListeners(nsIContent* aContent, PRUint32 aType)
return PR_FALSE; return PR_FALSE;
} }
//----------------------------------------------------------------------
static nsChangeHint
StyleHintFor(nsINodeInfo* aNodeInfo)
{
nsCOMPtr<nsIAtom> tagName = aNodeInfo->GetNameAtom();
if ((tagName == nsXULAtoms::broadcaster) ||
(tagName == nsXULAtoms::command) ||
(tagName == nsXULAtoms::key)) {
return NS_STYLE_HINT_NONE;
}
return NS_STYLE_HINT_UNKNOWN;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
nsrefcnt nsXULElement::gRefCnt; nsrefcnt nsXULElement::gRefCnt;
@ -2524,8 +2508,7 @@ nsXULElement::SetAttr(nsINodeInfo* aNodeInfo,
? PRInt32(nsIDOMMutationEvent::MODIFICATION) ? PRInt32(nsIDOMMutationEvent::MODIFICATION)
: PRInt32(nsIDOMMutationEvent::ADDITION); : PRInt32(nsIDOMMutationEvent::ADDITION);
mDocument->AttributeChanged(this, attrns, attrName, modHint, mDocument->AttributeChanged(this, attrns, attrName, modHint);
StyleHintFor(NodeInfo()));
mDocument->EndUpdate(); mDocument->EndUpdate();
} }
} }
@ -2802,8 +2785,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID,
if (aNotify) { if (aNotify) {
mDocument->AttributeChanged(this, aNameSpaceID, aName, mDocument->AttributeChanged(this, aNameSpaceID, aName,
nsIDOMMutationEvent::REMOVAL, nsIDOMMutationEvent::REMOVAL);
StyleHintFor(NodeInfo()));
// XXXwaterson do we need to mDocument->EndUpdate() here? // XXXwaterson do we need to mDocument->EndUpdate() here?
} }
@ -3645,10 +3627,11 @@ nsXULElement::GetInlineStyleRule(nsIStyleRule** aStyleRule)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, nsXULElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const nsChangeHint& aHint) const
{ {
aHint = NS_STYLE_HINT_CONTENT; // by default, never map attributes to style aHint = NS_STYLE_HINT_NONE;
if (aAttribute == nsXULAtoms::value && if (aAttribute == nsXULAtoms::value &&
(aModType == nsIDOMMutationEvent::REMOVAL || aModType == nsIDOMMutationEvent::ADDITION)) { (aModType == nsIDOMMutationEvent::REMOVAL || aModType == nsIDOMMutationEvent::ADDITION)) {
@ -3659,23 +3642,6 @@ nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModTy
// XUL text frame. If the value attribute is being added or removed, then we need to return // XUL text frame. If the value attribute is being added or removed, then we need to return
// a hint of frame change. (See bugzilla bug 95475 for details.) // a hint of frame change. (See bugzilla bug 95475 for details.)
aHint = NS_STYLE_HINT_FRAMECHANGE; aHint = NS_STYLE_HINT_FRAMECHANGE;
else
aHint = NS_STYLE_HINT_ATTRCHANGE;
}
else if (aAttribute == nsXULAtoms::value || aAttribute == nsXULAtoms::flex ||
aAttribute == nsXULAtoms::label || aAttribute == nsXULAtoms::mousethrough) {
// VERY IMPORTANT! This has a huge positive performance impact!
aHint = NS_STYLE_HINT_ATTRCHANGE;
}
else if (NodeInfo()->Equals(nsXULAtoms::window) ||
NodeInfo()->Equals(nsXULAtoms::page) ||
NodeInfo()->Equals(nsXULAtoms::dialog) ||
NodeInfo()->Equals(nsXULAtoms::wizard)) {
// Ignore 'width', 'height', 'screenX', 'screenY' and 'sizemode' on a <window>
if (nsXULAtoms::width == aAttribute || nsXULAtoms::height == aAttribute ||
nsXULAtoms::screenX == aAttribute || nsXULAtoms::screenY == aAttribute ||
nsXULAtoms::sizemode == aAttribute)
aHint = NS_STYLE_HINT_NONE;
} else { } else {
// if left or top changes we reflow. This will happen in xul containers that // if left or top changes we reflow. This will happen in xul containers that
// manage positioned children such as a bulletinboard. // manage positioned children such as a bulletinboard.
@ -3686,6 +3652,12 @@ nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModTy
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP_(PRBool)
nsXULElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
return PR_FALSE;
}
// Controllers Methods // Controllers Methods
NS_IMETHODIMP NS_IMETHODIMP
nsXULElement::GetControllers(nsIControllers** aResult) nsXULElement::GetControllers(nsIControllers** aResult)

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

@ -472,9 +472,10 @@ public:
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker); NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule); NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType, NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const; nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
// nsIXULContent // nsIXULContent
NS_IMETHOD PeekChildCount(PRInt32& aCount) const; NS_IMETHOD PeekChildCount(PRInt32& aCount) const;

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

@ -1092,8 +1092,7 @@ nsXULDocument::ExecuteOnBroadcastHandlerFor(nsIContent* aBroadcaster,
NS_IMETHODIMP NS_IMETHODIMP
nsXULDocument::AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID, nsXULDocument::AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, PRInt32 aModType, nsIAtom* aAttribute, PRInt32 aModType)
nsChangeHint aHint)
{ {
nsresult rv; nsresult rv;
@ -1152,7 +1151,7 @@ nsXULDocument::AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID,
for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) { for (PRInt32 i = mObservers.Count() - 1; i >= 0; --i) {
nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i]; nsIDocumentObserver* observer = (nsIDocumentObserver*)mObservers[i];
observer->AttributeChanged(this, aElement, aNameSpaceID, aAttribute, observer->AttributeChanged(this, aElement, aNameSpaceID, aAttribute,
aModType, aHint); aModType);
} }
// See if there is anything we need to persist in the localstore. // See if there is anything we need to persist in the localstore.

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

@ -128,8 +128,7 @@ public:
PRInt32 aIndexInContainer); PRInt32 aIndexInContainer);
NS_IMETHOD AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID, NS_IMETHOD AttributeChanged(nsIContent* aElement, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, PRInt32 aModType, nsIAtom* aAttribute, PRInt32 aModType);
nsChangeHint aHint);
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent, nsEvent* aEvent,

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

@ -137,8 +137,7 @@ public:
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
nsChangeHint aHint);
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument* aDocument); NS_IMETHOD DocumentWillBeDestroyed(nsIDocument* aDocument);
@ -1692,8 +1691,7 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
// Handle "open" and "close" cases. We do this handling before // Handle "open" and "close" cases. We do this handling before
// we've notified the observer, so that content is already created // we've notified the observer, so that content is already created
@ -1713,7 +1711,7 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
} }
// Pass along to the generic template builder. // Pass along to the generic template builder.
return nsXULTemplateBuilder::AttributeChanged(aDocument, aContent, aNameSpaceID, aAttribute, aModType, aHint); return nsXULTemplateBuilder::AttributeChanged(aDocument, aContent, aNameSpaceID, aAttribute, aModType);
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -313,8 +313,7 @@ nsXULTemplateBuilder::AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
// Check for a change to the 'ref' attribute on an atom, in which // Check for a change to the 'ref' attribute on an atom, in which
// case we may need to nuke and rebuild the entire content model // case we may need to nuke and rebuild the entire content model

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

@ -638,7 +638,7 @@ NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(inDOMView)
NS_IMETHODIMP NS_IMETHODIMP
inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID, inDOMView::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, PRInt32 aModType, nsChangeHint aHint) nsIAtom* aAttribute, PRInt32 aModType)
{ {
if (!mTree) { if (!mTree) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;

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

@ -216,8 +216,7 @@ nsXPathResult::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
Invalidate(); Invalidate();
return NS_OK; return NS_OK;

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

@ -865,8 +865,7 @@ txMozillaXSLTProcessor::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
mStylesheet = nsnull; mStylesheet = nsnull;
return NS_OK; return NS_OK;

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

@ -10229,8 +10229,7 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
nsresult result = NS_OK; nsresult result = NS_OK;
@ -10242,17 +10241,6 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
// Get the frame associated with the content which is the highest in the frame tree // Get the frame associated with the content which is the highest in the frame tree
nsIFrame* primaryFrame; nsIFrame* primaryFrame;
shell->GetPrimaryFrameFor(aContent, &primaryFrame); shell->GetPrimaryFrameFor(aContent, &primaryFrame);
// Get the frame associated with the content whose style context is highest in the style context tree
nsIFrame* primaryStyleFrame = primaryFrame;
if (primaryFrame) {
PRBool providerIsChild = PR_FALSE;
nsIFrame *styleContextProvider;
primaryFrame->GetParentStyleContextFrame(aPresContext,
&styleContextProvider,
&providerIsChild);
if (providerIsChild)
primaryStyleFrame = styleContextProvider;
}
#if 0 #if 0
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
@ -10261,17 +10249,15 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
#endif #endif
// the style tag has its own interpretation based on aHint // the style tag has its own interpretation based on aHint
if (aHint & nsChangeHint_Unknown) { nsChangeHint hint = NS_STYLE_HINT_NONE;
nsCOMPtr<nsIStyledContent> styledContent = do_QueryInterface(aContent); nsCOMPtr<nsIStyledContent> styledContent = do_QueryInterface(aContent);
if (styledContent) { if (styledContent) {
// Get style hint from HTML content object. // Get style hint from HTML content object.
styledContent->GetMappedAttributeImpact(aAttribute, aModType, aHint); styledContent->GetAttributeChangeHint(aAttribute, aModType, hint);
}
} }
PRBool reconstruct = (aHint & nsChangeHint_ReconstructDoc) != 0; PRBool reconstruct = (hint & nsChangeHint_ReconstructDoc) != 0;
PRBool reframe = (aHint & (nsChangeHint_ReconstructDoc | nsChangeHint_ReconstructFrame)) != 0; PRBool reframe = (hint & (nsChangeHint_ReconstructDoc | nsChangeHint_ReconstructFrame)) != 0;
PRBool restyle = (aHint & ~(nsChangeHint_AttrChange)) != 0;
#ifdef MOZ_XUL #ifdef MOZ_XUL
// The following listbox widget trap prevents offscreen listbox widget // The following listbox widget trap prevents offscreen listbox widget
@ -10323,23 +10309,17 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
} }
// apply changes // apply changes
if (primaryFrame && (aHint & nsChangeHint_AttrChange) && !(aHint & ~(nsChangeHint_AttrChange))) { if (reconstruct) {
result = primaryFrame->AttributeChanged(aPresContext, aContent, aNameSpaceID, aAttribute, aModType, aHint);
}
else if (reconstruct) {
result = ReconstructDocElementHierarchy(aPresContext); result = ReconstructDocElementHierarchy(aPresContext);
} }
else if (reframe) { else if (reframe) {
result = RecreateFramesForContent(aPresContext, aContent); result = RecreateFramesForContent(aPresContext, aContent);
} }
else if (restyle) { else {
// If there is no frame then there is no point in re-styling it,
// is there?
if (primaryFrame) { if (primaryFrame) {
nsChangeHint maxHint = aHint;
nsStyleChangeList changeList; nsStyleChangeList changeList;
// put primary frame on list to deal with, re-resolve may update or add next in flows // put primary frame on list to deal with, re-resolve may update or add next in flows
changeList.AppendChange(primaryFrame, aContent, maxHint); changeList.AppendChange(primaryFrame, aContent, hint);
nsCOMPtr<nsIFrameManager> frameManager; nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager)); shell->GetFrameManager(getter_AddRefs(frameManager));
@ -10347,42 +10327,34 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
frameManager->HasAttributeDependentStyle(aContent, frameManager->HasAttributeDependentStyle(aContent,
aAttribute, aModType, &affects); aAttribute, aModType, &affects);
if (affects) { if (affects) {
#ifdef DEBUG_shaver
fputc('+', stderr);
#endif
// there is an effect, so compute it // there is an effect, so compute it
frameManager->ComputeStyleChangeFor(primaryFrame, frameManager->ComputeStyleChangeFor(primaryFrame,
aNameSpaceID, aAttribute, aNameSpaceID, aAttribute,
changeList, aHint, maxHint); changeList, hint, hint);
} else {
#ifdef DEBUG_shaver
fputc('-', stderr);
#endif
// let this frame update itself, but don't walk the whole frame tree
maxHint = NS_STYLE_HINT_VISUAL;
} }
// maxHint is hint for primary only // hint is for primary only
if (maxHint & nsChangeHint_ReconstructDoc) { if (hint & nsChangeHint_ReconstructDoc) {
result = ReconstructDocElementHierarchy(aPresContext); result = ReconstructDocElementHierarchy(aPresContext);
changeList.Clear(); changeList.Clear();
} else if (maxHint & nsChangeHint_ReconstructFrame) { } else if (hint & nsChangeHint_ReconstructFrame) {
result = RecreateFramesForContent(aPresContext, aContent); result = RecreateFramesForContent(aPresContext, aContent);
changeList.Clear(); changeList.Clear();
} else if (maxHint & ~(nsChangeHint_AttrChange | nsChangeHint_Aural)) { } else {
// let the frame deal with it, since we don't know how to // let the frame deal with it, since we don't know how to
result = primaryFrame->AttributeChanged(aPresContext, aContent, aNameSpaceID, aAttribute, aModType, maxHint); result = primaryFrame->AttributeChanged(aPresContext, aContent,
aNameSpaceID, aAttribute,
aModType);
// XXXwaterson should probably check for special IB siblings // XXXwaterson should probably check for special IB siblings
// here, and propagate the AttributeChanged notification to // here, and propagate the AttributeChanged notification to
// them, as well. Currently, inline and block frames don't // them, as well. Currently, inline frames don't do anything on
// do anything on this notification, so it's not that big a // this notification, so it's not that big a deal.
// deal.
}
// handle any children (primary may be on list too) // handle any children (primary may be on list too)
ProcessRestyledFrames(changeList, aPresContext); ProcessRestyledFrames(changeList, aPresContext);
} }
else { // no frame now, possibly genetate one with new style data }
else {
result = MaybeRecreateFramesForContent(aPresContext, aContent); result = MaybeRecreateFramesForContent(aPresContext, aContent);
} }
} }

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

@ -138,8 +138,7 @@ public:
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
nsChangeHint aHint);
NS_IMETHOD ProcessRestyledFrames(nsStyleChangeList& aRestyleArray, NS_IMETHOD ProcessRestyledFrames(nsStyleChangeList& aRestyleArray,
nsIPresContext* aPresContext); nsIPresContext* aPresContext);

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

@ -42,17 +42,12 @@
// Defines for various style related constants // Defines for various style related constants
enum nsChangeHint { enum nsChangeHint {
nsChangeHint_None = 0, // change has no impact nsChangeHint_RepaintFrame = 0x01, // change was visual only (e.g., COLOR=)
nsChangeHint_Unknown = 0x01, // change has unknown impact nsChangeHint_ReflowFrame = 0x02, // change requires reflow (e.g., WIDTH=)
nsChangeHint_AttrChange = 0x02, // change should cause notification to frame but nothing else nsChangeHint_SyncFrameView = 0x04, // change requires view to be updated, if there is one (e.g., clip:)
nsChangeHint_Aural = 0x04, // change was aural nsChangeHint_ReconstructFrame = 0x08, // change requires frame change (e.g., display:)
nsChangeHint_Content = 0x08, // change was contentual (e.g., SRC=)
nsChangeHint_RepaintFrame = 0x10, // change was visual only (e.g., COLOR=)
nsChangeHint_ReflowFrame = 0x20, // change requires reflow (e.g., WIDTH=)
nsChangeHint_SyncFrameView = 0x40, // change requires view to be updated, if there is one (e.g., clip:)
nsChangeHint_ReconstructFrame = 0x80, // change requires frame change (e.g., display:)
// This subsumes all the above // This subsumes all the above
nsChangeHint_ReconstructDoc = 0x100 nsChangeHint_ReconstructDoc = 0x10
// change requires reconstruction of entire document (e.g., style sheet change) // change requires reconstruction of entire document (e.g., style sheet change)
// This subsumes all the above // This subsumes all the above
@ -99,25 +94,15 @@ inline PRBool NS_IsHintSubset(nsChangeHint aSubset, nsChangeHint aSuperSet) {
} }
// Redefine the old NS_STYLE_HINT constants in terms of the new hint structure // Redefine the old NS_STYLE_HINT constants in terms of the new hint structure
const nsChangeHint NS_STYLE_HINT_UNKNOWN = nsChangeHint_Unknown; #define NS_STYLE_HINT_NONE \
const nsChangeHint NS_STYLE_HINT_NONE = nsChangeHint_None; nsChangeHint(0)
const nsChangeHint NS_STYLE_HINT_ATTRCHANGE = nsChangeHint_AttrChange; #define NS_STYLE_HINT_VISUAL \
const nsChangeHint NS_STYLE_HINT_AURAL = (nsChangeHint) nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)
(nsChangeHint_AttrChange | nsChangeHint_Aural); #define NS_STYLE_HINT_REFLOW \
const nsChangeHint NS_STYLE_HINT_CONTENT = (nsChangeHint) nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_ReflowFrame)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content); #define NS_STYLE_HINT_FRAMECHANGE \
const nsChangeHint NS_STYLE_HINT_VISUAL = (nsChangeHint) nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame #define NS_STYLE_HINT_RECONSTRUCT_ALL \
| nsChangeHint_SyncFrameView); nsChangeHint(NS_STYLE_HINT_FRAMECHANGE | nsChangeHint_ReconstructDoc)
const nsChangeHint NS_STYLE_HINT_REFLOW = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame
| nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame);
const nsChangeHint NS_STYLE_HINT_FRAMECHANGE = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame
| nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame | nsChangeHint_ReconstructFrame);
const nsChangeHint NS_STYLE_HINT_RECONSTRUCT_ALL = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame
| nsChangeHint_SyncFrameView | nsChangeHint_ReflowFrame | nsChangeHint_ReconstructFrame
| nsChangeHint_ReconstructDoc);
#endif /* nsChangeHint_h___ */ #endif /* nsChangeHint_h___ */

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

@ -5294,8 +5294,7 @@ PresShell::AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
// XXXwaterson it might be more elegant to wait until after the // XXXwaterson it might be more elegant to wait until after the
@ -5303,7 +5302,7 @@ PresShell::AttributeChanged(nsIDocument *aDocument,
// squelch any other inappropriate notifications as well. // squelch any other inappropriate notifications as well.
if (mDidInitialReflow) { if (mDidInitialReflow) {
WillCauseReflow(); WillCauseReflow();
rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType, aHint); rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType);
VERIFY_STYLE_TREE; VERIFY_STYLE_TREE;
DidCauseReflow(); DidCauseReflow();
} }

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

@ -823,8 +823,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType) = 0;
PRInt32 aHint) = 0;
/** /**
* Return how your frame can be split. * Return how your frame can be split.

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

@ -229,8 +229,7 @@ public:
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType) = 0;
nsChangeHint aHint) = 0;
/** /**

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

@ -231,8 +231,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType) = 0;
nsChangeHint aHint) = 0;
// Notification that we were unable to render a replaced element. // Notification that we were unable to render a replaced element.
// Called when the replaced element can not be rendered, and we should // Called when the replaced element can not be rendered, and we should

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

@ -527,8 +527,7 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
// propagate disabled to text / button inputs // propagate disabled to text / button inputs
if (aNameSpaceID == kNameSpaceID_None && if (aNameSpaceID == kNameSpaceID_None &&
@ -540,7 +539,7 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext,
SyncAttr(aNameSpaceID, aAttribute, SYNC_TEXT); SyncAttr(aNameSpaceID, aAttribute, SYNC_TEXT);
} }
return nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); return nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType);
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -100,8 +100,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
NS_IMETHOD GetName(nsAString* aName); NS_IMETHOD GetName(nsAString* aName);
NS_IMETHOD_(PRInt32) GetType() const; NS_IMETHOD_(PRInt32) GetType() const;

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

@ -337,8 +337,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
@ -356,7 +355,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext,
// defer to HTMLButtonControlFrame // defer to HTMLButtonControlFrame
} else { } else {
rv = nsHTMLButtonControlFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); rv = nsHTMLButtonControlFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType);
} }
return rv; return rv;
} }

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

@ -99,8 +99,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
protected: protected:
NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize, NS_IMETHOD AddComputedBorderPaddingToDesiredSize(nsHTMLReflowMetrics& aDesiredSize,

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

@ -347,14 +347,13 @@ nsIsIndexFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (nsHTMLAtoms::prompt == aAttribute) { if (nsHTMLAtoms::prompt == aAttribute) {
rv = UpdatePromptLabel(); rv = UpdatePromptLabel();
} else { } else {
rv = nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); rv = nsAreaFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType);
} }
return rv; return rv;
} }

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

@ -115,8 +115,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
void SetFocus(PRBool aOn, PRBool aRepaint); void SetFocus(PRBool aOn, PRBool aRepaint);
void ScrollIntoView(nsIPresContext* aPresContext); void ScrollIntoView(nsIPresContext* aPresContext);

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

@ -2663,20 +2663,12 @@ nsTextControlFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
if (!mEditor || !mSelCon) {return NS_ERROR_NOT_INITIALIZED;} if (!mEditor || !mSelCon) {return NS_ERROR_NOT_INITIALIZED;}
nsresult rv = NS_OK; nsresult rv = NS_OK;
if (nsHTMLAtoms::value == aAttribute) if (nsHTMLAtoms::maxlength == aAttribute)
{
// XXX If this should happen when value= attribute is set, shouldn't it
// happen when .value is set too?
if (aHint != NS_STYLE_HINT_REFLOW)
nsFormControlHelper::StyleChangeReflow(aPresContext, this);
}
else if (nsHTMLAtoms::maxlength == aAttribute)
{ {
PRInt32 maxLength; PRInt32 maxLength;
nsresult rv = GetMaxLength(&maxLength); nsresult rv = GetMaxLength(&maxLength);
@ -2744,22 +2736,10 @@ nsTextControlFrame::AttributeChanged(nsIPresContext* aPresContext,
} }
mEditor->SetFlags(flags); mEditor->SetFlags(flags);
} }
else if ((nsHTMLAtoms::size == aAttribute ||
nsHTMLAtoms::rows == aAttribute ||
nsHTMLAtoms::cols == aAttribute) && aHint != NS_STYLE_HINT_REFLOW) {
// XXX Bug 34573 & 50280
// The following code should be all we need for these two bugs (it does work for bug 50280)
// This doesn't wrong entirely for rows/cols, the borders don't get painted
// to fix that I have added a REFLOW hint in nsHTMLTextAreaElement::GetMappedAttributeImpact
// but it appears there are some problems when you hold down the return key
mPrefSize.width = -1;
mPrefSize.height = -1;
nsFormControlHelper::StyleChangeReflow(aPresContext, this);
}
// Allow the base class to handle common attributes supported // Allow the base class to handle common attributes supported
// by all form elements... // by all form elements...
else { else {
rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint); rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType);
} }
return rv; return rv;

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

@ -179,8 +179,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
NS_IMETHOD GetText(nsString* aText); NS_IMETHOD GetText(nsString* aText);

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

@ -171,12 +171,11 @@ nsAreaFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
nsresult rv = nsBlockFrame::AttributeChanged(aPresContext, aChild, nsresult rv = nsBlockFrame::AttributeChanged(aPresContext, aChild,
aNameSpaceID, aAttribute, aNameSpaceID, aAttribute,
aModType, aHint); aModType);
// If the accesskey changed, register for the new value // If the accesskey changed, register for the new value
// The old value has been unregistered in nsXULElement::SetAttr // The old value has been unregistered in nsXULElement::SetAttr

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

@ -71,8 +71,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
#endif #endif
/** /**

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

@ -2778,11 +2778,11 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
nsresult rv = nsBlockFrameSuper::AttributeChanged(aPresContext, aChild, nsresult rv = nsBlockFrameSuper::AttributeChanged(aPresContext, aChild,
aNameSpaceID, aAttribute, aModType, aHint); aNameSpaceID, aAttribute,
aModType);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;

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

@ -163,8 +163,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
#ifdef DO_SELECTION #ifdef DO_SELECTION
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext, NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,

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

@ -2285,8 +2285,7 @@ nsFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
return NS_OK; return NS_OK;
} }

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

@ -232,8 +232,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const; NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const;
NS_IMETHOD SetPrevInFlow(nsIFrame*); NS_IMETHOD SetPrevInFlow(nsIFrame*);

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

@ -169,8 +169,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
// if the content is "visibility:hidden", then just hide the view // if the content is "visibility:hidden", then just hide the view
// and all our contents. We don't extend "visibility:hidden" to // and all our contents. We don't extend "visibility:hidden" to
@ -609,8 +608,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
nsCOMPtr<nsIAtom> type; nsCOMPtr<nsIAtom> type;
aChild->GetTag(getter_AddRefs(type)); aChild->GetTag(getter_AddRefs(type));

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

@ -300,8 +300,7 @@ nsHTMLFramesetFrame::Observe(nsISupports* aObject, const char* aAction,
doc->AttributeChanged(mContent, doc->AttributeChanged(mContent,
kNameSpaceID_None, kNameSpaceID_None,
nsHTMLAtoms::frameborder, nsHTMLAtoms::frameborder,
nsIDOMMutationEvent::MODIFICATION, nsIDOMMutationEvent::MODIFICATION);
NS_STYLE_HINT_REFLOW);
doc->EndUpdate(); doc->EndUpdate();
} }
} }

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

@ -823,8 +823,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType) = 0;
PRInt32 aHint) = 0;
/** /**
* Return how your frame can be split. * Return how your frame can be split.

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

@ -1779,14 +1779,15 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
nsresult rv = nsSplittableFrame::AttributeChanged(aPresContext, aChild, nsresult rv = nsSplittableFrame::AttributeChanged(aPresContext, aChild,
aNameSpaceID, aAttribute, aModType, aHint); aNameSpaceID, aAttribute,
aModType);
if (NS_OK != rv) { if (NS_OK != rv) {
return rv; return rv;
} }
// XXXldb Shouldn't width and height be handled by attribute mapping?
if (nsHTMLAtoms::width == aAttribute || nsHTMLAtoms::height == aAttribute || nsHTMLAtoms::alt == aAttribute) if (nsHTMLAtoms::width == aAttribute || nsHTMLAtoms::height == aAttribute || nsHTMLAtoms::alt == aAttribute)
{ // XXX: could check for new width == old width, and make that a no-op { // XXX: could check for new width == old width, and make that a no-op
nsCOMPtr<nsIPresShell> presShell; nsCOMPtr<nsIPresShell> presShell;

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

@ -122,8 +122,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);

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

@ -1060,8 +1060,7 @@ nsImageMap::AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
// If the parent of the changing content node is our map then update // If the parent of the changing content node is our map then update
// the map. // the map.

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

@ -171,12 +171,11 @@ nsAreaFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
nsresult rv = nsBlockFrame::AttributeChanged(aPresContext, aChild, nsresult rv = nsBlockFrame::AttributeChanged(aPresContext, aChild,
aNameSpaceID, aAttribute, aNameSpaceID, aAttribute,
aModType, aHint); aModType);
// If the accesskey changed, register for the new value // If the accesskey changed, register for the new value
// The old value has been unregistered in nsXULElement::SetAttr // The old value has been unregistered in nsXULElement::SetAttr

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

@ -71,8 +71,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
#endif #endif
/** /**

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

@ -2778,11 +2778,11 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
nsresult rv = nsBlockFrameSuper::AttributeChanged(aPresContext, aChild, nsresult rv = nsBlockFrameSuper::AttributeChanged(aPresContext, aChild,
aNameSpaceID, aAttribute, aModType, aHint); aNameSpaceID, aAttribute,
aModType);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;

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

@ -163,8 +163,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
#ifdef DO_SELECTION #ifdef DO_SELECTION
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext, NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,

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

@ -2285,8 +2285,7 @@ nsFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
return NS_OK; return NS_OK;
} }

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

@ -232,8 +232,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const; NS_IMETHOD GetPrevInFlow(nsIFrame** aPrevInFlow) const;
NS_IMETHOD SetPrevInFlow(nsIFrame*); NS_IMETHOD SetPrevInFlow(nsIFrame*);

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

@ -1779,14 +1779,15 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
PRInt32 aHint)
{ {
nsresult rv = nsSplittableFrame::AttributeChanged(aPresContext, aChild, nsresult rv = nsSplittableFrame::AttributeChanged(aPresContext, aChild,
aNameSpaceID, aAttribute, aModType, aHint); aNameSpaceID, aAttribute,
aModType);
if (NS_OK != rv) { if (NS_OK != rv) {
return rv; return rv;
} }
// XXXldb Shouldn't width and height be handled by attribute mapping?
if (nsHTMLAtoms::width == aAttribute || nsHTMLAtoms::height == aAttribute || nsHTMLAtoms::alt == aAttribute) if (nsHTMLAtoms::width == aAttribute || nsHTMLAtoms::height == aAttribute || nsHTMLAtoms::alt == aAttribute)
{ // XXX: could check for new width == old width, and make that a no-op { // XXX: could check for new width == old width, and make that a no-op
nsCOMPtr<nsIPresShell> presShell; nsCOMPtr<nsIPresShell> presShell;

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

@ -122,8 +122,7 @@ public:
nsIContent* aChild, nsIContent* aChild,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType);
PRInt32 aHint);
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);

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

@ -1060,8 +1060,7 @@ nsImageMap::AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent, nsIContent* aContent,
PRInt32 aNameSpaceID, PRInt32 aNameSpaceID,
nsIAtom* aAttribute, nsIAtom* aAttribute,
PRInt32 aModType, PRInt32 aModType)
nsChangeHint aHint)
{ {
// If the parent of the changing content node is our map then update // If the parent of the changing content node is our map then update
// the map. // the map.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше