fix for bug 174802 - simplify GetMappedAttributeImpact, buy making a simple attribute->reflow style map and providing a single helper which walks the map
r=dbaron,sr=jst git-svn-id: svn://10.0.0.236/trunk@141248 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2565,10 +2565,12 @@ nsGenericHTMLElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
sCommonAttributeMap
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint,
|
||||
map, NS_ARRAY_LENGTH(map));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -3165,38 +3167,67 @@ nsGenericHTMLElement::MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAt
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLElement::GetCommonMappedAttributesImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint)
|
||||
|
||||
|
||||
const nsGenericHTMLElement::AttributeImpactEntry
|
||||
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 }
|
||||
};
|
||||
|
||||
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 }
|
||||
};
|
||||
|
||||
const nsGenericHTMLElement::AttributeImpactEntry
|
||||
nsGenericHTMLElement::sImageAlignAttributeMap[] = {
|
||||
{ &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
const nsGenericHTMLElement::AttributeImpactEntry
|
||||
nsGenericHTMLElement::sImageBorderAttributeMap[] = {
|
||||
{ &nsHTMLAtoms::border, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
|
||||
const nsGenericHTMLElement::AttributeImpactEntry
|
||||
nsGenericHTMLElement::sBackgroundAttributeMap[] = {
|
||||
{ &nsHTMLAtoms::background, NS_STYLE_HINT_VISUAL },
|
||||
{ &nsHTMLAtoms::bgcolor, NS_STYLE_HINT_VISUAL },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::FindAttributeImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint,
|
||||
const AttributeImpactEntry* const aMaps[],
|
||||
PRUint32 aMapCount)
|
||||
{
|
||||
if (nsHTMLAtoms::dir == aAttribute) {
|
||||
aHint = NS_STYLE_HINT_REFLOW; // XXX really? possibly FRAMECHANGE?
|
||||
return PR_TRUE;
|
||||
for (PRUint32 mapindex = 0; mapindex < aMapCount; ++mapindex) {
|
||||
const AttributeImpactEntry* map = aMaps[mapindex];
|
||||
while (map->attribute) {
|
||||
if (aAttribute == *map->attribute) {
|
||||
aHint = map->hint;
|
||||
return;
|
||||
}
|
||||
map++;
|
||||
}
|
||||
}
|
||||
else if (nsHTMLAtoms::lang == aAttribute) {
|
||||
aHint = NS_STYLE_HINT_REFLOW; // LANG attribute affects font selection
|
||||
return PR_TRUE;
|
||||
}
|
||||
else if (nsHTMLAtoms::_baseHref == aAttribute) {
|
||||
aHint = NS_STYLE_HINT_VISUAL; // at a minimum, elements may need to override
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
||||
// fall-through
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLElement::GetImageMappedAttributesImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint)
|
||||
{
|
||||
if ((nsHTMLAtoms::width == aAttribute) ||
|
||||
(nsHTMLAtoms::height == aAttribute) ||
|
||||
(nsHTMLAtoms::hspace == aAttribute) ||
|
||||
(nsHTMLAtoms::vspace == aAttribute)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
@@ -3242,16 +3273,6 @@ nsGenericHTMLElement::MapDivAlignAttributeInto(const nsIHTMLMappedAttributes* aA
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLElement::GetImageAlignAttributeImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint)
|
||||
{
|
||||
if ((nsHTMLAtoms::align == aAttribute)) {
|
||||
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
@@ -3373,18 +3394,6 @@ nsGenericHTMLElement::MapImageBorderAttributeInto(const nsIHTMLMappedAttributes*
|
||||
borderColor->mBottom.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, eCSSUnit_Enumerated);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLElement::GetImageBorderAttributeImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint)
|
||||
{
|
||||
if ((nsHTMLAtoms::border == aAttribute)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
@@ -3444,19 +3453,6 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(const nsIHTMLMappedAttributes*
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLElement::GetBackgroundAttributesImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint)
|
||||
{
|
||||
if ((nsHTMLAtoms::background == aAttribute) ||
|
||||
(nsHTMLAtoms::bgcolor == aAttribute)) {
|
||||
aHint = NS_STYLE_HINT_VISUAL;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsGenericHTMLLeafElement::nsGenericHTMLLeafElement()
|
||||
|
||||
@@ -71,7 +71,6 @@ class nsILayoutHistoryState;
|
||||
struct nsRect;
|
||||
struct nsSize;
|
||||
|
||||
|
||||
/**
|
||||
* A common superclass for HTML elements
|
||||
*/
|
||||
@@ -485,38 +484,32 @@ public:
|
||||
*/
|
||||
static void MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsRuleData* aRuleData);
|
||||
/**
|
||||
* Get the style impact of common attributes (dir, lang and _baseHref
|
||||
* currently). To be called from GetMappedAttributeImpact().
|
||||
*
|
||||
* @param aAttribute the attribute to test for impact
|
||||
* @param aHint the impact (NS_STYLE_HINT_*)
|
||||
* @return whether the impact was set
|
||||
*/
|
||||
static PRBool GetCommonMappedAttributesImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint);
|
||||
struct AttributeImpactEntry {
|
||||
nsIAtom** attribute;
|
||||
nsChangeHint hint;
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry sCommonAttributeMap[];
|
||||
static const AttributeImpactEntry sImageAttributeMap[];
|
||||
static const AttributeImpactEntry sImageBorderAttributeMap[];
|
||||
static const AttributeImpactEntry sImageAlignAttributeMap[];
|
||||
static const AttributeImpactEntry sBackgroundAttributeMap[];
|
||||
|
||||
/**
|
||||
* Get the style impact of image attributes (width, height, hspace and vspace
|
||||
* currently). To be called from GetMappedAttributeImpact().
|
||||
* 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 the attribute to test for impact
|
||||
* @param aHint the impact (NS_STYLE_HINT_*)
|
||||
* @return whether the impact was set
|
||||
* @param aAttribute attribute that we care about
|
||||
* @param aHint the resulting hint
|
||||
* @param aImpactFlags the types of attributes that we care about - see the
|
||||
* NS_*_ATTRIBUTE_IMPACT flags
|
||||
*/
|
||||
static PRBool GetImageMappedAttributesImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint);
|
||||
/**
|
||||
* Get the style impact of image align attributes (align currently). To be
|
||||
* called from GetMappedAttributeImpact().
|
||||
*
|
||||
* @param aAttribute the attribute to test for impact
|
||||
* @param aHint the impact (NS_STYLE_HINT_*)
|
||||
* @return whether the impact was set
|
||||
*/
|
||||
static PRBool GetImageAlignAttributeImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint);
|
||||
|
||||
static void
|
||||
FindAttributeImpact(const nsIAtom* aAttribute, nsChangeHint& aHint,
|
||||
const AttributeImpactEntry* const aMaps[],
|
||||
PRUint32 aMapCount);
|
||||
/**
|
||||
* Helper to map the align attribute into a style struct.
|
||||
*
|
||||
@@ -565,17 +558,6 @@ public:
|
||||
*/
|
||||
static void MapImagePositionAttributeInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsRuleData* aData);
|
||||
/**
|
||||
* Get the style impact of image border attributes (border currently). To be
|
||||
* called from GetMappedAttributeImpact().
|
||||
*
|
||||
* @param aAttribute the attribute to test for impact
|
||||
* @param aHint the impact (NS_STYLE_HINT_*)
|
||||
* @return whether the impact was set
|
||||
*/
|
||||
static PRBool GetImageBorderAttributeImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint);
|
||||
|
||||
/**
|
||||
* Helper to map the background attributes (currently background and bgcolor)
|
||||
* into a style struct.
|
||||
@@ -586,17 +568,6 @@ public:
|
||||
*/
|
||||
static void MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
|
||||
nsRuleData* aData);
|
||||
/**
|
||||
* Get the style impact of background attributes (background and bgcolor
|
||||
* currently). To be called from GetMappedAttributeImpact().
|
||||
*
|
||||
* @param aAttribute the attribute to test for impact
|
||||
* @param aHint the impact (NS_STYLE_HINT_*)
|
||||
* @return whether the impact was set
|
||||
*/
|
||||
static PRBool GetBackgroundAttributesImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint);
|
||||
|
||||
/**
|
||||
* Get the primary frame for a piece of content.
|
||||
*
|
||||
|
||||
@@ -231,15 +231,15 @@ NS_IMETHODIMP
|
||||
nsHTMLAppletElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
|
||||
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
sCommonAttributeMap,
|
||||
sImageAttributeMap,
|
||||
sImageAlignAttributeMap,
|
||||
sImageBorderAttributeMap
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,14 +215,17 @@ NS_IMETHODIMP
|
||||
nsHTMLBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (nsHTMLAtoms::clear == aAttribute) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::clear, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -207,13 +207,20 @@ NS_IMETHODIMP
|
||||
nsHTMLBaseFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((nsHTMLAtoms::color == aAttribute) ||
|
||||
(nsHTMLAtoms::face == aAttribute) ||
|
||||
(nsHTMLAtoms::size == aAttribute)) {
|
||||
aHint = NS_STYLE_HINT_RECONSTRUCT_ALL; // XXX this seems a bit harsh, perhaps we need a reflow_all?
|
||||
}
|
||||
else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -608,21 +608,23 @@ NS_IMETHODIMP
|
||||
nsHTMLBodyElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::link) ||
|
||||
(aAttribute == nsHTMLAtoms::vlink) ||
|
||||
(aAttribute == nsHTMLAtoms::alink) ||
|
||||
(aAttribute == nsHTMLAtoms::text)) {
|
||||
aHint = NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
else if ((aAttribute == nsHTMLAtoms::marginwidth) ||
|
||||
(aAttribute == nsHTMLAtoms::marginheight)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetBackgroundAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
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 AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sBackgroundAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -178,12 +178,17 @@ NS_IMETHODIMP
|
||||
nsHTMLDListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::compact) {
|
||||
aHint = NS_STYLE_HINT_CONTENT; // handled by ua.css?
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::compact, NS_STYLE_HINT_CONTENT }, // handled by ua.css?
|
||||
{ nsnull, NS_STYLE_HINT_NONE },
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -222,15 +222,19 @@ NS_IMETHODIMP
|
||||
nsHTMLDirectoryElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::compact) {
|
||||
aHint = NS_STYLE_HINT_CONTENT; // XXX
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW },
|
||||
{ &nsHTMLAtoms::compact, NS_STYLE_HINT_CONTENT}, // XXX
|
||||
{ nsnull, NS_STYLE_HINT_NONE}
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -220,12 +220,18 @@ NS_IMETHODIMP
|
||||
nsHTMLDivElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -307,19 +307,21 @@ NS_IMETHODIMP
|
||||
nsHTMLFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::color) {
|
||||
aHint = NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
else if ((aAttribute == nsHTMLAtoms::face) ||
|
||||
(aAttribute == nsHTMLAtoms::pointSize) ||
|
||||
(aAttribute == nsHTMLAtoms::size) ||
|
||||
(aAttribute == nsHTMLAtoms::fontWeight)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
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 },
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -383,13 +383,19 @@ NS_IMETHODIMP
|
||||
nsHTMLFrameSetElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::rows) ||
|
||||
(aAttribute == nsHTMLAtoms::cols)) {
|
||||
aHint = mCurrentRowColHint;
|
||||
}
|
||||
else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
// can't be static const because it uses mCurrentRowColHint
|
||||
AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::rows, mCurrentRowColHint },
|
||||
{ &nsHTMLAtoms::cols, mCurrentRowColHint },
|
||||
{ nsnull, NS_STYLE_HINT_NONE },
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -273,18 +273,21 @@ NS_IMETHODIMP
|
||||
nsHTMLHRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::noshade) {
|
||||
aHint = NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
else if ((aAttribute == nsHTMLAtoms::align) ||
|
||||
(aAttribute == nsHTMLAtoms::width) ||
|
||||
(aAttribute == nsHTMLAtoms::size)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
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 },
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -199,16 +199,22 @@ MapAttributesIntoRule(const nsIHTMLMappedAttributes* aAttributes, nsRuleData* aD
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLHeadingElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsHTMLHeadingElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE },
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -494,19 +494,20 @@ nsHTMLIFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::width) ||
|
||||
(aAttribute == nsHTMLAtoms::height)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::align) {
|
||||
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::frameborder) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
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 AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -554,18 +554,21 @@ nsHTMLImageElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::usemap) ||
|
||||
(aAttribute == nsHTMLAtoms::ismap) ||
|
||||
(aAttribute == nsHTMLAtoms::align)) {
|
||||
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 },
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sImageAttributeMap,
|
||||
sImageBorderAttributeMap
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1967,28 +1967,27 @@ NS_IMETHODIMP
|
||||
nsHTMLInputElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::value) {
|
||||
if (mType == NS_FORM_INPUT_BUTTON ||
|
||||
mType == NS_FORM_INPUT_RESET ||
|
||||
mType == NS_FORM_INPUT_SUBMIT) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
else {
|
||||
aHint = NS_STYLE_HINT_ATTRCHANGE;
|
||||
}
|
||||
}
|
||||
else if ((aAttribute == nsHTMLAtoms::align) ||
|
||||
(aAttribute == nsHTMLAtoms::type)) {
|
||||
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::value, valueHint },
|
||||
{ &nsHTMLAtoms::align, NS_STYLE_HINT_FRAMECHANGE },
|
||||
{ &nsHTMLAtoms::type, NS_STYLE_HINT_FRAMECHANGE },
|
||||
{ nsnull, NS_STYLE_HINT_NONE },
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sImageAttributeMap,
|
||||
sImageBorderAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -2157,7 +2156,7 @@ nsHTMLInputElement::FireEventForAccessibility(nsIPresContext* aPresContext,
|
||||
{
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
nsCOMPtr<nsIEventListenerManager> manager;
|
||||
nsresult rv = GetListenerManager(getter_AddRefs(manager));
|
||||
GetListenerManager(getter_AddRefs(manager));
|
||||
if (manager &&
|
||||
NS_SUCCEEDED(manager->CreateEvent(aPresContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
|
||||
event->InitEvent(aEventType, PR_TRUE, PR_TRUE);
|
||||
|
||||
@@ -240,12 +240,17 @@ NS_IMETHODIMP
|
||||
nsHTMLLIElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE },
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -215,12 +215,17 @@ NS_IMETHODIMP
|
||||
nsHTMLMapElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::name) {
|
||||
aHint = NS_STYLE_HINT_RECONSTRUCT_ALL;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -222,12 +222,17 @@ NS_IMETHODIMP
|
||||
nsHTMLMenuElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -258,12 +258,17 @@ NS_IMETHODIMP
|
||||
nsHTMLOListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -299,16 +299,15 @@ NS_IMETHODIMP
|
||||
nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
sCommonAttributeMap,
|
||||
sImageAttributeMap,
|
||||
sImageBorderAttributeMap,
|
||||
sImageAlignAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -497,14 +497,21 @@ nsHTMLOptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32
|
||||
nsIFormControlFrame* fcFrame = GetSelectFrame();
|
||||
|
||||
if (fcFrame) {
|
||||
if (aAttribute == nsHTMLAtoms::label) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
} else if (aAttribute == nsHTMLAtoms::text) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
} else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
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 {
|
||||
|
||||
@@ -204,13 +204,18 @@ NS_IMETHODIMP
|
||||
nsHTMLParagraphElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -255,16 +255,21 @@ NS_IMETHODIMP
|
||||
nsHTMLPreElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::variable) ||
|
||||
(aAttribute == nsHTMLAtoms::wrap) ||
|
||||
(aAttribute == nsHTMLAtoms::cols) ||
|
||||
(aAttribute == nsHTMLAtoms::width) ||
|
||||
(aAttribute == nsHTMLAtoms::tabstop)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
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 },
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1880,16 +1880,19 @@ nsHTMLSelectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::multiple ||
|
||||
aAttribute == nsHTMLAtoms::size) {
|
||||
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::align) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
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 }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -411,32 +411,35 @@ nsHTMLSharedLeafElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
|
||||
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
|
||||
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
sCommonAttributeMap,
|
||||
sImageAttributeMap,
|
||||
sImageAlignAttributeMap,
|
||||
sImageBorderAttributeMap
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
|
||||
if ((aAttribute == nsHTMLAtoms::usemap) ||
|
||||
(aAttribute == nsHTMLAtoms::ismap)) {
|
||||
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
} else if (aAttribute == nsHTMLAtoms::align) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
} else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sImageAttributeMap,
|
||||
sImageBorderAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsGenericHTMLLeafElement::GetMappedAttributeImpact(aAttribute,
|
||||
|
||||
@@ -411,32 +411,35 @@ nsHTMLSharedLeafElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
|
||||
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
|
||||
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
sCommonAttributeMap,
|
||||
sImageAttributeMap,
|
||||
sImageAlignAttributeMap,
|
||||
sImageBorderAttributeMap
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
|
||||
if ((aAttribute == nsHTMLAtoms::usemap) ||
|
||||
(aAttribute == nsHTMLAtoms::ismap)) {
|
||||
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
} else if (aAttribute == nsHTMLAtoms::align) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
} else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sImageAttributeMap,
|
||||
sImageBorderAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return nsGenericHTMLLeafElement::GetMappedAttributeImpact(aAttribute,
|
||||
|
||||
@@ -299,16 +299,15 @@ NS_IMETHODIMP
|
||||
nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
|
||||
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
sCommonAttributeMap,
|
||||
sImageAttributeMap,
|
||||
sImageBorderAttributeMap,
|
||||
sImageAlignAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -217,12 +217,17 @@ NS_IMETHODIMP
|
||||
nsHTMLTableCaptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -509,22 +509,26 @@ NS_IMETHODIMP
|
||||
nsHTMLTableCellElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::align) ||
|
||||
(aAttribute == nsHTMLAtoms::valign) ||
|
||||
(aAttribute == nsHTMLAtoms::nowrap) ||
|
||||
(aAttribute == nsHTMLAtoms::abbr) ||
|
||||
(aAttribute == nsHTMLAtoms::axis) ||
|
||||
(aAttribute == nsHTMLAtoms::headers) ||
|
||||
(aAttribute == nsHTMLAtoms::scope) ||
|
||||
(aAttribute == nsHTMLAtoms::width) ||
|
||||
(aAttribute == nsHTMLAtoms::height)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetBackgroundAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
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 AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sBackgroundAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -327,16 +327,24 @@ nsHTMLTableColElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||
PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::width) ||
|
||||
(aAttribute == nsHTMLAtoms::align) ||
|
||||
(aAttribute == nsHTMLAtoms::valign) ||
|
||||
((aAttribute == nsHTMLAtoms::span) &&
|
||||
!mNodeInfo->Equals(nsHTMLAtoms::col))) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
// we don't match "span" if we're a <col>
|
||||
nsIAtom** matchSpan = mNodeInfo->Equals(nsHTMLAtoms::col) ?
|
||||
nsnull : &nsHTMLAtoms::span;
|
||||
|
||||
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 AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1505,33 +1505,36 @@ NS_IMETHODIMP
|
||||
nsHTMLTableElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::layout) ||
|
||||
(aAttribute == nsHTMLAtoms::cellpadding) ||
|
||||
(aAttribute == nsHTMLAtoms::cellspacing) ||
|
||||
(aAttribute == nsHTMLAtoms::cols) ||
|
||||
(aAttribute == nsHTMLAtoms::border) ||
|
||||
(aAttribute == nsHTMLAtoms::frame) ||
|
||||
(aAttribute == nsHTMLAtoms::width) ||
|
||||
(aAttribute == nsHTMLAtoms::height) ||
|
||||
(aAttribute == nsHTMLAtoms::hspace) ||
|
||||
(aAttribute == nsHTMLAtoms::vspace)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (aAttribute == nsHTMLAtoms::bordercolor) {
|
||||
aHint = NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
else if ((aAttribute == nsHTMLAtoms::align) ||
|
||||
(aAttribute == nsHTMLAtoms::rules)) {
|
||||
// Changing to rules will force border-collapse. Unfortunately, if border-collapse was
|
||||
// already in effect, then a frame change is not necessary.
|
||||
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetBackgroundAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
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 },
|
||||
|
||||
{ &nsHTMLAtoms::bordercolor, NS_STYLE_HINT_VISUAL },
|
||||
|
||||
// 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 }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sBackgroundAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -639,17 +639,21 @@ NS_IMETHODIMP
|
||||
nsHTMLTableRowElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::align) ||
|
||||
(aAttribute == nsHTMLAtoms::valign) ||
|
||||
(aAttribute == nsHTMLAtoms::height)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetBackgroundAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
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 AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sBackgroundAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -394,17 +394,20 @@ NS_IMETHODIMP
|
||||
nsHTMLTableSectionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if ((aAttribute == nsHTMLAtoms::align) ||
|
||||
(aAttribute == nsHTMLAtoms::valign) ||
|
||||
(aAttribute == nsHTMLAtoms::height)) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
if (!GetBackgroundAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
}
|
||||
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 AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
sBackgroundAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -635,15 +635,19 @@ nsHTMLTextAreaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt
|
||||
// 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
|
||||
if (aAttribute == nsHTMLAtoms::align ||
|
||||
aAttribute == nsHTMLAtoms::rows ||
|
||||
aAttribute == nsHTMLAtoms::cols) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
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 }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -239,13 +239,18 @@ NS_IMETHODIMP
|
||||
nsHTMLUListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
|
||||
nsChangeHint& aHint) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
aHint = NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
|
||||
aHint = NS_STYLE_HINT_CONTENT;
|
||||
}
|
||||
static const AttributeImpactEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW },
|
||||
{ nsnull, NS_STYLE_HINT_NONE }
|
||||
};
|
||||
|
||||
static const AttributeImpactEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user