Bug 895274 part.116 Rename NS_COPY to eCopy r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 08 Sep 2015 23:33:34 +0900
changeset 295708 e248269468d485ddf48fe63e5e3ee955c74c03e0
parent 295707 cc988d9676a400f8a7cb0596e2738daf1f845bfc
child 295709 a25fc31cd465e517a19870f311e7bfe733cae19a
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs895274
milestone43.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 895274 part.116 Rename NS_COPY to eCopy r=smaug
dom/base/nsCopySupport.cpp
dom/base/nsCopySupport.h
dom/base/nsGlobalWindowCommands.cpp
dom/events/ClipboardEvent.cpp
dom/events/DataTransfer.cpp
dom/events/EventNameList.h
editor/libeditor/nsPlaintextEditor.cpp
layout/base/nsDocumentViewer.cpp
widget/EventMessageList.h
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -626,17 +626,17 @@ nsCopySupport::FireClipboardEvent(EventM
                                   nsIPresShell* aPresShell,
                                   nsISelection* aSelection,
                                   bool* aActionTaken)
 {
   if (aActionTaken) {
     *aActionTaken = false;
   }
 
-  NS_ASSERTION(aEventMessage == NS_CUT || aEventMessage == NS_COPY ||
+  NS_ASSERTION(aEventMessage == NS_CUT || aEventMessage == eCopy ||
                aEventMessage == NS_PASTE,
                "Invalid clipboard event type");
 
   nsCOMPtr<nsIPresShell> presShell = aPresShell;
   if (!presShell)
     return false;
 
   nsCOMPtr<nsIDocument> doc = presShell->GetDocument();
--- a/dom/base/nsCopySupport.h
+++ b/dom/base/nsCopySupport.h
@@ -59,17 +59,17 @@ class nsCopySupport
     /**
      * Returns true if a copy operation is currently permitted based on the
      * current focus and selection within the specified document.
      */
     static bool CanCopy(nsIDocument* aDocument);
 
     /**
      * Fires a cut, copy or paste event, on the given presshell, depending
-     * on the value of aEventMessage, which should be either NS_CUT, NS_COPY or
+     * on the value of aEventMessage, which should be either NS_CUT, eCopy or
      * NS_PASTE, and perform the default copy action if the event was not
      * cancelled.
      *
      * If aSelection is specified, then this selection is used as the target
      * of the operation. Otherwise, GetSelectionForCopy is used to retrieve
      * the current selection.
      *
      * This will fire a cut, copy or paste event at the node at the start
--- a/dom/base/nsGlobalWindowCommands.cpp
+++ b/dom/base/nsGlobalWindowCommands.cpp
@@ -515,17 +515,17 @@ nsClipboardCommand::DoCommand(const char
   NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
 
   nsIDocShell *docShell = window->GetDocShell();
   NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
   NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
 
-  EventMessage eventMessage = NS_COPY;
+  EventMessage eventMessage = eCopy;
   if (strcmp(aCommandName, "cmd_cut") == 0) {
     eventMessage = NS_CUT;
   }
 
   bool actionTaken = false;
   nsCopySupport::FireClipboardEvent(eventMessage,
                                     nsIClipboard::kGlobalClipboard,
                                     presShell, nullptr, &actionTaken);
--- a/dom/events/ClipboardEvent.cpp
+++ b/dom/events/ClipboardEvent.cpp
@@ -74,17 +74,17 @@ ClipboardEvent::Constructor(const Global
 
   nsRefPtr<DataTransfer> clipboardData;
   if (e->mEventIsInternal) {
     InternalClipboardEvent* event = e->mEvent->AsClipboardEvent();
     if (event) {
       // Always create a clipboardData for the copy event. If this is changed to
       // support other types of events, make sure that read/write privileges are
       // checked properly within DataTransfer.
-      clipboardData = new DataTransfer(ToSupports(e), NS_COPY, false, -1);
+      clipboardData = new DataTransfer(ToSupports(e), eCopy, false, -1);
       clipboardData->SetData(aParam.mDataType, aParam.mData);
     }
   }
 
   e->InitClipboardEvent(aType, aParam.mBubbles, aParam.mCancelable,
                         clipboardData, aRv);
   e->SetTrusted(trusted);
   return e.forget();
@@ -100,17 +100,17 @@ ClipboardEvent::GetClipboardData(nsIDOMD
 DataTransfer*
 ClipboardEvent::GetClipboardData()
 {
   InternalClipboardEvent* event = mEvent->AsClipboardEvent();
 
   if (!event->clipboardData) {
     if (mEventIsInternal) {
       event->clipboardData =
-        new DataTransfer(ToSupports(this), NS_COPY, false, -1);
+        new DataTransfer(ToSupports(this), eCopy, false, -1);
     } else {
       event->clipboardData =
         new DataTransfer(ToSupports(this), event->mMessage,
                          event->mMessage == NS_PASTE,
                          nsIClipboard::kGlobalClipboard);
     }
   }
 
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -82,17 +82,17 @@ DataTransfer::DataTransfer(nsISupports* 
   , mClipboardType(aClipboardType)
   , mDragImageX(0)
   , mDragImageY(0)
 {
   // For these events, we want to be able to add data to the data transfer, so
   // clear the readonly state. Otherwise, the data is already present. For
   // external usage, cache the data from the native clipboard or drag.
   if (aEventMessage == NS_CUT ||
-      aEventMessage == NS_COPY ||
+      aEventMessage == eCopy ||
       aEventMessage == eDragStart ||
       aEventMessage == eLegacyDragGesture) {
     mReadOnly = false;
   } else if (mIsExternal) {
     if (aEventMessage == NS_PASTE) {
       CacheExternalClipboardFormats();
     } else if (aEventMessage >= eDragDropEventFirst &&
                aEventMessage <= eDragDropEventLast) {
@@ -538,17 +538,17 @@ DataTransfer::GetMozSourceNode(nsIDOMNod
   return CallQueryInterface(sourceNode, aSourceNode);
 }
 
 already_AddRefed<DOMStringList>
 DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv)
 {
   // Only the first item is valid for clipboard events
   if (aIndex > 0 &&
-      (mEventMessage == NS_CUT || mEventMessage == NS_COPY ||
+      (mEventMessage == NS_CUT || mEventMessage == eCopy ||
        mEventMessage == NS_PASTE)) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return nullptr;
   }
 
   nsRefPtr<DOMStringList> types = new DOMStringList();
   if (aIndex < mItems.Length()) {
     // note that you can retrieve the types regardless of their principal
@@ -579,17 +579,17 @@ DataTransfer::MozGetDataAt(const nsAStri
     return NS_OK;
 
   if (aIndex >= mItems.Length()) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   }
 
   // Only the first item is valid for clipboard events
   if (aIndex > 0 &&
-      (mEventMessage == NS_CUT || mEventMessage == NS_COPY ||
+      (mEventMessage == NS_CUT || mEventMessage == eCopy ||
        mEventMessage == NS_PASTE)) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   }
 
 
   nsAutoString format;
   GetRealFormat(aFormat, format);
 
@@ -691,17 +691,17 @@ DataTransfer::MozSetDataAt(const nsAStri
   // Specifying an index less than the current length will replace an existing
   // item. Specifying an index equal to the current length will add a new item.
   if (aIndex > mItems.Length()) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   }
 
   // Only the first item is valid for clipboard events
   if (aIndex > 0 &&
-      (mEventMessage == NS_CUT || mEventMessage == NS_COPY ||
+      (mEventMessage == NS_CUT || mEventMessage == eCopy ||
        mEventMessage == NS_PASTE)) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   }
 
   // don't allow non-chrome to add file data
   // XXX perhaps this should also limit any non-string type as well
   if ((aFormat.EqualsLiteral("application/x-moz-file-promise") ||
        aFormat.EqualsLiteral("application/x-moz-file")) &&
@@ -737,33 +737,33 @@ DataTransfer::MozClearDataAt(const nsASt
 
   if (aIndex >= mItems.Length()) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return;
   }
 
   // Only the first item is valid for clipboard events
   if (aIndex > 0 &&
-      (mEventMessage == NS_CUT || mEventMessage == NS_COPY ||
+      (mEventMessage == NS_CUT || mEventMessage == eCopy ||
        mEventMessage == NS_PASTE)) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
     return;
   }
 
   MozClearDataAtHelper(aFormat, aIndex, aRv);
 }
 
 void
 DataTransfer::MozClearDataAtHelper(const nsAString& aFormat, uint32_t aIndex,
                                    ErrorResult& aRv)
 {
   MOZ_ASSERT(!mReadOnly);
   MOZ_ASSERT(aIndex < mItems.Length());
   MOZ_ASSERT(aIndex == 0 ||
-             (mEventMessage != NS_CUT && mEventMessage != NS_COPY &&
+             (mEventMessage != NS_CUT && mEventMessage != eCopy &&
               mEventMessage != NS_PASTE));
 
   nsAutoString format;
   GetRealFormat(aFormat, format);
 
   nsIPrincipal* principal = nsContentUtils::SubjectPrincipal();
 
   // if the format is empty, clear all formats
@@ -1295,17 +1295,17 @@ DataTransfer::FillInExternalData(Transfe
 {
   NS_PRECONDITION(mIsExternal, "Not an external data transfer");
 
   if (aItem.mData) {
     return;
   }
 
   // only drag and paste events should be calling FillInExternalData
-  NS_ASSERTION(mEventMessage != NS_CUT && mEventMessage != NS_COPY,
+  NS_ASSERTION(mEventMessage != NS_CUT && mEventMessage != eCopy,
                "clipboard event with empty data");
 
     NS_ConvertUTF16toUTF8 utf8format(aItem.mFormat);
     const char* format = utf8format.get();
     if (strcmp(format, "text/plain") == 0)
       format = kUnicodeMime;
     else if (strcmp(format, "text/uri-list") == 0)
       format = kURLDataMime;
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -417,17 +417,17 @@ EVENT(waiting,
       NS_WAITING,
       EventNameType_HTML,
       eBasicEventClass)
 EVENT(wheel,
       NS_WHEEL_WHEEL,
       EventNameType_All,
       eWheelEventClass)
 EVENT(copy,
-      NS_COPY,
+      eCopy,
       EventNameType_HTMLXUL,
       eClipboardEventClass)
 EVENT(cut,
       NS_CUT,
       EventNameType_HTMLXUL,
       eClipboardEventClass)
 EVENT(paste,
       NS_PASTE,
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -1212,17 +1212,17 @@ NS_IMETHODIMP nsPlaintextEditor::CanCut(
   *aCanCut = (doc && doc->IsHTMLOrXHTML()) ||
     (IsModifiable() && CanCutOrCopy(ePasswordFieldNotAllowed));
   return NS_OK;
 }
 
 NS_IMETHODIMP nsPlaintextEditor::Copy()
 {
   bool actionTaken = false;
-  FireClipboardEvent(NS_COPY, nsIClipboard::kGlobalClipboard, &actionTaken);
+  FireClipboardEvent(eCopy, nsIClipboard::kGlobalClipboard, &actionTaken);
 
   return actionTaken ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsPlaintextEditor::CanCopy(bool *aCanCopy)
 {
   NS_ENSURE_ARG_POINTER(aCanCopy);
   // Copy is always enabled in HTML documents
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2615,17 +2615,18 @@ NS_IMETHODIMP nsDocumentViewer::SelectAl
 
   mozilla::dom::Selection::AutoApplyUserSelectStyle userSelection(selection);
   rv = selection->SelectAllChildren(bodyNode);
   return rv;
 }
 
 NS_IMETHODIMP nsDocumentViewer::CopySelection()
 {
-  nsCopySupport::FireClipboardEvent(NS_COPY, nsIClipboard::kGlobalClipboard, mPresShell, nullptr);
+  nsCopySupport::FireClipboardEvent(eCopy, nsIClipboard::kGlobalClipboard,
+                                    mPresShell, nullptr);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsDocumentViewer::CopyLinkLocation()
 {
   NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_INITIALIZED);
   nsCOMPtr<nsIDOMNode> node;
   GetPopupLinkNode(getter_AddRefs(node));
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -202,17 +202,17 @@ NS_EVENT_MESSAGE(eSVGZoomEventFirst,    
 NS_EVENT_MESSAGE(eSVGZoom,              eSVGZoomEventFirst)
 
 // XUL command events
 NS_EVENT_MESSAGE(eXULCommandEventFirst, 3000)
 NS_EVENT_MESSAGE(eXULCommand,           eXULCommandEventFirst)
 
 // Cut, copy, paste events
 NS_EVENT_MESSAGE(eClipboardEventFirst,  3100)
-NS_EVENT_MESSAGE(NS_COPY,               eClipboardEventFirst)
+NS_EVENT_MESSAGE(eCopy,                 eClipboardEventFirst)
 NS_EVENT_MESSAGE(NS_CUT,                eClipboardEventFirst + 1)
 NS_EVENT_MESSAGE(NS_PASTE,              eClipboardEventFirst + 2)
 
 // Query the content information
 NS_EVENT_MESSAGE(NS_QUERY_CONTENT_EVENT_START,       3200)
 // Query for the selected text information, it return the selection offset,
 // selection length and selected text.
 NS_EVENT_MESSAGE(NS_QUERY_SELECTED_TEXT,             NS_QUERY_CONTENT_EVENT_START)