зеркало из https://github.com/mozilla/pjs.git
Remove hint parameter from AttributeChanged methods and simplify style hint mechanism. b=211308 r+sr=bzbarsky
This commit is contained in:
Родитель
af4f62e783
Коммит
92b921aca3
|
@ -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,14 +67,21 @@ 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,
|
||||
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,15 +2308,9 @@ nsresult
|
|||
nsGenericHTMLElement::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
|
||||
if (aRuleWalker) {
|
||||
if (mAttributes) {
|
||||
result = mAttributes->WalkMappedAttributeStyleRules(aRuleWalker);
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
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,68 +3221,67 @@ 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[],
|
||||
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,
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsRuleData* aRuleData)
|
||||
{
|
||||
if (aRuleData->mSID == eStyleStruct_Display || aRuleData->mSID == eStyleStruct_TextReset) {
|
||||
|
@ -3393,7 +3368,7 @@ nsGenericHTMLElement::MapImageMarginAttributeInto(const nsIHTMLMappedAttributes*
|
|||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapImagePositionAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
if (!aAttributes || aData->mSID != eStyleStruct_Position || !aData->mPositionData)
|
||||
|
|
|
@ -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,31 +492,26 @@ 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[],
|
||||
static PRBool
|
||||
FindAttributeDependence(const nsIAtom* aAttribute,
|
||||
const AttributeDependenceEntry* const aMaps[],
|
||||
PRUint32 aMapCount);
|
||||
/**
|
||||
* Helper to map the align attribute into a style struct.
|
||||
|
@ -526,7 +520,7 @@ public:
|
|||
* @param aData the returned rule data [INOUT]
|
||||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
static void MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsRuleData* aData);
|
||||
|
||||
/**
|
||||
|
@ -565,7 +559,7 @@ public:
|
|||
* @param aData the returned rule data [INOUT]
|
||||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapImagePositionAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
static void MapImageSizeAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsRuleData* aData);
|
||||
/**
|
||||
* Helper to map the background attributes (currently background and bgcolor)
|
||||
|
|
|
@ -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,7 +87,8 @@ public:
|
|||
NS_IMETHOD AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsAString& aResult) const;
|
||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const;
|
||||
private:
|
||||
nsresult ParseRowCol(const nsAString& aValue,
|
||||
|
@ -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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,7 +70,8 @@ public:
|
|||
// nsIDOMHTMLMapElement
|
||||
NS_DECL_NSIDOMHTMLMAPELEMENT
|
||||
|
||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
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,
|
||||
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,7 +109,7 @@ public:
|
|||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsHTMLValue& aResult);
|
||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
NS_IMETHOD GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const;
|
||||
|
||||
|
@ -491,35 +491,19 @@ nsHTMLOptionElement::StringToAttribute(nsIAtom* aAttribute,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLOptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsHTMLOptionElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
nsIFormControlFrame* fcFrame = GetSelectFrame();
|
||||
nsresult rv =
|
||||
nsGenericHTMLContainerElement::GetAttributeChangeHint(aAttribute,
|
||||
aModType, aHint);
|
||||
|
||||
if (fcFrame) {
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::label, NS_STYLE_HINT_REFLOW },
|
||||
{ &nsHTMLAtoms::text, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
} else {
|
||||
// XXX don't we want to try common attributes here?
|
||||
if (aAttribute == nsXULAtoms::menuactive) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
} else {
|
||||
aHint = NS_STYLE_HINT_NONE;
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,11 +1395,9 @@ nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aO
|
|||
|
||||
if (mUserInput == aOther.mUserInput) {
|
||||
if (mUserModify == aOther.mUserModify) {
|
||||
if (mUserFocus == aOther.mUserFocus) {
|
||||
// ignore mUserFocus
|
||||
return NS_STYLE_HINT_NONE;
|
||||
}
|
||||
return NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
|
||||
|
@ -1441,11 +1439,9 @@ nsChangeHint nsStyleUIReset::CalcDifference(const nsStyleUIReset& aOther) const
|
|||
if (mForceBrokenImageIcon == aOther.mForceBrokenImageIcon) {
|
||||
if (mResizer == aOther.mResizer &&
|
||||
mUserSelect == aOther.mUserSelect) {
|
||||
if (mKeyEquivalent == aOther.mKeyEquivalent) {
|
||||
// ignore mKeyEquivalent
|
||||
return NS_STYLE_HINT_NONE;
|
||||
}
|
||||
return NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
return NS_STYLE_HINT_FRAMECHANGE;
|
||||
|
|
|
@ -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,
|
||||
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,
|
||||
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) {
|
||||
nsChangeHint hint = NS_STYLE_HINT_NONE;
|
||||
nsCOMPtr<nsIStyledContent> styledContent = do_QueryInterface(aContent);
|
||||
if (styledContent) {
|
||||
// Get style hint from HTML content object.
|
||||
styledContent->GetMappedAttributeImpact(aAttribute, aModType, aHint);
|
||||
}
|
||||
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)) {
|
||||
} else {
|
||||
// let the frame deal with it, since we don't know how to
|
||||
result = primaryFrame->AttributeChanged(aPresContext, aContent, aNameSpaceID, aAttribute, aModType, maxHint);
|
||||
|
||||
result = primaryFrame->AttributeChanged(aPresContext, aContent,
|
||||
aNameSpaceID, aAttribute,
|
||||
aModType);
|
||||
// XXXwaterson should probably check for special IB siblings
|
||||
// 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.
|
||||
}
|
||||
// them, as well. Currently, inline 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);
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,379 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsStyleSet_h___
|
||||
#define nsStyleSet_h___
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsISupports.h"
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIStyleRule;
|
||||
class nsIStyleSheet;
|
||||
class nsStyleContext;
|
||||
class nsIStyleRuleSupplier;
|
||||
class nsIStyleFrameConstruction;
|
||||
class nsIPresContext;
|
||||
class nsIPresShell;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIDocument;
|
||||
class nsIFrameManager;
|
||||
class nsISupportsArray;
|
||||
class nsRuleNode;
|
||||
struct nsFindFrameHint;
|
||||
struct nsCachedStyleData;
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsICSSPseudoComparator;
|
||||
|
||||
// IID for the nsIStyleSet interface {e59396b0-b244-11d1-8031-006008159b5a}
|
||||
#define NS_ISTYLE_SET_IID \
|
||||
{0xe59396b0, 0xb244, 0x11d1, {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}}
|
||||
|
||||
class nsIStyleSet : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTYLE_SET_IID)
|
||||
|
||||
// Style sheets are ordered, most significant first
|
||||
// NOTE: this is the reverse of the way documents store the sheets
|
||||
virtual void AppendOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void InsertOverrideStyleSheetAfter(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aAfterSheet) = 0;
|
||||
virtual void InsertOverrideStyleSheetBefore(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aBeforeSheet) = 0;
|
||||
virtual void RemoveOverrideStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfOverrideStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetOverrideStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
|
||||
// the ordering of document style sheets is given by the document
|
||||
virtual void AddDocStyleSheet(nsIStyleSheet* aSheet, nsIDocument* aDocument) = 0;
|
||||
virtual void RemoveDocStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfDocStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetDocStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
|
||||
virtual void AppendUserStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void InsertUserStyleSheetAfter(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aAfterSheet) = 0;
|
||||
virtual void InsertUserStyleSheetBefore(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aBeforeSheet) = 0;
|
||||
virtual void RemoveUserStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfUserStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetUserStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
virtual void ReplaceUserStyleSheets(nsISupportsArray* aNewSheets) = 0;
|
||||
|
||||
virtual void AppendAgentStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual void InsertAgentStyleSheetAfter(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aAfterSheet) = 0;
|
||||
virtual void InsertAgentStyleSheetBefore(nsIStyleSheet* aSheet,
|
||||
nsIStyleSheet* aBeforeSheet) = 0;
|
||||
virtual void RemoveAgentStyleSheet(nsIStyleSheet* aSheet) = 0;
|
||||
virtual PRInt32 GetNumberOfAgentStyleSheets() = 0;
|
||||
virtual nsIStyleSheet* GetAgentStyleSheetAt(PRInt32 aIndex) = 0;
|
||||
virtual void ReplaceAgentStyleSheets(nsISupportsArray* aNewSheets) = 0;
|
||||
|
||||
virtual nsresult GetRuleTree(nsRuleNode** aResult) = 0;
|
||||
|
||||
// For getting the cached default data in case we hit out-of-memory.
|
||||
// To be used only by nsRuleNode.
|
||||
virtual nsCachedStyleData* GetDefaultStyleData() = 0;
|
||||
|
||||
virtual nsresult GetStyleFrameConstruction(nsIStyleFrameConstruction** aResult) = 0;
|
||||
|
||||
// Clear all style data cached in the style context tree and rule tree.
|
||||
virtual nsresult ClearStyleData(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
// enable / disable the Quirk style sheet:
|
||||
// returns NS_FAILURE if none is found, otherwise NS_OK
|
||||
NS_IMETHOD EnableQuirkStyleSheet(PRBool aEnable) = 0;
|
||||
|
||||
|
||||
NS_IMETHOD NotifyStyleSheetStateChanged(PRBool aApplicable) = 0;
|
||||
|
||||
// get a style context for a non-pseudo frame.
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aParentContext) = 0;
|
||||
|
||||
// Get a style context for a non-element (which no rules will match).
|
||||
// Eventually, this should go away and we shouldn't even create style
|
||||
// contexts for such content nodes. However, not doing any rule
|
||||
// matching for them is a first step.
|
||||
//
|
||||
// XXX This is temporary. It should go away when we stop creating
|
||||
// style contexts for text nodes and placeholder frames. (We also use
|
||||
// it once to create a style context for the nsFirstLetterFrame that
|
||||
// represents everything except the first letter.)
|
||||
//
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleForNonElement(nsIPresContext* aPresContext,
|
||||
nsStyleContext* aParentContext) = 0;
|
||||
|
||||
// get a style context for a pseudo-element (i.e.,
|
||||
// |aPseudoTag == nsCOMPtr<nsIAtom>(do_GetAtom(":first-line"))|;
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator = nsnull) = 0;
|
||||
|
||||
// This funtions just like ResolvePseudoStyleFor except that it will
|
||||
// return nsnull if there are no explicit style rules for that
|
||||
// pseudo element.
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ProbePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext) = 0;
|
||||
|
||||
NS_IMETHOD BeginShutdown(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
NS_IMETHOD Shutdown(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
NS_IMETHOD NotifyStyleContextDestroyed(nsIPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext) = 0;
|
||||
|
||||
// Get a new style context that lives in a different parent
|
||||
// The new context will be the same as the old if the new parent == the old parent
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ReParentStyleContext(nsIPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
nsStyleContext* aNewParentContext) = 0;
|
||||
|
||||
// Test if style is dependent on content state
|
||||
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
PRInt32 aStateMask,
|
||||
PRBool* aResult) = 0;
|
||||
|
||||
// Test if style is dependent on the presence of an attribute.
|
||||
NS_IMETHOD HasAttributeDependentStyle(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
PRBool* aResult) = 0;
|
||||
|
||||
// Create frames for the root content element and its child content
|
||||
NS_IMETHOD ConstructRootFrame(nsIPresContext* aPresContext,
|
||||
nsIContent* aDocElement,
|
||||
nsIFrame*& aFrameSubTree) = 0;
|
||||
|
||||
// Causes reconstruction of a frame hierarchy rooted by the
|
||||
// frame document element frame. This is often called when radical style
|
||||
// change precludes incremental reflow.
|
||||
NS_IMETHOD ReconstructDocElementHierarchy(nsIPresContext* aPresContext) = 0;
|
||||
|
||||
// Notifications of changes to the content mpodel
|
||||
NS_IMETHOD ContentAppended(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
PRInt32 aNewIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentInserted(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentReplaced(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aNewChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
NS_IMETHOD ContentRemoved(nsIPresContext* aPresContext,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aIndexInContainer) = 0;
|
||||
|
||||
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsISupports* aSubContent) = 0;
|
||||
NS_IMETHOD ContentStatesChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent1,
|
||||
nsIContent* aContent2,
|
||||
PRInt32 aStateMask) = 0;
|
||||
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
||||
nsIContent* aChild,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint aHint) = 0;
|
||||
|
||||
// Notification that we were unable to render a replaced element.
|
||||
// Called when the replaced element can not be rendered, and we should
|
||||
// instead render the element's contents.
|
||||
// The content object associated with aFrame should either be a IMG
|
||||
// element or an OBJECT element.
|
||||
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame) = 0;
|
||||
|
||||
// Request to create a continuing frame
|
||||
NS_IMETHOD CreateContinuingFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIFrame** aContinuingFrame) = 0;
|
||||
|
||||
/** Request to find the primary frame associated with a given content object.
|
||||
* This is typically called by the pres shell when there is no mapping in
|
||||
* the pres shell hash table.
|
||||
* @param aPresContext the pres context
|
||||
* @param aFrameManager the frame manager
|
||||
* @param aContent the content we need to find a frame for
|
||||
* @param aFrame [OUT] the resulting frame
|
||||
* @param aHint optional performance hint, may be null
|
||||
*
|
||||
* @return NS_OK. aFrame will be null if no frame could be found
|
||||
*/
|
||||
NS_IMETHOD FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
||||
nsIFrameManager* aFrameManager,
|
||||
nsIContent* aContent,
|
||||
nsIFrame** aFrame,
|
||||
nsFindFrameHint* aHint=0) = 0;
|
||||
|
||||
/**
|
||||
* Return the point in the frame hierarchy where the frame that
|
||||
* will be constructed for |aChildContent| ought be inserted.
|
||||
*
|
||||
* @param aPresShell the presentation shell
|
||||
* @param aParentFrame the frame that will parent the frame that is
|
||||
* created for aChildContent
|
||||
* @param aChildContent the child content for which a frame is to be
|
||||
* created
|
||||
* @param aInsertionPoint [OUT] the frame that should parent the frame
|
||||
* for |aChildContent|.
|
||||
*/
|
||||
NS_IMETHOD GetInsertionPoint(nsIPresShell* aPresShell,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIContent* aChildContent,
|
||||
nsIFrame** aInsertionPoint) = 0;
|
||||
|
||||
// APIs for registering objects that can supply additional
|
||||
// rules during processing.
|
||||
NS_IMETHOD SetStyleRuleSupplier(nsIStyleRuleSupplier* aSupplier)=0;
|
||||
NS_IMETHOD GetStyleRuleSupplier(nsIStyleRuleSupplier** aSupplier)=0;
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) = 0;
|
||||
virtual void ListContexts(nsIFrame* aRootFrame, FILE* out = stdout, PRInt32 aIndent = 0) = 0;
|
||||
#endif
|
||||
|
||||
virtual void ResetUniqueStyleItems(void) = 0;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewStyleSet(nsIStyleSet** aInstancePtrResult);
|
||||
|
||||
|
||||
class nsUniqueStyleItems : private nsVoidArray
|
||||
{
|
||||
public :
|
||||
// return a singleton instance of the nsUniqueStyleItems object
|
||||
static nsUniqueStyleItems *GetUniqueStyleItems( void ){
|
||||
if(mInstance == nsnull){
|
||||
#ifdef DEBUG
|
||||
nsUniqueStyleItems *pInstance =
|
||||
#endif
|
||||
new nsUniqueStyleItems;
|
||||
|
||||
NS_ASSERTION(pInstance == mInstance, "Singleton?");
|
||||
|
||||
// the ctor sets the mInstance static member variable...
|
||||
// if it is null, then we just end up returning null...
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
void *GetItem(void *aPtr){
|
||||
PRInt32 index = nsVoidArray::IndexOf(aPtr);
|
||||
if( index != -1){
|
||||
return nsVoidArray::ElementAt(index);
|
||||
} else {
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool AddItem(void *aPtr){
|
||||
if(nsVoidArray::IndexOf(aPtr) == -1){
|
||||
return nsVoidArray::AppendElement(aPtr);
|
||||
} else {
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool RemoveItem(void *aPtr){
|
||||
return nsVoidArray::RemoveElement(aPtr);
|
||||
}
|
||||
|
||||
PRInt32 Count(void){
|
||||
return nsVoidArray::Count();
|
||||
}
|
||||
|
||||
void Clear(void){
|
||||
nsVoidArray::Clear();
|
||||
}
|
||||
protected:
|
||||
// disallow these:
|
||||
nsUniqueStyleItems( const nsUniqueStyleItems& src);
|
||||
nsUniqueStyleItems& operator =(const nsUniqueStyleItems& src);
|
||||
|
||||
// make this accessable to factory only
|
||||
nsUniqueStyleItems(void) : nsVoidArray(){
|
||||
NS_ASSERTION(mInstance == nsnull, "singleton?");
|
||||
mInstance=this;
|
||||
}
|
||||
|
||||
static nsUniqueStyleItems *mInstance;
|
||||
};
|
||||
|
||||
#define UNIQUE_STYLE_ITEMS(__ptr) \
|
||||
nsUniqueStyleItems* __ptr = nsUniqueStyleItems::GetUniqueStyleItems(); \
|
||||
NS_ASSERTION(__ptr != nsnull, "UniqueItems cannot be null: error in nsUniqueStyleItems factory");
|
||||
|
||||
/** a simple struct (that may someday be expanded)
|
||||
* that contains data supplied by the caller to help
|
||||
* the style set find a frame for a content node
|
||||
*/
|
||||
struct nsFindFrameHint
|
||||
{
|
||||
nsIFrame *mPrimaryFrameForPrevSibling; // weak ref to the primary frame for the content for which we need a frame
|
||||
nsFindFrameHint() {
|
||||
mPrimaryFrameForPrevSibling = nsnull;
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* nsIStyleSet_h___ */
|
|
@ -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.
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче