argh, back myself out - I'm crashing on startup now! :(

This commit is contained in:
alecf%netscape.com 2003-04-16 18:55:56 +00:00
Родитель d0ed272eb9
Коммит 9b8874c8d0
36 изменённых файлов: 474 добавлений и 568 удалений

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

@ -2565,12 +2565,10 @@ nsGenericHTMLElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
{
static const AttributeImpactEntry* const map[] = {
sCommonAttributeMap
};
FindAttributeImpact(aAttribute, aHint,
map, NS_ARRAY_LENGTH(map));
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}
@ -3167,67 +3165,38 @@ nsGenericHTMLElement::MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAt
}
}
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)
PRBool
nsGenericHTMLElement::GetCommonMappedAttributesImpact(const nsIAtom* aAttribute,
nsChangeHint& aHint)
{
for (PRUint32 mapindex = 0; mapindex < aMapCount; ++mapindex) {
const AttributeImpactEntry* map = aMaps[mapindex];
while (map->attribute) {
if (aAttribute == *map->attribute) {
aHint = map->hint;
return;
}
map++;
}
if (nsHTMLAtoms::dir == aAttribute) {
aHint = NS_STYLE_HINT_REFLOW; // XXX really? possibly FRAMECHANGE?
return PR_TRUE;
}
// fall-through
aHint = NS_STYLE_HINT_CONTENT;
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;
}
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,
@ -3273,6 +3242,16 @@ 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,
@ -3394,6 +3373,18 @@ 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)
@ -3453,6 +3444,19 @@ 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,6 +71,7 @@ class nsILayoutHistoryState;
struct nsRect;
struct nsSize;
/**
* A common superclass for HTML elements
*/
@ -484,32 +485,38 @@ public:
*/
static void MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
nsRuleData* aRuleData);
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[];
/**
* 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.
* Get the style impact of common attributes (dir, lang and _baseHref
* currently). To be called from GetMappedAttributeImpact().
*
* @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
* @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);
/**
* Get the style impact of image attributes (width, height, hspace and vspace
* 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 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.
*
@ -558,6 +565,17 @@ 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.
@ -568,6 +586,17 @@ 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
{
static const AttributeImpactEntry* const map[] = {
sCommonAttributeMap,
sImageAttributeMap,
sImageAlignAttributeMap,
sImageBorderAttributeMap
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
}
}
}
return NS_OK;
}

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

@ -215,17 +215,14 @@ NS_IMETHODIMP
nsHTMLBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
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));
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (nsHTMLAtoms::clear == aAttribute) {
aHint = NS_STYLE_HINT_REFLOW;
}
else {
aHint = NS_STYLE_HINT_CONTENT;
}
}
return NS_OK;
}

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

@ -207,20 +207,13 @@ 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));
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;
}
return NS_OK;
}

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

@ -608,23 +608,21 @@ NS_IMETHODIMP
nsHTMLBodyElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) 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 AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
sBackgroundAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
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;
}
}
return NS_OK;
}

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

@ -178,17 +178,12 @@ NS_IMETHODIMP
nsHTMLDListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
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));
if (aAttribute == nsHTMLAtoms::compact) {
aHint = NS_STYLE_HINT_CONTENT; // handled by ua.css?
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}

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

@ -222,19 +222,15 @@ NS_IMETHODIMP
nsHTMLDirectoryElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) 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 AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
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;
}
return NS_OK;
}

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

@ -220,18 +220,12 @@ NS_IMETHODIMP
nsHTMLDivElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
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));
if (aAttribute == nsHTMLAtoms::align) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}

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

@ -307,21 +307,19 @@ NS_IMETHODIMP
nsHTMLFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) 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 },
};
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* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -383,19 +383,13 @@ NS_IMETHODIMP
nsHTMLFrameSetElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
// 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));
if ((aAttribute == nsHTMLAtoms::rows) ||
(aAttribute == nsHTMLAtoms::cols)) {
aHint = mCurrentRowColHint;
}
else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}

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

@ -273,21 +273,18 @@ NS_IMETHODIMP
nsHTMLHRElement::GetMappedAttributeImpact(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 },
};
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
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;
}
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -199,22 +199,16 @@ 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
{
static const AttributeImpactEntry attributes[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW },
{ nsnull, NS_STYLE_HINT_NONE },
};
if (aAttribute == nsHTMLAtoms::align) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -494,20 +494,19 @@ nsHTMLIFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) 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 AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
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;
}
return NS_OK;
}

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

@ -554,21 +554,18 @@ nsHTMLImageElement::GetMappedAttributeImpact(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 },
};
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
sImageAttributeMap,
sImageBorderAttributeMap
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
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;
}
}
}
return NS_OK;
}

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

@ -1967,27 +1967,28 @@ NS_IMETHODIMP
nsHTMLInputElement::GetMappedAttributeImpact(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;
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;
}
}
}
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;
}
@ -2156,7 +2157,7 @@ nsHTMLInputElement::FireEventForAccessibility(nsIPresContext* aPresContext,
{
nsCOMPtr<nsIDOMEvent> event;
nsCOMPtr<nsIEventListenerManager> manager;
GetListenerManager(getter_AddRefs(manager));
nsresult rv = 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,17 +240,12 @@ NS_IMETHODIMP
nsHTMLLIElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
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));
if (aAttribute == nsHTMLAtoms::type) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}

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

@ -215,17 +215,12 @@ NS_IMETHODIMP
nsHTMLMapElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
static const AttributeImpactEntry attributes[] = {
{ &nsHTMLAtoms::name, NS_STYLE_HINT_RECONSTRUCT_ALL },
{ nsnull, NS_STYLE_HINT_NONE }
};
if (aAttribute == nsHTMLAtoms::name) {
aHint = NS_STYLE_HINT_RECONSTRUCT_ALL;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -222,17 +222,12 @@ NS_IMETHODIMP
nsHTMLMenuElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
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));
if (aAttribute == nsHTMLAtoms::type) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}

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

@ -258,17 +258,12 @@ NS_IMETHODIMP
nsHTMLOListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
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));
if (aAttribute == nsHTMLAtoms::type) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}

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

@ -299,15 +299,16 @@ NS_IMETHODIMP
nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
static const AttributeImpactEntry* const map[] = {
sCommonAttributeMap,
sImageAttributeMap,
sImageBorderAttributeMap,
sImageAlignAttributeMap,
};
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
}
}
}
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -497,21 +497,14 @@ nsHTMLOptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32
nsIFormControlFrame* fcFrame = GetSelectFrame();
if (fcFrame) {
static const AttributeImpactEntry attributes[] = {
{ &nsHTMLAtoms::label, NS_STYLE_HINT_REFLOW },
{ &nsHTMLAtoms::text, NS_STYLE_HINT_REFLOW },
{ nsnull, NS_STYLE_HINT_NONE }
};
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
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;
}
} else {
// XXX don't we want to try common attributes here?
if (aAttribute == nsXULAtoms::menuactive) {
aHint = NS_STYLE_HINT_CONTENT;
} else {

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

@ -204,18 +204,13 @@ NS_IMETHODIMP
nsHTMLParagraphElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
static const AttributeImpactEntry attributes[] = {
{ &nsHTMLAtoms::align, NS_STYLE_HINT_REFLOW },
{ nsnull, NS_STYLE_HINT_NONE }
};
if (aAttribute == nsHTMLAtoms::align) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -255,21 +255,16 @@ NS_IMETHODIMP
nsHTMLPreElement::GetMappedAttributeImpact(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 },
};
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
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;
}
return NS_OK;
}

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

@ -1880,19 +1880,16 @@ nsHTMLSelectElement::GetMappedAttributeImpact(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 }
};
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
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;
}
return NS_OK;
}

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

@ -411,35 +411,32 @@ nsHTMLSharedLeafElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
nsChangeHint& aHint) const
{
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
static const AttributeImpactEntry* const map[] = {
sCommonAttributeMap,
sImageAttributeMap,
sImageAlignAttributeMap,
sImageBorderAttributeMap
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
}
}
}
return NS_OK;
}
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 AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
sImageAttributeMap,
sImageBorderAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
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;
}
}
}
}
return nsGenericHTMLLeafElement::GetMappedAttributeImpact(aAttribute,

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

@ -411,35 +411,32 @@ nsHTMLSharedLeafElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
nsChangeHint& aHint) const
{
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
static const AttributeImpactEntry* const map[] = {
sCommonAttributeMap,
sImageAttributeMap,
sImageAlignAttributeMap,
sImageBorderAttributeMap
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
}
}
}
return NS_OK;
}
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 AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
sImageAttributeMap,
sImageBorderAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
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;
}
}
}
}
return nsGenericHTMLLeafElement::GetMappedAttributeImpact(aAttribute,

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

@ -299,15 +299,16 @@ NS_IMETHODIMP
nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
static const AttributeImpactEntry* const map[] = {
sCommonAttributeMap,
sImageAttributeMap,
sImageBorderAttributeMap,
sImageAlignAttributeMap,
};
if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageBorderAttributeImpact(aAttribute, aHint)) {
if (!GetImageMappedAttributesImpact(aAttribute, aHint)) {
if (!GetImageAlignAttributeImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
}
}
}
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -217,17 +217,12 @@ NS_IMETHODIMP
nsHTMLTableCaptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
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));
if (aAttribute == nsHTMLAtoms::align) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
return NS_OK;
}

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

@ -509,26 +509,22 @@ NS_IMETHODIMP
nsHTMLTableCellElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) 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 AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
sBackgroundAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
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;
}
}
return NS_OK;
}

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

@ -327,24 +327,16 @@ nsHTMLTableColElement::GetMappedAttributeImpact(const nsIAtom* aAttribute,
PRInt32 aModType,
nsChangeHint& aHint) const
{
// 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));
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;
}
return NS_OK;
}

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

@ -1505,36 +1505,33 @@ NS_IMETHODIMP
nsHTMLTableElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) 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 },
{ &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 }
};
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* const map[] = {
attributes,
sCommonAttributeMap,
sBackgroundAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -639,21 +639,17 @@ NS_IMETHODIMP
nsHTMLTableRowElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) 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 }
};
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* const map[] = {
attributes,
sCommonAttributeMap,
sBackgroundAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -394,20 +394,17 @@ NS_IMETHODIMP
nsHTMLTableSectionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) 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 }
};
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* const map[] = {
attributes,
sCommonAttributeMap,
sBackgroundAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -635,19 +635,15 @@ 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
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 }
};
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* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}

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

@ -239,18 +239,13 @@ NS_IMETHODIMP
nsHTMLUListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, PRInt32 aModType,
nsChangeHint& aHint) const
{
static const AttributeImpactEntry attributes[] = {
{ &nsHTMLAtoms::type, NS_STYLE_HINT_REFLOW },
{ nsnull, NS_STYLE_HINT_NONE }
};
if (aAttribute == nsHTMLAtoms::type) {
aHint = NS_STYLE_HINT_REFLOW;
}
else if (!GetCommonMappedAttributesImpact(aAttribute, aHint)) {
aHint = NS_STYLE_HINT_CONTENT;
}
static const AttributeImpactEntry* const map[] = {
attributes,
sCommonAttributeMap,
};
FindAttributeImpact(aAttribute, aHint, map, NS_ARRAY_LENGTH(map));
return NS_OK;
}