From ec5d09357ebf25dc8212edf79b28a640a781036b Mon Sep 17 00:00:00 2001 From: "bugzilla%arlen.demon.co.uk" Date: Fri, 31 Dec 2004 00:41:58 +0000 Subject: [PATCH] Bug 113580 switch uses of getAttribute to hasAttributeValue whenever possible p=bugmail@q1n.org r=dbaron sr=bzbarsky git-svn-id: svn://10.0.0.236/trunk@167123 18797224-902f-48f8-a5cc-f745e15eee43 --- .../base/src/nsHTMLContentSerializer.cpp | 21 ++++--------------- .../base/src/nsHTMLContentSerializer.h | 1 - mozilla/layout/tables/nsTableCellFrame.cpp | 4 +--- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/mozilla/content/base/src/nsHTMLContentSerializer.cpp b/mozilla/content/base/src/nsHTMLContentSerializer.cpp index efdcced3f03..7575afffbf0 100644 --- a/mozilla/content/base/src/nsHTMLContentSerializer.cpp +++ b/mozilla/content/base/src/nsHTMLContentSerializer.cpp @@ -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 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) { diff --git a/mozilla/content/base/src/nsHTMLContentSerializer.h b/mozilla/content/base/src/nsHTMLContentSerializer.h index 508e5275d7c..75847e429db 100644 --- a/mozilla/content/base/src/nsHTMLContentSerializer.h +++ b/mozilla/content/base/src/nsHTMLContentSerializer.h @@ -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); diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index c360b86ace4..c8c7687c04a 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -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());