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,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint aHint) = 0;
PRInt32 aModType) = 0;
NS_IMETHOD ContentAppended(nsIContent* aContainer,
PRInt32 aNewIndexInContainer) = 0;
NS_IMETHOD ContentInserted(nsIContent* aContainer,

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

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

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

@ -67,15 +67,22 @@ public:
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) = 0;
NS_IMETHOD GetInlineStyleRule(nsIStyleRule** aStyleRule) = 0;
/** NRA ***
* Get a hint that tells the style system what to do when
* an attribute on this node changes.
* 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
/**
* Does the list of style rules walked by |WalkContentStyleRules|
* depend on the attribute?
*/
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const = 0;
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;
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -65,9 +65,6 @@ public:
// nsIDOMHTMLBaseElement
NS_DECL_NSIDOMHTMLBASEFONTELEMENT
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const;
};
nsresult
@ -202,25 +199,3 @@ nsHTMLBaseFontElement::SetSize(PRInt32 aSize)
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);
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
protected:
BodyRule* mContentStyleRule;
@ -627,27 +626,28 @@ nsHTMLBodyElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
return NS_OK;
}
NS_IMETHODIMP
nsHTMLBodyElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
NS_IMETHODIMP_(PRBool)
nsHTMLBodyElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
static const AttributeImpactEntry attributes[] = {
{ &nsHTMLAtoms::link, NS_STYLE_HINT_VISUAL },
{ &nsHTMLAtoms::vlink, NS_STYLE_HINT_VISUAL },
{ &nsHTMLAtoms::alink, NS_STYLE_HINT_VISUAL },
{ &nsHTMLAtoms::text, NS_STYLE_HINT_VISUAL },
{ &nsHTMLAtoms::marginwidth, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::marginheight, NS_STYLE_HINT_REFLOW },
{ nsnull, NS_STYLE_HINT_NONE },
static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::link },
{ &nsHTMLAtoms::vlink },
{ &nsHTMLAtoms::alink },
{ &nsHTMLAtoms::text },
// These aren't mapped through attribute mapping, but they are
// mapped through a style rule, so it is attribute dependent style.
// 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,
sCommonAttributeMap,
sBackgroundAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -109,9 +109,9 @@ public:
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
const nsAString& aValue,
nsHTMLValue& aResult);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const;
// nsIOptionElement
NS_IMETHOD SetSelectedInternal(PRBool aValue, PRBool aNotify);
@ -491,35 +491,19 @@ nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute,
}
NS_IMETHODIMP
nsHTMLOptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
nsHTMLOptionElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
{
nsIFormControlFrame* fcFrame = GetSelectFrame();
if (fcFrame) {
static const AttributeImpactEntry attributes[] = {
{ &nsHTMLAtoms::label, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::text, NS_STYLE_HINT_REFLOW },
{ nsnull, NS_STYLE_HINT_NONE }
};
nsresult rv =
nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute,
aModType, aHint);
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;
}
if (aAttribute == nsHTMLAtoms::label ||
aAttribute == nsHTMLAtoms::text) {
NS_UpdateHint(aHint, NS_STYLE_HINT_REFLOW);
}
return NS_OK;
return rv;
}
NS_IMETHODIMP

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -84,8 +84,7 @@ public:
nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
protected:
// 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
// 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;
GetParent(getter_AddRefs(row));
@ -510,32 +511,33 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP
nsHTMLTableCellElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
NS_IMETHODIMP_(PRBool)
nsHTMLTableCellElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
static const AttributeImpactEntry attributes[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::valign, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::nowrap, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::abbr, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::axis, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::headers, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::scope, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW },
{ nsnull, NS_STYLE_HINT_NONE }
static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::align },
{ &nsHTMLAtoms::valign },
{ &nsHTMLAtoms::nowrap },
#if 0
// XXXldb If these are implemented, they might need to move to
// GetAttributeChangeHint (depending on how, and preferably not).
{ &nsHTMLAtoms::abbr },
{ &nsHTMLAtoms::axis },
{ &nsHTMLAtoms::headers },
{ &nsHTMLAtoms::scope },
#endif
{ &nsHTMLAtoms::width },
{ &nsHTMLAtoms::height },
{ nsnull }
};
static const AttributeImpactEntry* const map[] = {
static const AttributeDependenceEntry* const map[] = {
attributes,
sCommonAttributeMap,
sBackgroundAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
}
NS_IMETHODIMP

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

@ -83,8 +83,7 @@ public:
const nsHTMLValue& aValue,
nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
};
nsresult
@ -251,10 +250,9 @@ void MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleDat
if (!aAttributes || !aData)
return;
nsHTMLValue value;
if (aData->mPositionData && aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
// width
nsHTMLValue value;
aAttributes->GetAttribute(nsHTMLAtoms::width, value);
if (value.GetUnit() != eHTMLUnit_Null) {
switch (value.GetUnit()) {
@ -306,8 +304,6 @@ void ColMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
if (!aAttributes || !aData)
return;
nsHTMLValue value;
if (aData->mSID == eStyleStruct_Table &&
aData->mTableData &&
aData->mTableData->mSpan.GetUnit() == eCSSUnit_Null) {
@ -322,31 +318,38 @@ void ColMapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
MapAttributesIntoRule(aAttributes, aData);
}
NS_IMETHODIMP
nsHTMLTableColElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
NS_IMETHODIMP_(PRBool)
nsHTMLTableColElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
// we don't match "span" if we're a <col>
nsIAtom** matchSpan = mNodeInfo->Equals(nsHTMLAtoms::col) ?
nsnull : &nsHTMLAtoms::span;
const AttributeImpactEntry attributes[] = {
{ &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 }
static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::width },
{ &nsHTMLAtoms::align },
{ &nsHTMLAtoms::valign },
{ nsnull }
};
const AttributeImpactEntry* const map[] = {
static const AttributeDependenceEntry span_attribute[] = {
{ &nsHTMLAtoms::span }
};
static const AttributeDependenceEntry* const col_map[] = {
attributes,
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,
nsAString& aResult) const;
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const;
NS_IMETHOD_(PRBool) HasAttributeDependentStyle(const nsIAtom* aAttribute) const;
protected:
GenericElementCollection *mTBodies;
@ -1231,6 +1230,16 @@ static void
MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
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)
return;
@ -1492,41 +1501,38 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes,
}
}
NS_IMETHODIMP
nsHTMLTableElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
NS_IMETHODIMP_(PRBool)
nsHTMLTableElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
static const AttributeImpactEntry attributes[] = {
{ &nsHTMLAtoms::layout, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::cellpadding, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::cellspacing, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::cols, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::border, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::frame, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::width, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::height, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::hspace, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::vspace, NS_STYLE_HINT_REFLOW },
static const AttributeDependenceEntry attributes[] = {
{ &nsHTMLAtoms::layout },
{ &nsHTMLAtoms::cellpadding },
{ &nsHTMLAtoms::cellspacing },
{ &nsHTMLAtoms::cols },
{ &nsHTMLAtoms::border },
{ &nsHTMLAtoms::frame },
{ &nsHTMLAtoms::width },
{ &nsHTMLAtoms::height },
{ &nsHTMLAtoms::hspace },
{ &nsHTMLAtoms::vspace },
{ &nsHTMLAtoms::bordercolor, NS_STYLE_HINT_VISUAL },
{ &nsHTMLAtoms::bordercolor },
// Changing to rules will force border-collapse. Unfortunately, if
// border-collapse was already in effect, then a frame change is
// not necessary.
{ &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE },
{ &nsHTMLAtoms::rules, NS_STYLE_HINT_FRAMECHANGE },
{ nsnull, NS_STYLE_HINT_NONE }
{ &nsHTMLAtoms::align },
{ &nsHTMLAtoms::rules },
{ nsnull }
};
static const AttributeImpactEntry* const map[] = {
static const AttributeDependenceEntry* const map[] = {
attributes,
sCommonAttributeMap,
sBackgroundAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
}
NS_IMETHODIMP

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -874,12 +874,7 @@ HTMLStyleSheetImpl::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
// Handle the content style rules.
if (styledContent) {
nsChangeHint hint = NS_STYLE_HINT_NONE;
styledContent->GetMappedAttributeImpact(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) {
if (styledContent->HasAttributeDependentStyle(aData->mAttribute)) {
*aResult = PR_TRUE;
return NS_OK;
}

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

@ -42,17 +42,12 @@
// Defines for various style related constants
enum nsChangeHint {
nsChangeHint_None = 0, // change has no impact
nsChangeHint_Unknown = 0x01, // change has unknown impact
nsChangeHint_AttrChange = 0x02, // change should cause notification to frame but nothing else
nsChangeHint_Aural = 0x04, // change was aural
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:)
nsChangeHint_RepaintFrame = 0x01, // change was visual only (e.g., COLOR=)
nsChangeHint_ReflowFrame = 0x02, // change requires reflow (e.g., WIDTH=)
nsChangeHint_SyncFrameView = 0x04, // change requires view to be updated, if there is one (e.g., clip:)
nsChangeHint_ReconstructFrame = 0x08, // change requires frame change (e.g., display:)
// This subsumes all the above
nsChangeHint_ReconstructDoc = 0x100
nsChangeHint_ReconstructDoc = 0x10
// change requires reconstruction of entire document (e.g., style sheet change)
// 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
const nsChangeHint NS_STYLE_HINT_UNKNOWN = nsChangeHint_Unknown;
const nsChangeHint NS_STYLE_HINT_NONE = nsChangeHint_None;
const nsChangeHint NS_STYLE_HINT_ATTRCHANGE = nsChangeHint_AttrChange;
const nsChangeHint NS_STYLE_HINT_AURAL = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural);
const nsChangeHint NS_STYLE_HINT_CONTENT = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content);
const nsChangeHint NS_STYLE_HINT_VISUAL = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame
| nsChangeHint_SyncFrameView);
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);
#define NS_STYLE_HINT_NONE \
nsChangeHint(0)
#define NS_STYLE_HINT_VISUAL \
nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)
#define NS_STYLE_HINT_REFLOW \
nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_ReflowFrame)
#define NS_STYLE_HINT_FRAMECHANGE \
nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame)
#define NS_STYLE_HINT_RECONSTRUCT_ALL \
nsChangeHint(NS_STYLE_HINT_FRAMECHANGE | nsChangeHint_ReconstructDoc)
#endif /* nsChangeHint_h___ */

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

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

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

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

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

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

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

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

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

@ -405,22 +405,6 @@ static PRBool HasMutationListeners(nsIContent* aContent, PRUint32 aType)
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;
@ -2524,8 +2508,7 @@ nsXULElement::SetAttr(nsINodeInfo* aNodeInfo,
? PRInt32(nsIDOMMutationEvent::MODIFICATION)
: PRInt32(nsIDOMMutationEvent::ADDITION);
mDocument->AttributeChanged(this, attrns, attrName, modHint,
StyleHintFor(NodeInfo()));
mDocument->AttributeChanged(this, attrns, attrName, modHint);
mDocument->EndUpdate();
}
}
@ -2802,8 +2785,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID,
if (aNotify) {
mDocument->AttributeChanged(this, aNameSpaceID, aName,
nsIDOMMutationEvent::REMOVAL,
StyleHintFor(NodeInfo()));
nsIDOMMutationEvent::REMOVAL);
// XXXwaterson do we need to mDocument->EndUpdate() here?
}
@ -3645,10 +3627,11 @@ nsXULElement::GetInlineStyleRule(nsIStyleRule** aStyleRule)
}
NS_IMETHODIMP
nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
nsXULElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
{
aHint = NS_STYLE_HINT_CONTENT; // by default, never map attributes to style
aHint = NS_STYLE_HINT_NONE;
if (aAttribute == nsXULAtoms::value &&
(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
// a hint of frame change. (See bugzilla bug 95475 for details.)
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 {
// if left or top changes we reflow. This will happen in xul containers that
// manage positioned children such as a bulletinboard.
@ -3686,6 +3652,12 @@ nsXULElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModTy
return NS_OK;
}
NS_IMETHODIMP_(PRBool)
nsXULElement::HasAttributeDependentStyle(const nsIAtom* aAttribute) const
{
return PR_FALSE;
}
// Controllers Methods
NS_IMETHODIMP
nsXULElement::GetControllers(nsIControllers** aResult)

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

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

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

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

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

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

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

@ -137,8 +137,7 @@ public:
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint aHint);
PRInt32 aModType);
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument* aDocument);
@ -1692,8 +1691,7 @@ nsXULContentBuilder::AttributeChanged(nsIDocument* aDocument,
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint aHint)
PRInt32 aModType)
{
// Handle "open" and "close" cases. We do this handling before
// 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.
return nsXULTemplateBuilder::AttributeChanged(aDocument, aContent, aNameSpaceID, aAttribute, aModType, aHint);
return nsXULTemplateBuilder::AttributeChanged(aDocument, aContent, aNameSpaceID, aAttribute, aModType);
}
NS_IMETHODIMP

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

@ -313,8 +313,7 @@ nsXULTemplateBuilder::AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint aHint)
PRInt32 aModType)
{
// 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

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

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

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

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

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

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

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

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

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

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

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

@ -42,17 +42,12 @@
// Defines for various style related constants
enum nsChangeHint {
nsChangeHint_None = 0, // change has no impact
nsChangeHint_Unknown = 0x01, // change has unknown impact
nsChangeHint_AttrChange = 0x02, // change should cause notification to frame but nothing else
nsChangeHint_Aural = 0x04, // change was aural
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:)
nsChangeHint_RepaintFrame = 0x01, // change was visual only (e.g., COLOR=)
nsChangeHint_ReflowFrame = 0x02, // change requires reflow (e.g., WIDTH=)
nsChangeHint_SyncFrameView = 0x04, // change requires view to be updated, if there is one (e.g., clip:)
nsChangeHint_ReconstructFrame = 0x08, // change requires frame change (e.g., display:)
// This subsumes all the above
nsChangeHint_ReconstructDoc = 0x100
nsChangeHint_ReconstructDoc = 0x10
// change requires reconstruction of entire document (e.g., style sheet change)
// 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
const nsChangeHint NS_STYLE_HINT_UNKNOWN = nsChangeHint_Unknown;
const nsChangeHint NS_STYLE_HINT_NONE = nsChangeHint_None;
const nsChangeHint NS_STYLE_HINT_ATTRCHANGE = nsChangeHint_AttrChange;
const nsChangeHint NS_STYLE_HINT_AURAL = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural);
const nsChangeHint NS_STYLE_HINT_CONTENT = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content);
const nsChangeHint NS_STYLE_HINT_VISUAL = (nsChangeHint)
(nsChangeHint_AttrChange | nsChangeHint_Aural | nsChangeHint_Content | nsChangeHint_RepaintFrame
| nsChangeHint_SyncFrameView);
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);
#define NS_STYLE_HINT_NONE \
nsChangeHint(0)
#define NS_STYLE_HINT_VISUAL \
nsChangeHint(nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)
#define NS_STYLE_HINT_REFLOW \
nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_ReflowFrame)
#define NS_STYLE_HINT_FRAMECHANGE \
nsChangeHint(NS_STYLE_HINT_REFLOW | nsChangeHint_ReconstructFrame)
#define NS_STYLE_HINT_RECONSTRUCT_ALL \
nsChangeHint(NS_STYLE_HINT_FRAMECHANGE | nsChangeHint_ReconstructDoc)
#endif /* nsChangeHint_h___ */

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

@ -5294,8 +5294,7 @@ PresShell::AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint aHint)
PRInt32 aModType)
{
nsresult rv = NS_OK;
// 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.
if (mDidInitialReflow) {
WillCauseReflow();
rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType, aHint);
rv = mStyleSet->AttributeChanged(mPresContext, aContent, aNameSpaceID, aAttribute, aModType);
VERIFY_STYLE_TREE;
DidCauseReflow();
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -2663,20 +2663,12 @@ nsTextControlFrame::AttributeChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType,
PRInt32 aHint)
PRInt32 aModType)
{
if (!mEditor || !mSelCon) {return NS_ERROR_NOT_INITIALIZED;}
nsresult rv = NS_OK;
if (nsHTMLAtoms::value == 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)
if (nsHTMLAtoms::maxlength == aAttribute)
{
PRInt32 maxLength;
nsresult rv = GetMaxLength(&maxLength);
@ -2744,22 +2736,10 @@ nsTextControlFrame::AttributeChanged(nsIPresContext* aPresContext,
}
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
// by all form elements...
else {
rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType, aHint);
rv = nsBoxFrame::AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aModType);
}
return rv;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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