diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 42073bb85ac..f32ba268758 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -222,6 +222,8 @@ nsDOMCSSAttributeDeclaration::GetBaseURL(nsIURI** aURL) //---------------------------------------------------------------------- +// this function is a holdover from when attributes were shared +// leaving it in place in case we need to go back to that model static nsresult EnsureWritableAttributes(nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes, PRBool aCreate) { @@ -229,29 +231,7 @@ static nsresult EnsureWritableAttributes(nsIHTMLContent* aContent, if (nsnull == aAttributes) { if (PR_TRUE == aCreate) { - nsMapAttributesFunc fontMapFunc; - nsMapAttributesFunc mapFunc; - result = aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - if (NS_OK == result) { - result = NS_NewHTMLAttributes(&aAttributes, nsnull, fontMapFunc, mapFunc); - if (NS_OK == result) { - aAttributes->AddContentRef(); - } - } - } - } - else { - PRInt32 contentRefCount; - aAttributes->GetContentRefCount(contentRefCount); - if (1 < contentRefCount) { - nsIHTMLAttributes* attrs; - result = aAttributes->Clone(&attrs); - if (NS_OK == result) { - aAttributes->ReleaseContentRef(); - NS_RELEASE(aAttributes); - aAttributes = attrs; - aAttributes->AddContentRef(); - } + result = NS_NewHTMLAttributes(&aAttributes); } } return result; @@ -259,7 +239,7 @@ static nsresult EnsureWritableAttributes(nsIHTMLContent* aContent, static void ReleaseAttributes(nsIHTMLAttributes*& aAttributes) { - aAttributes->ReleaseContentRef(); +// aAttributes->ReleaseContentRef(); NS_RELEASE(aAttributes); } @@ -283,9 +263,7 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent, nsresult result = NS_OK; if (nsnull != mAttributes) { - aDst->mAttributes = mAttributes; - NS_ADDREF(mAttributes); - mAttributes->AddContentRef(); + result = mAttributes->Clone(&(aDst->mAttributes)); } return result; @@ -434,7 +412,7 @@ nsGenericHTMLElement::SetDocument(nsIDocument* aDocument, PRBool aDeep) nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument); if (nsnull != sheet) { mAttributes->SetStyleSheet(sheet); - sheet->SetAttributesFor(htmlContent, mAttributes); // sync attributes with sheet +// sheet->SetAttributesFor(htmlContent, mAttributes); // sync attributes with sheet NS_RELEASE(sheet); } } @@ -611,10 +589,14 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID, } else { // set as string value to avoid another string copy + PRBool impact = NS_STYLE_HINT_NONE; + htmlContent->GetMappedAttributeImpact(aAttribute, impact); if (nsnull != mDocument) { // set attr via style sheet nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument); if (nsnull != sheet) { - result = sheet->SetAttributeFor(aAttribute, aValue, htmlContent, mAttributes); + result = sheet->SetAttributeFor(aAttribute, aValue, + (NS_STYLE_HINT_CONTENT < impact), + htmlContent, mAttributes); NS_RELEASE(sheet); } } @@ -622,7 +604,9 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID, result = EnsureWritableAttributes(htmlContent, mAttributes, PR_TRUE); if (nsnull != mAttributes) { PRInt32 count; - result = mAttributes->SetAttribute(aAttribute, aValue, count); + result = mAttributes->SetAttributeFor(aAttribute, aValue, + (NS_STYLE_HINT_CONTENT < impact), + htmlContent, nsnull, count); if (0 == count) { ReleaseAttributes(mAttributes); } @@ -672,34 +656,38 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute, if (NS_OK != result) { return result; } + PRBool impact = NS_STYLE_HINT_NONE; + htmlContent->GetMappedAttributeImpact(aAttribute, impact); if (nsnull != mDocument) { // set attr via style sheet - PRInt32 hint = NS_STYLE_HINT_UNKNOWN; if (aNotify && (nsHTMLAtoms::style == aAttribute)) { nsHTMLValue oldValue; - PRInt32 oldHint = NS_STYLE_HINT_NONE; + PRInt32 oldImpact = NS_STYLE_HINT_NONE; if (NS_CONTENT_ATTR_NOT_THERE != GetHTMLAttribute(aAttribute, oldValue)) { - oldHint = GetStyleImpactFrom(oldValue); + oldImpact = GetStyleImpactFrom(oldValue); } - hint = GetStyleImpactFrom(aValue); - if (hint < oldHint) { - hint = oldHint; + impact = GetStyleImpactFrom(aValue); + if (impact < oldImpact) { + impact = oldImpact; } } nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument); if (nsnull != sheet) { - result = sheet->SetAttributeFor(aAttribute, aValue, htmlContent, - mAttributes); + result = sheet->SetAttributeFor(aAttribute, aValue, + (NS_STYLE_HINT_CONTENT < impact), + htmlContent, mAttributes); NS_RELEASE(sheet); } if (aNotify) { - mDocument->AttributeChanged(mContent, aAttribute, hint); + mDocument->AttributeChanged(mContent, aAttribute, impact); } } else { // manage this ourselves and re-sync when we connect to doc result = EnsureWritableAttributes(htmlContent, mAttributes, PR_TRUE); if (nsnull != mAttributes) { PRInt32 count; - result = mAttributes->SetAttribute(aAttribute, aValue, count); + result = mAttributes->SetAttributeFor(aAttribute, aValue, + (NS_STYLE_HINT_CONTENT < impact), + htmlContent, nsnull, count); if (0 == count) { ReleaseAttributes(mAttributes); } @@ -709,25 +697,6 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute, return result; } -/** - * Handle attributes common to all html elements - */ -void -nsGenericHTMLElement::MapCommonAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aStyleContext, - nsIPresContext* aPresContext) -{ - if (nsnull != aAttributes) { - nsHTMLValue value; - aAttributes->GetAttribute(nsHTMLAtoms::dir, value); - if (value.GetUnit() == eHTMLUnit_Enumerated) { - nsStyleDisplay* display = (nsStyleDisplay*) - aStyleContext->GetMutableStyleData(eStyleStruct_Display); - display->mDirection = value.GetIntValue(); - } - } -} - nsresult nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { @@ -751,14 +720,14 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, return result; } if (nsnull != mDocument) { // set attr via style sheet - PRInt32 hint = NS_STYLE_HINT_UNKNOWN; + PRInt32 impact = NS_STYLE_HINT_UNKNOWN; if (aNotify && (nsHTMLAtoms::style == aAttribute)) { nsHTMLValue oldValue; if (NS_CONTENT_ATTR_NOT_THERE != GetHTMLAttribute(aAttribute, oldValue)) { - hint = GetStyleImpactFrom(oldValue); + impact = GetStyleImpactFrom(oldValue); } else { - hint = NS_STYLE_HINT_NONE; + impact = NS_STYLE_HINT_NONE; } } nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument); @@ -767,14 +736,14 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, NS_RELEASE(sheet); } if (aNotify) { - mDocument->AttributeChanged(mContent, aAttribute, hint); + mDocument->AttributeChanged(mContent, aAttribute, impact); } } else { // manage this ourselves and re-sync when we connect to doc result = EnsureWritableAttributes(htmlContent, mAttributes, PR_FALSE); if (nsnull != mAttributes) { PRInt32 count; - result = mAttributes->UnsetAttribute(aAttribute, count); + result = mAttributes->UnsetAttributeFor(aAttribute, htmlContent, nsnull, count); if (0 == count) { ReleaseAttributes(mAttributes); } @@ -930,15 +899,15 @@ nsGenericHTMLElement::HasClass(nsIAtom* aClass) const nsresult nsGenericHTMLElement::GetContentStyleRules(nsISupportsArray* aRules) { - nsresult result = NS_ERROR_NULL_POINTER; - nsIStyleRule* rule = nsnull; + nsresult result = NS_OK; - if (aRules && mAttributes) { - result = mAttributes->QueryInterface(kIStyleRuleIID, (void**)&rule); + if (aRules) { + if (mAttributes) { + result = mAttributes->GetMappedAttributeStyleRules(aRules); + } } - if (rule) { - aRules->AppendElement(rule); - NS_RELEASE(rule); + else { + result = NS_ERROR_NULL_POINTER; } return result; } @@ -969,11 +938,15 @@ nsGenericHTMLElement::GetInlineStyleRules(nsISupportsArray* aRules) nsresult nsGenericHTMLElement::GetBaseURL(nsIURI*& aBaseURL) const { - return GetBaseURL(mAttributes, mDocument, &aBaseURL); + nsHTMLValue baseHref; + if (mAttributes) { + mAttributes->GetAttribute(nsHTMLAtoms::_baseHref, baseHref); + } + return GetBaseURL(baseHref, mDocument, &aBaseURL); } nsresult -nsGenericHTMLElement::GetBaseURL(nsIHTMLAttributes* aAttributes, +nsGenericHTMLElement::GetBaseURL(const nsHTMLValue& aBaseHref, nsIDocument* aDocument, nsIURI** aBaseURL) { @@ -984,35 +957,30 @@ nsGenericHTMLElement::GetBaseURL(nsIHTMLAttributes* aAttributes, result = aDocument->GetBaseURL(docBaseURL); } *aBaseURL = docBaseURL; -// NS_IF_RELEASE(docBaseURL); - if (nsnull != aAttributes) { - nsHTMLValue value; - if (NS_CONTENT_ATTR_HAS_VALUE == aAttributes->GetAttribute(nsHTMLAtoms::_baseHref, value)) { - if (eHTMLUnit_String == value.GetUnit()) { - nsAutoString baseHref; - value.GetStringValue(baseHref); + if (eHTMLUnit_String == aBaseHref.GetUnit()) { + nsAutoString baseHref; + aBaseHref.GetStringValue(baseHref); - nsIURI* url = nsnull; + nsIURI* url = nsnull; #ifndef NECKO - nsILoadGroup* LoadGroup = nsnull; - docBaseURL->GetLoadGroup(&LoadGroup); - if (LoadGroup) { - result = LoadGroup->CreateURL(&url, docBaseURL, baseHref, nsnull); - NS_RELEASE(LoadGroup); - } - else -#endif - { -#ifndef NECKO - result = NS_NewURL(&url, baseHref, docBaseURL); -#else - result = NS_NewURI(&url, baseHref, docBaseURL); -#endif // NECKO - } - *aBaseURL = url; - } + nsILoadGroup* LoadGroup = nsnull; + docBaseURL->GetLoadGroup(&LoadGroup); + if (LoadGroup) { + result = LoadGroup->CreateURL(&url, docBaseURL, baseHref, nsnull); + NS_RELEASE(LoadGroup); } + else +#endif + { +#ifndef NECKO + result = NS_NewURL(&url, baseHref, docBaseURL); +#else + result = NS_NewURI(&url, baseHref, docBaseURL); +#endif // NECKO + } + NS_IF_RELEASE(docBaseURL); + *aBaseURL = url; } return result; } @@ -1433,39 +1401,38 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, colorStr.ToCString(cbuf, sizeof(cbuf)); nscolor color = 0; if (NS_ColorNameToRGB(cbuf, &color)) { - aResult.SetStringValue(colorStr); + aResult.SetStringValue(colorStr, eHTMLUnit_ColorName); return PR_TRUE; } - if (NS_LooseHexToRGB(cbuf, &color)) { - aResult.SetColorValue(color); - return PR_TRUE; - } - - // We failed to match the color value as either a color name or a hex - // number - if ('#' == cbuf[0]) { #if 0 + nsDTDMode mode = eDTDMode_NoQuirks; + if (mDocument) { nsIHTMLDocument* htmlDoc; nsresult result; - result = mDocument->QueryInterface(kIHTMLDocumentIID, (void**)&htmlDoc); if (NS_SUCCEEDED(result)) { - nsDTDMode mode; - // Check the compatibility mode - result = htmlDoc->GetDTDMode(&mode); + result = htmlDoc->GetDTDMode(mode); NS_RELEASE(htmlDoc); - - if (NS_SUCCEEDED(result) && (eDTDMode_Nav == mode)) { -#endif - // Nav treats illegal hex numbers as 0 - aResult.SetColorValue(0); - return PR_TRUE; -#if 0 - } } -#endif } + + if (eDTDMode_NoQuirks == mode) { + if (('#' == cbuf[0]) && NS_HexToRGB(&(cbuf[1]), &color)) { + aResult.SetColorValue(color); + return PR_TRUE; + } + } + else { +#endif + aString.ToCString(cbuf, sizeof(cbuf)); // no space compression + if (NS_LooseHexToRGB(cbuf, &color)) { + aResult.SetColorValue(color); + return PR_TRUE; + } +#if 0 + } +#endif } // Illegal values are mapped to empty @@ -1759,91 +1726,134 @@ nsGenericHTMLElement::ScrollingValueToString(PRBool aStandardMode, } } +/** + * Handle attributes common to all html elements + */ void -nsGenericHTMLElement::MapImageAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext) +nsGenericHTMLElement::MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aStyleContext, + nsIPresContext* aPresContext) { - if (nsnull != aAttributes) { - nsHTMLValue value; - - float p2t; - aPresContext->GetScaledPixelsToTwips(&p2t); - nsStylePosition* pos = (nsStylePosition*) - aContext->GetMutableStyleData(eStyleStruct_Position); - nsStyleSpacing* spacing = (nsStyleSpacing*) - aContext->GetMutableStyleData(eStyleStruct_Spacing); - - // width: value - aAttributes->GetAttribute(nsHTMLAtoms::width, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - pos->mWidth.SetCoordValue(twips); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - pos->mWidth.SetPercentValue(value.GetPercentValue()); - } - - // height: value - aAttributes->GetAttribute(nsHTMLAtoms::height, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - pos->mHeight.SetCoordValue(twips); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - pos->mHeight.SetPercentValue(value.GetPercentValue()); - } - - // hspace: value - aAttributes->GetAttribute(nsHTMLAtoms::hspace, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - nsStyleCoord c(twips); - spacing->mMargin.SetLeft(c); - spacing->mMargin.SetRight(c); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - nsStyleCoord c(value.GetPercentValue(), eStyleUnit_Coord); - spacing->mMargin.SetLeft(c); - spacing->mMargin.SetRight(c); - } - - // vspace: value - aAttributes->GetAttribute(nsHTMLAtoms::vspace, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - nsStyleCoord c(twips); - spacing->mMargin.SetTop(c); - spacing->mMargin.SetBottom(c); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - nsStyleCoord c(value.GetPercentValue(), eStyleUnit_Coord); - spacing->mMargin.SetTop(c); - spacing->mMargin.SetBottom(c); - } + nsHTMLValue value; + aAttributes->GetAttribute(nsHTMLAtoms::dir, value); + if (value.GetUnit() == eHTMLUnit_Enumerated) { + nsStyleDisplay* display = (nsStyleDisplay*) + aStyleContext->GetMutableStyleData(eStyleStruct_Display); + display->mDirection = value.GetIntValue(); } } +PRBool +nsGenericHTMLElement::GetCommonMappedAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint) +{ + if (nsHTMLAtoms::dir == aAttribute) { + aHint = NS_STYLE_HINT_REFLOW; // XXX really? possibly FRAMECHANGE? + 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; +} + void -nsGenericHTMLElement::MapImageAlignAttributeInto(nsIHTMLAttributes* aAttributes, +nsGenericHTMLElement::MapImageAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + nsHTMLValue value; + + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + nsStylePosition* pos = (nsStylePosition*) + aContext->GetMutableStyleData(eStyleStruct_Position); + nsStyleSpacing* spacing = (nsStyleSpacing*) + aContext->GetMutableStyleData(eStyleStruct_Spacing); + + // width: value + aAttributes->GetAttribute(nsHTMLAtoms::width, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + pos->mWidth.SetCoordValue(twips); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + pos->mWidth.SetPercentValue(value.GetPercentValue()); + } + + // height: value + aAttributes->GetAttribute(nsHTMLAtoms::height, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + pos->mHeight.SetCoordValue(twips); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + pos->mHeight.SetPercentValue(value.GetPercentValue()); + } + + // hspace: value + aAttributes->GetAttribute(nsHTMLAtoms::hspace, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + nsStyleCoord c(twips); + spacing->mMargin.SetLeft(c); + spacing->mMargin.SetRight(c); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + nsStyleCoord c(value.GetPercentValue(), eStyleUnit_Percent); + spacing->mMargin.SetLeft(c); + spacing->mMargin.SetRight(c); + } + + // vspace: value + aAttributes->GetAttribute(nsHTMLAtoms::vspace, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + nsStyleCoord c(twips); + spacing->mMargin.SetTop(c); + spacing->mMargin.SetBottom(c); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + nsStyleCoord c(value.GetPercentValue(), eStyleUnit_Percent); + spacing->mMargin.SetTop(c); + spacing->mMargin.SetBottom(c); + } +} + +PRBool +nsGenericHTMLElement::GetImageMappedAttributesImpact(const nsIAtom* aAttribute, + PRInt32& 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::MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { - if (nsnull != aAttributes) { - nsHTMLValue value; - aAttributes->GetAttribute(nsHTMLAtoms::align, value); - if (value.GetUnit() == eHTMLUnit_Enumerated) { - PRUint8 align = value.GetIntValue(); - nsStyleDisplay* display = (nsStyleDisplay*) - aContext->GetMutableStyleData(eStyleStruct_Display); - nsStyleText* text = (nsStyleText*) - aContext->GetMutableStyleData(eStyleStruct_Text); - nsStyleSpacing* spacing = (nsStyleSpacing*) - aContext->GetMutableStyleData(eStyleStruct_Spacing); - float p2t; - aPresContext->GetScaledPixelsToTwips(&p2t); - nsStyleCoord three(NSIntPixelsToTwips(3, p2t)); - switch (align) { + nsHTMLValue value; + aAttributes->GetAttribute(nsHTMLAtoms::align, value); + if (value.GetUnit() == eHTMLUnit_Enumerated) { + PRUint8 align = (PRUint8)(value.GetIntValue()); + nsStyleDisplay* display = (nsStyleDisplay*) + aContext->GetMutableStyleData(eStyleStruct_Display); + nsStyleText* text = (nsStyleText*) + aContext->GetMutableStyleData(eStyleStruct_Text); + nsStyleSpacing* spacing = (nsStyleSpacing*) + aContext->GetMutableStyleData(eStyleStruct_Spacing); + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + nsStyleCoord three(NSIntPixelsToTwips(3, p2t)); + switch (align) { case NS_STYLE_TEXT_ALIGN_LEFT: display->mFloats = NS_STYLE_FLOAT_LEFT; spacing->mMargin.SetLeft(three); @@ -1857,45 +1867,55 @@ nsGenericHTMLElement::MapImageAlignAttributeInto(nsIHTMLAttributes* aAttributes, default: text->mVerticalAlign.SetIntValue(align, eStyleUnit_Enumerated); break; - } } } } -void -nsGenericHTMLElement::MapImageBorderAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext, - nscolor aBorderColors[4]) +PRBool +nsGenericHTMLElement::GetImageAlignAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) { - if (nsnull != aAttributes) { - nsHTMLValue value; + if ((nsHTMLAtoms::align == aAttribute)) { + aHint = NS_STYLE_HINT_REFLOW; + return PR_TRUE; + } + return PR_FALSE; +} - // border: pixels - aAttributes->GetAttribute(nsHTMLAtoms::border, value); - if (value.GetUnit() != eHTMLUnit_Pixel) { - if (nsnull == aBorderColors) { - return; - } - // If no border is defined and we are forcing a border, force - // the size to 2 pixels. - value.SetPixelValue(2); + +void +nsGenericHTMLElement::MapImageBorderAttributeInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext, + nscolor aBorderColors[4]) +{ + nsHTMLValue value; + + // border: pixels + aAttributes->GetAttribute(nsHTMLAtoms::border, value); + if (value.GetUnit() != eHTMLUnit_Pixel) { + if (nsnull == aBorderColors) { + return; } + // If no border is defined and we are forcing a border, force + // the size to 2 pixels. + value.SetPixelValue(2); + } - float p2t; - aPresContext->GetScaledPixelsToTwips(&p2t); - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - // Fixup border-padding sums: subtract out the old size and then - // add in the new size. - nsStyleSpacing* spacing = (nsStyleSpacing*) - aContext->GetMutableStyleData(eStyleStruct_Spacing); - nsStyleCoord coord; - coord.SetCoordValue(twips); - spacing->mBorder.SetTop(coord); - spacing->mBorder.SetRight(coord); - spacing->mBorder.SetBottom(coord); - spacing->mBorder.SetLeft(coord); + // Fixup border-padding sums: subtract out the old size and then + // add in the new size. + nsStyleSpacing* spacing = (nsStyleSpacing*) + aContext->GetMutableStyleData(eStyleStruct_Spacing); + nsStyleCoord coord; + coord.SetCoordValue(twips); + spacing->mBorder.SetTop(coord); + spacing->mBorder.SetRight(coord); + spacing->mBorder.SetBottom(coord); + spacing->mBorder.SetLeft(coord); spacing->SetBorderStyle(0,NS_STYLE_BORDER_STYLE_SOLID); spacing->SetBorderStyle(1,NS_STYLE_BORDER_STYLE_SOLID); @@ -1903,29 +1923,40 @@ nsGenericHTMLElement::MapImageBorderAttributesInto(nsIHTMLAttributes* aAttribute spacing->SetBorderStyle(3,NS_STYLE_BORDER_STYLE_SOLID); - // Use supplied colors if provided, otherwise use color for border - // color - if (nsnull != aBorderColors) { - spacing->SetBorderColor(0, aBorderColors[0]); - spacing->SetBorderColor(1, aBorderColors[1]); - spacing->SetBorderColor(2, aBorderColors[2]); - spacing->SetBorderColor(3, aBorderColors[3]); - } - else { - // Color is inherited from "color" - const nsStyleColor* styleColor = (const nsStyleColor*) - aContext->GetStyleData(eStyleStruct_Color); - nscolor color = styleColor->mColor; - spacing->SetBorderColor(0, color); - spacing->SetBorderColor(1, color); - spacing->SetBorderColor(2, color); - spacing->SetBorderColor(3, color); - } + // Use supplied colors if provided, otherwise use color for border + // color + if (nsnull != aBorderColors) { + spacing->SetBorderColor(0, aBorderColors[0]); + spacing->SetBorderColor(1, aBorderColors[1]); + spacing->SetBorderColor(2, aBorderColors[2]); + spacing->SetBorderColor(3, aBorderColors[3]); + } + else { + // Color is inherited from "color" + const nsStyleColor* styleColor = (const nsStyleColor*) + aContext->GetStyleData(eStyleStruct_Color); + nscolor color = styleColor->mColor; + spacing->SetBorderColor(0, color); + spacing->SetBorderColor(1, color); + spacing->SetBorderColor(2, color); + spacing->SetBorderColor(3, color); } } +PRBool +nsGenericHTMLElement::GetImageBorderAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) +{ + if ((nsHTMLAtoms::border == aAttribute)) { + aHint = NS_STYLE_HINT_REFLOW; + return PR_TRUE; + } + return PR_FALSE; +} + + void -nsGenericHTMLElement::MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes, +nsGenericHTMLElement::MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -1947,7 +1978,9 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes rv = shell->GetDocument(getter_AddRefs(doc)); if (NS_SUCCEEDED(rv) && doc) { nsCOMPtr docURL; - nsGenericHTMLElement::GetBaseURL(aAttributes, doc, + nsHTMLValue baseHref; + aAttributes->GetAttribute(nsHTMLAtoms::_baseHref, baseHref); + nsGenericHTMLElement::GetBaseURL(baseHref, doc, getter_AddRefs(docURL)); #ifndef NECKO rv = NS_MakeAbsoluteURL(docURL, "", spec, absURLSpec); @@ -1969,29 +2002,29 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes // bgcolor if (NS_CONTENT_ATTR_HAS_VALUE == aAttributes->GetAttribute(nsHTMLAtoms::bgcolor, value)) { - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())) { nsStyleColor* color = (nsStyleColor*) aContext->GetMutableStyleData(eStyleStruct_Color); color->mBackgroundColor = value.GetColorValue(); color->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT; } - else if (eHTMLUnit_String == value.GetUnit()) { - nsAutoString buffer; - value.GetStringValue(buffer); - char cbuf[40]; - buffer.ToCString(cbuf, sizeof(cbuf)); - - nscolor backgroundColor; - if (NS_ColorNameToRGB(cbuf, &backgroundColor)) { - nsStyleColor* color = (nsStyleColor*) - aContext->GetMutableStyleData(eStyleStruct_Color); - color->mBackgroundColor = backgroundColor; - color->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT; - } - } } } +PRBool +nsGenericHTMLElement::GetBackgroundAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint) +{ + if ((nsHTMLAtoms::background == aAttribute) || + (nsHTMLAtoms::bgcolor == aAttribute)) { + aHint = NS_STYLE_HINT_VISUAL; + return PR_TRUE; + } + return PR_FALSE; +} + + static PRBool AttributeChangeRequiresRepaint(const nsIAtom* aAttribute) { // these are attributes that always require a restyle and a repaint, but not a reflow @@ -2024,36 +2057,6 @@ static PRBool AttributeChangeRequiresReflow(const nsIAtom* aAttribute) aAttribute==nsHTMLAtoms::width); } -static PRBool AttributeChangeRequiresReframe(const nsIAtom* aAttribute) -{ - return (PRBool) - (aAttribute==nsHTMLAtoms::id || - aAttribute==nsHTMLAtoms::kClass || - aAttribute==nsHTMLAtoms::dir); -} - -PRBool -nsGenericHTMLElement::GetStyleHintForCommonAttributes(const nsIContent* aNode, - const nsIAtom* aAttribute, - PRInt32* aHint) -{ - PRBool setHint = PR_TRUE; - if (PR_TRUE == AttributeChangeRequiresReframe(aAttribute)) { - *aHint = NS_STYLE_HINT_FRAMECHANGE; - } - else if (PR_TRUE == AttributeChangeRequiresReflow(aAttribute)) { - *aHint = NS_STYLE_HINT_REFLOW; - } - else if (PR_TRUE == AttributeChangeRequiresRepaint(aAttribute)) { - *aHint = NS_STYLE_HINT_VISUAL; - } - else { - *aHint = NS_STYLE_HINT_CONTENT; // only frames will get notified... - setHint = PR_FALSE; - } - return setHint; -} - //---------------------------------------------------------------------- nsGenericHTMLLeafElement::nsGenericHTMLLeafElement() diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index 739026ff6a8..e65e6255973 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -37,6 +37,7 @@ class nsIDOMNodeList; class nsIEventListenerManager; class nsIFrame; class nsIHTMLAttributes; +class nsIHTMLMappedAttributes; class nsIHTMLContent; class nsIStyleContext; class nsIStyleRule; @@ -209,26 +210,6 @@ public: static PRBool FrameborderValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, nsString& aResult); - static void MapCommonAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aStyleContext, - nsIPresContext* aPresContext); - - static void MapImageAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext); - - static void MapImageAlignAttributeInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext); - - static void MapImageBorderAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext, - nscolor aBorderColors[4]); - - static void MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext); static PRBool ParseScrollingValue(PRBool aStandardMode, const nsString& aString, @@ -238,15 +219,48 @@ public: const nsHTMLValue& aValue, nsString& aResult); - static PRBool GetStyleHintForCommonAttributes(const nsIContent* aNode, - const nsIAtom* aAttribute, - PRInt32* aHint); + /** Attribute Mapping Helpers + * + * All attributes that are mapped into style contexts must have a + * matched set of mapping function and impact getter + */ + + static void MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aStyleContext, + nsIPresContext* aPresContext); + static PRBool GetCommonMappedAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint); + + static void MapImageAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext); + static PRBool GetImageMappedAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint); + + static void MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext); + static PRBool GetImageAlignAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint); + + static void MapImageBorderAttributeInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext, + nscolor aBorderColors[4]); + static PRBool GetImageBorderAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint); + + static void MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext); + static PRBool GetBackgroundAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint); //XXX This creates a dependency between content and frames static nsresult GetPrimaryFrame(nsIHTMLContent* aContent, nsIFormControlFrame *&aFormControlFrame); - static nsresult GetBaseURL(nsIHTMLAttributes* aAttributes, + static nsresult GetBaseURL(const nsHTMLValue& aBaseHref, nsIDocument* aDocument, nsIURI** aResult); @@ -460,8 +474,8 @@ public: nsString& aResult) const; \ NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ nsMapAttributesFunc& aMapFunc) const; \ - NS_IMETHOD GetStyleHintForAttributeChange(const nsIAtom* aAttribute, \ - PRInt32 *aHint) const; + NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \ + PRInt32& aHint) const; #define NS_IMPL_IHTMLCONTENT_USING_GENERIC2(_g) \ NS_IMETHOD Compact() { \ @@ -506,8 +520,8 @@ public: nsString& aResult) const; \ NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ nsMapAttributesFunc& aMapFunc) const; \ - NS_IMETHOD GetStyleHintForAttributeChange(const nsIAtom* aAttribute, \ - PRInt32 *aHint) const; + NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \ + PRInt32& aHint) const; /** * This macro implements the portion of query interface that is diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index 3c07948823e..62ac54e8614 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -247,13 +247,23 @@ nsHTMLAnchorElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLAnchorElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLAnchorElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -365,30 +375,3 @@ nsHTMLAnchorElement::HandleDOMEvent(nsIPresContext& aPresContext, return ret; } -NS_IMETHODIMP -nsHTMLAnchorElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if ((aAttribute == nsHTMLAtoms::charset) || - (aAttribute == nsHTMLAtoms::coords) || - (aAttribute == nsHTMLAtoms::href) || - (aAttribute == nsHTMLAtoms::hreflang) || - (aAttribute == nsHTMLAtoms::name) || - (aAttribute == nsHTMLAtoms::rel) || - (aAttribute == nsHTMLAtoms::rev) || - (aAttribute == nsHTMLAtoms::shape) || - (aAttribute == nsHTMLAtoms::tabindex) || - (aAttribute == nsHTMLAtoms::target) || - (aAttribute == nsHTMLAtoms::type)) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if (aAttribute == nsHTMLAtoms::accesskey) { - // XXX Notification needs to happen for this attribute - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp b/mozilla/content/html/content/src/nsHTMLAppletElement.cpp index 62840119d0d..ffd3ab2fa78 100644 --- a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAppletElement.cpp @@ -212,14 +212,30 @@ nsHTMLAppletElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { - nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, nsnull); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); + nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull); +} + +NS_IMETHODIMP +nsHTMLAppletElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageAlignAttributeImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + } + return NS_OK; } NS_IMETHODIMP @@ -244,15 +260,6 @@ nsHTMLAppletElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLAppletElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} - #if defined(OJI) extern nsresult NS_GetObjectFramePluginInstance(nsIFrame* aFrame, nsIPluginInstance*& aPluginInstance); #endif diff --git a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp index 72a6b730924..aa2bbd0e1dd 100644 --- a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp @@ -175,13 +175,25 @@ nsHTMLAreaElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLAreaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const + +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLAreaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -203,31 +215,6 @@ nsHTMLAreaElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLAreaElement::GetStyleHintForAttributeChange(const nsIAtom* aAttribute, - PRInt32 *aHint) const - -{ - if ((aAttribute == nsHTMLAtoms::alt) || - (aAttribute == nsHTMLAtoms::coords) || - (aAttribute == nsHTMLAtoms::href) || - (aAttribute == nsHTMLAtoms::nohref) || - (aAttribute == nsHTMLAtoms::shape) || - (aAttribute == nsHTMLAtoms::tabindex) || - (aAttribute == nsHTMLAtoms::target)) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if (aAttribute == nsHTMLAtoms::accesskey) { - // XXX Notification needs to happen for this attribute - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} - NS_IMETHODIMP nsHTMLAreaElement::SetFocus(nsIPresContext* aPresContext) { diff --git a/mozilla/content/html/content/src/nsHTMLBRElement.cpp b/mozilla/content/html/content/src/nsHTMLBRElement.cpp index 79e6e82ac58..1474861986e 100644 --- a/mozilla/content/html/content/src/nsHTMLBRElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBRElement.cpp @@ -161,22 +161,36 @@ nsHTMLBRElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { - if (nsnull != aAttributes) { - nsStyleDisplay* display = (nsStyleDisplay*) - aContext->GetMutableStyleData(eStyleStruct_Display); - nsHTMLValue value; - aAttributes->GetAttribute(nsHTMLAtoms::clear, value); - if (value.GetUnit() == eHTMLUnit_Enumerated) { - display->mBreakType = value.GetIntValue(); - } + nsStyleDisplay* display = (nsStyleDisplay*) + aContext->GetMutableStyleData(eStyleStruct_Display); + + nsHTMLValue value; + aAttributes->GetAttribute(nsHTMLAtoms::clear, value); + if (value.GetUnit() == eHTMLUnit_Enumerated) { + display->mBreakType = value.GetIntValue(); } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (nsHTMLAtoms::clear == aAttribute) { + aHint = NS_STYLE_HINT_REFLOW; + } + else { + aHint = NS_STYLE_HINT_CONTENT; + } + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -198,11 +212,3 @@ nsHTMLBRElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLBRElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLBaseElement.cpp b/mozilla/content/html/content/src/nsHTMLBaseElement.cpp index 850a1be4f75..f14127690ff 100644 --- a/mozilla/content/html/content/src/nsHTMLBaseElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBaseElement.cpp @@ -144,13 +144,23 @@ nsHTMLBaseElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLBaseElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLBaseElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -172,11 +182,3 @@ nsHTMLBaseElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLBaseElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp b/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp index 7afb9f15ce9..9503166a1e2 100644 --- a/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp @@ -149,7 +149,7 @@ nsHTMLBaseFontElement::AttributeToString(nsIAtom* aAttribute, } static void -MapFontAttributesInto(nsIHTMLAttributes* aAttributes, +MapFontAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -157,13 +157,29 @@ MapFontAttributesInto(nsIHTMLAttributes* aAttributes, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } + +NS_IMETHODIMP +nsHTMLBaseFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLBaseFontElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -186,18 +202,3 @@ nsHTMLBaseFontElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLBaseFontElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::color == aAttribute || - nsHTMLAtoms::face == aAttribute || - nsHTMLAtoms::size == aAttribute) { - *aHint = NS_STYLE_HINT_RECONSTRUCT_ALL; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp index 2ad98e6846e..e638689f070 100644 --- a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp @@ -264,11 +264,11 @@ BodyRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresConte aPresContext->GetFontScaler(&scaler); float scaleFactor = nsStyleUtil::GetScalingFactor(scaler); // apply font scaling to the body - font->mFont.size *= scaleFactor; + font->mFont.size = NSToCoordFloor(float(font->mFont.size) * scaleFactor); if (font->mFont.size < 1) { font->mFont.size = 1; } - font->mFixedFont.size *= scaleFactor; + font->mFixedFont.size = NSToCoordFloor(float(font->mFixedFont.size) * scaleFactor); if (font->mFixedFont.size < 1) { font->mFixedFont.size = 1; } @@ -619,18 +619,8 @@ nsHTMLBodyElement::AttributeToString(nsIAtom* aAttribute, return mInner.AttributeToString(aAttribute, aValue, aResult); } -static PRBool ColorNameToRGB(const nsHTMLValue& aValue, nscolor* aColor) -{ - nsAutoString buffer; - aValue.GetStringValue(buffer); - char cbuf[40]; - buffer.ToCString(cbuf, sizeof(cbuf)); - - return NS_ColorNameToRGB(cbuf, aColor); -} - static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -639,19 +629,12 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext); aAttributes->GetAttribute(nsHTMLAtoms::text, value); - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())){ nsStyleColor* color = (nsStyleColor*) aContext->GetMutableStyleData(eStyleStruct_Color); color->mColor = value.GetColorValue(); } - else if (eHTMLUnit_String == value.GetUnit()) { - nscolor backgroundColor; - if (ColorNameToRGB(value, &backgroundColor)) { - nsStyleColor* color = (nsStyleColor*) - aContext->GetMutableStyleData(eStyleStruct_Color); - color->mColor = backgroundColor; - } - } nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); @@ -665,37 +648,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsIHTMLStyleSheet* styleSheet; if (NS_OK == htmlContainer->GetAttributeStyleSheet(&styleSheet)) { aAttributes->GetAttribute(nsHTMLAtoms::link, value); - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())) { styleSheet->SetLinkColor(value.GetColorValue()); } - else if (eHTMLUnit_String == value.GetUnit()) { - nscolor linkColor; - if (ColorNameToRGB(value, &linkColor)) { - styleSheet->SetLinkColor(linkColor); - } - } aAttributes->GetAttribute(nsHTMLAtoms::alink, value); - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())) { styleSheet->SetActiveLinkColor(value.GetColorValue()); } - else if (eHTMLUnit_String == value.GetUnit()) { - nscolor linkColor; - if (ColorNameToRGB(value, &linkColor)) { - styleSheet->SetActiveLinkColor(linkColor); - } - } aAttributes->GetAttribute(nsHTMLAtoms::vlink, value); - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())) { styleSheet->SetVisitedLinkColor(value.GetColorValue()); } - else if (eHTMLUnit_String == value.GetUnit()) { - nscolor linkColor; - if (ColorNameToRGB(value, &linkColor)) { - styleSheet->SetVisitedLinkColor(linkColor); - } - } NS_RELEASE(styleSheet); } NS_RELEASE(htmlContainer); @@ -804,21 +772,23 @@ nsHTMLBodyElement::GetInlineStyleRules(nsISupportsArray* aRules) } NS_IMETHODIMP -nsHTMLBodyElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const +nsHTMLBodyElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const { if ((aAttribute == nsHTMLAtoms::link) || (aAttribute == nsHTMLAtoms::vlink) || (aAttribute == nsHTMLAtoms::alink) || - (aAttribute == nsHTMLAtoms::bgcolor) || - (aAttribute == nsHTMLAtoms::background) || - (aAttribute == nsHTMLAtoms::text)) - { - *aHint = NS_STYLE_HINT_VISUAL; + (aAttribute == nsHTMLAtoms::text)) { + aHint = NS_STYLE_HINT_VISUAL; } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); + else if ((aAttribute == nsHTMLAtoms::marginwidth) || + (aAttribute == nsHTMLAtoms::marginheight)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } } return NS_OK; diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp index c68a9de4628..f73dde3155f 100644 --- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp @@ -345,13 +345,23 @@ nsHTMLButtonElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLButtonElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLButtonElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -483,11 +493,3 @@ nsHTMLButtonElement::SetForm(nsIDOMHTMLFormElement* aForm) return result; } -NS_IMETHODIMP -nsHTMLButtonElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLDListElement.cpp b/mozilla/content/html/content/src/nsHTMLDListElement.cpp index 5df67fefb4d..b20cea08824 100644 --- a/mozilla/content/html/content/src/nsHTMLDListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDListElement.cpp @@ -146,7 +146,7 @@ nsHTMLDListElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -161,6 +161,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLDListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::compact) { + aHint = NS_STYLE_HINT_CONTENT; // handled by ua.css? + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLDListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -182,17 +196,3 @@ nsHTMLDListElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLDListElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::compact) { - *aHint = NS_STYLE_HINT_CONTENT; // handled by ua.css - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLDelElement.cpp b/mozilla/content/html/content/src/nsHTMLDelElement.cpp index 56670de721f..ef42476958c 100644 --- a/mozilla/content/html/content/src/nsHTMLDelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDelElement.cpp @@ -146,7 +146,7 @@ nsHTMLDelElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -154,6 +154,17 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLDelElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLDelElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -175,11 +186,3 @@ nsHTMLDelElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLDelElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp b/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp index 58801c4894b..63f42cad4e3 100644 --- a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp @@ -165,7 +165,7 @@ nsHTMLDirectoryElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -189,6 +189,23 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLDirectoryElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (aAttribute == nsHTMLAtoms::compact) { + aHint = NS_STYLE_HINT_CONTENT; // XXX + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLDirectoryElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -211,17 +228,3 @@ nsHTMLDirectoryElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLDirectoryElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::compact) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLDivElement.cpp b/mozilla/content/html/content/src/nsHTMLDivElement.cpp index 1663e3e09f5..370cda5b8d7 100644 --- a/mozilla/content/html/content/src/nsHTMLDivElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDivElement.cpp @@ -168,7 +168,7 @@ nsHTMLDivElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -184,6 +184,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLDivElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLDivElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -205,11 +219,3 @@ nsHTMLDivElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLDivElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp b/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp index b523e90cb7e..61ddff94b82 100644 --- a/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp @@ -160,16 +160,33 @@ nsHTMLEmbedElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext); nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, nsnull); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLEmbedElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageAlignAttributeImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLEmbedElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -191,11 +208,3 @@ nsHTMLEmbedElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLEmbedElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp b/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp index 416547cf63e..9cbde8e90d9 100644 --- a/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp @@ -220,13 +220,23 @@ nsHTMLFieldSetElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLFieldSetElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLFieldSetElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -261,12 +271,3 @@ nsHTMLFieldSetElement::GetType(PRInt32* aType) } } - -NS_IMETHODIMP -nsHTMLFieldSetElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLFontElement.cpp b/mozilla/content/html/content/src/nsHTMLFontElement.cpp index d38ff7635bf..208bd900268 100644 --- a/mozilla/content/html/content/src/nsHTMLFontElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFontElement.cpp @@ -188,7 +188,7 @@ nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute, } static void -MapFontAttributesInto(nsIHTMLAttributes* aAttributes, +MapFontAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -251,8 +251,11 @@ MapFontAttributesInto(nsIHTMLAttributes* aAttributes, } else { // size: int, enum , NOTE: this does not count as an explicit size - // also this has no effect if font is already explicit - if (0 == (font->mFlags & NS_STYLE_FONT_SIZE_EXPLICIT)) { + // also this has no effect if font is already explicit (quirk mode) + nsCompatibility mode; + aPresContext->GetCompatibilityMode(&mode); + if ((eCompatibility_Standard == mode) || + (0 == (font->mFlags & NS_STYLE_FONT_SIZE_EXPLICIT))) { aAttributes->GetAttribute(nsHTMLAtoms::size, value); if ((value.GetUnit() == eHTMLUnit_Integer) || (value.GetUnit() == eHTMLUnit_Enumerated)) { @@ -297,7 +300,7 @@ MapFontAttributesInto(nsIHTMLAttributes* aAttributes, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -312,24 +315,37 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, aContext->GetMutableStyleData(eStyleStruct_Color); nsStyleText* text = (nsStyleText*) aContext->GetMutableStyleData(eStyleStruct_Text); - if (value.GetUnit() == eHTMLUnit_Color) { + if (((eHTMLUnit_Color == value.GetUnit())) || + (eHTMLUnit_ColorName == value.GetUnit())) { color->mColor = value.GetColorValue(); text->mTextDecoration = font->mFont.decorations; // re-apply inherited text decoration, so colors sync } - else if (value.GetUnit() == eHTMLUnit_String) { - nsAutoString buffer; - value.GetStringValue(buffer); - char cbuf[40]; - buffer.ToCString(cbuf, sizeof(cbuf)); - - NS_ColorNameToRGB(cbuf, &(color->mColor)); - text->mTextDecoration = font->mFont.decorations; // re-apply inherited text decoration, so colors sync - } } } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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 (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLFontElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -350,16 +366,3 @@ nsHTMLFontElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLFontElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::color == aAttribute) { - *aHint = NS_STYLE_HINT_VISUAL; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLFormElement.cpp b/mozilla/content/html/content/src/nsHTMLFormElement.cpp index c6c82c51e87..9acf21444b0 100644 --- a/mozilla/content/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFormElement.cpp @@ -394,7 +394,7 @@ nsHTMLFormElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -402,6 +402,18 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLFormElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLFormElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -713,11 +725,3 @@ nsFormControlList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) return result; } -NS_IMETHODIMP -nsHTMLFormElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp index 430c34a8e59..fe7ad31adf6 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp @@ -197,13 +197,25 @@ nsHTMLFrameElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLFrameElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -224,11 +236,3 @@ nsHTMLFrameElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLFrameElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp index 59c9b0b99f4..e7543dcf6ca 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -162,13 +162,31 @@ nsHTMLFrameSetElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } + +NS_IMETHODIMP +nsHTMLFrameSetElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::rows) || + (aAttribute == nsHTMLAtoms::cols)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLFrameSetElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -189,15 +207,3 @@ nsHTMLFrameSetElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLFrameSetElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if ((nsHTMLAtoms::rows == aAttribute) || (nsHTMLAtoms::cols == aAttribute)) { - *aHint = NS_STYLE_HINT_REFLOW; - } else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLHRElement.cpp b/mozilla/content/html/content/src/nsHTMLHRElement.cpp index 5f07cbc55cf..c3e8d6d5283 100644 --- a/mozilla/content/html/content/src/nsHTMLHRElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHRElement.cpp @@ -207,7 +207,7 @@ nsHTMLHRElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -262,6 +262,25 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, aPresContext); } +NS_IMETHODIMP +nsHTMLHRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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 (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLHRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -283,16 +302,3 @@ nsHTMLHRElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLHRElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::noshade == aAttribute) { - *aHint = NS_STYLE_HINT_VISUAL; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLHeadElement.cpp b/mozilla/content/html/content/src/nsHTMLHeadElement.cpp index f37dac205a6..c7d9c5f170c 100644 --- a/mozilla/content/html/content/src/nsHTMLHeadElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHeadElement.cpp @@ -141,13 +141,24 @@ nsHTMLHeadElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLHeadElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLHeadElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -169,11 +180,3 @@ nsHTMLHeadElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLHeadElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp b/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp index 5c811921ecf..9afc2fce4ee 100644 --- a/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp @@ -153,7 +153,7 @@ nsHTMLHeadingElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -169,6 +169,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLHeadingElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLHeadingElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -190,11 +204,3 @@ nsHTMLHeadingElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLHeadingElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp b/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp index 5deb8030e2b..eaaa54d0da0 100644 --- a/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp @@ -147,13 +147,24 @@ nsHTMLHtmlElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLHtmlElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLHtmlElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -178,11 +189,3 @@ nsHTMLHtmlElement::HandleDOMEvent(nsIPresContext& aPresContext, return NS_OK; } -NS_IMETHODIMP -nsHTMLHtmlElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp index 4356abda7b9..a4b1cce3382 100644 --- a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp @@ -223,7 +223,7 @@ nsHTMLIFrameElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -260,6 +260,23 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLIFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::width) || + (aAttribute == nsHTMLAtoms::height)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLIFrameElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -281,11 +298,3 @@ nsHTMLIFrameElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLIFrameElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLImageElement.cpp b/mozilla/content/html/content/src/nsHTMLImageElement.cpp index 797a8d81a59..d96f7301f47 100644 --- a/mozilla/content/html/content/src/nsHTMLImageElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLImageElement.cpp @@ -260,7 +260,7 @@ nsHTMLImageElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -309,10 +309,33 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } } nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, nsnull); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLImageElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::usemap) || + (aAttribute == nsHTMLAtoms::ismap)) { + aHint = NS_STYLE_HINT_FRAMECHANGE; + } + else if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLImageElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -383,24 +406,6 @@ nsHTMLImageElement::Finalize(JSContext *aContext) } -NS_IMETHODIMP -nsHTMLImageElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::src) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if ((aAttribute == nsHTMLAtoms::usemap) || - (aAttribute == nsHTMLAtoms::ismap)) { - *aHint = NS_STYLE_HINT_FRAMECHANGE; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} - NS_IMETHODIMP nsHTMLImageElement::Initialize(JSContext* aContext, PRUint32 argc, diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index 1988f4a5bcc..8ae10b7af5b 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -564,7 +564,7 @@ nsHTMLInputElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -636,7 +636,7 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, NS_RGB(0, 0, 255), NS_RGB(0, 0, 255) }; - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, blue); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, blue); nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); break; } @@ -645,6 +645,28 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLInputElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::align)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if ((aAttribute == nsHTMLAtoms::type)) { + aHint = NS_STYLE_HINT_FRAMECHANGE; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLInputElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -692,13 +714,3 @@ nsHTMLInputElement::GetType(PRInt32* aType) } -NS_IMETHODIMP -nsHTMLInputElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - *aHint = NS_STYLE_HINT_CONTENT; - return NS_OK; -} - - diff --git a/mozilla/content/html/content/src/nsHTMLInsElement.cpp b/mozilla/content/html/content/src/nsHTMLInsElement.cpp index 76b21125193..d5f969cab28 100644 --- a/mozilla/content/html/content/src/nsHTMLInsElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInsElement.cpp @@ -146,7 +146,7 @@ nsHTMLInsElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -154,6 +154,18 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLInsElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLInsElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -175,11 +187,3 @@ nsHTMLInsElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLInsElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp b/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp index 9069e841b50..b2c3fd2d3e6 100644 --- a/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp @@ -152,7 +152,7 @@ nsHTMLIsIndexElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -160,6 +160,18 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLIsIndexElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLIsIndexElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -181,11 +193,3 @@ nsHTMLIsIndexElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLIsIndexElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLLIElement.cpp b/mozilla/content/html/content/src/nsHTMLLIElement.cpp index a440dc799e5..513de1cfea5 100644 --- a/mozilla/content/html/content/src/nsHTMLLIElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLIElement.cpp @@ -174,7 +174,7 @@ nsHTMLLIElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -192,6 +192,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLLIElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLLIElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -212,22 +228,3 @@ nsHTMLLIElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLLIElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::value) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if (aAttribute == nsHTMLAtoms::type) { - // XXX This shouldn't require a frame change, just a reapplication - // of style down the tree (and a reflow). The style changes aren't - // percolating down far enough. - *aHint = NS_STYLE_HINT_REFLOW; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp index 59cae50e8b2..01ef1435e66 100644 --- a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp @@ -244,13 +244,25 @@ nsHTMLLabelElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLLabelElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLLabelElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -271,11 +283,3 @@ nsHTMLLabelElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLLabelElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLLegendElement.cpp b/mozilla/content/html/content/src/nsHTMLLegendElement.cpp index 26fbb8e96da..01ec5db9ccb 100644 --- a/mozilla/content/html/content/src/nsHTMLLegendElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLegendElement.cpp @@ -189,13 +189,26 @@ nsHTMLLegendElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLLegendElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLLegendElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -217,11 +230,3 @@ nsHTMLLegendElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLLegendElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLLinkElement.cpp b/mozilla/content/html/content/src/nsHTMLLinkElement.cpp index 3c6dc6f0be3..387c31cae5b 100644 --- a/mozilla/content/html/content/src/nsHTMLLinkElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLinkElement.cpp @@ -242,13 +242,25 @@ nsHTMLLinkElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLLinkElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLLinkElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -270,12 +282,3 @@ nsHTMLLinkElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLLinkElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} - diff --git a/mozilla/content/html/content/src/nsHTMLMapElement.cpp b/mozilla/content/html/content/src/nsHTMLMapElement.cpp index 5313e2574ef..d02a2753918 100644 --- a/mozilla/content/html/content/src/nsHTMLMapElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMapElement.cpp @@ -302,7 +302,7 @@ nsHTMLMapElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -310,6 +310,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, aPresContext); } +NS_IMETHODIMP +nsHTMLMapElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::name) { + aHint = NS_STYLE_HINT_RECONSTRUCT_ALL; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLMapElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -331,15 +347,3 @@ nsHTMLMapElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLMapElement::GetStyleHintForAttributeChange(const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::name) { - *aHint = NS_STYLE_HINT_RECONSTRUCT_ALL; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp b/mozilla/content/html/content/src/nsHTMLMenuElement.cpp index 24538a48aec..08c6ddcc511 100644 --- a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMenuElement.cpp @@ -165,7 +165,7 @@ nsHTMLMenuElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -189,6 +189,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLMenuElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLMenuElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -210,17 +224,3 @@ nsHTMLMenuElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLMenuElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::compact) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLMetaElement.cpp b/mozilla/content/html/content/src/nsHTMLMetaElement.cpp index b937dae4637..1750902551f 100644 --- a/mozilla/content/html/content/src/nsHTMLMetaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMetaElement.cpp @@ -150,13 +150,26 @@ nsHTMLMetaElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLMetaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLMetaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -178,11 +191,3 @@ nsHTMLMetaElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLMetaElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLModElement.cpp b/mozilla/content/html/content/src/nsHTMLModElement.cpp index e0c9a696784..b65ecc61de1 100644 --- a/mozilla/content/html/content/src/nsHTMLModElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLModElement.cpp @@ -146,7 +146,7 @@ nsHTMLModElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -154,6 +154,19 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLModElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLModElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -175,11 +188,3 @@ nsHTMLModElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLModElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLOListElement.cpp b/mozilla/content/html/content/src/nsHTMLOListElement.cpp index 291509020c0..fa28b3c95ff 100644 --- a/mozilla/content/html/content/src/nsHTMLOListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOListElement.cpp @@ -205,7 +205,7 @@ nsHTMLOListElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -229,6 +229,21 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLOListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLOListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -250,21 +265,3 @@ nsHTMLOListElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLOListElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if ((aAttribute == nsHTMLAtoms::start) || - (aAttribute == nsHTMLAtoms::compact)) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if (aAttribute == nsHTMLAtoms::type) { - *aHint = NS_STYLE_HINT_REFLOW; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp index 9e86beaab19..c4a5191383d 100644 --- a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp @@ -216,16 +216,34 @@ nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext); nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, nsnull); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageAlignAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLObjectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -247,11 +265,3 @@ nsHTMLObjectElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLObjectElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp b/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp index ac7c21a9401..c6f1be09d3d 100644 --- a/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp @@ -146,7 +146,7 @@ nsHTMLOptGroupElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -154,6 +154,17 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLOptGroupElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLOptGroupElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -175,11 +186,3 @@ nsHTMLOptGroupElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLOptGroupElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLOptionElement.cpp b/mozilla/content/html/content/src/nsHTMLOptionElement.cpp index fe9b8e7a8d6..43341eb2a8c 100644 --- a/mozilla/content/html/content/src/nsHTMLOptionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOptionElement.cpp @@ -370,13 +370,25 @@ nsHTMLOptionElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLOptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLOptionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -426,15 +438,6 @@ nsHTMLOptionElement::GetText(nsString& aText) return NS_OK; } -NS_IMETHODIMP -nsHTMLOptionElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} - // Options don't have frames - get the select content node // then call nsGenericHTMLElement::GetPrimaryFrame() nsresult nsHTMLOptionElement::GetPrimaryFrame(nsIFormControlFrame *&aIFormControlFrame) diff --git a/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp b/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp index 5fad36aec26..f5eefff8d61 100644 --- a/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp @@ -160,7 +160,7 @@ nsHTMLParagraphElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -176,6 +176,21 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLParagraphElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLParagraphElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -198,11 +213,3 @@ nsHTMLParagraphElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLParagraphElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLParamElement.cpp b/mozilla/content/html/content/src/nsHTMLParamElement.cpp index 2b96e7d58ad..744e3f39afa 100644 --- a/mozilla/content/html/content/src/nsHTMLParamElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLParamElement.cpp @@ -152,7 +152,7 @@ nsHTMLParamElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -160,6 +160,18 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLParamElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLParamElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -181,11 +193,3 @@ nsHTMLParamElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLParamElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLPreElement.cpp b/mozilla/content/html/content/src/nsHTMLPreElement.cpp index a663ea38120..1ccbcaa8d71 100644 --- a/mozilla/content/html/content/src/nsHTMLPreElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLPreElement.cpp @@ -169,7 +169,7 @@ nsHTMLPreElement::AttributeToString(nsIAtom* aAttribute, } static void -MapFontAttributesInto(nsIHTMLAttributes* aAttributes, +MapFontAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -187,7 +187,7 @@ MapFontAttributesInto(nsIHTMLAttributes* aAttributes, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -238,6 +238,26 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, aPresContext); } +NS_IMETHODIMP +nsHTMLPreElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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 (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLPreElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -259,11 +279,3 @@ nsHTMLPreElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLPreElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp b/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp index 50e7a0afd84..6e160223aca 100644 --- a/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp @@ -143,7 +143,7 @@ nsHTMLQuoteElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -151,6 +151,17 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLQuoteElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLQuoteElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -172,11 +183,3 @@ nsHTMLQuoteElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLQuoteElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp index f99b5938029..5b52f373cfc 100644 --- a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp @@ -205,13 +205,24 @@ nsHTMLScriptElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLScriptElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLScriptElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -233,11 +244,3 @@ nsHTMLScriptElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLScriptElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp index 095b15bbc46..727f9ad2a9b 100644 --- a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp @@ -691,7 +691,7 @@ nsHTMLSelectElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -719,6 +719,24 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLSelectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::multiple) { + aHint = NS_STYLE_HINT_FRAMECHANGE; + } + else if ((aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::size)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLSelectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -1083,17 +1101,3 @@ nsOptionList::Clear() mElements.Clear(); } -NS_IMETHODIMP -nsHTMLSelectElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::multiple == aAttribute) { - *aHint = NS_STYLE_HINT_FRAMECHANGE; - } else if (nsHTMLAtoms::size == aAttribute) { - *aHint = NS_STYLE_HINT_REFLOW; - } else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp b/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp index 9e86beaab19..c4a5191383d 100644 --- a/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -216,16 +216,34 @@ nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext); nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, nsnull); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageAlignAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLObjectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -247,11 +265,3 @@ nsHTMLObjectElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLObjectElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp index 757755de636..c9364b9a155 100644 --- a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp @@ -160,7 +160,7 @@ nsHTMLSpacerElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -200,6 +200,24 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLSpacerElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_FRAMECHANGE; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLSpacerElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -221,11 +239,3 @@ nsHTMLSpacerElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLSpacerElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp index ed224b3d7fa..aca2a1ae854 100644 --- a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp @@ -129,7 +129,7 @@ nsHTMLSpanElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -137,6 +137,17 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLSpanElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLSpanElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -158,11 +169,3 @@ nsHTMLSpanElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLSpanElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLStyleElement.cpp b/mozilla/content/html/content/src/nsHTMLStyleElement.cpp index 56b8fc0eadb..5e2d572e0cf 100644 --- a/mozilla/content/html/content/src/nsHTMLStyleElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLStyleElement.cpp @@ -226,13 +226,25 @@ nsHTMLStyleElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLStyleElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLStyleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -254,11 +266,3 @@ nsHTMLStyleElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLStyleElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp b/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp index 21828141e6a..13851ba049d 100644 --- a/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp @@ -161,7 +161,7 @@ nsHTMLTableCaptionElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -186,6 +186,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTableCaptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLTableCaptionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -207,11 +223,3 @@ nsHTMLTableCaptionElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableCaptionElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp b/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp index d9190201597..f7d197eb80f 100644 --- a/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp @@ -421,7 +421,7 @@ nsHTMLTableCellElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -493,6 +493,32 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } } +NS_IMETHODIMP +nsHTMLTableCellElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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 (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLTableCellElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -514,21 +540,3 @@ nsHTMLTableCellElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableCellElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else if (nsHTMLAtoms::abbr != aAttribute && - nsHTMLAtoms::axis != aAttribute && - nsHTMLAtoms::headers != aAttribute && - nsHTMLAtoms::scope != aAttribute) - { - *aHint = NS_STYLE_HINT_REFLOW; - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLTableColElement.cpp b/mozilla/content/html/content/src/nsHTMLTableColElement.cpp index f63a41aee75..d0d1af3c3f5 100644 --- a/mozilla/content/html/content/src/nsHTMLTableColElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableColElement.cpp @@ -220,7 +220,7 @@ nsHTMLTableColElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -284,6 +284,23 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTableColElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::width) || + (aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::valign) || + (aAttribute == nsHTMLAtoms::span)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTableColElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, @@ -319,18 +336,3 @@ NS_METHOD nsHTMLTableColElement::GetSpanValue(PRInt32* aSpan) return NS_OK; } -NS_IMETHODIMP -nsHTMLTableColElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp b/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp index 462e55832e7..4e419c568dd 100644 --- a/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp @@ -209,7 +209,7 @@ nsHTMLTableColGroupElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -261,18 +261,26 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, textStyle = (nsStyleText*)aContext->GetMutableStyleData(eStyleStruct_Text); textStyle->mVerticalAlign.SetIntValue(value.GetIntValue(), eStyleUnit_Enumerated); } - - // span: int - aAttributes->GetAttribute(nsHTMLAtoms::span, value); - if (value.GetUnit() == eHTMLUnit_Integer) - { - nsStyleTable *tableStyle = (nsStyleTable*)aContext->GetMutableStyleData(eStyleStruct_Table); - tableStyle->mSpan = value.GetIntValue(); - } } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTableColGroupElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::width) || + (aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::valign)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTableColGroupElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, @@ -295,18 +303,3 @@ nsHTMLTableColGroupElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableColGroupElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLTableElement.cpp b/mozilla/content/html/content/src/nsHTMLTableElement.cpp index b6ccc2ebcda..cc0a88fa9ee 100644 --- a/mozilla/content/html/content/src/nsHTMLTableElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableElement.cpp @@ -951,7 +951,7 @@ nsHTMLTableElement::AttributeToString(nsIAtom* aAttribute, } static void -MapTableFrameInto(nsIHTMLAttributes* aAttributes, +MapTableFrameInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext, nsStyleSpacing* aSpacing) @@ -1023,7 +1023,7 @@ MapTableFrameInto(nsIHTMLAttributes* aAttributes, } static void -MapTableBorderInto(nsIHTMLAttributes* aAttributes, +MapTableBorderInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -1079,7 +1079,7 @@ MapTableBorderInto(nsIHTMLAttributes* aAttributes, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -1213,25 +1213,36 @@ x += 1; //background: color nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); - - // direction - aAttributes->GetAttribute(nsHTMLAtoms::dir, value); - if (eHTMLUnit_String == value.GetUnit()) { - nsString dir; - value.GetStringValue(dir); - nsStyleDisplay* display = (nsStyleDisplay*) - aContext->GetMutableStyleData(eStyleStruct_Display); - if (dir.EqualsIgnoreCase("RTL")) { - display->mDirection = NS_STYLE_DIRECTION_RTL; - } - else { - display->mDirection = NS_STYLE_DIRECTION_LTR; - } - } } } } +NS_IMETHODIMP +nsHTMLTableElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::layout) || + (aAttribute == nsHTMLAtoms::cellpadding) || + (aAttribute == nsHTMLAtoms::cellspacing) || + (aAttribute == nsHTMLAtoms::cols) || + (aAttribute == nsHTMLAtoms::rules) || + (aAttribute == nsHTMLAtoms::border) || + (aAttribute == nsHTMLAtoms::frame) || + (aAttribute == nsHTMLAtoms::width) || + (aAttribute == nsHTMLAtoms::height)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLTableElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -1253,19 +1264,3 @@ nsHTMLTableElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else if (nsHTMLAtoms::summary != aAttribute) - { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp index cd201a396b2..bd6be08eb9b 100644 --- a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp @@ -560,7 +560,7 @@ nsHTMLTableRowElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -605,6 +605,24 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } } +NS_IMETHODIMP +nsHTMLTableRowElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::valign) || + (aAttribute == nsHTMLAtoms::height)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTableRowElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -626,18 +644,3 @@ nsHTMLTableRowElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableRowElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp b/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp index 2b5ce68c84a..78333272b9c 100644 --- a/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp @@ -283,7 +283,7 @@ nsHTMLTableSectionElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -329,6 +329,25 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } +NS_IMETHODIMP +nsHTMLTableSectionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::valign) || + (aAttribute == nsHTMLAtoms::height)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLTableSectionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -350,18 +369,3 @@ nsHTMLTableSectionElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableSectionElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp index d2e71ee7087..fbb06b2d1e0 100644 --- a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -371,7 +371,7 @@ nsHTMLTextAreaElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -398,6 +398,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTextAreaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTextAreaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -457,15 +471,3 @@ nsHTMLTextAreaElement::SetForm(nsIDOMHTMLFormElement* aForm) return result; } -NS_IMETHODIMP -nsHTMLTextAreaElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::readonly == aAttribute) { - *aHint = NS_STYLE_HINT_CONTENT; - } else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLTitleElement.cpp b/mozilla/content/html/content/src/nsHTMLTitleElement.cpp index 240c641ef51..6a9489dd4aa 100644 --- a/mozilla/content/html/content/src/nsHTMLTitleElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTitleElement.cpp @@ -145,13 +145,24 @@ nsHTMLTitleElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTitleElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTitleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -227,11 +238,3 @@ nsHTMLTitleElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTitleElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLUListElement.cpp b/mozilla/content/html/content/src/nsHTMLUListElement.cpp index f3fdcbf995d..e9de64b0bf1 100644 --- a/mozilla/content/html/content/src/nsHTMLUListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLUListElement.cpp @@ -183,7 +183,7 @@ nsHTMLUListElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -207,6 +207,21 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLUListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLUListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -228,20 +243,3 @@ nsHTMLUListElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLUListElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::type) { - *aHint = NS_STYLE_HINT_REFLOW; - } - else if (aAttribute == nsHTMLAtoms::compact) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/content/html/content/src/nsHTMLWBRElement.cpp b/mozilla/content/html/content/src/nsHTMLWBRElement.cpp index 97fcd7b684a..743c51155c9 100644 --- a/mozilla/content/html/content/src/nsHTMLWBRElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLWBRElement.cpp @@ -139,13 +139,24 @@ nsHTMLWBRElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLWBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLWBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -168,11 +179,3 @@ nsHTMLWBRElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLWBRElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp index 42073bb85ac..f32ba268758 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp @@ -222,6 +222,8 @@ nsDOMCSSAttributeDeclaration::GetBaseURL(nsIURI** aURL) //---------------------------------------------------------------------- +// this function is a holdover from when attributes were shared +// leaving it in place in case we need to go back to that model static nsresult EnsureWritableAttributes(nsIHTMLContent* aContent, nsIHTMLAttributes*& aAttributes, PRBool aCreate) { @@ -229,29 +231,7 @@ static nsresult EnsureWritableAttributes(nsIHTMLContent* aContent, if (nsnull == aAttributes) { if (PR_TRUE == aCreate) { - nsMapAttributesFunc fontMapFunc; - nsMapAttributesFunc mapFunc; - result = aContent->GetAttributeMappingFunctions(fontMapFunc, mapFunc); - if (NS_OK == result) { - result = NS_NewHTMLAttributes(&aAttributes, nsnull, fontMapFunc, mapFunc); - if (NS_OK == result) { - aAttributes->AddContentRef(); - } - } - } - } - else { - PRInt32 contentRefCount; - aAttributes->GetContentRefCount(contentRefCount); - if (1 < contentRefCount) { - nsIHTMLAttributes* attrs; - result = aAttributes->Clone(&attrs); - if (NS_OK == result) { - aAttributes->ReleaseContentRef(); - NS_RELEASE(aAttributes); - aAttributes = attrs; - aAttributes->AddContentRef(); - } + result = NS_NewHTMLAttributes(&aAttributes); } } return result; @@ -259,7 +239,7 @@ static nsresult EnsureWritableAttributes(nsIHTMLContent* aContent, static void ReleaseAttributes(nsIHTMLAttributes*& aAttributes) { - aAttributes->ReleaseContentRef(); +// aAttributes->ReleaseContentRef(); NS_RELEASE(aAttributes); } @@ -283,9 +263,7 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent, nsresult result = NS_OK; if (nsnull != mAttributes) { - aDst->mAttributes = mAttributes; - NS_ADDREF(mAttributes); - mAttributes->AddContentRef(); + result = mAttributes->Clone(&(aDst->mAttributes)); } return result; @@ -434,7 +412,7 @@ nsGenericHTMLElement::SetDocument(nsIDocument* aDocument, PRBool aDeep) nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument); if (nsnull != sheet) { mAttributes->SetStyleSheet(sheet); - sheet->SetAttributesFor(htmlContent, mAttributes); // sync attributes with sheet +// sheet->SetAttributesFor(htmlContent, mAttributes); // sync attributes with sheet NS_RELEASE(sheet); } } @@ -611,10 +589,14 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID, } else { // set as string value to avoid another string copy + PRBool impact = NS_STYLE_HINT_NONE; + htmlContent->GetMappedAttributeImpact(aAttribute, impact); if (nsnull != mDocument) { // set attr via style sheet nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument); if (nsnull != sheet) { - result = sheet->SetAttributeFor(aAttribute, aValue, htmlContent, mAttributes); + result = sheet->SetAttributeFor(aAttribute, aValue, + (NS_STYLE_HINT_CONTENT < impact), + htmlContent, mAttributes); NS_RELEASE(sheet); } } @@ -622,7 +604,9 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID, result = EnsureWritableAttributes(htmlContent, mAttributes, PR_TRUE); if (nsnull != mAttributes) { PRInt32 count; - result = mAttributes->SetAttribute(aAttribute, aValue, count); + result = mAttributes->SetAttributeFor(aAttribute, aValue, + (NS_STYLE_HINT_CONTENT < impact), + htmlContent, nsnull, count); if (0 == count) { ReleaseAttributes(mAttributes); } @@ -672,34 +656,38 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute, if (NS_OK != result) { return result; } + PRBool impact = NS_STYLE_HINT_NONE; + htmlContent->GetMappedAttributeImpact(aAttribute, impact); if (nsnull != mDocument) { // set attr via style sheet - PRInt32 hint = NS_STYLE_HINT_UNKNOWN; if (aNotify && (nsHTMLAtoms::style == aAttribute)) { nsHTMLValue oldValue; - PRInt32 oldHint = NS_STYLE_HINT_NONE; + PRInt32 oldImpact = NS_STYLE_HINT_NONE; if (NS_CONTENT_ATTR_NOT_THERE != GetHTMLAttribute(aAttribute, oldValue)) { - oldHint = GetStyleImpactFrom(oldValue); + oldImpact = GetStyleImpactFrom(oldValue); } - hint = GetStyleImpactFrom(aValue); - if (hint < oldHint) { - hint = oldHint; + impact = GetStyleImpactFrom(aValue); + if (impact < oldImpact) { + impact = oldImpact; } } nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument); if (nsnull != sheet) { - result = sheet->SetAttributeFor(aAttribute, aValue, htmlContent, - mAttributes); + result = sheet->SetAttributeFor(aAttribute, aValue, + (NS_STYLE_HINT_CONTENT < impact), + htmlContent, mAttributes); NS_RELEASE(sheet); } if (aNotify) { - mDocument->AttributeChanged(mContent, aAttribute, hint); + mDocument->AttributeChanged(mContent, aAttribute, impact); } } else { // manage this ourselves and re-sync when we connect to doc result = EnsureWritableAttributes(htmlContent, mAttributes, PR_TRUE); if (nsnull != mAttributes) { PRInt32 count; - result = mAttributes->SetAttribute(aAttribute, aValue, count); + result = mAttributes->SetAttributeFor(aAttribute, aValue, + (NS_STYLE_HINT_CONTENT < impact), + htmlContent, nsnull, count); if (0 == count) { ReleaseAttributes(mAttributes); } @@ -709,25 +697,6 @@ nsGenericHTMLElement::SetHTMLAttribute(nsIAtom* aAttribute, return result; } -/** - * Handle attributes common to all html elements - */ -void -nsGenericHTMLElement::MapCommonAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aStyleContext, - nsIPresContext* aPresContext) -{ - if (nsnull != aAttributes) { - nsHTMLValue value; - aAttributes->GetAttribute(nsHTMLAtoms::dir, value); - if (value.GetUnit() == eHTMLUnit_Enumerated) { - nsStyleDisplay* display = (nsStyleDisplay*) - aStyleContext->GetMutableStyleData(eStyleStruct_Display); - display->mDirection = value.GetIntValue(); - } - } -} - nsresult nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRBool aNotify) { @@ -751,14 +720,14 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, return result; } if (nsnull != mDocument) { // set attr via style sheet - PRInt32 hint = NS_STYLE_HINT_UNKNOWN; + PRInt32 impact = NS_STYLE_HINT_UNKNOWN; if (aNotify && (nsHTMLAtoms::style == aAttribute)) { nsHTMLValue oldValue; if (NS_CONTENT_ATTR_NOT_THERE != GetHTMLAttribute(aAttribute, oldValue)) { - hint = GetStyleImpactFrom(oldValue); + impact = GetStyleImpactFrom(oldValue); } else { - hint = NS_STYLE_HINT_NONE; + impact = NS_STYLE_HINT_NONE; } } nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument); @@ -767,14 +736,14 @@ nsGenericHTMLElement::UnsetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, NS_RELEASE(sheet); } if (aNotify) { - mDocument->AttributeChanged(mContent, aAttribute, hint); + mDocument->AttributeChanged(mContent, aAttribute, impact); } } else { // manage this ourselves and re-sync when we connect to doc result = EnsureWritableAttributes(htmlContent, mAttributes, PR_FALSE); if (nsnull != mAttributes) { PRInt32 count; - result = mAttributes->UnsetAttribute(aAttribute, count); + result = mAttributes->UnsetAttributeFor(aAttribute, htmlContent, nsnull, count); if (0 == count) { ReleaseAttributes(mAttributes); } @@ -930,15 +899,15 @@ nsGenericHTMLElement::HasClass(nsIAtom* aClass) const nsresult nsGenericHTMLElement::GetContentStyleRules(nsISupportsArray* aRules) { - nsresult result = NS_ERROR_NULL_POINTER; - nsIStyleRule* rule = nsnull; + nsresult result = NS_OK; - if (aRules && mAttributes) { - result = mAttributes->QueryInterface(kIStyleRuleIID, (void**)&rule); + if (aRules) { + if (mAttributes) { + result = mAttributes->GetMappedAttributeStyleRules(aRules); + } } - if (rule) { - aRules->AppendElement(rule); - NS_RELEASE(rule); + else { + result = NS_ERROR_NULL_POINTER; } return result; } @@ -969,11 +938,15 @@ nsGenericHTMLElement::GetInlineStyleRules(nsISupportsArray* aRules) nsresult nsGenericHTMLElement::GetBaseURL(nsIURI*& aBaseURL) const { - return GetBaseURL(mAttributes, mDocument, &aBaseURL); + nsHTMLValue baseHref; + if (mAttributes) { + mAttributes->GetAttribute(nsHTMLAtoms::_baseHref, baseHref); + } + return GetBaseURL(baseHref, mDocument, &aBaseURL); } nsresult -nsGenericHTMLElement::GetBaseURL(nsIHTMLAttributes* aAttributes, +nsGenericHTMLElement::GetBaseURL(const nsHTMLValue& aBaseHref, nsIDocument* aDocument, nsIURI** aBaseURL) { @@ -984,35 +957,30 @@ nsGenericHTMLElement::GetBaseURL(nsIHTMLAttributes* aAttributes, result = aDocument->GetBaseURL(docBaseURL); } *aBaseURL = docBaseURL; -// NS_IF_RELEASE(docBaseURL); - if (nsnull != aAttributes) { - nsHTMLValue value; - if (NS_CONTENT_ATTR_HAS_VALUE == aAttributes->GetAttribute(nsHTMLAtoms::_baseHref, value)) { - if (eHTMLUnit_String == value.GetUnit()) { - nsAutoString baseHref; - value.GetStringValue(baseHref); + if (eHTMLUnit_String == aBaseHref.GetUnit()) { + nsAutoString baseHref; + aBaseHref.GetStringValue(baseHref); - nsIURI* url = nsnull; + nsIURI* url = nsnull; #ifndef NECKO - nsILoadGroup* LoadGroup = nsnull; - docBaseURL->GetLoadGroup(&LoadGroup); - if (LoadGroup) { - result = LoadGroup->CreateURL(&url, docBaseURL, baseHref, nsnull); - NS_RELEASE(LoadGroup); - } - else -#endif - { -#ifndef NECKO - result = NS_NewURL(&url, baseHref, docBaseURL); -#else - result = NS_NewURI(&url, baseHref, docBaseURL); -#endif // NECKO - } - *aBaseURL = url; - } + nsILoadGroup* LoadGroup = nsnull; + docBaseURL->GetLoadGroup(&LoadGroup); + if (LoadGroup) { + result = LoadGroup->CreateURL(&url, docBaseURL, baseHref, nsnull); + NS_RELEASE(LoadGroup); } + else +#endif + { +#ifndef NECKO + result = NS_NewURL(&url, baseHref, docBaseURL); +#else + result = NS_NewURI(&url, baseHref, docBaseURL); +#endif // NECKO + } + NS_IF_RELEASE(docBaseURL); + *aBaseURL = url; } return result; } @@ -1433,39 +1401,38 @@ nsGenericHTMLElement::ParseColor(const nsString& aString, colorStr.ToCString(cbuf, sizeof(cbuf)); nscolor color = 0; if (NS_ColorNameToRGB(cbuf, &color)) { - aResult.SetStringValue(colorStr); + aResult.SetStringValue(colorStr, eHTMLUnit_ColorName); return PR_TRUE; } - if (NS_LooseHexToRGB(cbuf, &color)) { - aResult.SetColorValue(color); - return PR_TRUE; - } - - // We failed to match the color value as either a color name or a hex - // number - if ('#' == cbuf[0]) { #if 0 + nsDTDMode mode = eDTDMode_NoQuirks; + if (mDocument) { nsIHTMLDocument* htmlDoc; nsresult result; - result = mDocument->QueryInterface(kIHTMLDocumentIID, (void**)&htmlDoc); if (NS_SUCCEEDED(result)) { - nsDTDMode mode; - // Check the compatibility mode - result = htmlDoc->GetDTDMode(&mode); + result = htmlDoc->GetDTDMode(mode); NS_RELEASE(htmlDoc); - - if (NS_SUCCEEDED(result) && (eDTDMode_Nav == mode)) { -#endif - // Nav treats illegal hex numbers as 0 - aResult.SetColorValue(0); - return PR_TRUE; -#if 0 - } } -#endif } + + if (eDTDMode_NoQuirks == mode) { + if (('#' == cbuf[0]) && NS_HexToRGB(&(cbuf[1]), &color)) { + aResult.SetColorValue(color); + return PR_TRUE; + } + } + else { +#endif + aString.ToCString(cbuf, sizeof(cbuf)); // no space compression + if (NS_LooseHexToRGB(cbuf, &color)) { + aResult.SetColorValue(color); + return PR_TRUE; + } +#if 0 + } +#endif } // Illegal values are mapped to empty @@ -1759,91 +1726,134 @@ nsGenericHTMLElement::ScrollingValueToString(PRBool aStandardMode, } } +/** + * Handle attributes common to all html elements + */ void -nsGenericHTMLElement::MapImageAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext) +nsGenericHTMLElement::MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aStyleContext, + nsIPresContext* aPresContext) { - if (nsnull != aAttributes) { - nsHTMLValue value; - - float p2t; - aPresContext->GetScaledPixelsToTwips(&p2t); - nsStylePosition* pos = (nsStylePosition*) - aContext->GetMutableStyleData(eStyleStruct_Position); - nsStyleSpacing* spacing = (nsStyleSpacing*) - aContext->GetMutableStyleData(eStyleStruct_Spacing); - - // width: value - aAttributes->GetAttribute(nsHTMLAtoms::width, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - pos->mWidth.SetCoordValue(twips); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - pos->mWidth.SetPercentValue(value.GetPercentValue()); - } - - // height: value - aAttributes->GetAttribute(nsHTMLAtoms::height, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - pos->mHeight.SetCoordValue(twips); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - pos->mHeight.SetPercentValue(value.GetPercentValue()); - } - - // hspace: value - aAttributes->GetAttribute(nsHTMLAtoms::hspace, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - nsStyleCoord c(twips); - spacing->mMargin.SetLeft(c); - spacing->mMargin.SetRight(c); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - nsStyleCoord c(value.GetPercentValue(), eStyleUnit_Coord); - spacing->mMargin.SetLeft(c); - spacing->mMargin.SetRight(c); - } - - // vspace: value - aAttributes->GetAttribute(nsHTMLAtoms::vspace, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - nsStyleCoord c(twips); - spacing->mMargin.SetTop(c); - spacing->mMargin.SetBottom(c); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - nsStyleCoord c(value.GetPercentValue(), eStyleUnit_Coord); - spacing->mMargin.SetTop(c); - spacing->mMargin.SetBottom(c); - } + nsHTMLValue value; + aAttributes->GetAttribute(nsHTMLAtoms::dir, value); + if (value.GetUnit() == eHTMLUnit_Enumerated) { + nsStyleDisplay* display = (nsStyleDisplay*) + aStyleContext->GetMutableStyleData(eStyleStruct_Display); + display->mDirection = value.GetIntValue(); } } +PRBool +nsGenericHTMLElement::GetCommonMappedAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint) +{ + if (nsHTMLAtoms::dir == aAttribute) { + aHint = NS_STYLE_HINT_REFLOW; // XXX really? possibly FRAMECHANGE? + 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; +} + void -nsGenericHTMLElement::MapImageAlignAttributeInto(nsIHTMLAttributes* aAttributes, +nsGenericHTMLElement::MapImageAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext) +{ + nsHTMLValue value; + + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + nsStylePosition* pos = (nsStylePosition*) + aContext->GetMutableStyleData(eStyleStruct_Position); + nsStyleSpacing* spacing = (nsStyleSpacing*) + aContext->GetMutableStyleData(eStyleStruct_Spacing); + + // width: value + aAttributes->GetAttribute(nsHTMLAtoms::width, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + pos->mWidth.SetCoordValue(twips); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + pos->mWidth.SetPercentValue(value.GetPercentValue()); + } + + // height: value + aAttributes->GetAttribute(nsHTMLAtoms::height, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + pos->mHeight.SetCoordValue(twips); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + pos->mHeight.SetPercentValue(value.GetPercentValue()); + } + + // hspace: value + aAttributes->GetAttribute(nsHTMLAtoms::hspace, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + nsStyleCoord c(twips); + spacing->mMargin.SetLeft(c); + spacing->mMargin.SetRight(c); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + nsStyleCoord c(value.GetPercentValue(), eStyleUnit_Percent); + spacing->mMargin.SetLeft(c); + spacing->mMargin.SetRight(c); + } + + // vspace: value + aAttributes->GetAttribute(nsHTMLAtoms::vspace, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + nsStyleCoord c(twips); + spacing->mMargin.SetTop(c); + spacing->mMargin.SetBottom(c); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + nsStyleCoord c(value.GetPercentValue(), eStyleUnit_Percent); + spacing->mMargin.SetTop(c); + spacing->mMargin.SetBottom(c); + } +} + +PRBool +nsGenericHTMLElement::GetImageMappedAttributesImpact(const nsIAtom* aAttribute, + PRInt32& 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::MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { - if (nsnull != aAttributes) { - nsHTMLValue value; - aAttributes->GetAttribute(nsHTMLAtoms::align, value); - if (value.GetUnit() == eHTMLUnit_Enumerated) { - PRUint8 align = value.GetIntValue(); - nsStyleDisplay* display = (nsStyleDisplay*) - aContext->GetMutableStyleData(eStyleStruct_Display); - nsStyleText* text = (nsStyleText*) - aContext->GetMutableStyleData(eStyleStruct_Text); - nsStyleSpacing* spacing = (nsStyleSpacing*) - aContext->GetMutableStyleData(eStyleStruct_Spacing); - float p2t; - aPresContext->GetScaledPixelsToTwips(&p2t); - nsStyleCoord three(NSIntPixelsToTwips(3, p2t)); - switch (align) { + nsHTMLValue value; + aAttributes->GetAttribute(nsHTMLAtoms::align, value); + if (value.GetUnit() == eHTMLUnit_Enumerated) { + PRUint8 align = (PRUint8)(value.GetIntValue()); + nsStyleDisplay* display = (nsStyleDisplay*) + aContext->GetMutableStyleData(eStyleStruct_Display); + nsStyleText* text = (nsStyleText*) + aContext->GetMutableStyleData(eStyleStruct_Text); + nsStyleSpacing* spacing = (nsStyleSpacing*) + aContext->GetMutableStyleData(eStyleStruct_Spacing); + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + nsStyleCoord three(NSIntPixelsToTwips(3, p2t)); + switch (align) { case NS_STYLE_TEXT_ALIGN_LEFT: display->mFloats = NS_STYLE_FLOAT_LEFT; spacing->mMargin.SetLeft(three); @@ -1857,45 +1867,55 @@ nsGenericHTMLElement::MapImageAlignAttributeInto(nsIHTMLAttributes* aAttributes, default: text->mVerticalAlign.SetIntValue(align, eStyleUnit_Enumerated); break; - } } } } -void -nsGenericHTMLElement::MapImageBorderAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext, - nscolor aBorderColors[4]) +PRBool +nsGenericHTMLElement::GetImageAlignAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) { - if (nsnull != aAttributes) { - nsHTMLValue value; + if ((nsHTMLAtoms::align == aAttribute)) { + aHint = NS_STYLE_HINT_REFLOW; + return PR_TRUE; + } + return PR_FALSE; +} - // border: pixels - aAttributes->GetAttribute(nsHTMLAtoms::border, value); - if (value.GetUnit() != eHTMLUnit_Pixel) { - if (nsnull == aBorderColors) { - return; - } - // If no border is defined and we are forcing a border, force - // the size to 2 pixels. - value.SetPixelValue(2); + +void +nsGenericHTMLElement::MapImageBorderAttributeInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext, + nscolor aBorderColors[4]) +{ + nsHTMLValue value; + + // border: pixels + aAttributes->GetAttribute(nsHTMLAtoms::border, value); + if (value.GetUnit() != eHTMLUnit_Pixel) { + if (nsnull == aBorderColors) { + return; } + // If no border is defined and we are forcing a border, force + // the size to 2 pixels. + value.SetPixelValue(2); + } - float p2t; - aPresContext->GetScaledPixelsToTwips(&p2t); - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - // Fixup border-padding sums: subtract out the old size and then - // add in the new size. - nsStyleSpacing* spacing = (nsStyleSpacing*) - aContext->GetMutableStyleData(eStyleStruct_Spacing); - nsStyleCoord coord; - coord.SetCoordValue(twips); - spacing->mBorder.SetTop(coord); - spacing->mBorder.SetRight(coord); - spacing->mBorder.SetBottom(coord); - spacing->mBorder.SetLeft(coord); + // Fixup border-padding sums: subtract out the old size and then + // add in the new size. + nsStyleSpacing* spacing = (nsStyleSpacing*) + aContext->GetMutableStyleData(eStyleStruct_Spacing); + nsStyleCoord coord; + coord.SetCoordValue(twips); + spacing->mBorder.SetTop(coord); + spacing->mBorder.SetRight(coord); + spacing->mBorder.SetBottom(coord); + spacing->mBorder.SetLeft(coord); spacing->SetBorderStyle(0,NS_STYLE_BORDER_STYLE_SOLID); spacing->SetBorderStyle(1,NS_STYLE_BORDER_STYLE_SOLID); @@ -1903,29 +1923,40 @@ nsGenericHTMLElement::MapImageBorderAttributesInto(nsIHTMLAttributes* aAttribute spacing->SetBorderStyle(3,NS_STYLE_BORDER_STYLE_SOLID); - // Use supplied colors if provided, otherwise use color for border - // color - if (nsnull != aBorderColors) { - spacing->SetBorderColor(0, aBorderColors[0]); - spacing->SetBorderColor(1, aBorderColors[1]); - spacing->SetBorderColor(2, aBorderColors[2]); - spacing->SetBorderColor(3, aBorderColors[3]); - } - else { - // Color is inherited from "color" - const nsStyleColor* styleColor = (const nsStyleColor*) - aContext->GetStyleData(eStyleStruct_Color); - nscolor color = styleColor->mColor; - spacing->SetBorderColor(0, color); - spacing->SetBorderColor(1, color); - spacing->SetBorderColor(2, color); - spacing->SetBorderColor(3, color); - } + // Use supplied colors if provided, otherwise use color for border + // color + if (nsnull != aBorderColors) { + spacing->SetBorderColor(0, aBorderColors[0]); + spacing->SetBorderColor(1, aBorderColors[1]); + spacing->SetBorderColor(2, aBorderColors[2]); + spacing->SetBorderColor(3, aBorderColors[3]); + } + else { + // Color is inherited from "color" + const nsStyleColor* styleColor = (const nsStyleColor*) + aContext->GetStyleData(eStyleStruct_Color); + nscolor color = styleColor->mColor; + spacing->SetBorderColor(0, color); + spacing->SetBorderColor(1, color); + spacing->SetBorderColor(2, color); + spacing->SetBorderColor(3, color); } } +PRBool +nsGenericHTMLElement::GetImageBorderAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) +{ + if ((nsHTMLAtoms::border == aAttribute)) { + aHint = NS_STYLE_HINT_REFLOW; + return PR_TRUE; + } + return PR_FALSE; +} + + void -nsGenericHTMLElement::MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes, +nsGenericHTMLElement::MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -1947,7 +1978,9 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes rv = shell->GetDocument(getter_AddRefs(doc)); if (NS_SUCCEEDED(rv) && doc) { nsCOMPtr docURL; - nsGenericHTMLElement::GetBaseURL(aAttributes, doc, + nsHTMLValue baseHref; + aAttributes->GetAttribute(nsHTMLAtoms::_baseHref, baseHref); + nsGenericHTMLElement::GetBaseURL(baseHref, doc, getter_AddRefs(docURL)); #ifndef NECKO rv = NS_MakeAbsoluteURL(docURL, "", spec, absURLSpec); @@ -1969,29 +2002,29 @@ nsGenericHTMLElement::MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes // bgcolor if (NS_CONTENT_ATTR_HAS_VALUE == aAttributes->GetAttribute(nsHTMLAtoms::bgcolor, value)) { - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())) { nsStyleColor* color = (nsStyleColor*) aContext->GetMutableStyleData(eStyleStruct_Color); color->mBackgroundColor = value.GetColorValue(); color->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT; } - else if (eHTMLUnit_String == value.GetUnit()) { - nsAutoString buffer; - value.GetStringValue(buffer); - char cbuf[40]; - buffer.ToCString(cbuf, sizeof(cbuf)); - - nscolor backgroundColor; - if (NS_ColorNameToRGB(cbuf, &backgroundColor)) { - nsStyleColor* color = (nsStyleColor*) - aContext->GetMutableStyleData(eStyleStruct_Color); - color->mBackgroundColor = backgroundColor; - color->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT; - } - } } } +PRBool +nsGenericHTMLElement::GetBackgroundAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint) +{ + if ((nsHTMLAtoms::background == aAttribute) || + (nsHTMLAtoms::bgcolor == aAttribute)) { + aHint = NS_STYLE_HINT_VISUAL; + return PR_TRUE; + } + return PR_FALSE; +} + + static PRBool AttributeChangeRequiresRepaint(const nsIAtom* aAttribute) { // these are attributes that always require a restyle and a repaint, but not a reflow @@ -2024,36 +2057,6 @@ static PRBool AttributeChangeRequiresReflow(const nsIAtom* aAttribute) aAttribute==nsHTMLAtoms::width); } -static PRBool AttributeChangeRequiresReframe(const nsIAtom* aAttribute) -{ - return (PRBool) - (aAttribute==nsHTMLAtoms::id || - aAttribute==nsHTMLAtoms::kClass || - aAttribute==nsHTMLAtoms::dir); -} - -PRBool -nsGenericHTMLElement::GetStyleHintForCommonAttributes(const nsIContent* aNode, - const nsIAtom* aAttribute, - PRInt32* aHint) -{ - PRBool setHint = PR_TRUE; - if (PR_TRUE == AttributeChangeRequiresReframe(aAttribute)) { - *aHint = NS_STYLE_HINT_FRAMECHANGE; - } - else if (PR_TRUE == AttributeChangeRequiresReflow(aAttribute)) { - *aHint = NS_STYLE_HINT_REFLOW; - } - else if (PR_TRUE == AttributeChangeRequiresRepaint(aAttribute)) { - *aHint = NS_STYLE_HINT_VISUAL; - } - else { - *aHint = NS_STYLE_HINT_CONTENT; // only frames will get notified... - setHint = PR_FALSE; - } - return setHint; -} - //---------------------------------------------------------------------- nsGenericHTMLLeafElement::nsGenericHTMLLeafElement() diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.h b/mozilla/layout/html/content/src/nsGenericHTMLElement.h index 739026ff6a8..e65e6255973 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.h @@ -37,6 +37,7 @@ class nsIDOMNodeList; class nsIEventListenerManager; class nsIFrame; class nsIHTMLAttributes; +class nsIHTMLMappedAttributes; class nsIHTMLContent; class nsIStyleContext; class nsIStyleRule; @@ -209,26 +210,6 @@ public: static PRBool FrameborderValueToString(PRBool aStandardMode, const nsHTMLValue& aValue, nsString& aResult); - static void MapCommonAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aStyleContext, - nsIPresContext* aPresContext); - - static void MapImageAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext); - - static void MapImageAlignAttributeInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext); - - static void MapImageBorderAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext, - nscolor aBorderColors[4]); - - static void MapBackgroundAttributesInto(nsIHTMLAttributes* aAttributes, - nsIStyleContext* aContext, - nsIPresContext* aPresContext); static PRBool ParseScrollingValue(PRBool aStandardMode, const nsString& aString, @@ -238,15 +219,48 @@ public: const nsHTMLValue& aValue, nsString& aResult); - static PRBool GetStyleHintForCommonAttributes(const nsIContent* aNode, - const nsIAtom* aAttribute, - PRInt32* aHint); + /** Attribute Mapping Helpers + * + * All attributes that are mapped into style contexts must have a + * matched set of mapping function and impact getter + */ + + static void MapCommonAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aStyleContext, + nsIPresContext* aPresContext); + static PRBool GetCommonMappedAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint); + + static void MapImageAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext); + static PRBool GetImageMappedAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint); + + static void MapImageAlignAttributeInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext); + static PRBool GetImageAlignAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint); + + static void MapImageBorderAttributeInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext, + nscolor aBorderColors[4]); + static PRBool GetImageBorderAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint); + + static void MapBackgroundAttributesInto(const nsIHTMLMappedAttributes* aAttributes, + nsIStyleContext* aContext, + nsIPresContext* aPresContext); + static PRBool GetBackgroundAttributesImpact(const nsIAtom* aAttribute, + PRInt32& aHint); //XXX This creates a dependency between content and frames static nsresult GetPrimaryFrame(nsIHTMLContent* aContent, nsIFormControlFrame *&aFormControlFrame); - static nsresult GetBaseURL(nsIHTMLAttributes* aAttributes, + static nsresult GetBaseURL(const nsHTMLValue& aBaseHref, nsIDocument* aDocument, nsIURI** aResult); @@ -460,8 +474,8 @@ public: nsString& aResult) const; \ NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ nsMapAttributesFunc& aMapFunc) const; \ - NS_IMETHOD GetStyleHintForAttributeChange(const nsIAtom* aAttribute, \ - PRInt32 *aHint) const; + NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \ + PRInt32& aHint) const; #define NS_IMPL_IHTMLCONTENT_USING_GENERIC2(_g) \ NS_IMETHOD Compact() { \ @@ -506,8 +520,8 @@ public: nsString& aResult) const; \ NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, \ nsMapAttributesFunc& aMapFunc) const; \ - NS_IMETHOD GetStyleHintForAttributeChange(const nsIAtom* aAttribute, \ - PRInt32 *aHint) const; + NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute, \ + PRInt32& aHint) const; /** * This macro implements the portion of query interface that is diff --git a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp index 3c07948823e..62ac54e8614 100644 --- a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp @@ -247,13 +247,23 @@ nsHTMLAnchorElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLAnchorElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLAnchorElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -365,30 +375,3 @@ nsHTMLAnchorElement::HandleDOMEvent(nsIPresContext& aPresContext, return ret; } -NS_IMETHODIMP -nsHTMLAnchorElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if ((aAttribute == nsHTMLAtoms::charset) || - (aAttribute == nsHTMLAtoms::coords) || - (aAttribute == nsHTMLAtoms::href) || - (aAttribute == nsHTMLAtoms::hreflang) || - (aAttribute == nsHTMLAtoms::name) || - (aAttribute == nsHTMLAtoms::rel) || - (aAttribute == nsHTMLAtoms::rev) || - (aAttribute == nsHTMLAtoms::shape) || - (aAttribute == nsHTMLAtoms::tabindex) || - (aAttribute == nsHTMLAtoms::target) || - (aAttribute == nsHTMLAtoms::type)) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if (aAttribute == nsHTMLAtoms::accesskey) { - // XXX Notification needs to happen for this attribute - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp b/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp index 62840119d0d..ffd3ab2fa78 100644 --- a/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp @@ -212,14 +212,30 @@ nsHTMLAppletElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { - nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, nsnull); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); + nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); + nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull); +} + +NS_IMETHODIMP +nsHTMLAppletElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageAlignAttributeImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + } + return NS_OK; } NS_IMETHODIMP @@ -244,15 +260,6 @@ nsHTMLAppletElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLAppletElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} - #if defined(OJI) extern nsresult NS_GetObjectFramePluginInstance(nsIFrame* aFrame, nsIPluginInstance*& aPluginInstance); #endif diff --git a/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp b/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp index 72a6b730924..aa2bbd0e1dd 100644 --- a/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp @@ -175,13 +175,25 @@ nsHTMLAreaElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLAreaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const + +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLAreaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -203,31 +215,6 @@ nsHTMLAreaElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLAreaElement::GetStyleHintForAttributeChange(const nsIAtom* aAttribute, - PRInt32 *aHint) const - -{ - if ((aAttribute == nsHTMLAtoms::alt) || - (aAttribute == nsHTMLAtoms::coords) || - (aAttribute == nsHTMLAtoms::href) || - (aAttribute == nsHTMLAtoms::nohref) || - (aAttribute == nsHTMLAtoms::shape) || - (aAttribute == nsHTMLAtoms::tabindex) || - (aAttribute == nsHTMLAtoms::target)) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if (aAttribute == nsHTMLAtoms::accesskey) { - // XXX Notification needs to happen for this attribute - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} - NS_IMETHODIMP nsHTMLAreaElement::SetFocus(nsIPresContext* aPresContext) { diff --git a/mozilla/layout/html/content/src/nsHTMLBRElement.cpp b/mozilla/layout/html/content/src/nsHTMLBRElement.cpp index 79e6e82ac58..1474861986e 100644 --- a/mozilla/layout/html/content/src/nsHTMLBRElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBRElement.cpp @@ -161,22 +161,36 @@ nsHTMLBRElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { - if (nsnull != aAttributes) { - nsStyleDisplay* display = (nsStyleDisplay*) - aContext->GetMutableStyleData(eStyleStruct_Display); - nsHTMLValue value; - aAttributes->GetAttribute(nsHTMLAtoms::clear, value); - if (value.GetUnit() == eHTMLUnit_Enumerated) { - display->mBreakType = value.GetIntValue(); - } + nsStyleDisplay* display = (nsStyleDisplay*) + aContext->GetMutableStyleData(eStyleStruct_Display); + + nsHTMLValue value; + aAttributes->GetAttribute(nsHTMLAtoms::clear, value); + if (value.GetUnit() == eHTMLUnit_Enumerated) { + display->mBreakType = value.GetIntValue(); } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (nsHTMLAtoms::clear == aAttribute) { + aHint = NS_STYLE_HINT_REFLOW; + } + else { + aHint = NS_STYLE_HINT_CONTENT; + } + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -198,11 +212,3 @@ nsHTMLBRElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLBRElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp b/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp index 850a1be4f75..f14127690ff 100644 --- a/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp @@ -144,13 +144,23 @@ nsHTMLBaseElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLBaseElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLBaseElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -172,11 +182,3 @@ nsHTMLBaseElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLBaseElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp b/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp index 7afb9f15ce9..9503166a1e2 100644 --- a/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp @@ -149,7 +149,7 @@ nsHTMLBaseFontElement::AttributeToString(nsIAtom* aAttribute, } static void -MapFontAttributesInto(nsIHTMLAttributes* aAttributes, +MapFontAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -157,13 +157,29 @@ MapFontAttributesInto(nsIHTMLAttributes* aAttributes, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } + +NS_IMETHODIMP +nsHTMLBaseFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLBaseFontElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -186,18 +202,3 @@ nsHTMLBaseFontElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLBaseFontElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::color == aAttribute || - nsHTMLAtoms::face == aAttribute || - nsHTMLAtoms::size == aAttribute) { - *aHint = NS_STYLE_HINT_RECONSTRUCT_ALL; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp b/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp index 2ad98e6846e..e638689f070 100644 --- a/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp @@ -264,11 +264,11 @@ BodyRule::MapFontStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresConte aPresContext->GetFontScaler(&scaler); float scaleFactor = nsStyleUtil::GetScalingFactor(scaler); // apply font scaling to the body - font->mFont.size *= scaleFactor; + font->mFont.size = NSToCoordFloor(float(font->mFont.size) * scaleFactor); if (font->mFont.size < 1) { font->mFont.size = 1; } - font->mFixedFont.size *= scaleFactor; + font->mFixedFont.size = NSToCoordFloor(float(font->mFixedFont.size) * scaleFactor); if (font->mFixedFont.size < 1) { font->mFixedFont.size = 1; } @@ -619,18 +619,8 @@ nsHTMLBodyElement::AttributeToString(nsIAtom* aAttribute, return mInner.AttributeToString(aAttribute, aValue, aResult); } -static PRBool ColorNameToRGB(const nsHTMLValue& aValue, nscolor* aColor) -{ - nsAutoString buffer; - aValue.GetStringValue(buffer); - char cbuf[40]; - buffer.ToCString(cbuf, sizeof(cbuf)); - - return NS_ColorNameToRGB(cbuf, aColor); -} - static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -639,19 +629,12 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext); aAttributes->GetAttribute(nsHTMLAtoms::text, value); - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())){ nsStyleColor* color = (nsStyleColor*) aContext->GetMutableStyleData(eStyleStruct_Color); color->mColor = value.GetColorValue(); } - else if (eHTMLUnit_String == value.GetUnit()) { - nscolor backgroundColor; - if (ColorNameToRGB(value, &backgroundColor)) { - nsStyleColor* color = (nsStyleColor*) - aContext->GetMutableStyleData(eStyleStruct_Color); - color->mColor = backgroundColor; - } - } nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); @@ -665,37 +648,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsIHTMLStyleSheet* styleSheet; if (NS_OK == htmlContainer->GetAttributeStyleSheet(&styleSheet)) { aAttributes->GetAttribute(nsHTMLAtoms::link, value); - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())) { styleSheet->SetLinkColor(value.GetColorValue()); } - else if (eHTMLUnit_String == value.GetUnit()) { - nscolor linkColor; - if (ColorNameToRGB(value, &linkColor)) { - styleSheet->SetLinkColor(linkColor); - } - } aAttributes->GetAttribute(nsHTMLAtoms::alink, value); - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())) { styleSheet->SetActiveLinkColor(value.GetColorValue()); } - else if (eHTMLUnit_String == value.GetUnit()) { - nscolor linkColor; - if (ColorNameToRGB(value, &linkColor)) { - styleSheet->SetActiveLinkColor(linkColor); - } - } aAttributes->GetAttribute(nsHTMLAtoms::vlink, value); - if (eHTMLUnit_Color == value.GetUnit()) { + if ((eHTMLUnit_Color == value.GetUnit()) || + (eHTMLUnit_ColorName == value.GetUnit())) { styleSheet->SetVisitedLinkColor(value.GetColorValue()); } - else if (eHTMLUnit_String == value.GetUnit()) { - nscolor linkColor; - if (ColorNameToRGB(value, &linkColor)) { - styleSheet->SetVisitedLinkColor(linkColor); - } - } NS_RELEASE(styleSheet); } NS_RELEASE(htmlContainer); @@ -804,21 +772,23 @@ nsHTMLBodyElement::GetInlineStyleRules(nsISupportsArray* aRules) } NS_IMETHODIMP -nsHTMLBodyElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const +nsHTMLBodyElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const { if ((aAttribute == nsHTMLAtoms::link) || (aAttribute == nsHTMLAtoms::vlink) || (aAttribute == nsHTMLAtoms::alink) || - (aAttribute == nsHTMLAtoms::bgcolor) || - (aAttribute == nsHTMLAtoms::background) || - (aAttribute == nsHTMLAtoms::text)) - { - *aHint = NS_STYLE_HINT_VISUAL; + (aAttribute == nsHTMLAtoms::text)) { + aHint = NS_STYLE_HINT_VISUAL; } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); + else if ((aAttribute == nsHTMLAtoms::marginwidth) || + (aAttribute == nsHTMLAtoms::marginheight)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } } return NS_OK; diff --git a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp index c68a9de4628..f73dde3155f 100644 --- a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp @@ -345,13 +345,23 @@ nsHTMLButtonElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLButtonElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLButtonElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -483,11 +493,3 @@ nsHTMLButtonElement::SetForm(nsIDOMHTMLFormElement* aForm) return result; } -NS_IMETHODIMP -nsHTMLButtonElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLDListElement.cpp b/mozilla/layout/html/content/src/nsHTMLDListElement.cpp index 5df67fefb4d..b20cea08824 100644 --- a/mozilla/layout/html/content/src/nsHTMLDListElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDListElement.cpp @@ -146,7 +146,7 @@ nsHTMLDListElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -161,6 +161,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLDListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::compact) { + aHint = NS_STYLE_HINT_CONTENT; // handled by ua.css? + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLDListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -182,17 +196,3 @@ nsHTMLDListElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLDListElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::compact) { - *aHint = NS_STYLE_HINT_CONTENT; // handled by ua.css - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLDelElement.cpp b/mozilla/layout/html/content/src/nsHTMLDelElement.cpp index 56670de721f..ef42476958c 100644 --- a/mozilla/layout/html/content/src/nsHTMLDelElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDelElement.cpp @@ -146,7 +146,7 @@ nsHTMLDelElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -154,6 +154,17 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLDelElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLDelElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -175,11 +186,3 @@ nsHTMLDelElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLDelElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp b/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp index 58801c4894b..63f42cad4e3 100644 --- a/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp @@ -165,7 +165,7 @@ nsHTMLDirectoryElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -189,6 +189,23 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLDirectoryElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (aAttribute == nsHTMLAtoms::compact) { + aHint = NS_STYLE_HINT_CONTENT; // XXX + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLDirectoryElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -211,17 +228,3 @@ nsHTMLDirectoryElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLDirectoryElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::compact) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLDivElement.cpp b/mozilla/layout/html/content/src/nsHTMLDivElement.cpp index 1663e3e09f5..370cda5b8d7 100644 --- a/mozilla/layout/html/content/src/nsHTMLDivElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDivElement.cpp @@ -168,7 +168,7 @@ nsHTMLDivElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -184,6 +184,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLDivElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLDivElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -205,11 +219,3 @@ nsHTMLDivElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLDivElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp b/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp index b523e90cb7e..61ddff94b82 100644 --- a/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp @@ -160,16 +160,33 @@ nsHTMLEmbedElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext); nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, nsnull); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLEmbedElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageAlignAttributeImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLEmbedElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -191,11 +208,3 @@ nsHTMLEmbedElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLEmbedElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp b/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp index 416547cf63e..9cbde8e90d9 100644 --- a/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp @@ -220,13 +220,23 @@ nsHTMLFieldSetElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLFieldSetElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + NS_IMETHODIMP nsHTMLFieldSetElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -261,12 +271,3 @@ nsHTMLFieldSetElement::GetType(PRInt32* aType) } } - -NS_IMETHODIMP -nsHTMLFieldSetElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp index d38ff7635bf..208bd900268 100644 --- a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp @@ -188,7 +188,7 @@ nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute, } static void -MapFontAttributesInto(nsIHTMLAttributes* aAttributes, +MapFontAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -251,8 +251,11 @@ MapFontAttributesInto(nsIHTMLAttributes* aAttributes, } else { // size: int, enum , NOTE: this does not count as an explicit size - // also this has no effect if font is already explicit - if (0 == (font->mFlags & NS_STYLE_FONT_SIZE_EXPLICIT)) { + // also this has no effect if font is already explicit (quirk mode) + nsCompatibility mode; + aPresContext->GetCompatibilityMode(&mode); + if ((eCompatibility_Standard == mode) || + (0 == (font->mFlags & NS_STYLE_FONT_SIZE_EXPLICIT))) { aAttributes->GetAttribute(nsHTMLAtoms::size, value); if ((value.GetUnit() == eHTMLUnit_Integer) || (value.GetUnit() == eHTMLUnit_Enumerated)) { @@ -297,7 +300,7 @@ MapFontAttributesInto(nsIHTMLAttributes* aAttributes, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -312,24 +315,37 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, aContext->GetMutableStyleData(eStyleStruct_Color); nsStyleText* text = (nsStyleText*) aContext->GetMutableStyleData(eStyleStruct_Text); - if (value.GetUnit() == eHTMLUnit_Color) { + if (((eHTMLUnit_Color == value.GetUnit())) || + (eHTMLUnit_ColorName == value.GetUnit())) { color->mColor = value.GetColorValue(); text->mTextDecoration = font->mFont.decorations; // re-apply inherited text decoration, so colors sync } - else if (value.GetUnit() == eHTMLUnit_String) { - nsAutoString buffer; - value.GetStringValue(buffer); - char cbuf[40]; - buffer.ToCString(cbuf, sizeof(cbuf)); - - NS_ColorNameToRGB(cbuf, &(color->mColor)); - text->mTextDecoration = font->mFont.decorations; // re-apply inherited text decoration, so colors sync - } } } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLFontElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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 (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLFontElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -350,16 +366,3 @@ nsHTMLFontElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLFontElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::color == aAttribute) { - *aHint = NS_STYLE_HINT_VISUAL; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp index c6c82c51e87..9acf21444b0 100644 --- a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp @@ -394,7 +394,7 @@ nsHTMLFormElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -402,6 +402,18 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLFormElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLFormElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -713,11 +725,3 @@ nsFormControlList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) return result; } -NS_IMETHODIMP -nsHTMLFormElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp b/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp index 430c34a8e59..fe7ad31adf6 100644 --- a/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp @@ -197,13 +197,25 @@ nsHTMLFrameElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLFrameElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -224,11 +236,3 @@ nsHTMLFrameElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLFrameElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp index 59c9b0b99f4..e7543dcf6ca 100644 --- a/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp @@ -162,13 +162,31 @@ nsHTMLFrameSetElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } + +NS_IMETHODIMP +nsHTMLFrameSetElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::rows) || + (aAttribute == nsHTMLAtoms::cols)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLFrameSetElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -189,15 +207,3 @@ nsHTMLFrameSetElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLFrameSetElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if ((nsHTMLAtoms::rows == aAttribute) || (nsHTMLAtoms::cols == aAttribute)) { - *aHint = NS_STYLE_HINT_REFLOW; - } else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLHRElement.cpp b/mozilla/layout/html/content/src/nsHTMLHRElement.cpp index 5f07cbc55cf..c3e8d6d5283 100644 --- a/mozilla/layout/html/content/src/nsHTMLHRElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHRElement.cpp @@ -207,7 +207,7 @@ nsHTMLHRElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -262,6 +262,25 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, aPresContext); } +NS_IMETHODIMP +nsHTMLHRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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 (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLHRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -283,16 +302,3 @@ nsHTMLHRElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLHRElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::noshade == aAttribute) { - *aHint = NS_STYLE_HINT_VISUAL; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp b/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp index f37dac205a6..c7d9c5f170c 100644 --- a/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp @@ -141,13 +141,24 @@ nsHTMLHeadElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLHeadElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLHeadElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -169,11 +180,3 @@ nsHTMLHeadElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLHeadElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp b/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp index 5c811921ecf..9afc2fce4ee 100644 --- a/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp @@ -153,7 +153,7 @@ nsHTMLHeadingElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -169,6 +169,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLHeadingElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLHeadingElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -190,11 +204,3 @@ nsHTMLHeadingElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLHeadingElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp b/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp index 5deb8030e2b..eaaa54d0da0 100644 --- a/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp @@ -147,13 +147,24 @@ nsHTMLHtmlElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLHtmlElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + return NS_OK; +} + + NS_IMETHODIMP nsHTMLHtmlElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -178,11 +189,3 @@ nsHTMLHtmlElement::HandleDOMEvent(nsIPresContext& aPresContext, return NS_OK; } -NS_IMETHODIMP -nsHTMLHtmlElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp index 4356abda7b9..a4b1cce3382 100644 --- a/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp @@ -223,7 +223,7 @@ nsHTMLIFrameElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -260,6 +260,23 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLIFrameElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::width) || + (aAttribute == nsHTMLAtoms::height)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLIFrameElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -281,11 +298,3 @@ nsHTMLIFrameElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLIFrameElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLImageElement.cpp b/mozilla/layout/html/content/src/nsHTMLImageElement.cpp index 797a8d81a59..d96f7301f47 100644 --- a/mozilla/layout/html/content/src/nsHTMLImageElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLImageElement.cpp @@ -260,7 +260,7 @@ nsHTMLImageElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -309,10 +309,33 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } } nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, nsnull); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLImageElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::usemap) || + (aAttribute == nsHTMLAtoms::ismap)) { + aHint = NS_STYLE_HINT_FRAMECHANGE; + } + else if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLImageElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -383,24 +406,6 @@ nsHTMLImageElement::Finalize(JSContext *aContext) } -NS_IMETHODIMP -nsHTMLImageElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::src) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if ((aAttribute == nsHTMLAtoms::usemap) || - (aAttribute == nsHTMLAtoms::ismap)) { - *aHint = NS_STYLE_HINT_FRAMECHANGE; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} - NS_IMETHODIMP nsHTMLImageElement::Initialize(JSContext* aContext, PRUint32 argc, diff --git a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp index 1988f4a5bcc..8ae10b7af5b 100644 --- a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp @@ -564,7 +564,7 @@ nsHTMLInputElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -636,7 +636,7 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, NS_RGB(0, 0, 255), NS_RGB(0, 0, 255) }; - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, blue); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, blue); nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); break; } @@ -645,6 +645,28 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLInputElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::align)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if ((aAttribute == nsHTMLAtoms::type)) { + aHint = NS_STYLE_HINT_FRAMECHANGE; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLInputElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -692,13 +714,3 @@ nsHTMLInputElement::GetType(PRInt32* aType) } -NS_IMETHODIMP -nsHTMLInputElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - *aHint = NS_STYLE_HINT_CONTENT; - return NS_OK; -} - - diff --git a/mozilla/layout/html/content/src/nsHTMLInsElement.cpp b/mozilla/layout/html/content/src/nsHTMLInsElement.cpp index 76b21125193..d5f969cab28 100644 --- a/mozilla/layout/html/content/src/nsHTMLInsElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLInsElement.cpp @@ -146,7 +146,7 @@ nsHTMLInsElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -154,6 +154,18 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLInsElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLInsElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -175,11 +187,3 @@ nsHTMLInsElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLInsElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp b/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp index 9069e841b50..b2c3fd2d3e6 100644 --- a/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp @@ -152,7 +152,7 @@ nsHTMLIsIndexElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -160,6 +160,18 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLIsIndexElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLIsIndexElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -181,11 +193,3 @@ nsHTMLIsIndexElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLIsIndexElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLLIElement.cpp b/mozilla/layout/html/content/src/nsHTMLLIElement.cpp index a440dc799e5..513de1cfea5 100644 --- a/mozilla/layout/html/content/src/nsHTMLLIElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLIElement.cpp @@ -174,7 +174,7 @@ nsHTMLLIElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -192,6 +192,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLLIElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLLIElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -212,22 +228,3 @@ nsHTMLLIElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLLIElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::value) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if (aAttribute == nsHTMLAtoms::type) { - // XXX This shouldn't require a frame change, just a reapplication - // of style down the tree (and a reflow). The style changes aren't - // percolating down far enough. - *aHint = NS_STYLE_HINT_REFLOW; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp b/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp index 59cae50e8b2..01ef1435e66 100644 --- a/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp @@ -244,13 +244,25 @@ nsHTMLLabelElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLLabelElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLLabelElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -271,11 +283,3 @@ nsHTMLLabelElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLLabelElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp b/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp index fd701043a34..c7ba57f4529 100644 --- a/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLayerElement.cpp @@ -237,83 +237,105 @@ nsHTMLLayerElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { // Note: ua.css specifies that the 'position' is absolute - if (nsnull != aAttributes) { - nsHTMLValue value; - float p2t; - aPresContext->GetScaledPixelsToTwips(&p2t); - nsStylePosition* position = (nsStylePosition*) - aContext->GetMutableStyleData(eStyleStruct_Position); + nsHTMLValue value; + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + nsStylePosition* position = (nsStylePosition*) + aContext->GetMutableStyleData(eStyleStruct_Position); - // Left - aAttributes->GetAttribute(nsHTMLAtoms::left, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - position->mOffset.SetLeft(nsStyleCoord(twips)); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - position->mOffset.SetLeft(nsStyleCoord(value.GetPercentValue(), eStyleUnit_Percent)); - } - - // Top - aAttributes->GetAttribute(nsHTMLAtoms::top, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - position->mOffset.SetTop(nsStyleCoord(twips)); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - position->mOffset.SetTop(nsStyleCoord(value.GetPercentValue(), eStyleUnit_Percent)); - } - - // Width - aAttributes->GetAttribute(nsHTMLAtoms::width, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - position->mWidth.SetCoordValue(twips); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - position->mWidth.SetPercentValue(value.GetPercentValue()); - } - - // Height - aAttributes->GetAttribute(nsHTMLAtoms::height, value); - if (value.GetUnit() == eHTMLUnit_Pixel) { - nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); - position->mHeight.SetCoordValue(twips); - } - else if (value.GetUnit() == eHTMLUnit_Percent) { - position->mHeight.SetPercentValue(value.GetPercentValue()); - } - - // Z-index - aAttributes->GetAttribute(nsHTMLAtoms::zindex, value); - if (value.GetUnit() == eHTMLUnit_Integer) { - position->mZIndex.SetIntValue(value.GetIntValue(), eStyleUnit_Integer); - } - aAttributes->GetAttribute(nsHTMLAtoms::z_index, value); - if (value.GetUnit() == eHTMLUnit_Integer) { - position->mZIndex.SetIntValue(value.GetIntValue(), eStyleUnit_Integer); - } - - // Visibility - aAttributes->GetAttribute(nsHTMLAtoms::visibility, value); - if (value.GetUnit() == eHTMLUnit_Enumerated) { - nsStyleDisplay* display = (nsStyleDisplay*) - aContext->GetMutableStyleData(eStyleStruct_Display); - - display->mVisible = value.GetIntValue() == NS_STYLE_VISIBILITY_VISIBLE; - } - - // Background and bgcolor - nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext); + // Left + aAttributes->GetAttribute(nsHTMLAtoms::left, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + position->mOffset.SetLeft(nsStyleCoord(twips)); } + else if (value.GetUnit() == eHTMLUnit_Percent) { + position->mOffset.SetLeft(nsStyleCoord(value.GetPercentValue(), eStyleUnit_Percent)); + } + + // Top + aAttributes->GetAttribute(nsHTMLAtoms::top, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + position->mOffset.SetTop(nsStyleCoord(twips)); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + position->mOffset.SetTop(nsStyleCoord(value.GetPercentValue(), eStyleUnit_Percent)); + } + + // Width + aAttributes->GetAttribute(nsHTMLAtoms::width, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + position->mWidth.SetCoordValue(twips); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + position->mWidth.SetPercentValue(value.GetPercentValue()); + } + + // Height + aAttributes->GetAttribute(nsHTMLAtoms::height, value); + if (value.GetUnit() == eHTMLUnit_Pixel) { + nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t); + position->mHeight.SetCoordValue(twips); + } + else if (value.GetUnit() == eHTMLUnit_Percent) { + position->mHeight.SetPercentValue(value.GetPercentValue()); + } + + // Z-index + aAttributes->GetAttribute(nsHTMLAtoms::zindex, value); + if (value.GetUnit() == eHTMLUnit_Integer) { + position->mZIndex.SetIntValue(value.GetIntValue(), eStyleUnit_Integer); + } + aAttributes->GetAttribute(nsHTMLAtoms::z_index, value); + if (value.GetUnit() == eHTMLUnit_Integer) { + position->mZIndex.SetIntValue(value.GetIntValue(), eStyleUnit_Integer); + } + + // Visibility + aAttributes->GetAttribute(nsHTMLAtoms::visibility, value); + if (value.GetUnit() == eHTMLUnit_Enumerated) { + nsStyleDisplay* display = (nsStyleDisplay*) + aContext->GetMutableStyleData(eStyleStruct_Display); + + display->mVisible = value.GetIntValue() == NS_STYLE_VISIBILITY_VISIBLE; + } + + // Background and bgcolor + nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLLayerElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::visibility) || + (aAttribute == nsHTMLAtoms::zindex) || + (aAttribute == nsHTMLAtoms::z_index)) { + aHint = NS_STYLE_HINT_VISUAL; + } + else if ((aAttribute == nsHTMLAtoms::left) || + (aAttribute == nsHTMLAtoms::top) || + (aAttribute == nsHTMLAtoms::width) || + (aAttribute == nsHTMLAtoms::height)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLLayerElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -335,22 +357,3 @@ nsHTMLLayerElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLLayerElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if ((aAttribute == nsHTMLAtoms::visibility) || - (aAttribute == nsHTMLAtoms::z_index) || - (aAttribute == nsHTMLAtoms::zindex)) { - *aHint = NS_STYLE_HINT_VISUAL; - } - else if ((aAttribute == nsHTMLAtoms::top) || - (aAttribute == nsHTMLAtoms::left)) { - *aHint = NS_STYLE_HINT_REFLOW; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp b/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp index 26fbb8e96da..01ec5db9ccb 100644 --- a/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp @@ -189,13 +189,26 @@ nsHTMLLegendElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLLegendElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLLegendElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -217,11 +230,3 @@ nsHTMLLegendElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLLegendElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp b/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp index 3c6dc6f0be3..387c31cae5b 100644 --- a/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp @@ -242,13 +242,25 @@ nsHTMLLinkElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLLinkElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLLinkElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -270,12 +282,3 @@ nsHTMLLinkElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLLinkElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} - diff --git a/mozilla/layout/html/content/src/nsHTMLMapElement.cpp b/mozilla/layout/html/content/src/nsHTMLMapElement.cpp index 5313e2574ef..d02a2753918 100644 --- a/mozilla/layout/html/content/src/nsHTMLMapElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLMapElement.cpp @@ -302,7 +302,7 @@ nsHTMLMapElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -310,6 +310,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, aPresContext); } +NS_IMETHODIMP +nsHTMLMapElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::name) { + aHint = NS_STYLE_HINT_RECONSTRUCT_ALL; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLMapElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -331,15 +347,3 @@ nsHTMLMapElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLMapElement::GetStyleHintForAttributeChange(const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::name) { - *aHint = NS_STYLE_HINT_RECONSTRUCT_ALL; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp b/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp index 24538a48aec..08c6ddcc511 100644 --- a/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp @@ -165,7 +165,7 @@ nsHTMLMenuElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -189,6 +189,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLMenuElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLMenuElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -210,17 +224,3 @@ nsHTMLMenuElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLMenuElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::compact) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp b/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp index b937dae4637..1750902551f 100644 --- a/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp @@ -150,13 +150,26 @@ nsHTMLMetaElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLMetaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLMetaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -178,11 +191,3 @@ nsHTMLMetaElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLMetaElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLModElement.cpp b/mozilla/layout/html/content/src/nsHTMLModElement.cpp index e0c9a696784..b65ecc61de1 100644 --- a/mozilla/layout/html/content/src/nsHTMLModElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLModElement.cpp @@ -146,7 +146,7 @@ nsHTMLModElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -154,6 +154,19 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLModElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLModElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -175,11 +188,3 @@ nsHTMLModElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLModElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLOListElement.cpp b/mozilla/layout/html/content/src/nsHTMLOListElement.cpp index 291509020c0..fa28b3c95ff 100644 --- a/mozilla/layout/html/content/src/nsHTMLOListElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLOListElement.cpp @@ -205,7 +205,7 @@ nsHTMLOListElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -229,6 +229,21 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLOListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLOListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -250,21 +265,3 @@ nsHTMLOListElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLOListElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if ((aAttribute == nsHTMLAtoms::start) || - (aAttribute == nsHTMLAtoms::compact)) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else if (aAttribute == nsHTMLAtoms::type) { - *aHint = NS_STYLE_HINT_REFLOW; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp b/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp index 9e86beaab19..c4a5191383d 100644 --- a/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp @@ -216,16 +216,34 @@ nsHTMLObjectElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aContext, aPresContext); nsGenericHTMLElement::MapImageAttributesInto(aAttributes, aContext, aPresContext); - nsGenericHTMLElement::MapImageBorderAttributesInto(aAttributes, aContext, aPresContext, nsnull); + nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aContext, aPresContext, nsnull); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLObjectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageBorderAttributeImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetImageAlignAttributeImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLObjectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -247,11 +265,3 @@ nsHTMLObjectElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLObjectElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp b/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp index ac7c21a9401..c6f1be09d3d 100644 --- a/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp @@ -146,7 +146,7 @@ nsHTMLOptGroupElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -154,6 +154,17 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLOptGroupElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLOptGroupElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -175,11 +186,3 @@ nsHTMLOptGroupElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLOptGroupElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp b/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp index fe9b8e7a8d6..43341eb2a8c 100644 --- a/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp @@ -370,13 +370,25 @@ nsHTMLOptionElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLOptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLOptionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -426,15 +438,6 @@ nsHTMLOptionElement::GetText(nsString& aText) return NS_OK; } -NS_IMETHODIMP -nsHTMLOptionElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} - // Options don't have frames - get the select content node // then call nsGenericHTMLElement::GetPrimaryFrame() nsresult nsHTMLOptionElement::GetPrimaryFrame(nsIFormControlFrame *&aIFormControlFrame) diff --git a/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp b/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp index 5fad36aec26..f5eefff8d61 100644 --- a/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp @@ -160,7 +160,7 @@ nsHTMLParagraphElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -176,6 +176,21 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLParagraphElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLParagraphElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -198,11 +213,3 @@ nsHTMLParagraphElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLParagraphElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLParamElement.cpp b/mozilla/layout/html/content/src/nsHTMLParamElement.cpp index 2b96e7d58ad..744e3f39afa 100644 --- a/mozilla/layout/html/content/src/nsHTMLParamElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLParamElement.cpp @@ -152,7 +152,7 @@ nsHTMLParamElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -160,6 +160,18 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLParamElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLParamElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -181,11 +193,3 @@ nsHTMLParamElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLParamElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLPreElement.cpp b/mozilla/layout/html/content/src/nsHTMLPreElement.cpp index a663ea38120..1ccbcaa8d71 100644 --- a/mozilla/layout/html/content/src/nsHTMLPreElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLPreElement.cpp @@ -169,7 +169,7 @@ nsHTMLPreElement::AttributeToString(nsIAtom* aAttribute, } static void -MapFontAttributesInto(nsIHTMLAttributes* aAttributes, +MapFontAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -187,7 +187,7 @@ MapFontAttributesInto(nsIHTMLAttributes* aAttributes, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -238,6 +238,26 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, aPresContext); } +NS_IMETHODIMP +nsHTMLPreElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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 (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLPreElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -259,11 +279,3 @@ nsHTMLPreElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLPreElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp b/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp index 50e7a0afd84..6e160223aca 100644 --- a/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp @@ -143,7 +143,7 @@ nsHTMLQuoteElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -151,6 +151,17 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLQuoteElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLQuoteElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -172,11 +183,3 @@ nsHTMLQuoteElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLQuoteElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp b/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp index f99b5938029..5b52f373cfc 100644 --- a/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp @@ -205,13 +205,24 @@ nsHTMLScriptElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLScriptElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLScriptElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -233,11 +244,3 @@ nsHTMLScriptElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLScriptElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp index 095b15bbc46..727f9ad2a9b 100644 --- a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp @@ -691,7 +691,7 @@ nsHTMLSelectElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -719,6 +719,24 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLSelectElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::multiple) { + aHint = NS_STYLE_HINT_FRAMECHANGE; + } + else if ((aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::size)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLSelectElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -1083,17 +1101,3 @@ nsOptionList::Clear() mElements.Clear(); } -NS_IMETHODIMP -nsHTMLSelectElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::multiple == aAttribute) { - *aHint = NS_STYLE_HINT_FRAMECHANGE; - } else if (nsHTMLAtoms::size == aAttribute) { - *aHint = NS_STYLE_HINT_REFLOW; - } else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp b/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp index 757755de636..c9364b9a155 100644 --- a/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp @@ -160,7 +160,7 @@ nsHTMLSpacerElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -200,6 +200,24 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLSpacerElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_FRAMECHANGE; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLSpacerElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -221,11 +239,3 @@ nsHTMLSpacerElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLSpacerElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp b/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp index ed224b3d7fa..aca2a1ae854 100644 --- a/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp @@ -129,7 +129,7 @@ nsHTMLSpanElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -137,6 +137,17 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLSpanElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLSpanElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -158,11 +169,3 @@ nsHTMLSpanElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLSpanElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp b/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp index 56b8fc0eadb..5e2d572e0cf 100644 --- a/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp @@ -226,13 +226,25 @@ nsHTMLStyleElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLStyleElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLStyleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -254,11 +266,3 @@ nsHTMLStyleElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLStyleElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp index 21828141e6a..13851ba049d 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp @@ -161,7 +161,7 @@ nsHTMLTableCaptionElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -186,6 +186,22 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTableCaptionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLTableCaptionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -207,11 +223,3 @@ nsHTMLTableCaptionElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableCaptionElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp index d9190201597..f7d197eb80f 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp @@ -421,7 +421,7 @@ nsHTMLTableCellElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -493,6 +493,32 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } } +NS_IMETHODIMP +nsHTMLTableCellElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& 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 (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + + return NS_OK; +} + + + NS_IMETHODIMP nsHTMLTableCellElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -514,21 +540,3 @@ nsHTMLTableCellElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableCellElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else if (nsHTMLAtoms::abbr != aAttribute && - nsHTMLAtoms::axis != aAttribute && - nsHTMLAtoms::headers != aAttribute && - nsHTMLAtoms::scope != aAttribute) - { - *aHint = NS_STYLE_HINT_REFLOW; - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp index f63a41aee75..d0d1af3c3f5 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp @@ -220,7 +220,7 @@ nsHTMLTableColElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -284,6 +284,23 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTableColElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::width) || + (aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::valign) || + (aAttribute == nsHTMLAtoms::span)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTableColElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, @@ -319,18 +336,3 @@ NS_METHOD nsHTMLTableColElement::GetSpanValue(PRInt32* aSpan) return NS_OK; } -NS_IMETHODIMP -nsHTMLTableColElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp index 462e55832e7..4e419c568dd 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp @@ -209,7 +209,7 @@ nsHTMLTableColGroupElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -261,18 +261,26 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, textStyle = (nsStyleText*)aContext->GetMutableStyleData(eStyleStruct_Text); textStyle->mVerticalAlign.SetIntValue(value.GetIntValue(), eStyleUnit_Enumerated); } - - // span: int - aAttributes->GetAttribute(nsHTMLAtoms::span, value); - if (value.GetUnit() == eHTMLUnit_Integer) - { - nsStyleTable *tableStyle = (nsStyleTable*)aContext->GetMutableStyleData(eStyleStruct_Table); - tableStyle->mSpan = value.GetIntValue(); - } } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTableColGroupElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::width) || + (aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::valign)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTableColGroupElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, @@ -295,18 +303,3 @@ nsHTMLTableColGroupElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableColGroupElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp index b6ccc2ebcda..cc0a88fa9ee 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp @@ -951,7 +951,7 @@ nsHTMLTableElement::AttributeToString(nsIAtom* aAttribute, } static void -MapTableFrameInto(nsIHTMLAttributes* aAttributes, +MapTableFrameInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext, nsStyleSpacing* aSpacing) @@ -1023,7 +1023,7 @@ MapTableFrameInto(nsIHTMLAttributes* aAttributes, } static void -MapTableBorderInto(nsIHTMLAttributes* aAttributes, +MapTableBorderInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -1079,7 +1079,7 @@ MapTableBorderInto(nsIHTMLAttributes* aAttributes, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -1213,25 +1213,36 @@ x += 1; //background: color nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aContext, aPresContext); nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); - - // direction - aAttributes->GetAttribute(nsHTMLAtoms::dir, value); - if (eHTMLUnit_String == value.GetUnit()) { - nsString dir; - value.GetStringValue(dir); - nsStyleDisplay* display = (nsStyleDisplay*) - aContext->GetMutableStyleData(eStyleStruct_Display); - if (dir.EqualsIgnoreCase("RTL")) { - display->mDirection = NS_STYLE_DIRECTION_RTL; - } - else { - display->mDirection = NS_STYLE_DIRECTION_LTR; - } - } } } } +NS_IMETHODIMP +nsHTMLTableElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::layout) || + (aAttribute == nsHTMLAtoms::cellpadding) || + (aAttribute == nsHTMLAtoms::cellspacing) || + (aAttribute == nsHTMLAtoms::cols) || + (aAttribute == nsHTMLAtoms::rules) || + (aAttribute == nsHTMLAtoms::border) || + (aAttribute == nsHTMLAtoms::frame) || + (aAttribute == nsHTMLAtoms::width) || + (aAttribute == nsHTMLAtoms::height)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLTableElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -1253,19 +1264,3 @@ nsHTMLTableElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else if (nsHTMLAtoms::summary != aAttribute) - { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp index cd201a396b2..bd6be08eb9b 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp @@ -560,7 +560,7 @@ nsHTMLTableRowElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -605,6 +605,24 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } } +NS_IMETHODIMP +nsHTMLTableRowElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::valign) || + (aAttribute == nsHTMLAtoms::height)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTableRowElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -626,18 +644,3 @@ nsHTMLTableRowElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableRowElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp index 2b5ce68c84a..78333272b9c 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp @@ -283,7 +283,7 @@ nsHTMLTableSectionElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -329,6 +329,25 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, } +NS_IMETHODIMP +nsHTMLTableSectionElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if ((aAttribute == nsHTMLAtoms::align) || + (aAttribute == nsHTMLAtoms::valign) || + (aAttribute == nsHTMLAtoms::height)) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + if (! nsGenericHTMLElement::GetBackgroundAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLTableSectionElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -350,18 +369,3 @@ nsHTMLTableSectionElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTableSectionElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (PR_TRUE == nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, - aAttribute, aHint)) { - // Do nothing - } - else { - // XXX put in real handling for known attributes, return CONTENT for anything else - *aHint = NS_STYLE_HINT_CONTENT; - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp index d2e71ee7087..fbb06b2d1e0 100644 --- a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp @@ -371,7 +371,7 @@ nsHTMLTextAreaElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -398,6 +398,20 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTextAreaElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::align) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTextAreaElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -457,15 +471,3 @@ nsHTMLTextAreaElement::SetForm(nsIDOMHTMLFormElement* aForm) return result; } -NS_IMETHODIMP -nsHTMLTextAreaElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (nsHTMLAtoms::readonly == aAttribute) { - *aHint = NS_STYLE_HINT_CONTENT; - } else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp b/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp index 240c641ef51..6a9489dd4aa 100644 --- a/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp @@ -145,13 +145,24 @@ nsHTMLTitleElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLTitleElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLTitleElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -227,11 +238,3 @@ nsHTMLTitleElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLTitleElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLUListElement.cpp b/mozilla/layout/html/content/src/nsHTMLUListElement.cpp index f3fdcbf995d..e9de64b0bf1 100644 --- a/mozilla/layout/html/content/src/nsHTMLUListElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLUListElement.cpp @@ -183,7 +183,7 @@ nsHTMLUListElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { @@ -207,6 +207,21 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLUListElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (aAttribute == nsHTMLAtoms::type) { + aHint = NS_STYLE_HINT_REFLOW; + } + else if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + + NS_IMETHODIMP nsHTMLUListElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -228,20 +243,3 @@ nsHTMLUListElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLUListElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - if (aAttribute == nsHTMLAtoms::type) { - *aHint = NS_STYLE_HINT_REFLOW; - } - else if (aAttribute == nsHTMLAtoms::compact) { - *aHint = NS_STYLE_HINT_CONTENT; - } - else { - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - } - - return NS_OK; -} diff --git a/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp b/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp index 97fcd7b684a..743c51155c9 100644 --- a/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp @@ -139,13 +139,24 @@ nsHTMLWBRElement::AttributeToString(nsIAtom* aAttribute, } static void -MapAttributesInto(nsIHTMLAttributes* aAttributes, +MapAttributesInto(const nsIHTMLMappedAttributes* aAttributes, nsIStyleContext* aContext, nsIPresContext* aPresContext) { nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aContext, aPresContext); } +NS_IMETHODIMP +nsHTMLWBRElement::GetMappedAttributeImpact(const nsIAtom* aAttribute, + PRInt32& aHint) const +{ + if (! nsGenericHTMLElement::GetCommonMappedAttributesImpact(aAttribute, aHint)) { + aHint = NS_STYLE_HINT_CONTENT; + } + + return NS_OK; +} + NS_IMETHODIMP nsHTMLWBRElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc, nsMapAttributesFunc& aMapFunc) const @@ -168,11 +179,3 @@ nsHTMLWBRElement::HandleDOMEvent(nsIPresContext& aPresContext, aFlags, aEventStatus); } -NS_IMETHODIMP -nsHTMLWBRElement::GetStyleHintForAttributeChange( - const nsIAtom* aAttribute, - PRInt32 *aHint) const -{ - nsGenericHTMLElement::GetStyleHintForCommonAttributes(this, aAttribute, aHint); - return NS_OK; -}