small changes to clients of string converting APIs

This commit is contained in:
scc@netscape.com
2000-03-26 10:06:21 +00:00
parent 0208585a56
commit a09a9c5b56
53 changed files with 184 additions and 184 deletions

View File

@@ -2692,7 +2692,7 @@ PRBool nsDocument::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID
mPropName.Assign(JS_GetStringChars(JS_ValueToString(aContext, aID)));
if (mPropName.Length() > 2)
mPrefix.Assign(mPropName.GetUnicode(), 2);
if (mPrefix == "on") {
if (mPrefix.Equals("on")) {
nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(mPropName));
nsIEventListenerManager *mManager = nsnull;

View File

@@ -173,7 +173,7 @@ nsTextEncoder::EncodeToString(nsString& aOutputString)
{
nsString buffer;
if (mMimeType == "text/xif")
if (mMimeType.Equals("text/xif"))
{
mDocument->CreateXIF(aOutputString, mSelection);
return NS_OK;
@@ -192,7 +192,7 @@ nsTextEncoder::EncodeToString(nsString& aOutputString)
{
nsIHTMLContentSink* sink = nsnull;
if (mMimeType == "text/html")
if (mMimeType.Equals("text/html"))
rv = NS_New_HTML_ContentSinkStream(&sink, &aOutputString, mFlags);
else // default to text/plain
@@ -249,7 +249,7 @@ nsTextEncoder::EncodeToStream(nsIOutputStream* aStream)
if (NS_SUCCEEDED(rv)) {
nsIHTMLContentSink* sink = nsnull;
if (mMimeType == "text/html")
if (mMimeType.Equals("text/html"))
rv = NS_New_HTML_ContentSinkStream(&sink, aStream, charset, mFlags);
else

View File

@@ -1296,7 +1296,7 @@ nsGenericElement::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, js
propName.Assign(JS_GetStringChars(JS_ValueToString(aContext, aID)));
if (propName.Length() > 2)
prefix.Assign(propName.GetUnicode(), 2);
if (prefix == "on") {
if (prefix.Equals("on")) {
nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(propName));
nsIEventListenerManager *manager = nsnull;

View File

@@ -1802,7 +1802,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aParent, nsIContent* aCh
if (focusable) {
nsAutoString value;
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, value);
if (value != "true")
if (!value.Equals("true"))
disabled = PR_FALSE;
}
}

View File

@@ -557,7 +557,7 @@ nsHTMLInputElement::GetChecked(PRBool* aValue)
}
}
if (value == "1")
if (value.Equals("1"))
*aValue = PR_TRUE;
else
*aValue = PR_FALSE;

View File

@@ -260,7 +260,7 @@ nsHTMLOptionElement::GetSelected(PRBool* aValue)
nsString value;
value.Append(indx, 10); // Save the index in base 10
formControlFrame->GetProperty(nsHTMLAtoms::selected, value);
if (value == "1")
if (value.Equals("1"))
*aValue = PR_TRUE;
else
*aValue = PR_FALSE;

View File

@@ -3557,7 +3557,7 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
if (0 == mimeType.Length()) {
nsString extension;
aHref.Right(extension, 4);
if (extension == ".css") {
if (extension.Equals(".css")) {
isStyleSheet = PR_TRUE; // strict mode + no mime type + '.css' extension
}
}

View File

@@ -431,7 +431,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(lastModKey);
if (NS_SUCCEEDED(rv)) {
lastModified = lastModHeader;
lastModified.Assign(lastModHeader);
SetLastModified(lastModified);
}
@@ -445,7 +445,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(referrerKey);
if (NS_SUCCEEDED(rv)) {
referrer = referrerHeader;
referrer.Assign(referrerHeader);
SetReferrer(referrer);
}
@@ -457,7 +457,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(contentTypeKey);
if (NS_SUCCEEDED(rv)) {
nsAutoString contentType;
contentType = contenttypeheader;
contentType.Assign(contenttypeheader);
PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ;
if(kNotFound != start)
{

View File

@@ -405,7 +405,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
// in the excludes list.
nsAutoString excludes;
content->GetAttribute(kNameSpaceID_None, kExcludesAtom, excludes);
if (excludes != "*") {
if (!excludes.Equals("*")) {
if (!excludes.IsEmpty()) {
// Walk the children and ensure that all of them
// are in the excludes array.
@@ -450,7 +450,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
nsCOMPtr<nsIDOMAttr> attr(do_QueryInterface(attribute));
nsAutoString name;
attr->GetName(name);
if (name != "excludes") {
if (!name.Equals("excludes")) {
nsAutoString value;
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mBoundElement));
element->GetAttribute(name, value);
@@ -504,7 +504,7 @@ nsXBLBinding::InstallEventHandlers(nsIContent* aBoundElement)
nsAutoString type;
child->GetAttribute(kNameSpaceID_None, kTypeAtom, type);
if (type != "") {
if (!type.IsEmpty()) {
nsCOMPtr<nsIAtom> eventAtom = getter_AddRefs(NS_NewAtom(type));
PRBool found = PR_FALSE;
nsIID iid;
@@ -526,7 +526,7 @@ nsXBLBinding::InstallEventHandlers(nsIContent* aBoundElement)
PRBool useCapture = PR_FALSE;
nsAutoString capturer;
child->GetAttribute(kNameSpaceID_None, kCapturerAtom, capturer);
if (capturer == "true")
if (capturer.Equals("true"))
useCapture = PR_TRUE;
// Add the event listener.
@@ -569,7 +569,7 @@ nsXBLBinding::GetBaseTag(nsIAtom** aResult)
nsAutoString extends;
mBinding->GetAttribute(kNameSpaceID_None, kExtendsAtom, extends);
if (extends != "") {
if (!extends.IsEmpty()) {
// Obtain the namespace prefix.
nsAutoString prefix;
PRInt32 offset = extends.FindChar(kNameSpaceSeparator);
@@ -657,7 +657,7 @@ nsXBLBinding::AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool
// Construct a new text node and insert it.
nsAutoString value;
nsresult result = mBoundElement->GetAttribute(aNameSpaceID, aAttribute, value);
if (value != "") {
if (!value.IsEmpty()) {
nsCOMPtr<nsIDOMText> textNode;
nsCOMPtr<nsIDocument> doc;
mBoundElement->GetDocument(*getter_AddRefs(doc));
@@ -731,7 +731,7 @@ nsXBLBinding::IsInExcludesList(nsIAtom* aTag, const nsString& aList)
nsAutoString element;
aTag->ToString(element);
if (aList == "*")
if (aList.Equals("*"))
return PR_TRUE; // match _everything_!
PRInt32 indx = aList.Find(element);
@@ -762,7 +762,7 @@ nsXBLBinding::ConstructAttributeTable(nsIContent* aElement)
// ability to map one attribute to another.
nsAutoString inherits;
aElement->GetAttribute(kNameSpaceID_None, kInheritsAtom, inherits);
if (inherits != "") {
if (!inherits.IsEmpty()) {
if (!mAttributeTable) {
mAttributeTable = new nsSupportsHashtable(8);
}
@@ -825,7 +825,7 @@ nsXBLBinding::ConstructAttributeTable(nsIContent* aElement)
aElement->SetAttribute(kNameSpaceID_None, attribute, value, PR_TRUE);
nsCOMPtr<nsIAtom> tag;
aElement->GetTag(*getter_AddRefs(tag));
if ((tag.get() == kHTMLAtom) && (attribute.get() == kValueAtom) && value != "") {
if ((tag.get() == kHTMLAtom) && (attribute.get() == kValueAtom) && !value.IsEmpty()) {
nsCOMPtr<nsIDOMText> textNode;
nsCOMPtr<nsIDocument> doc;
mBoundElement->GetDocument(*getter_AddRefs(doc));
@@ -873,21 +873,21 @@ nsXBLBinding::GetEventHandlerIID(nsIAtom* aName, nsIID* aIID, PRBool* aFound)
PRBool
nsXBLBinding::IsMouseHandler(const nsString& aName)
{
return ((aName == "click") || (aName == "dblclick") || (aName=="mousedown") ||
(aName == "mouseover") || (aName == "mouseout") || (aName == "mouseup"));
return ((aName.Equals("click")) || (aName.Equals("dblclick")) || (aName.Equals("mousedown")) ||
(aName.Equals("mouseover")) || (aName.Equals("mouseout")) || (aName.Equals("mouseup")));
}
PRBool
nsXBLBinding::IsKeyHandler(const nsString& aName)
{
return ((aName == "keypress") || (aName == "keydown") || (aName == "keyup"));
return ((aName.Equals("keypress")) || (aName.Equals("keydown")) || (aName.Equals("keyup")));
}
PRBool
nsXBLBinding::IsXULHandler(const nsString& aName)
{
return ((aName == "create") || (aName == "destroy") || (aName=="broadcast") ||
(aName == "command") || (aName == "commandupdate") || (aName == "close"));
return ((aName.Equals("create")) || (aName.Equals("destroy")) || (aName.Equals("broadcast")) ||
(aName.Equals("command")) || (aName.Equals("commandupdate")) || (aName.Equals("close")));
}
NS_IMETHODIMP

View File

@@ -101,7 +101,7 @@ nsresult nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent)
{
if (mEventName != "keyup")
if (!mEventName.Equals("keyup"))
return NS_OK;
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
@@ -112,7 +112,7 @@ nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent)
nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent)
{
if (mEventName != "keydown")
if (!mEventName.Equals("keydown"))
return NS_OK;
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
@@ -123,7 +123,7 @@ nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent)
nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent)
{
if (mEventName != "keypress")
if (!mEventName.Equals("keypress"))
return NS_OK;
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
@@ -134,7 +134,7 @@ nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent)
nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "mousedown")
if (!mEventName.Equals("mousedown"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -145,7 +145,7 @@ nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "mouseup")
if (!mEventName.Equals("mouseup"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -156,7 +156,7 @@ nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "click")
if (!mEventName.Equals("click"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -167,7 +167,7 @@ nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "dblclick")
if (!mEventName.Equals("dblclick"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -178,7 +178,7 @@ nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "mouseover")
if (!mEventName.Equals("mouseover"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -189,7 +189,7 @@ nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "mouseout")
if (!mEventName.Equals("mouseout"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -200,7 +200,7 @@ nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::Action(nsIDOMEvent* aEvent)
{
if (mEventName != "command")
if (!mEventName.Equals("command"))
return NS_OK;
ExecuteHandler(nsAutoString("command"), aEvent);
@@ -209,7 +209,7 @@ nsresult nsXBLEventHandler::Action(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::Create(nsIDOMEvent* aEvent)
{
if (mEventName != "create")
if (!mEventName.Equals("create"))
return NS_OK;
ExecuteHandler(nsAutoString("create"), aEvent);
@@ -218,7 +218,7 @@ nsresult nsXBLEventHandler::Create(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::Close(nsIDOMEvent* aEvent)
{
if (mEventName != "close")
if (!mEventName.Equals("close"))
return NS_OK;
ExecuteHandler(nsAutoString("close"), aEvent);
@@ -227,7 +227,7 @@ nsresult nsXBLEventHandler::Close(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::Broadcast(nsIDOMEvent* aEvent)
{
if (mEventName != "broadcast")
if (!mEventName.Equals("broadcast"))
return NS_OK;
ExecuteHandler(nsAutoString("broadcast"), aEvent);
@@ -236,7 +236,7 @@ nsresult nsXBLEventHandler::Broadcast(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::CommandUpdate(nsIDOMEvent* aEvent)
{
if (mEventName != "commandupdate")
if (!mEventName.Equals("commandupdate"))
return NS_OK;
ExecuteHandler(nsAutoString("commandupdate"), aEvent);
@@ -245,7 +245,7 @@ nsresult nsXBLEventHandler::CommandUpdate(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
{
if (mEventName != "destroy")
if (!mEventName.Equals("destroy"))
return NS_OK;
ExecuteHandler(nsAutoString("destroy"), aEvent);

View File

@@ -340,7 +340,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
{
*aResult = nsnull;
if (aURLStr == nsCAutoString(""))
if (aURLStr.IsEmpty())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIURL> uri;
@@ -379,7 +379,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::name, value);
// If no ref is specified just use this.
if ((bindingName == "") || (bindingName == value)) {
if ((bindingName.IsEmpty()) || (bindingName == value)) {
// Make a new binding
NS_NewXBLBinding(aResult);
@@ -388,7 +388,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
// Check for the presence of an extends attribute
child->GetAttribute(kNameSpaceID_None, kExtendsAtom, value);
if (value != "") {
if (!value.IsEmpty()) {
// See if we are extending a builtin tag.
nsCOMPtr<nsIAtom> tag;
(*aResult)->GetBaseTag(getter_AddRefs(tag));
@@ -538,7 +538,7 @@ nsXBLService::StripWhitespaceNodes(nsIContent* aElement)
nsAutoString result;
text->CopyText(result);
result.StripWhitespace();
if (result == "") {
if (result.IsEmpty()) {
// This node contained nothing but whitespace.
// Remove it from the content model.
aElement->RemoveChildAt(i, PR_TRUE);

View File

@@ -1960,7 +1960,7 @@ nsXMLContentSink::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aR
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
progID += nameSpace;
progID.Append(nameSpace);
// Retrieve the appropriate factory.
NS_WITH_SERVICE(nsIElementFactory, elementFactory, progID, &rv);

View File

@@ -276,7 +276,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(contentTypeKey);
if (NS_SUCCEEDED(rv)) {
nsAutoString contentType;
contentType = contenttypeheader;
contentType.Assign(contenttypeheader);
PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ;
if(kNotFound != start)
{

View File

@@ -2277,7 +2277,7 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell,
nsString charData;
domData->GetData(charData);
charData = charData.StripWhitespace();
if ((charData.Length() <= 0) && (charData != " ")) { // XXX check this
if ((charData.Length() <= 0) && (!charData.Equals(" "))) { // XXX check this
needCell = PR_FALSE; // only contains whitespace, don't create cell
}
NS_RELEASE(domData);
@@ -4326,7 +4326,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
const nsStyleUserInterface* ui= (const nsStyleUserInterface*)
styleContext->GetStyleData(eStyleStruct_UserInterface);
if (ui->mBehavior != "") {
if (!ui->mBehavior.IsEmpty()) {
// Get the XBL loader.
nsresult rv;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
@@ -4489,7 +4489,7 @@ nsCSSFrameConstructor::CreateAnonymousTreeCellFrames(nsIPresShell* aPresS
const nsStyleUserInterface* ui= (const nsStyleUserInterface*)
styleContext->GetStyleData(eStyleStruct_UserInterface);
if (ui->mBehavior != "") {
if (!ui->mBehavior.IsEmpty()) {
// Get the XBL loader.
nsresult rv;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
@@ -4577,7 +4577,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
aStyleContext->GetStyleData(eStyleStruct_UserInterface);
// Ensure that our XBL bindings are installed.
if (ui->mBehavior != "") {
if (!ui->mBehavior.IsEmpty()) {
// Get the XBL loader.
nsresult rv;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);

View File

@@ -2692,7 +2692,7 @@ PRBool nsDocument::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID
mPropName.Assign(JS_GetStringChars(JS_ValueToString(aContext, aID)));
if (mPropName.Length() > 2)
mPrefix.Assign(mPropName.GetUnicode(), 2);
if (mPrefix == "on") {
if (mPrefix.Equals("on")) {
nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(mPropName));
nsIEventListenerManager *mManager = nsnull;

View File

@@ -173,7 +173,7 @@ nsTextEncoder::EncodeToString(nsString& aOutputString)
{
nsString buffer;
if (mMimeType == "text/xif")
if (mMimeType.Equals("text/xif"))
{
mDocument->CreateXIF(aOutputString, mSelection);
return NS_OK;
@@ -192,7 +192,7 @@ nsTextEncoder::EncodeToString(nsString& aOutputString)
{
nsIHTMLContentSink* sink = nsnull;
if (mMimeType == "text/html")
if (mMimeType.Equals("text/html"))
rv = NS_New_HTML_ContentSinkStream(&sink, &aOutputString, mFlags);
else // default to text/plain
@@ -249,7 +249,7 @@ nsTextEncoder::EncodeToStream(nsIOutputStream* aStream)
if (NS_SUCCEEDED(rv)) {
nsIHTMLContentSink* sink = nsnull;
if (mMimeType == "text/html")
if (mMimeType.Equals("text/html"))
rv = NS_New_HTML_ContentSinkStream(&sink, aStream, charset, mFlags);
else

View File

@@ -1296,7 +1296,7 @@ nsGenericElement::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, js
propName.Assign(JS_GetStringChars(JS_ValueToString(aContext, aID)));
if (propName.Length() > 2)
prefix.Assign(propName.GetUnicode(), 2);
if (prefix == "on") {
if (prefix.Equals("on")) {
nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(propName));
nsIEventListenerManager *manager = nsnull;

View File

@@ -1802,7 +1802,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aParent, nsIContent* aCh
if (focusable) {
nsAutoString value;
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, value);
if (value != "true")
if (!value.Equals("true"))
disabled = PR_FALSE;
}
}

View File

@@ -111,7 +111,7 @@ void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame
PRBool nsFormControlHelper::GetBool(const nsString& aValue)
{
if (aValue == NS_STRING_TRUE)
if (aValue.Equals(NS_STRING_TRUE))
return(PR_TRUE);
else
return (PR_FALSE);

View File

@@ -481,7 +481,7 @@ nsGfxButtonControlFrame::ButtonLocalize(char* aKey, nsString& oVal)
nsAutoString key(aKey);
rv = bundle->GetStringFromName(key.GetUnicode(), getter_Copies(valUni));
if (NS_SUCCEEDED(rv) && valUni) {
oVal = valUni;
oVal.Assign(valUni);
} else {
oVal.Truncate();
}

View File

@@ -549,9 +549,9 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou
nsGfxCheckboxControlFrame::CheckState
nsGfxCheckboxControlFrame::StringToCheckState ( const nsString & aStateAsString )
{
if ( aStateAsString == NS_STRING_TRUE )
if ( aStateAsString.Equals(NS_STRING_TRUE) )
return eOn;
else if ( aStateAsString == NS_STRING_FALSE )
else if ( aStateAsString.Equals(NS_STRING_FALSE) )
return eOff;
// not true and not false means mixed

View File

@@ -125,7 +125,7 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex,
NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue)
{
if (nsHTMLAtoms::checked == aName) {
PRBool state = (aValue == NS_STRING_TRUE) ? PR_TRUE : PR_FALSE;
PRBool state = (aValue.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
// if there is no form than the radiobtn is an orphan
@@ -365,7 +365,7 @@ nsGfxRadioControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState*
mIsRestored = PR_TRUE;
nsAutoString string;
aState->GetStateProperty("checked", string);
PRBool state = (string == NS_STRING_TRUE) ? PR_TRUE : PR_FALSE;
PRBool state = (string.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
SetRadioState(aPresContext, state); // sets mChecked
mRestoredChecked = mChecked;

View File

@@ -650,7 +650,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
if (classid.Find("clsid:") != -1)
{
classid.Cut(0, 6); // Strip off the "clsid:". What's left is the class ID.
bJavaPluginClsid = (classid == JAVA_CLASS_ID);
bJavaPluginClsid = (classid.Equals(JAVA_CLASS_ID));
}
// if we find "java:" in the class id, or we match the Java classid number, we have a java applet
@@ -702,7 +702,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
{
// These are some builtin types that we know about for now.
// (Eventually this will move somewhere else.)
if (classid == "browser")
if (classid.Equals("browser"))
{
widgetCID = kCAppShellCID;
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID);

View File

@@ -650,7 +650,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
if (classid.Find("clsid:") != -1)
{
classid.Cut(0, 6); // Strip off the "clsid:". What's left is the class ID.
bJavaPluginClsid = (classid == JAVA_CLASS_ID);
bJavaPluginClsid = (classid.Equals(JAVA_CLASS_ID));
}
// if we find "java:" in the class id, or we match the Java classid number, we have a java applet
@@ -702,7 +702,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
{
// These are some builtin types that we know about for now.
// (Eventually this will move somewhere else.)
if (classid == "browser")
if (classid.Equals("browser"))
{
widgetCID = kCAppShellCID;
rv = InstantiateWidget(aPresContext, aMetrics, aReflowState, widgetCID);

View File

@@ -557,7 +557,7 @@ nsHTMLInputElement::GetChecked(PRBool* aValue)
}
}
if (value == "1")
if (value.Equals("1"))
*aValue = PR_TRUE;
else
*aValue = PR_FALSE;

View File

@@ -260,7 +260,7 @@ nsHTMLOptionElement::GetSelected(PRBool* aValue)
nsString value;
value.Append(indx, 10); // Save the index in base 10
formControlFrame->GetProperty(nsHTMLAtoms::selected, value);
if (value == "1")
if (value.Equals("1"))
*aValue = PR_TRUE;
else
*aValue = PR_FALSE;

View File

@@ -3557,7 +3557,7 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
if (0 == mimeType.Length()) {
nsString extension;
aHref.Right(extension, 4);
if (extension == ".css") {
if (extension.Equals(".css")) {
isStyleSheet = PR_TRUE; // strict mode + no mime type + '.css' extension
}
}

View File

@@ -431,7 +431,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(lastModKey);
if (NS_SUCCEEDED(rv)) {
lastModified = lastModHeader;
lastModified.Assign(lastModHeader);
SetLastModified(lastModified);
}
@@ -445,7 +445,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(referrerKey);
if (NS_SUCCEEDED(rv)) {
referrer = referrerHeader;
referrer.Assign(referrerHeader);
SetReferrer(referrer);
}
@@ -457,7 +457,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(contentTypeKey);
if (NS_SUCCEEDED(rv)) {
nsAutoString contentType;
contentType = contenttypeheader;
contentType.Assign(contenttypeheader);
PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ;
if(kNotFound != start)
{

View File

@@ -111,7 +111,7 @@ void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame
PRBool nsFormControlHelper::GetBool(const nsString& aValue)
{
if (aValue == NS_STRING_TRUE)
if (aValue.Equals(NS_STRING_TRUE))
return(PR_TRUE);
else
return (PR_FALSE);

View File

@@ -191,7 +191,7 @@ void nsGfxAutoTextControlFrame::ReadAttributes(nsIContent* aContent)
if (NS_SUCCEEDED(aContent->GetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::autocompletetype, val)))
{
if (! val.IsEmpty())
mUseBlurr = (val == "blurr");
mUseBlurr = (val.Equals("blurr"));
}
}

View File

@@ -481,7 +481,7 @@ nsGfxButtonControlFrame::ButtonLocalize(char* aKey, nsString& oVal)
nsAutoString key(aKey);
rv = bundle->GetStringFromName(key.GetUnicode(), getter_Copies(valUni));
if (NS_SUCCEEDED(rv) && valUni) {
oVal = valUni;
oVal.Assign(valUni);
} else {
oVal.Truncate();
}

View File

@@ -549,9 +549,9 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou
nsGfxCheckboxControlFrame::CheckState
nsGfxCheckboxControlFrame::StringToCheckState ( const nsString & aStateAsString )
{
if ( aStateAsString == NS_STRING_TRUE )
if ( aStateAsString.Equals(NS_STRING_TRUE) )
return eOn;
else if ( aStateAsString == NS_STRING_FALSE )
else if ( aStateAsString.Equals(NS_STRING_FALSE) )
return eOff;
// not true and not false means mixed

View File

@@ -125,7 +125,7 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex,
NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue)
{
if (nsHTMLAtoms::checked == aName) {
PRBool state = (aValue == NS_STRING_TRUE) ? PR_TRUE : PR_FALSE;
PRBool state = (aValue.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
// if there is no form than the radiobtn is an orphan
@@ -365,7 +365,7 @@ nsGfxRadioControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState*
mIsRestored = PR_TRUE;
nsAutoString string;
aState->GetStateProperty("checked", string);
PRBool state = (string == NS_STRING_TRUE) ? PR_TRUE : PR_FALSE;
PRBool state = (string.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE;
SetRadioState(aPresContext, state); // sets mChecked
mRestoredChecked = mChecked;

View File

@@ -2277,7 +2277,7 @@ nsCSSFrameConstructor::TableProcessChild(nsIPresShell* aPresShell,
nsString charData;
domData->GetData(charData);
charData = charData.StripWhitespace();
if ((charData.Length() <= 0) && (charData != " ")) { // XXX check this
if ((charData.Length() <= 0) && (!charData.Equals(" "))) { // XXX check this
needCell = PR_FALSE; // only contains whitespace, don't create cell
}
NS_RELEASE(domData);
@@ -4326,7 +4326,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
const nsStyleUserInterface* ui= (const nsStyleUserInterface*)
styleContext->GetStyleData(eStyleStruct_UserInterface);
if (ui->mBehavior != "") {
if (!ui->mBehavior.IsEmpty()) {
// Get the XBL loader.
nsresult rv;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
@@ -4489,7 +4489,7 @@ nsCSSFrameConstructor::CreateAnonymousTreeCellFrames(nsIPresShell* aPresS
const nsStyleUserInterface* ui= (const nsStyleUserInterface*)
styleContext->GetStyleData(eStyleStruct_UserInterface);
if (ui->mBehavior != "") {
if (!ui->mBehavior.IsEmpty()) {
// Get the XBL loader.
nsresult rv;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
@@ -4577,7 +4577,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
aStyleContext->GetStyleData(eStyleStruct_UserInterface);
// Ensure that our XBL bindings are installed.
if (ui->mBehavior != "") {
if (!ui->mBehavior.IsEmpty()) {
// Get the XBL loader.
nsresult rv;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);

View File

@@ -405,7 +405,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
// in the excludes list.
nsAutoString excludes;
content->GetAttribute(kNameSpaceID_None, kExcludesAtom, excludes);
if (excludes != "*") {
if (!excludes.Equals("*")) {
if (!excludes.IsEmpty()) {
// Walk the children and ensure that all of them
// are in the excludes array.
@@ -450,7 +450,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
nsCOMPtr<nsIDOMAttr> attr(do_QueryInterface(attribute));
nsAutoString name;
attr->GetName(name);
if (name != "excludes") {
if (!name.Equals("excludes")) {
nsAutoString value;
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mBoundElement));
element->GetAttribute(name, value);
@@ -504,7 +504,7 @@ nsXBLBinding::InstallEventHandlers(nsIContent* aBoundElement)
nsAutoString type;
child->GetAttribute(kNameSpaceID_None, kTypeAtom, type);
if (type != "") {
if (!type.IsEmpty()) {
nsCOMPtr<nsIAtom> eventAtom = getter_AddRefs(NS_NewAtom(type));
PRBool found = PR_FALSE;
nsIID iid;
@@ -526,7 +526,7 @@ nsXBLBinding::InstallEventHandlers(nsIContent* aBoundElement)
PRBool useCapture = PR_FALSE;
nsAutoString capturer;
child->GetAttribute(kNameSpaceID_None, kCapturerAtom, capturer);
if (capturer == "true")
if (capturer.Equals("true"))
useCapture = PR_TRUE;
// Add the event listener.
@@ -569,7 +569,7 @@ nsXBLBinding::GetBaseTag(nsIAtom** aResult)
nsAutoString extends;
mBinding->GetAttribute(kNameSpaceID_None, kExtendsAtom, extends);
if (extends != "") {
if (!extends.IsEmpty()) {
// Obtain the namespace prefix.
nsAutoString prefix;
PRInt32 offset = extends.FindChar(kNameSpaceSeparator);
@@ -657,7 +657,7 @@ nsXBLBinding::AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool
// Construct a new text node and insert it.
nsAutoString value;
nsresult result = mBoundElement->GetAttribute(aNameSpaceID, aAttribute, value);
if (value != "") {
if (!value.IsEmpty()) {
nsCOMPtr<nsIDOMText> textNode;
nsCOMPtr<nsIDocument> doc;
mBoundElement->GetDocument(*getter_AddRefs(doc));
@@ -731,7 +731,7 @@ nsXBLBinding::IsInExcludesList(nsIAtom* aTag, const nsString& aList)
nsAutoString element;
aTag->ToString(element);
if (aList == "*")
if (aList.Equals("*"))
return PR_TRUE; // match _everything_!
PRInt32 indx = aList.Find(element);
@@ -762,7 +762,7 @@ nsXBLBinding::ConstructAttributeTable(nsIContent* aElement)
// ability to map one attribute to another.
nsAutoString inherits;
aElement->GetAttribute(kNameSpaceID_None, kInheritsAtom, inherits);
if (inherits != "") {
if (!inherits.IsEmpty()) {
if (!mAttributeTable) {
mAttributeTable = new nsSupportsHashtable(8);
}
@@ -825,7 +825,7 @@ nsXBLBinding::ConstructAttributeTable(nsIContent* aElement)
aElement->SetAttribute(kNameSpaceID_None, attribute, value, PR_TRUE);
nsCOMPtr<nsIAtom> tag;
aElement->GetTag(*getter_AddRefs(tag));
if ((tag.get() == kHTMLAtom) && (attribute.get() == kValueAtom) && value != "") {
if ((tag.get() == kHTMLAtom) && (attribute.get() == kValueAtom) && !value.IsEmpty()) {
nsCOMPtr<nsIDOMText> textNode;
nsCOMPtr<nsIDocument> doc;
mBoundElement->GetDocument(*getter_AddRefs(doc));
@@ -873,21 +873,21 @@ nsXBLBinding::GetEventHandlerIID(nsIAtom* aName, nsIID* aIID, PRBool* aFound)
PRBool
nsXBLBinding::IsMouseHandler(const nsString& aName)
{
return ((aName == "click") || (aName == "dblclick") || (aName=="mousedown") ||
(aName == "mouseover") || (aName == "mouseout") || (aName == "mouseup"));
return ((aName.Equals("click")) || (aName.Equals("dblclick")) || (aName.Equals("mousedown")) ||
(aName.Equals("mouseover")) || (aName.Equals("mouseout")) || (aName.Equals("mouseup")));
}
PRBool
nsXBLBinding::IsKeyHandler(const nsString& aName)
{
return ((aName == "keypress") || (aName == "keydown") || (aName == "keyup"));
return ((aName.Equals("keypress")) || (aName.Equals("keydown")) || (aName.Equals("keyup")));
}
PRBool
nsXBLBinding::IsXULHandler(const nsString& aName)
{
return ((aName == "create") || (aName == "destroy") || (aName=="broadcast") ||
(aName == "command") || (aName == "commandupdate") || (aName == "close"));
return ((aName.Equals("create")) || (aName.Equals("destroy")) || (aName.Equals("broadcast")) ||
(aName.Equals("command")) || (aName.Equals("commandupdate")) || (aName.Equals("close")));
}
NS_IMETHODIMP

View File

@@ -101,7 +101,7 @@ nsresult nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent)
{
if (mEventName != "keyup")
if (!mEventName.Equals("keyup"))
return NS_OK;
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
@@ -112,7 +112,7 @@ nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent)
nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent)
{
if (mEventName != "keydown")
if (!mEventName.Equals("keydown"))
return NS_OK;
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
@@ -123,7 +123,7 @@ nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent)
nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent)
{
if (mEventName != "keypress")
if (!mEventName.Equals("keypress"))
return NS_OK;
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aKeyEvent);
@@ -134,7 +134,7 @@ nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent)
nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "mousedown")
if (!mEventName.Equals("mousedown"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -145,7 +145,7 @@ nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "mouseup")
if (!mEventName.Equals("mouseup"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -156,7 +156,7 @@ nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "click")
if (!mEventName.Equals("click"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -167,7 +167,7 @@ nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "dblclick")
if (!mEventName.Equals("dblclick"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -178,7 +178,7 @@ nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "mouseover")
if (!mEventName.Equals("mouseover"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -189,7 +189,7 @@ nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent)
{
if (mEventName != "mouseout")
if (!mEventName.Equals("mouseout"))
return NS_OK;
nsCOMPtr<nsIDOMUIEvent> mouseEvent = do_QueryInterface(aMouseEvent);
@@ -200,7 +200,7 @@ nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent)
nsresult nsXBLEventHandler::Action(nsIDOMEvent* aEvent)
{
if (mEventName != "command")
if (!mEventName.Equals("command"))
return NS_OK;
ExecuteHandler(nsAutoString("command"), aEvent);
@@ -209,7 +209,7 @@ nsresult nsXBLEventHandler::Action(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::Create(nsIDOMEvent* aEvent)
{
if (mEventName != "create")
if (!mEventName.Equals("create"))
return NS_OK;
ExecuteHandler(nsAutoString("create"), aEvent);
@@ -218,7 +218,7 @@ nsresult nsXBLEventHandler::Create(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::Close(nsIDOMEvent* aEvent)
{
if (mEventName != "close")
if (!mEventName.Equals("close"))
return NS_OK;
ExecuteHandler(nsAutoString("close"), aEvent);
@@ -227,7 +227,7 @@ nsresult nsXBLEventHandler::Close(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::Broadcast(nsIDOMEvent* aEvent)
{
if (mEventName != "broadcast")
if (!mEventName.Equals("broadcast"))
return NS_OK;
ExecuteHandler(nsAutoString("broadcast"), aEvent);
@@ -236,7 +236,7 @@ nsresult nsXBLEventHandler::Broadcast(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::CommandUpdate(nsIDOMEvent* aEvent)
{
if (mEventName != "commandupdate")
if (!mEventName.Equals("commandupdate"))
return NS_OK;
ExecuteHandler(nsAutoString("commandupdate"), aEvent);
@@ -245,7 +245,7 @@ nsresult nsXBLEventHandler::CommandUpdate(nsIDOMEvent* aEvent)
nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent)
{
if (mEventName != "destroy")
if (!mEventName.Equals("destroy"))
return NS_OK;
ExecuteHandler(nsAutoString("destroy"), aEvent);

View File

@@ -340,7 +340,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
{
*aResult = nsnull;
if (aURLStr == nsCAutoString(""))
if (aURLStr.IsEmpty())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIURL> uri;
@@ -379,7 +379,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::name, value);
// If no ref is specified just use this.
if ((bindingName == "") || (bindingName == value)) {
if ((bindingName.IsEmpty()) || (bindingName == value)) {
// Make a new binding
NS_NewXBLBinding(aResult);
@@ -388,7 +388,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
// Check for the presence of an extends attribute
child->GetAttribute(kNameSpaceID_None, kExtendsAtom, value);
if (value != "") {
if (!value.IsEmpty()) {
// See if we are extending a builtin tag.
nsCOMPtr<nsIAtom> tag;
(*aResult)->GetBaseTag(getter_AddRefs(tag));
@@ -538,7 +538,7 @@ nsXBLService::StripWhitespaceNodes(nsIContent* aElement)
nsAutoString result;
text->CopyText(result);
result.StripWhitespace();
if (result == "") {
if (result.IsEmpty()) {
// This node contained nothing but whitespace.
// Remove it from the content model.
aElement->RemoveChildAt(i, PR_TRUE);

View File

@@ -1960,7 +1960,7 @@ nsXMLContentSink::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aR
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
progID += nameSpace;
progID.Append(nameSpace);
// Retrieve the appropriate factory.
NS_WITH_SERVICE(nsIElementFactory, elementFactory, progID, &rv);

View File

@@ -276,7 +276,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(contentTypeKey);
if (NS_SUCCEEDED(rv)) {
nsAutoString contentType;
contentType = contenttypeheader;
contentType.Assign(contenttypeheader);
PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ;
if(kNotFound != start)
{

View File

@@ -91,7 +91,7 @@ nsGrippyFrame::MouseClicked(nsIPresContext* aPresContext)
nsString value;
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::state, value))
{
if (value=="collapsed")
if (value.Equals("collapsed"))
a = "open";
}

View File

@@ -611,7 +611,7 @@ nsMenuBarFrame::IsDisabled(nsIContent* aContent)
{
nsString disabled = "";
aContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
if (disabled == "true")
if (disabled.Equals("true"))
return PR_TRUE;
return PR_FALSE;
}

View File

@@ -233,7 +233,7 @@ nsMenuFrame::GetFrameForPoint(nsIPresContext* aPresContext,
// This allows selective overriding for subcontent.
nsAutoString value;
content->GetAttribute(kNameSpaceID_None, nsXULAtoms::allowevents, value);
if (value == "true")
if (value.Equals("true"))
return result;
}
const nsStyleDisplay* disp = (const nsStyleDisplay*)
@@ -407,7 +407,7 @@ PRBool nsMenuFrame::IsGenerated()
if (child) {
nsString genVal;
child->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, genVal);
if (genVal == "")
if (genVal.IsEmpty())
return PR_FALSE;
}
@@ -426,7 +426,7 @@ nsMenuFrame::MarkAsGenerated()
if (child) {
nsAutoString genVal;
child->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, genVal);
if (genVal == "")
if (genVal.IsEmpty())
child->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, "true", PR_TRUE);
}
@@ -468,7 +468,7 @@ nsMenuFrame::AttributeChanged(nsIPresContext* aPresContext,
if (aAttribute == nsXULAtoms::open) {
aChild->GetAttribute(kNameSpaceID_None, aAttribute, value);
if (value == "true")
if (value.Equals("true"))
OpenMenuInternal(PR_TRUE);
else
OpenMenuInternal(PR_FALSE);
@@ -572,15 +572,15 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag)
if (onMenuBar) {
if (popupAnchor == "")
if (popupAnchor.IsEmpty())
popupAnchor = "bottomleft";
if (popupAlign == "")
if (popupAlign.IsEmpty())
popupAlign = "topleft";
}
else {
if (popupAnchor == "")
if (popupAnchor.IsEmpty())
popupAnchor = "topright";
if (popupAlign == "")
if (popupAlign.IsEmpty())
popupAlign = "topleft";
}
@@ -837,15 +837,15 @@ nsMenuFrame::DidReflow(nsIPresContext* aPresContext,
mMenuParent->IsMenuBar(onMenuBar);
if (onMenuBar) {
if (popupAnchor == "")
if (popupAnchor.IsEmpty())
popupAnchor = "bottomleft";
if (popupAlign == "")
if (popupAlign.IsEmpty())
popupAlign = "topleft";
}
else {
if (popupAnchor == "")
if (popupAnchor.IsEmpty())
popupAnchor = "topright";
if (popupAlign == "")
if (popupAlign.IsEmpty())
popupAlign = "topleft";
}
@@ -945,7 +945,7 @@ nsMenuFrame::Notify(nsITimer* aTimer)
if (!mMenuOpen && mMenuParent) {
nsAutoString active = "";
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, active);
if (active == "true") {
if (active.Equals("true")) {
// We're still the active menu.
OpenMenu(PR_TRUE);
}
@@ -962,7 +962,7 @@ nsMenuFrame::IsDisabled()
{
nsAutoString disabled;
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
if (disabled == "true")
if (disabled.Equals("true"))
return PR_TRUE;
return PR_FALSE;
}
@@ -972,9 +972,9 @@ nsMenuFrame::UpdateMenuType(nsIPresContext* aPresContext)
{
nsAutoString value;
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, value);
if (value == "checkbox")
if (value.Equals("checkbox"))
mType = eMenuType_Checkbox;
else if (value == "radio") {
else if (value.Equals("radio")) {
mType = eMenuType_Radio;
nsAutoString value;
@@ -999,7 +999,7 @@ nsMenuFrame::UpdateMenuSpecialState(nsIPresContext* aPresContext) {
mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked,
value);
newChecked = (value == "true");
newChecked = (value.Equals("true"));
if (newChecked == mChecked) {
/* checked state didn't change */
@@ -1093,7 +1093,7 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString)
{
nsString accelText;
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::acceltext, accelText);
if (accelText != "") {
if (!accelText.IsEmpty()) {
// Just use this.
aAccelString = accelText;
return;
@@ -1137,7 +1137,7 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString)
nsAutoString xulkey;
keyElement->GetAttribute(nsAutoString("xulkey"), xulkey);
if (xulkey == "true") {
if (xulkey.Equals("true")) {
// Set the default for the xul key modifier
#ifdef XP_MAC
commandValue = "true";
@@ -1150,24 +1150,24 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString)
PRBool prependPlus = PR_FALSE;
if(commandValue != "" && commandValue != "false") {
if(!commandValue.IsEmpty() && !commandValue.Equals("false")) {
prependPlus = PR_TRUE;
aAccelString += "Ctrl"; // Hmmm. Kinda defeats the point of having an abstraction.
}
if(controlValue != "" && controlValue != "false") {
if(!controlValue.IsEmpty() && !controlValue.Equals("false")) {
prependPlus = PR_TRUE;
aAccelString += "Ctrl";
}
if(shiftValue != "" && shiftValue != "false") {
if(!shiftValue.IsEmpty() && !shiftValue.Equals("false")) {
if (prependPlus)
aAccelString += "+";
prependPlus = PR_TRUE;
aAccelString += "Shift";
}
if (altValue != "" && altValue != "false") {
if (!altValue.IsEmpty() && !altValue.Equals("false")) {
if (prependPlus)
aAccelString += "+";
prependPlus = PR_TRUE;
@@ -1175,14 +1175,14 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString)
}
keyChar.ToUpperCase();
if (keyChar != "") {
if (!keyChar.IsEmpty()) {
if (prependPlus)
aAccelString += "+";
prependPlus = PR_TRUE;
aAccelString += keyChar;
}
if (aAccelString != "")
if (!aAccelString.IsEmpty())
mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::acceltext, aAccelString, PR_FALSE);
}

View File

@@ -319,35 +319,35 @@ nsMenuPopupFrame :: AdjustPositionForAnchorAlign ( PRInt32* ioXPos, PRInt32* ioY
const nsString& aPopupAnchor, const nsString& aPopupAlign,
PRBool* outFlushWithTopBottom )
{
if (aPopupAnchor == "topright" && aPopupAlign == "topleft") {
if (aPopupAnchor.Equals("topright") && aPopupAlign.Equals("topleft")) {
*ioXPos += inParentRect.width;
}
else if (aPopupAnchor == "topright" && aPopupAlign == "bottomright") {
else if (aPopupAnchor.Equals("topright") && aPopupAlign.Equals("bottomright")) {
*ioXPos -= (mRect.width - inParentRect.width);
*ioYPos -= mRect.height;
*outFlushWithTopBottom = PR_TRUE;
}
else if (aPopupAnchor == "bottomright" && aPopupAlign == "bottomleft") {
else if (aPopupAnchor.Equals("bottomright") && aPopupAlign.Equals("bottomleft")) {
*ioXPos += inParentRect.width;
*ioYPos -= (mRect.height - inParentRect.height);
}
else if (aPopupAnchor == "bottomright" && aPopupAlign == "topright") {
else if (aPopupAnchor.Equals("bottomright") && aPopupAlign.Equals("topright")) {
*ioXPos -= (mRect.width - inParentRect.width);
*ioYPos += inParentRect.height;
*outFlushWithTopBottom = PR_TRUE;
}
else if (aPopupAnchor == "topleft" && aPopupAlign == "topright") {
else if (aPopupAnchor.Equals("topleft") && aPopupAlign.Equals("topright")) {
*ioXPos -= mRect.width;
}
else if (aPopupAnchor == "topleft" && aPopupAlign == "bottomleft") {
else if (aPopupAnchor.Equals("topleft") && aPopupAlign.Equals("bottomleft")) {
*ioYPos -= mRect.height;
*outFlushWithTopBottom = PR_TRUE;
}
else if (aPopupAnchor == "bottomleft" && aPopupAlign == "bottomright") {
else if (aPopupAnchor.Equals("bottomleft") && aPopupAlign.Equals("bottomright")) {
*ioXPos -= mRect.width;
*ioYPos -= (mRect.height - inParentRect.height);
}
else if (aPopupAnchor == "bottomleft" && aPopupAlign == "topleft") {
else if (aPopupAnchor.Equals("bottomleft") && aPopupAlign.Equals("topleft")) {
*ioYPos += inParentRect.height;
*outFlushWithTopBottom = PR_TRUE;
}
@@ -709,7 +709,7 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
nsAutoString shouldDisplay, menuActive;
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, menuActive);
if (menuActive != "true") {
if (!menuActive.Equals("true")) {
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, shouldDisplay);
if ( shouldDisplay.Equals("true") )
mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, "true", PR_TRUE);
@@ -1221,7 +1221,7 @@ nsMenuPopupFrame::IsDisabled(nsIContent* aContent)
{
nsString disabled = "";
aContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
if (disabled == "true")
if (disabled.Equals("true"))
return PR_TRUE;
return PR_FALSE;
}

View File

@@ -336,9 +336,9 @@ nsPopupSetFrame::DidReflow(nsIPresContext* aPresContext,
menuPopupContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::popupanchor, popupAnchor);
menuPopupContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::popupalign, popupAlign);
if (popupAnchor == "")
if (popupAnchor.IsEmpty())
popupAnchor = "bottomleft";
if (popupAlign == "")
if (popupAlign.IsEmpty())
popupAlign = "topleft";
((nsMenuPopupFrame*)activeChild)->SyncViewWithFrame(aPresContext, popupAnchor, popupAlign, mElementFrame, mXPos, mYPos);
@@ -442,7 +442,7 @@ nsPopupSetFrame::CreatePopup(nsIFrame* aElementFrame, nsIContent* aPopupContent,
// determine if this menu is a context menu and flag it
nsIFrame* activeChild = GetActiveChild();
nsCOMPtr<nsIMenuParent> childPopup ( do_QueryInterface(activeChild) );
if ( childPopup && aPopupType == "context" )
if ( childPopup && aPopupType.Equals("context") )
childPopup->SetIsContextMenu(PR_TRUE);
// Now we'll have it in our child frame list.
@@ -482,7 +482,7 @@ nsPopupSetFrame::MarkAsGenerated(nsIContent* aPopupContent)
nsAutoString value;
childContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated,
value);
if (value == "true") {
if (value.Equals("true")) {
// Ungenerate this element.
childContent->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated,
PR_TRUE);
@@ -494,7 +494,7 @@ nsPopupSetFrame::MarkAsGenerated(nsIContent* aPopupContent)
nsAutoString value;
aPopupContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated,
value);
if (value != "true") {
if (!value.Equals("true")) {
// Generate this element.
aPopupContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, "true",
PR_TRUE);

View File

@@ -295,7 +295,7 @@ nsSliderFrame::IsHorizontal(nsIContent* scrollbar)
nsAutoString value;
if (NS_CONTENT_ATTR_HAS_VALUE == scrollbar->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, value))
{
if (value=="vertical")
if (value.Equals("vertical"))
isHorizontal = PR_FALSE;
}

View File

@@ -294,7 +294,7 @@ nsTitledButtonFrame::Init(nsIPresContext* aPresContext,
nsAutoString accesskey;
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey,
accesskey);
if (accesskey != "") {
if (!accesskey.IsEmpty()) {
mAccesskeyIndex = mTitle.Find(accesskey, PR_TRUE);
if (mAccesskeyIndex == -1) {
nsString tmpstring = "(" ;
@@ -808,7 +808,7 @@ nsTitledButtonFrame::UpdateAccessUnderline()
nsAutoString accesskey;
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey,
accesskey);
if (accesskey == "")
if (accesskey.IsEmpty())
return; // our work here is done
mAccesskeyIndex = mCroppedTitle.Find(accesskey, PR_TRUE);
@@ -1280,9 +1280,9 @@ nsTitledButtonFrame::MouseClicked (nsIPresContext* aPresContext)
nsTitledButtonFrame::CheckState
nsTitledButtonFrame :: StringToCheckState ( const nsString & aStateAsString )
{
if ( aStateAsString == NS_STRING_TRUE )
if ( aStateAsString.Equals(NS_STRING_TRUE) )
return eOn;
else if ( aStateAsString == NS_STRING_FALSE )
else if ( aStateAsString.Equals(NS_STRING_FALSE) )
return eOff;
// not true and not false means mixed

View File

@@ -458,7 +458,7 @@ nsToolboxFrame::CalculateGrippies(nsIPresContext* aPresContext)
value = "";
childContent->GetAttribute(kNameSpaceID_None, kCollapsedAtom, value);
if (value == "true") { // The bar is collapsed!
if (value.Equals("true")) { // The bar is collapsed!
nscoord grippyWidth;
nscoord grippyHeight;

View File

@@ -84,7 +84,7 @@ nsTreeCellFrame::Init(nsIPresContext* aPresContext,
nsresult result = aContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::allowevents, attrValue);
attrValue.ToLowerCase();
PRBool allowEvents = (result == NS_CONTENT_ATTR_NO_VALUE ||
(result == NS_CONTENT_ATTR_HAS_VALUE && attrValue=="true"));
(result == NS_CONTENT_ATTR_HAS_VALUE && attrValue.Equals("true")));
SetAllowEvents(allowEvents);
// Determine if we're a column header or not.
@@ -171,7 +171,7 @@ nsTreeCellFrame::GetFrameForPoint(nsIPresContext* aPresContext,
// This allows selective overriding for subcontent.
nsAutoString value;
content->GetAttribute(kNameSpaceID_None, nsXULAtoms::allowevents, value);
if (value == "true")
if (value.Equals("true"))
return result;
}
}
@@ -356,7 +356,7 @@ nsTreeCellFrame::ToggleOpenClose()
nsAutoString attrValue;
treeItem->GetAttribute("open", attrValue);
attrValue.ToLowerCase();
PRBool isExpanded = (attrValue=="true");
PRBool isExpanded = (attrValue.Equals("true"));
if (isExpanded)
{
// We're collapsing and need to remove frames from the flow.
@@ -391,7 +391,7 @@ nsTreeCellFrame::Open()
nsAutoString attrValue;
treeItem->GetAttribute("open", attrValue);
attrValue.ToLowerCase();
PRBool isExpanded = (attrValue=="true");
PRBool isExpanded = (attrValue.Equals("true"));
if (!isExpanded) {
// We're expanding and need to add frames to the flow.
treeItem->SetAttribute("open", "true");
@@ -420,7 +420,7 @@ nsTreeCellFrame::Close()
nsAutoString attrValue;
treeItem->GetAttribute("open", attrValue);
attrValue.ToLowerCase();
PRBool isExpanded = (attrValue=="true");
PRBool isExpanded = (attrValue.Equals("true"));
if (isExpanded) {
// We're expanding and need to add frames to the flow.
treeItem->RemoveAttribute("open");

View File

@@ -491,7 +491,7 @@ nsTreeFrame::Init(nsIPresContext* aPresContext,
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mContent);
element->GetAttribute("rows", value);
if (value != "") {
if (!value.IsEmpty()) {
PRInt32 dummy;
PRInt32 count = value.ToInteger(&dummy);
mFixedRows = count;
@@ -512,7 +512,7 @@ nsTreeFrame::ContainsFlexibleColumn(PRInt32 aStartIndex, PRInt32 aEndIndex,
if (colContent) {
nsAutoString fixedValue;
colContent->GetAttribute(kNameSpaceID_None, fixedAtom, fixedValue);
if (fixedValue != "true") {
if (!fixedValue.Equals("true")) {
// We are a proportional column.
if (aResult)
*aResult = result;

View File

@@ -309,7 +309,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext,
if (colContent) {
nsAutoString fixedValue;
colContent->GetAttribute(kNameSpaceID_None, fixedAtom, fixedValue);
if (fixedValue != "true") {
if (!fixedValue.Equals("true")) {
// We are a proportional column and should be annotated with our current
// width.
PRInt32 colWidth = treeFrame->GetColumnWidth(i);

View File

@@ -539,7 +539,7 @@ nsTreeRowGroupFrame::FindRowContentAtIndex(PRInt32& aIndex,
nsCOMPtr<nsIAtom> openAtom = dont_AddRef(NS_NewAtom("open"));
nsAutoString isOpen;
childContent->GetAttribute(kNameSpaceID_None, openAtom, isOpen);
if (isOpen == "true") {
if (isOpen.Equals("true")) {
// Find the <treechildren> node.
PRInt32 childContentCount;
nsCOMPtr<nsIContent> grandChild;
@@ -615,7 +615,7 @@ nsTreeRowGroupFrame::FindPreviousRowContent(PRInt32& aDelta, nsIContent* aUpward
nsCOMPtr<nsIAtom> openAtom = dont_AddRef(NS_NewAtom("open"));
nsAutoString isOpen;
childContent->GetAttribute(kNameSpaceID_None, openAtom, isOpen);
if (isOpen == "true") {
if (isOpen.Equals("true")) {
// Find the <treechildren> node.
PRInt32 childContentCount;
nsCOMPtr<nsIContent> grandChild;
@@ -683,7 +683,7 @@ nsTreeRowGroupFrame::ComputeTotalRowCount(PRInt32& aCount, nsIContent* aParent)
nsCOMPtr<nsIContent> parent;
childContent->GetParent(*getter_AddRefs(parent));
parent->GetAttribute(kNameSpaceID_None, openAtom, isOpen);
if (isOpen == "true")
if (isOpen.Equals("true"))
ComputeTotalRowCount(aCount, childContent);
}
}
@@ -1566,7 +1566,7 @@ nsTreeRowGroupFrame::ReflowScrollbar(nsIPresContext* aPresContext)
nsXULAtoms::curpos, value);
}
if (nukeScrollbar || (value == "0" && !mIsFull)) {
if (nukeScrollbar || (value.Equals("0") && !mIsFull)) {
// clear the scrollbar out of the event state manager so that the
// event manager doesn't send events to the destroyed scrollbar frames

View File

@@ -88,11 +88,11 @@ nsTreeTwistyListener::MouseDown(nsIDOMEvent* aEvent)
nsAutoString tagName;
element->GetTagName(tagName);
if (tagName == "titledbutton") {
if (tagName.Equals("titledbutton")) {
// Find out if we're the twisty.
nsAutoString classAttr;
element->GetAttribute("class", classAttr);
if (classAttr == "twisty") {
if (classAttr.Equals("twisty")) {
// Retrieve the parent treeitem.
nsCOMPtr<nsIDOMElement> treeItem;
GetTreeItem(element, getter_AddRefs(treeItem));
@@ -107,7 +107,7 @@ nsTreeTwistyListener::MouseDown(nsIDOMEvent* aEvent)
nsAutoString open;
treeItem->GetAttribute("open", open);
if (open == "true")
if (open.Equals("true"))
treeItem->RemoveAttribute("open");
else treeItem->SetAttribute("open", "true");
}

View File

@@ -139,7 +139,7 @@ nsXULTextFrame::Init(nsIPresContext* aPresContext,
nsAutoString accesskey;
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey,
accesskey);
if (accesskey != "") {
if (!accesskey.IsEmpty()) {
if (!mAccessKeyInfo)
mAccessKeyInfo = new nsAccessKeyInfo();
@@ -540,7 +540,7 @@ nsXULTextFrame::UpdateAccessUnderline()
nsAutoString accesskey;
mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey,
accesskey);
if (accesskey == "") {
if (accesskey.IsEmpty()) {
if (mAccessKeyInfo) {
delete mAccessKeyInfo;
mAccessKeyInfo = nsnull;