Bug 1006982 - Refactor anchor tag utility functions in nsHTMLEditor.cpp. r=ehsan
authorChris Peterson <cpeterson@mozilla.com>
Tue, 06 May 2014 21:29:20 -0700
changeset 182076 b9dc81faaec5f30f1ff614d2c7aed79f7d95440c
parent 182075 f1ef4bceb5933df1ea37f6f459b615618af9ce70
child 182077 d1934e246ff407e2d920a86f24bbdf02926efebe
push id43199
push usercpeterson@mozilla.com
push dateThu, 08 May 2014 01:08:02 +0000
treeherdermozilla-inbound@d1934e246ff4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1006982
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1006982 - Refactor anchor tag utility functions in nsHTMLEditor.cpp. r=ehsan
editor/libeditor/html/nsHTMLEditor.cpp
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -75,23 +75,28 @@
 #include "mozilla/dom/HTMLBodyElement.h"
 #include "nsTextFragment.h"
 #include "nsContentList.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::widget;
 
-// Some utilities to handle annoying overloading of "A" tag for link and named anchor
-static char hrefText[] = "href";
-static char anchorTxt[] = "anchor";
-static char namedanchorText[] = "namedanchor";
-
-#define IsLinkTag(s) (s.EqualsIgnoreCase(hrefText))
-#define IsNamedAnchorTag(s) (s.EqualsIgnoreCase(anchorTxt) || s.EqualsIgnoreCase(namedanchorText))
+// Some utilities to handle overloading of "A" tag for link and named anchor.
+static bool
+IsLinkTag(const nsString& s)
+{
+  return s.EqualsIgnoreCase("href");
+}
+
+static bool
+IsNamedAnchorTag(const nsString& s)
+{
+  return s.EqualsIgnoreCase("anchor") || s.EqualsIgnoreCase("namedanchor");
+}
 
 nsHTMLEditor::nsHTMLEditor()
 : nsPlaintextEditor()
 , mCRInParagraphCreatesParagraph(false)
 , mSelectedCellIndex(0)
 , mIsObjectResizingEnabled(true)
 , mIsResizing(false)
 , mIsAbsolutelyPositioningEnabled(true)