Bug 895274 part.117 Rename NS_CUT to eCut r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 08 Sep 2015 23:33:35 +0900
changeset 294004 a25fc31cd465e517a19870f311e7bfe733cae19a
parent 294003 e248269468d485ddf48fe63e5e3ee955c74c03e0
child 294005 2f15d2b271c76a22c8cb3a8696ded760caa23732
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [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.117 Rename NS_CUT to eCut r=smaug
dom/base/nsCopySupport.cpp
dom/base/nsCopySupport.h
dom/base/nsGlobalWindowCommands.cpp
dom/events/DataTransfer.cpp
dom/events/EventNameList.h
editor/libeditor/nsPlaintextEditor.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 == eCopy ||
+  NS_ASSERTION(aEventMessage == eCut || aEventMessage == eCopy ||
                aEventMessage == NS_PASTE,
                "Invalid clipboard event type");
 
   nsCOMPtr<nsIPresShell> presShell = aPresShell;
   if (!presShell)
     return false;
 
   nsCOMPtr<nsIDocument> doc = presShell->GetDocument();
@@ -738,17 +738,17 @@ nsCopySupport::FireClipboardEvent(EventM
     if (formControl) {
       if (formControl->GetType() == NS_FORM_INPUT_PASSWORD) {
         return false;
       }
     }
 
     // when cutting non-editable content, do nothing
     // XXX this is probably the wrong editable flag to check
-    if (aEventMessage != NS_CUT || content->IsEditable()) {
+    if (aEventMessage != eCut || content->IsEditable()) {
       // get the data from the selection if any
       bool isCollapsed;
       sel->GetIsCollapsed(&isCollapsed);
       if (isCollapsed) {
         if (aActionTaken) {
           *aActionTaken = true;
         }
         return false;
--- 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, eCopy or
+     * on the value of aEventMessage, which should be either eCut, 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
@@ -517,17 +517,17 @@ nsClipboardCommand::DoCommand(const char
   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 = eCopy;
   if (strcmp(aCommandName, "cmd_cut") == 0) {
-    eventMessage = NS_CUT;
+    eventMessage = eCut;
   }
 
   bool actionTaken = false;
   nsCopySupport::FireClipboardEvent(eventMessage,
                                     nsIClipboard::kGlobalClipboard,
                                     presShell, nullptr, &actionTaken);
 
   if (!strcmp(aCommandName, "cmd_copyAndCollapseToEnd")) {
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -81,17 +81,17 @@ DataTransfer::DataTransfer(nsISupports* 
   , mIsCrossDomainSubFrameDrop(false)
   , 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 ||
+  if (aEventMessage == eCut ||
       aEventMessage == eCopy ||
       aEventMessage == eDragStart ||
       aEventMessage == eLegacyDragGesture) {
     mReadOnly = false;
   } else if (mIsExternal) {
     if (aEventMessage == NS_PASTE) {
       CacheExternalClipboardFormats();
     } else if (aEventMessage >= eDragDropEventFirst &&
@@ -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 == eCopy ||
+      (mEventMessage == eCut || 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 == eCopy ||
+      (mEventMessage == eCut || 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 == eCopy ||
+      (mEventMessage == eCut || 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 == eCopy ||
+      (mEventMessage == eCut || 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 != eCopy &&
+             (mEventMessage != eCut && 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 != eCopy,
+  NS_ASSERTION(mEventMessage != eCut && 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
@@ -421,17 +421,17 @@ EVENT(wheel,
       NS_WHEEL_WHEEL,
       EventNameType_All,
       eWheelEventClass)
 EVENT(copy,
       eCopy,
       EventNameType_HTMLXUL,
       eClipboardEventClass)
 EVENT(cut,
-      NS_CUT,
+      eCut,
       EventNameType_HTMLXUL,
       eClipboardEventClass)
 EVENT(paste,
       NS_PASTE,
       EventNameType_HTMLXUL,
       eClipboardEventClass)
 // Gecko-specific extensions that apply to elements
 EVENT(beforescriptexecute,
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -1193,17 +1193,17 @@ nsPlaintextEditor::FireClipboardEvent(Ev
   // If the event handler caused the editor to be destroyed, return false.
   // Otherwise return true to indicate that the event was not cancelled.
   return !mDidPreDestroy;
 }
 
 NS_IMETHODIMP nsPlaintextEditor::Cut()
 {
   bool actionTaken = false;
-  if (FireClipboardEvent(NS_CUT, nsIClipboard::kGlobalClipboard, &actionTaken)) {
+  if (FireClipboardEvent(eCut, nsIClipboard::kGlobalClipboard, &actionTaken)) {
     DeleteSelection(eNone, eStrip);
   }
   return actionTaken ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsPlaintextEditor::CanCut(bool *aCanCut)
 {
   NS_ENSURE_ARG_POINTER(aCanCut);
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -203,17 +203,17 @@ NS_EVENT_MESSAGE(eSVGZoom,              
 
 // 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(eCopy,                 eClipboardEventFirst)
-NS_EVENT_MESSAGE(NS_CUT,                eClipboardEventFirst + 1)
+NS_EVENT_MESSAGE(eCut,                  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)
 // Query for the text content of specified range, it returns actual lengh (if