Bug 113580 switch uses of getAttribute to hasAttributeValue whenever possible

p=bugmail@q1n.org r=dbaron sr=bzbarsky
This commit is contained in:
bugzilla%arlen.demon.co.uk 2004-12-31 00:41:58 +00:00
parent 9ddca6ca8b
commit 70482809ca
3 changed files with 5 additions and 21 deletions

View File

@ -664,7 +664,8 @@ nsHTMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
// The _moz_dirty attribute is emitted by the editor to
// indicate that this element should be pretty printed
// even if we're not in pretty printing mode
PRBool hasDirtyAttr = HasDirtyAttr(content);
PRBool hasDirtyAttr = content->HasAttr(kNameSpaceID_None,
nsLayoutAtoms::mozdirty);
nsIAtom *name = content->Tag();
@ -774,7 +775,8 @@ nsHTMLContentSerializer::AppendElementEnd(nsIDOMElement *aElement,
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
if (!content) return NS_ERROR_FAILURE;
PRBool hasDirtyAttr = HasDirtyAttr(content);
PRBool hasDirtyAttr = content->HasAttr(kNameSpaceID_None,
nsLayoutAtoms::mozdirty);
nsIAtom *name = content->Tag();
@ -1022,21 +1024,6 @@ nsHTMLContentSerializer::AppendToStringConvertLF(const nsAString& aStr,
}
PRBool
nsHTMLContentSerializer::HasDirtyAttr(nsIContent* aContent)
{
nsAutoString val;
if (NS_CONTENT_ATTR_NOT_THERE != aContent->GetAttr(kNameSpaceID_None,
nsLayoutAtoms::mozdirty,
val)) {
return PR_TRUE;
}
else {
return PR_FALSE;
}
}
PRBool
nsHTMLContentSerializer::LineBreakBeforeOpen(nsIAtom* aName,
PRBool aHasDirtyAttr)
{

View File

@ -68,7 +68,6 @@ class nsHTMLContentSerializer : public nsXMLContentSerializer {
NS_IMETHOD AppendDocumentStart(nsIDOMDocument *aDocument,
nsAString& aStr);
protected:
PRBool HasDirtyAttr(nsIContent* aContent);
PRBool LineBreakBeforeOpen(nsIAtom* aName, PRBool aHasDirtyAttr);
PRBool LineBreakAfterOpen(nsIAtom* aName, PRBool aHasDirtyAttr);
PRBool LineBreakBeforeClose(nsIAtom* aName, PRBool aHasDirtyAttr);

View File

@ -231,9 +231,7 @@ void nsTableCellFrame::SetPass1MaxElementWidth(nscoord aMaxWidth,
styleText->mWhiteSpace != NS_STYLE_WHITESPACE_NOWRAP &&
styleText->mWhiteSpace != NS_STYLE_WHITESPACE_PRE) {
// has fixed width, check the content for nowrap
nsAutoString nowrap;
nsresult result = GetContent()->GetAttr(kNameSpaceID_None, nsHTMLAtoms::nowrap, nowrap);
if(NS_CONTENT_ATTR_NOT_THERE != result) {
if (GetContent()->HasAttr(kNameSpaceID_None, nsHTMLAtoms::nowrap)) {
// content has nowrap (is not mapped to style be cause it has width)
// set the max element size to the value of the fixed width (NAV/IE quirk)
maxElemWidth = NS_MAX(maxElemWidth, stylePosition->mWidth.GetCoordValue());