bug 104126 - remove nsStringArray::IndexOfIgnoreCase and its one consumer. sr=attinasi, r=jag
git-svn-id: svn://10.0.0.236/trunk@105133 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
8004e4a54e
commit
3d31b470bc
@ -1844,7 +1844,7 @@ PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
|
||||
if (mStyleSet) {
|
||||
PRInt32 count = mStyleSet->GetNumberOfDocStyleSheets();
|
||||
PRInt32 index;
|
||||
nsAutoString textHtml; textHtml.AssignWithConversion("text/html");
|
||||
NS_NAMED_LITERAL_STRING(textHtml, "text/html");
|
||||
for (index = 0; index < count; index++) {
|
||||
nsIStyleSheet* sheet = mStyleSet->GetDocStyleSheetAt(index);
|
||||
if (nsnull != sheet) {
|
||||
@ -1872,7 +1872,7 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
|
||||
PRInt32 count = 0;
|
||||
mDocument->GetNumberOfStyleSheets(&count);
|
||||
PRInt32 index;
|
||||
nsAutoString textHtml; textHtml.AssignWithConversion("text/html");
|
||||
NS_NAMED_LITERAL_STRING(textHtml,"text/html");
|
||||
for (index = 0; index < count; index++) {
|
||||
nsCOMPtr<nsIStyleSheet> sheet;
|
||||
mDocument->GetStyleSheetAt(index, getter_AddRefs(sheet));
|
||||
@ -1883,7 +1883,7 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
|
||||
nsAutoString title;
|
||||
sheet->GetTitle(title);
|
||||
if (0 < title.Length()) {
|
||||
if (title.EqualsIgnoreCase(aSheetTitle)) {
|
||||
if (title.Equals(aSheetTitle)) {
|
||||
mStyleSet->AddDocStyleSheet(sheet, mDocument);
|
||||
}
|
||||
else {
|
||||
@ -1905,7 +1905,7 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
|
||||
PRInt32 count = 0;
|
||||
mDocument->GetNumberOfStyleSheets(&count);
|
||||
PRInt32 index;
|
||||
nsAutoString textHtml; textHtml.AssignWithConversion("text/html");
|
||||
NS_NAMED_LITERAL_STRING(textHtml,"text/html");
|
||||
for (index = 0; index < count; index++) {
|
||||
nsCOMPtr<nsIStyleSheet> sheet;
|
||||
mDocument->GetStyleSheetAt(index, getter_AddRefs(sheet));
|
||||
@ -1916,7 +1916,7 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
|
||||
nsAutoString title;
|
||||
sheet->GetTitle(title);
|
||||
if (0 < title.Length()) {
|
||||
if (-1 == aTitleList.IndexOfIgnoreCase(title)) {
|
||||
if (-1 == aTitleList.IndexOf(title)) {
|
||||
aTitleList.AppendString(title);
|
||||
}
|
||||
}
|
||||
@ -3185,7 +3185,7 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList>nodeList;
|
||||
nsAutoString bodyTag; bodyTag.AssignWithConversion("body");
|
||||
NS_NAMED_LITERAL_STRING(bodyTag, "body");
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(document);
|
||||
if (!doc)
|
||||
@ -3850,7 +3850,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName)
|
||||
nsAutoString tagName;
|
||||
if (element && NS_SUCCEEDED(element->GetTagName(tagName))) {
|
||||
tagName.ToLowerCase();
|
||||
if (tagName.EqualsWithConversion("a")) {
|
||||
if (tagName.Equals(NS_LITERAL_STRING("a"))) {
|
||||
content = do_QueryInterface(element);
|
||||
break;
|
||||
}
|
||||
@ -4176,7 +4176,7 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
|
||||
if (element) {
|
||||
NS_NAMED_LITERAL_STRING(xlinkNS,"http://www.w3.org/1999/xlink");
|
||||
element->GetAttributeNS(xlinkNS,NS_LITERAL_STRING("type"),xlinkType);
|
||||
if (xlinkType.EqualsWithConversion("simple")) {
|
||||
if (xlinkType.Equals(NS_LITERAL_STRING("simple"))) {
|
||||
element->GetAttributeNS(xlinkNS,NS_LITERAL_STRING("href"),anchorText);
|
||||
if (!anchorText.IsEmpty()) {
|
||||
// Resolve the full URI using baseURI property
|
||||
@ -4206,7 +4206,7 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
|
||||
}
|
||||
}
|
||||
|
||||
if (anchor || area || link || xlinkType.EqualsWithConversion("simple")) {
|
||||
if (anchor || area || link || xlinkType.Equals(NS_LITERAL_STRING("simple"))) {
|
||||
// get the clipboard helper
|
||||
nsCOMPtr<nsIClipboardHelper>
|
||||
clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv));
|
||||
@ -6298,7 +6298,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
|
||||
}
|
||||
}
|
||||
else {
|
||||
name.AssignWithConversion("(null)");
|
||||
name.Assign(NS_LITERAL_STRING("(null)"));
|
||||
}
|
||||
fputs(name, stdout);
|
||||
|
||||
@ -6313,7 +6313,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
|
||||
}
|
||||
}
|
||||
else {
|
||||
name.AssignWithConversion("(null)");
|
||||
name.Assign(NS_LITERAL_STRING("(null)"));
|
||||
}
|
||||
fputs(name, stdout);
|
||||
|
||||
|
||||
@ -1844,7 +1844,7 @@ PresShell::GetActiveAlternateStyleSheet(nsString& aSheetTitle)
|
||||
if (mStyleSet) {
|
||||
PRInt32 count = mStyleSet->GetNumberOfDocStyleSheets();
|
||||
PRInt32 index;
|
||||
nsAutoString textHtml; textHtml.AssignWithConversion("text/html");
|
||||
NS_NAMED_LITERAL_STRING(textHtml, "text/html");
|
||||
for (index = 0; index < count; index++) {
|
||||
nsIStyleSheet* sheet = mStyleSet->GetDocStyleSheetAt(index);
|
||||
if (nsnull != sheet) {
|
||||
@ -1872,7 +1872,7 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
|
||||
PRInt32 count = 0;
|
||||
mDocument->GetNumberOfStyleSheets(&count);
|
||||
PRInt32 index;
|
||||
nsAutoString textHtml; textHtml.AssignWithConversion("text/html");
|
||||
NS_NAMED_LITERAL_STRING(textHtml,"text/html");
|
||||
for (index = 0; index < count; index++) {
|
||||
nsCOMPtr<nsIStyleSheet> sheet;
|
||||
mDocument->GetStyleSheetAt(index, getter_AddRefs(sheet));
|
||||
@ -1883,7 +1883,7 @@ PresShell::SelectAlternateStyleSheet(const nsString& aSheetTitle)
|
||||
nsAutoString title;
|
||||
sheet->GetTitle(title);
|
||||
if (0 < title.Length()) {
|
||||
if (title.EqualsIgnoreCase(aSheetTitle)) {
|
||||
if (title.Equals(aSheetTitle)) {
|
||||
mStyleSet->AddDocStyleSheet(sheet, mDocument);
|
||||
}
|
||||
else {
|
||||
@ -1905,7 +1905,7 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
|
||||
PRInt32 count = 0;
|
||||
mDocument->GetNumberOfStyleSheets(&count);
|
||||
PRInt32 index;
|
||||
nsAutoString textHtml; textHtml.AssignWithConversion("text/html");
|
||||
NS_NAMED_LITERAL_STRING(textHtml,"text/html");
|
||||
for (index = 0; index < count; index++) {
|
||||
nsCOMPtr<nsIStyleSheet> sheet;
|
||||
mDocument->GetStyleSheetAt(index, getter_AddRefs(sheet));
|
||||
@ -1916,7 +1916,7 @@ PresShell::ListAlternateStyleSheets(nsStringArray& aTitleList)
|
||||
nsAutoString title;
|
||||
sheet->GetTitle(title);
|
||||
if (0 < title.Length()) {
|
||||
if (-1 == aTitleList.IndexOfIgnoreCase(title)) {
|
||||
if (-1 == aTitleList.IndexOf(title)) {
|
||||
aTitleList.AppendString(title);
|
||||
}
|
||||
}
|
||||
@ -3185,7 +3185,7 @@ PresShell::CompleteMove(PRBool aForward, PRBool aExtend)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNodeList>nodeList;
|
||||
nsAutoString bodyTag; bodyTag.AssignWithConversion("body");
|
||||
NS_NAMED_LITERAL_STRING(bodyTag, "body");
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(document);
|
||||
if (!doc)
|
||||
@ -3850,7 +3850,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName)
|
||||
nsAutoString tagName;
|
||||
if (element && NS_SUCCEEDED(element->GetTagName(tagName))) {
|
||||
tagName.ToLowerCase();
|
||||
if (tagName.EqualsWithConversion("a")) {
|
||||
if (tagName.Equals(NS_LITERAL_STRING("a"))) {
|
||||
content = do_QueryInterface(element);
|
||||
break;
|
||||
}
|
||||
@ -4176,7 +4176,7 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
|
||||
if (element) {
|
||||
NS_NAMED_LITERAL_STRING(xlinkNS,"http://www.w3.org/1999/xlink");
|
||||
element->GetAttributeNS(xlinkNS,NS_LITERAL_STRING("type"),xlinkType);
|
||||
if (xlinkType.EqualsWithConversion("simple")) {
|
||||
if (xlinkType.Equals(NS_LITERAL_STRING("simple"))) {
|
||||
element->GetAttributeNS(xlinkNS,NS_LITERAL_STRING("href"),anchorText);
|
||||
if (!anchorText.IsEmpty()) {
|
||||
// Resolve the full URI using baseURI property
|
||||
@ -4206,7 +4206,7 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
|
||||
}
|
||||
}
|
||||
|
||||
if (anchor || area || link || xlinkType.EqualsWithConversion("simple")) {
|
||||
if (anchor || area || link || xlinkType.Equals(NS_LITERAL_STRING("simple"))) {
|
||||
// get the clipboard helper
|
||||
nsCOMPtr<nsIClipboardHelper>
|
||||
clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv));
|
||||
@ -6298,7 +6298,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
|
||||
}
|
||||
}
|
||||
else {
|
||||
name.AssignWithConversion("(null)");
|
||||
name.Assign(NS_LITERAL_STRING("(null)"));
|
||||
}
|
||||
fputs(name, stdout);
|
||||
|
||||
@ -6313,7 +6313,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
|
||||
}
|
||||
}
|
||||
else {
|
||||
name.AssignWithConversion("(null)");
|
||||
name.Assign(NS_LITERAL_STRING("(null)"));
|
||||
}
|
||||
fputs(name, stdout);
|
||||
|
||||
|
||||
@ -804,26 +804,6 @@ nsStringArray::IndexOf(const nsAReadableString& aPossibleString) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsStringArray::IndexOfIgnoreCase(const nsAReadableString& aPossibleString) const
|
||||
{
|
||||
if (mImpl)
|
||||
{
|
||||
void** ap = mImpl->mArray;
|
||||
void** end = ap + mImpl->mCount;
|
||||
while (ap < end)
|
||||
{
|
||||
nsString* string = NS_STATIC_CAST(nsString*, *ap);
|
||||
if (!Compare(*string, aPossibleString, nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
return ap - mImpl->mArray;
|
||||
}
|
||||
ap++;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsStringArray::InsertStringAt(const nsAReadableString& aString, PRInt32 aIndex)
|
||||
{
|
||||
@ -860,17 +840,6 @@ nsStringArray::RemoveString(const nsAReadableString& aString)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsStringArray::RemoveStringIgnoreCase(const nsAReadableString& aString)
|
||||
{
|
||||
PRInt32 index = IndexOfIgnoreCase(aString);
|
||||
if (-1 < index)
|
||||
{
|
||||
return RemoveStringAt(index);
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsStringArray::RemoveStringAt(PRInt32 aIndex)
|
||||
{
|
||||
nsString* string = StringAt(aIndex);
|
||||
@ -901,22 +870,11 @@ CompareString(const nsString* aString1, const nsString* aString2, void*)
|
||||
return Compare(*aString1, *aString2);
|
||||
}
|
||||
|
||||
PR_STATIC_CALLBACK(int)
|
||||
CompareStringIgnoreCase(const nsString* aString1, const nsString* aString2, void*)
|
||||
{
|
||||
return Compare(*aString1, *aString2, nsCaseInsensitiveStringComparator());
|
||||
}
|
||||
|
||||
void nsStringArray::Sort(void)
|
||||
{
|
||||
Sort(CompareString, nsnull);
|
||||
}
|
||||
|
||||
void nsStringArray::SortIgnoreCase(void)
|
||||
{
|
||||
Sort(CompareStringIgnoreCase, nsnull);
|
||||
}
|
||||
|
||||
void nsStringArray::Sort(nsStringArrayComparatorFunc aFunc, void* aData)
|
||||
{
|
||||
nsVoidArray::Sort(NS_REINTERPRET_CAST(nsVoidArrayComparatorFunc, aFunc), aData);
|
||||
@ -1055,7 +1013,7 @@ nsCStringArray::IndexOfIgnoreCase(const nsCString& aPossibleString) const
|
||||
while (ap < end)
|
||||
{
|
||||
nsCString* string = NS_STATIC_CAST(nsCString*, *ap);
|
||||
if (string->EqualsIgnoreCase(aPossibleString))
|
||||
if (nsCRT::strcasecmp((*string).get(),aPossibleString.get())==0)
|
||||
{
|
||||
return ap - mImpl->mArray;
|
||||
}
|
||||
|
||||
@ -195,7 +195,6 @@ public:
|
||||
nsString* operator[](PRInt32 aIndex) const { return StringAt(aIndex); }
|
||||
|
||||
PRInt32 IndexOf(const nsAReadableString& aPossibleString) const;
|
||||
PRInt32 IndexOfIgnoreCase(const nsAReadableString& aPossibleString) const;
|
||||
|
||||
PRBool InsertStringAt(const nsAReadableString& aString, PRInt32 aIndex);
|
||||
|
||||
@ -206,7 +205,6 @@ public:
|
||||
}
|
||||
|
||||
PRBool RemoveString(const nsAReadableString& aString);
|
||||
PRBool RemoveStringIgnoreCase(const nsAReadableString& aString);
|
||||
PRBool RemoveStringAt(PRInt32 aIndex);
|
||||
void Clear(void);
|
||||
|
||||
@ -215,7 +213,6 @@ public:
|
||||
}
|
||||
|
||||
void Sort(void);
|
||||
void SortIgnoreCase(void);
|
||||
void Sort(nsStringArrayComparatorFunc aFunc, void* aData);
|
||||
|
||||
PRBool EnumerateForwards(nsStringArrayEnumFunc aFunc, void* aData);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user