Bug 1278014 part.5 Rename SelectionType::SELECTION_NORMAL to SelectionType::eNormal r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 09 Jun 2016 18:35:22 +0900
changeset 377650 c9ebef101aab87cc3ddd9132bbf148071dde686a
parent 377649 af4076e96f5a3559c8e05e95f6dbfceb7edbc559
child 377651 ddf076a9c1fe6c00d7404ac6432d0d2bb9e5b1b8
push id20850
push usermasayuki@d-toybox.com
push dateSat, 11 Jun 2016 06:51:43 +0000
reviewerssmaug
bugs1278014
milestone50.0a1
Bug 1278014 part.5 Rename SelectionType::SELECTION_NORMAL to SelectionType::eNormal r?smaug MozReview-Commit-ID: AAdxTTKEvrk
accessible/base/SelectionManager.cpp
accessible/generic/HyperTextAccessible-inl.h
accessible/generic/HyperTextAccessible.cpp
dom/base/nsCopySupport.cpp
dom/base/nsFocusManager.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindowCommands.cpp
dom/base/nsISelectionController.idl
dom/html/nsTextEditorState.cpp
editor/libeditor/nsEditor.cpp
editor/libeditor/nsEditor.h
layout/base/AccessibleCaretManager.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsPresShell.cpp
layout/generic/nsFrame.cpp
layout/generic/nsSelection.cpp
layout/generic/nsTextFrame.cpp
layout/printing/nsPrintEngine.cpp
widget/WidgetEventImpl.cpp
--- a/accessible/base/SelectionManager.cpp
+++ b/accessible/base/SelectionManager.cpp
@@ -54,18 +54,17 @@ SelectionManager::ClearControlSelectionL
   const nsFrameSelection* frameSel = mCurrCtrlFrame->GetConstFrameSelection();
   NS_ASSERTION(frameSel, "No frame selection for the element!");
 
   mCurrCtrlFrame = nullptr;
   if (!frameSel)
     return;
 
   // Remove 'this' registered as selection listener for the normal selection.
-  Selection* normalSel =
-    frameSel->GetSelection(SelectionType::SELECTION_NORMAL);
+  Selection* normalSel = frameSel->GetSelection(SelectionType::eNormal);
   normalSel->RemoveSelectionListener(this);
 
   // Remove 'this' registered as selection listener for the spellcheck
   // selection.
   Selection* spellSel =
     frameSel->GetSelection(SelectionType::SELECTION_SPELLCHECK);
   spellSel->RemoveSelectionListener(this);
 }
@@ -83,50 +82,47 @@ SelectionManager::SetControlSelectionLis
     return;
 
   const nsFrameSelection* frameSel = mCurrCtrlFrame->GetConstFrameSelection();
   NS_ASSERTION(frameSel, "No frame selection for focused element!");
   if (!frameSel)
     return;
 
   // Register 'this' as selection listener for the normal selection.
-  Selection* normalSel =
-    frameSel->GetSelection(SelectionType::SELECTION_NORMAL);
+  Selection* normalSel = frameSel->GetSelection(SelectionType::eNormal);
   normalSel->AddSelectionListener(this);
 
   // Register 'this' as selection listener for the spell check selection.
   Selection* spellSel =
     frameSel->GetSelection(SelectionType::SELECTION_SPELLCHECK);
   spellSel->AddSelectionListener(this);
 }
 
 void
 SelectionManager::AddDocSelectionListener(nsIPresShell* aPresShell)
 {
   const nsFrameSelection* frameSel = aPresShell->ConstFrameSelection();
 
   // Register 'this' as selection listener for the normal selection.
-  Selection* normalSel =
-    frameSel->GetSelection(SelectionType::SELECTION_NORMAL);
+  Selection* normalSel = frameSel->GetSelection(SelectionType::eNormal);
   normalSel->AddSelectionListener(this);
 
   // Register 'this' as selection listener for the spell check selection.
   Selection* spellSel =
     frameSel->GetSelection(SelectionType::SELECTION_SPELLCHECK);
   spellSel->AddSelectionListener(this);
 }
 
 void
 SelectionManager::RemoveDocSelectionListener(nsIPresShell* aPresShell)
 {
   const nsFrameSelection* frameSel = aPresShell->ConstFrameSelection();
 
   // Remove 'this' registered as selection listener for the normal selection.
-  Selection* normalSel =
-    frameSel->GetSelection(SelectionType::SELECTION_NORMAL);
+  Selection* normalSel = frameSel->GetSelection(SelectionType::eNormal);
   normalSel->RemoveSelectionListener(this);
 
   // Remove 'this' registered as selection listener for the spellcheck
   // selection.
   Selection* spellSel =
     frameSel->GetSelection(SelectionType::SELECTION_SPELLCHECK);
   spellSel->RemoveSelectionListener(this);
 }
@@ -220,17 +216,17 @@ SelectionManager::ProcessSelectionChange
   }
 
   HyperTextAccessible* text = nsAccUtils::GetTextContainer(cntrNode);
   if (!text) {
     NS_NOTREACHED("We must reach document accessible implementing text interface!");
     return;
   }
 
-  if (selection->GetType() == SelectionType::SELECTION_NORMAL) {
+  if (selection->GetType() == SelectionType::eNormal) {
     RefPtr<AccEvent> event =
       new AccTextSelChangeEvent(text, selection, aSelData->mReason);
     text->Document()->FireDelayedEvent(event);
 
   } else if (selection->GetType() == SelectionType::SELECTION_SPELLCHECK) {
     // XXX: fire an event for container accessible of the focus/anchor range
     // of the spelcheck selection.
     text->Document()->FireDelayedEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
--- a/accessible/generic/HyperTextAccessible-inl.h
+++ b/accessible/generic/HyperTextAccessible-inl.h
@@ -164,18 +164,17 @@ HyperTextAccessible::FrameSelection() co
   nsIFrame* frame = GetFrame();
   return frame ? frame->GetFrameSelection() : nullptr;
 }
 
 inline dom::Selection*
 HyperTextAccessible::DOMSelection() const
 {
   RefPtr<nsFrameSelection> frameSelection = FrameSelection();
-  return frameSelection ?
-    frameSelection->GetSelection(SelectionType::SELECTION_NORMAL) :
-    nullptr;
+  return frameSelection ? frameSelection->GetSelection(SelectionType::eNormal) :
+                          nullptr;
 }
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
 
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -1438,18 +1438,17 @@ int32_t
 HyperTextAccessible::CaretLineNumber()
 {
   // Provide the line number for the caret, relative to the
   // currently focused node. Use a 1-based index
   RefPtr<nsFrameSelection> frameSelection = FrameSelection();
   if (!frameSelection)
     return -1;
 
-  dom::Selection* domSel =
-    frameSelection->GetSelection(SelectionType::SELECTION_NORMAL);
+  dom::Selection* domSel = frameSelection->GetSelection(SelectionType::eNormal);
   if (!domSel)
     return - 1;
 
   nsINode* caretNode = domSel->GetFocusNode();
   if (!caretNode || !caretNode->IsContent())
     return -1;
 
   nsIContent* caretContent = caretNode->AsContent();
@@ -1586,29 +1585,29 @@ HyperTextAccessible::GetSelectionDOMRang
     }
   }
 }
 
 int32_t
 HyperTextAccessible::SelectionCount()
 {
   nsTArray<nsRange*> ranges;
-  GetSelectionDOMRanges(SelectionType::SELECTION_NORMAL, &ranges);
+  GetSelectionDOMRanges(SelectionType::eNormal, &ranges);
   return ranges.Length();
 }
 
 bool
 HyperTextAccessible::SelectionBoundsAt(int32_t aSelectionNum,
                                        int32_t* aStartOffset,
                                        int32_t* aEndOffset)
 {
   *aStartOffset = *aEndOffset = 0;
 
   nsTArray<nsRange*> ranges;
-  GetSelectionDOMRanges(SelectionType::SELECTION_NORMAL, &ranges);
+  GetSelectionDOMRanges(SelectionType::eNormal, &ranges);
 
   uint32_t rangeCount = ranges.Length();
   if (aSelectionNum < 0 || aSelectionNum >= static_cast<int32_t>(rangeCount))
     return false;
 
   nsRange* range = ranges[aSelectionNum];
 
   // Get start and end points.
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -568,17 +568,17 @@ nsCopySupport::GetSelectionForCopy(nsIDo
         selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, aSelection);
         return content;
       }
     }
   }
 
   // if no selection was found, use the main selection for the window
   NS_IF_ADDREF(*aSelection =
-                 presShell->GetCurrentSelection(SelectionType::SELECTION_NORMAL));
+                 presShell->GetCurrentSelection(SelectionType::eNormal));
   return nullptr;
 }
 
 bool
 nsCopySupport::CanCopy(nsIDocument* aDocument)
 {
   if (!aDocument)
     return false;
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -2244,17 +2244,17 @@ nsFocusManager::UpdateCaret(bool aMoveCa
 void
 nsFocusManager::MoveCaretToFocus(nsIPresShell* aPresShell, nsIContent* aContent)
 {
   // domDoc is a document interface we can create a range with
   nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aPresShell->GetDocument());
   if (domDoc) {
     RefPtr<nsFrameSelection> frameSelection = aPresShell->FrameSelection();
     nsCOMPtr<nsISelection> domSelection =
-      frameSelection->GetSelection(SelectionType::SELECTION_NORMAL);
+      frameSelection->GetSelection(SelectionType::eNormal);
     if (domSelection) {
       nsCOMPtr<nsIDOMNode> currentFocusNode(do_QueryInterface(aContent));
       // First clear the selection. This way, if there is no currently focused
       // content, the selection will just be cleared.
       domSelection->RemoveAllRanges();
       if (currentFocusNode) {
         nsCOMPtr<nsIDOMRange> newRange;
         nsresult rv = domDoc->CreateRange(getter_AddRefs(newRange));
@@ -2305,17 +2305,17 @@ nsFocusManager::SetCaretVisible(nsIPresS
       frameSelection = focusFrame->GetFrameSelection();
   }
 
   RefPtr<nsFrameSelection> docFrameSelection = aPresShell->FrameSelection();
 
   if (docFrameSelection && caret &&
      (frameSelection == docFrameSelection || !aContent)) {
     nsISelection* domSelection =
-      docFrameSelection->GetSelection(SelectionType::SELECTION_NORMAL);
+      docFrameSelection->GetSelection(SelectionType::eNormal);
     if (domSelection) {
       nsCOMPtr<nsISelectionController> selCon(do_QueryInterface(aPresShell));
       if (!selCon) {
         return NS_ERROR_FAILURE;
       }
       // First, hide the caret to prevent attempting to show it in SetCaretDOMSelection
       selCon->SetCaretEnabled(false);
 
@@ -2347,17 +2347,17 @@ nsFocusManager::GetSelectionLocation(nsI
 
   nsPresContext* presContext = aPresShell->GetPresContext();
   NS_ASSERTION(presContext, "mPresContent is null!!");
 
   RefPtr<nsFrameSelection> frameSelection = aPresShell->FrameSelection();
 
   nsCOMPtr<nsISelection> domSelection;
   if (frameSelection) {
-    domSelection = frameSelection->GetSelection(SelectionType::SELECTION_NORMAL);
+    domSelection = frameSelection->GetSelection(SelectionType::eNormal);
   }
 
   nsCOMPtr<nsIDOMNode> startNode, endNode;
   bool isCollapsed = false;
   nsCOMPtr<nsIContent> startContent, endContent;
   int32_t startOffset = 0;
   if (domSelection) {
     domSelection->GetIsCollapsed(&isCollapsed);
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -9433,17 +9433,17 @@ nsGlobalWindow::GetSelectionOuter()
   }
 
   nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
   if (!presShell) {
     return nullptr;
   }
 
   return static_cast<Selection*>(
-           presShell->GetCurrentSelection(SelectionType::SELECTION_NORMAL));
+           presShell->GetCurrentSelection(SelectionType::eNormal));
 }
 
 Selection*
 nsGlobalWindow::GetSelection(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetSelectionOuter, (), aError, nullptr);
 }
 
--- a/dom/base/nsGlobalWindowCommands.cpp
+++ b/dom/base/nsGlobalWindowCommands.cpp
@@ -538,17 +538,17 @@ nsClipboardCommand::DoCommand(const char
   bool actionTaken = false;
   bool notCancelled =
     nsCopySupport::FireClipboardEvent(eventMessage,
                                       nsIClipboard::kGlobalClipboard,
                                       presShell, nullptr, &actionTaken);
 
   if (notCancelled && !strcmp(aCommandName, "cmd_copyAndCollapseToEnd")) {
     dom::Selection *sel =
-      presShell->GetCurrentSelection(SelectionType::SELECTION_NORMAL);
+      presShell->GetCurrentSelection(SelectionType::eNormal);
     NS_ENSURE_TRUE(sel, NS_ERROR_FAILURE);
     sel->CollapseToEnd();
   }
 
   if (actionTaken) {
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
--- a/dom/base/nsISelectionController.idl
+++ b/dom/base/nsISelectionController.idl
@@ -281,17 +281,17 @@ interface nsISelectionController : nsISe
 
 namespace mozilla {
 
 typedef short RawSelectionType;
 enum class SelectionType : RawSelectionType
 {
   eInvalid = -1,
   eNone = nsISelectionController::SELECTION_NONE,
-  SELECTION_NORMAL = nsISelectionController::SELECTION_NORMAL,
+  eNormal = nsISelectionController::SELECTION_NORMAL,
   SELECTION_SPELLCHECK = nsISelectionController::SELECTION_SPELLCHECK,
   SELECTION_IME_RAWINPUT = nsISelectionController::SELECTION_IME_RAWINPUT,
   SELECTION_IME_SELECTEDRAWTEXT =
     nsISelectionController::SELECTION_IME_SELECTEDRAWTEXT,
   SELECTION_IME_CONVERTEDTEXT =
     nsISelectionController::SELECTION_IME_CONVERTEDTEXT,
   SELECTION_IME_SELECTEDCONVERTEDTEXT =
     nsISelectionController::SELECTION_IME_SELECTEDCONVERTEDTEXT,
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -412,17 +412,17 @@ nsTextInputSelectionImpl::SetCaretReadOn
   if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
   nsresult result;
   nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
   if (shell)
   {
     RefPtr<nsCaret> caret = shell->GetCaret();
     if (caret) {
       nsISelection* domSel =
-        mFrameSelection->GetSelection(SelectionType::SELECTION_NORMAL);
+        mFrameSelection->GetSelection(SelectionType::eNormal);
       if (domSel)
         caret->SetCaretReadOnly(aReadOnly);
       return NS_OK;
     }
   }
   return NS_ERROR_FAILURE;
 }
 
@@ -455,17 +455,17 @@ nsTextInputSelectionImpl::SetCaretVisibi
   if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
   nsresult result;
   nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
   if (shell)
   {
     RefPtr<nsCaret> caret = shell->GetCaret();
     if (caret) {
       nsISelection* domSel =
-        mFrameSelection->GetSelection(SelectionType::SELECTION_NORMAL);
+        mFrameSelection->GetSelection(SelectionType::eNormal);
       if (domSel)
         caret->SetVisibilityDuringSelection(aVisibility);
       return NS_OK;
     }
   }
   return NS_ERROR_FAILURE;
 }
 
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -635,17 +635,17 @@ nsEditor::DeleteSelection(EDirection aAc
   MOZ_ASSERT(aStripWrappers == eStrip || aStripWrappers == eNoStrip);
   return DeleteSelectionImpl(aAction, aStripWrappers);
 }
 
 
 NS_IMETHODIMP
 nsEditor::GetSelection(nsISelection** aSelection)
 {
-  return GetSelection(SelectionType::SELECTION_NORMAL, aSelection);
+  return GetSelection(SelectionType::eNormal, aSelection);
 }
 
 nsresult
 nsEditor::GetSelection(SelectionType aSelectionType, nsISelection** aSelection)
 {
   NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
   *aSelection = nullptr;
   nsCOMPtr<nsISelectionController> selcon;
@@ -2668,17 +2668,17 @@ nsEditor::SplitNodeImpl(nsIContent& aExi
                         nsIContent& aNewLeftNode)
 {
   // Remember all selection points.
   AutoTArray<SavedRange, 10> savedRanges;
   for (size_t i = 0; i < kPresentSelectionTypeCount; ++i) {
     SelectionType selectionType(ToSelectionType(1 << i));
     SavedRange range;
     range.mSelection = GetSelection(selectionType);
-    if (selectionType == SelectionType::SELECTION_NORMAL) {
+    if (selectionType == SelectionType::eNormal) {
       NS_ENSURE_TRUE(range.mSelection, NS_ERROR_NULL_POINTER);
     } else if (!range.mSelection) {
       // For non-normal selections, skip over the non-existing ones.
       continue;
     }
 
     for (uint32_t j = 0; j < range.mSelection->RangeCount(); ++j) {
       RefPtr<nsRange> r = range.mSelection->GetRangeAt(j);
@@ -2750,17 +2750,17 @@ nsEditor::SplitNodeImpl(nsIContent& aExi
     // If we have not seen the selection yet, clear all of its ranges.
     if (range.mSelection != previousSelection) {
       nsresult rv = range.mSelection->RemoveAllRanges();
       NS_ENSURE_SUCCESS(rv, rv);
       previousSelection = range.mSelection;
     }
 
     if (shouldSetSelection &&
-        range.mSelection->Type() == SelectionType::SELECTION_NORMAL) {
+        range.mSelection->Type() == SelectionType::eNormal) {
       // If the editor should adjust the selection, don't bother restoring
       // the ranges for the normal selection here.
       continue;
     }
 
     // Split the selection into existing node and new node.
     if (range.mStartNode == &aExistingRightNode) {
       if (range.mStartOffset < aOffset) {
@@ -2814,17 +2814,17 @@ nsEditor::JoinNodesImpl(nsINode* aNodeTo
   nsINode* parent = GetNodeLocation(aNodeToKeep, &keepOffset);
 
   // Remember all selection points.
   AutoTArray<SavedRange, 10> savedRanges;
   for (size_t i = 0; i < kPresentSelectionTypeCount; ++i) {
     SelectionType selectionType(ToSelectionType(1 << i));
     SavedRange range;
     range.mSelection = GetSelection(selectionType);
-    if (selectionType == SelectionType::SELECTION_NORMAL) {
+    if (selectionType == SelectionType::eNormal) {
       NS_ENSURE_TRUE(range.mSelection, NS_ERROR_NULL_POINTER);
     } else if (!range.mSelection) {
       // For non-normal selections, skip over the non-existing ones.
       continue;
     }
 
     for (uint32_t j = 0; j < range.mSelection->RangeCount(); ++j) {
       RefPtr<nsRange> r = range.mSelection->GetRangeAt(j);
@@ -2903,17 +2903,17 @@ nsEditor::JoinNodesImpl(nsINode* aNodeTo
     // If we have not seen the selection yet, clear all of its ranges.
     if (range.mSelection != previousSelection) {
       nsresult rv = range.mSelection->RemoveAllRanges();
       NS_ENSURE_SUCCESS(rv, rv);
       previousSelection = range.mSelection;
     }
 
     if (shouldSetSelection &&
-        range.mSelection->Type() == SelectionType::SELECTION_NORMAL) {
+        range.mSelection->Type() == SelectionType::eNormal) {
       // If the editor should adjust the selection, don't bother restoring
       // the ranges for the normal selection here.
       continue;
     }
 
     // Check to see if we joined nodes where selection starts.
     if (range.mStartNode == aNodeToJoin) {
       range.mStartNode = aNodeToKeep;
--- a/editor/libeditor/nsEditor.h
+++ b/editor/libeditor/nsEditor.h
@@ -613,17 +613,17 @@ public:
                                       int32_t* outEndOffset);
   static nsresult GetEndNodeAndOffset(Selection* aSelection,
                                       nsINode** aEndNode,
                                       int32_t* aEndOffset);
 #if DEBUG_JOE
   static void DumpNode(nsIDOMNode *aNode, int32_t indent=0);
 #endif
   Selection* GetSelection(mozilla::SelectionType aSelectionType =
-                            mozilla::SelectionType::SELECTION_NORMAL);
+                            mozilla::SelectionType::eNormal);
 
   // Helpers to add a node to the selection.
   // Used by table cell selection methods
   nsresult CreateRange(nsIDOMNode *aStartParent, int32_t aStartOffset,
                        nsIDOMNode *aEndParent, int32_t aEndOffset,
                        nsRange** aRange);
 
   // Creates a range with just the supplied node and appends that to the selection
--- a/layout/base/AccessibleCaretManager.cpp
+++ b/layout/base/AccessibleCaretManager.cpp
@@ -699,17 +699,17 @@ AccessibleCaretManager::OnKeyboardEvent(
 
 Selection*
 AccessibleCaretManager::GetSelection() const
 {
   RefPtr<nsFrameSelection> fs = GetFrameSelection();
   if (!fs) {
     return nullptr;
   }
-  return fs->GetSelection(SelectionType::SELECTION_NORMAL);
+  return fs->GetSelection(SelectionType::eNormal);
 }
 
 already_AddRefed<nsFrameSelection>
 AccessibleCaretManager::GetFrameSelection() const
 {
   if (!mPresShell) {
     return nullptr;
   }
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2546,17 +2546,17 @@ nsDocumentViewer::CreateDeviceContext(ns
 // own selection, which cannot be accessed with this method.
 mozilla::dom::Selection*
 nsDocumentViewer::GetDocumentSelection()
 {
   if (!mPresShell) {
     return nullptr;
   }
 
-  return mPresShell->GetCurrentSelection(SelectionType::SELECTION_NORMAL);
+  return mPresShell->GetCurrentSelection(SelectionType::eNormal);
 }
 
 /* ========================================================================================
  * nsIContentViewerEdit
  * ======================================================================================== */
 
 NS_IMETHODIMP nsDocumentViewer::ClearSelection()
 {
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -2735,17 +2735,17 @@ nsIPresShell::GetFrameToScrollAsScrollab
   if (fm && mDocument) {
     nsCOMPtr<nsIDOMElement> focusedElement;
     fm->GetFocusedElementForWindow(mDocument->GetWindow(), false, nullptr,
                                    getter_AddRefs(focusedElement));
     focusedContent = do_QueryInterface(focusedElement);
   }
   if (!focusedContent && mSelection) {
     nsISelection* domSelection =
-      mSelection->GetSelection(SelectionType::SELECTION_NORMAL);
+      mSelection->GetSelection(SelectionType::eNormal);
     if (domSelection) {
       nsCOMPtr<nsIDOMNode> focusedNode;
       domSelection->GetFocusNode(getter_AddRefs(focusedNode));
       focusedContent = do_QueryInterface(focusedNode);
     }
   }
   if (focusedContent) {
     nsIFrame* startFrame = focusedContent->GetPrimaryFrame();
@@ -3065,18 +3065,17 @@ PresShell::GoToAnchor(const nsAString& a
     RefPtr<nsIDOMRange> jumpToRange = new nsRange(mDocument);
     while (content && content->GetFirstChild()) {
       content = content->GetFirstChild();
     }
     nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
     NS_ASSERTION(node, "No nsIDOMNode for descendant of anchor");
     jumpToRange->SelectNodeContents(node);
     // Select the anchor
-    nsISelection* sel =
-      mSelection->GetSelection(SelectionType::SELECTION_NORMAL);
+    nsISelection* sel = mSelection->GetSelection(SelectionType::eNormal);
     if (sel) {
       sel->RemoveAllRanges();
       sel->AddRange(jumpToRange);
       if (!selectAnchor) {
         // Use a caret (collapsed selection) at the start of the anchor
         sel->CollapseToStart();
       }
     }
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1818,17 +1818,17 @@ nsFrame::DisplaySelectionOverlay(nsDispl
   SelectionDetails *details;
   //look up to see what selection(s) are on this frame
   details = frameSelection->LookUpSelection(newContent, offset, 1, false);
   if (!details)
     return;
   
   bool normal = false;
   while (details) {
-    if (details->mSelectionType == SelectionType::SELECTION_NORMAL) {
+    if (details->mSelectionType == SelectionType::eNormal) {
       normal = true;
     }
     SelectionDetails *next = details->mNext;
     delete details;
     details = next;
   }
 
   if (!normal && aContentType == nsISelectionDisplay::DISPLAY_IMAGES) {
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -112,17 +112,17 @@ namespace mozilla {
 const char*
 ToChar(SelectionType aSelectionType)
 {
   switch (aSelectionType) {
     case SelectionType::eInvalid:
       return "SelectionType::eInvalid";
     case SelectionType::eNone:
       return "SelectionType::eNone";
-    case SelectionType::SELECTION_NORMAL:
+    case SelectionType::eNormal:
       return "SelectionType::eNormal";
     case SelectionType::SELECTION_SPELLCHECK:
       return "SelectionType::eSpellCheck";
     case SelectionType::SELECTION_IME_RAWINPUT:
       return "SelectionType::eIMERawClause";
     case SelectionType::SELECTION_IME_SELECTEDRAWTEXT:
       return "SelectionType::eIMESelectedRawClause";
     case SelectionType::SELECTION_IME_CONVERTEDTEXT:
@@ -142,17 +142,17 @@ ToChar(SelectionType aSelectionType)
   }
 }
 
 static bool
 IsValidSelectionType(RawSelectionType aRawSelectionType)
 {
   switch (static_cast<SelectionType>(aRawSelectionType)) {
     case SelectionType::eNone:
-    case SelectionType::SELECTION_NORMAL:
+    case SelectionType::eNormal:
     case SelectionType::SELECTION_SPELLCHECK:
     case SelectionType::SELECTION_IME_RAWINPUT:
     case SelectionType::SELECTION_IME_SELECTEDRAWTEXT:
     case SelectionType::SELECTION_IME_CONVERTEDTEXT:
     case SelectionType::SELECTION_IME_SELECTEDCONVERTEDTEXT:
     case SelectionType::SELECTION_ACCESSIBILITY:
     case SelectionType::SELECTION_FIND:
     case SelectionType::SELECTION_URLSECONDARY:
@@ -346,17 +346,17 @@ nsresult NS_NewDomSelection(nsISelection
   NS_ADDREF(rlist);
   return NS_OK;
 }
 
 static int8_t
 GetIndexFromSelectionType(SelectionType aSelectionType)
 {
   switch (aSelectionType) {
-    case SelectionType::SELECTION_NORMAL:
+    case SelectionType::eNormal:
       return 0;
     case SelectionType::SELECTION_SPELLCHECK:
       return 1;
     case SelectionType::SELECTION_IME_RAWINPUT:
       return 2;
     case SelectionType::SELECTION_IME_SELECTEDRAWTEXT:
       return 3;
     case SelectionType::SELECTION_IME_CONVERTEDTEXT:
@@ -376,30 +376,30 @@ GetIndexFromSelectionType(SelectionType 
   }
   /* NOTREACHED */
 }
 
 static SelectionType
 GetSelectionTypeFromIndex(int8_t aIndex)
 {
   static const SelectionType kSelectionTypes[] = {
-    SelectionType::SELECTION_NORMAL,
+    SelectionType::eNormal,
     SelectionType::SELECTION_SPELLCHECK,
     SelectionType::SELECTION_IME_RAWINPUT,
     SelectionType::SELECTION_IME_SELECTEDRAWTEXT,
     SelectionType::SELECTION_IME_CONVERTEDTEXT,
     SelectionType::SELECTION_IME_SELECTEDCONVERTEDTEXT,
     SelectionType::SELECTION_ACCESSIBILITY,
     SelectionType::SELECTION_FIND,
     SelectionType::SELECTION_URLSECONDARY,
     SelectionType::SELECTION_URLSTRIKEOUT
   };
   if (NS_WARN_IF(aIndex < 0) ||
       NS_WARN_IF(static_cast<size_t>(aIndex) >= ArrayLength(kSelectionTypes))) {
-    return SelectionType::SELECTION_NORMAL;
+    return SelectionType::eNormal;
   }
   return kSelectionTypes[aIndex];
 }
 
 /*
 The limiter is used specifically for the text areas and textfields
 In that case it is the DIV tag that is anonymously created for the text
 areas/fields.  Text nodes and BR nodes fall beneath it.  In the case of a 
@@ -548,17 +548,17 @@ nsFrameSelection::nsFrameSelection()
   mSelectedCellIndex = 0;
 
   // Check to see if the autocopy pref is enabled
   //   and add the autocopy listener if it is
   if (Preferences::GetBool("clipboard.autocopy")) {
     nsAutoCopyListener *autoCopy = nsAutoCopyListener::GetInstance();
 
     if (autoCopy) {
-      int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+      int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
       if (mDomSelections[index]) {
         autoCopy->Listen(mDomSelections[index]);
       }
     }
   }
 
   mDisplaySelection = nsISelectionController::SELECTION_OFF;
   mSelectionChangeReason = nsISelectionListener::NO_REASON;
@@ -631,17 +631,17 @@ nsFrameSelection::FetchDesiredPos(nsPoin
     return NS_OK;
   }
 
   RefPtr<nsCaret> caret = mShell->GetCaret();
   if (!caret) {
     return NS_ERROR_NULL_POINTER;
   }
 
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   caret->SetSelection(mDomSelections[index]);
 
   nsRect coord;
   nsIFrame* caretFrame = caret->GetGeometry(&coord);
   if (!caretFrame) {
     return NS_ERROR_FAILURE;
   }
   nsPoint viewOffset(0, 0);
@@ -696,17 +696,17 @@ nsFrameSelection::ConstrainFrameAndPoint
   //
   // Get the frame and content for the selection's anchor point!
   //
 
   nsresult result;
   nsCOMPtr<nsIDOMNode> anchorNode;
   int32_t anchorOffset = 0;
 
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   result = mDomSelections[index]->GetAnchorNode(getter_AddRefs(anchorNode));
 
   if (NS_FAILED(result))
     return result;
 
@@ -914,24 +914,24 @@ nsFrameSelection::Init(nsIPresShell *aSh
     prefCachesInitialized = true;
 
     Preferences::AddBoolVarCache(&sSelectionEventsEnabled,
                                  "dom.select_events.enabled", false);
   }
 
   RefPtr<AccessibleCaretEventHub> eventHub = mShell->GetAccessibleCaretEventHub();
   if (eventHub) {
-    int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+    int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
     if (mDomSelections[index]) {
       mDomSelections[index]->AddSelectionListener(eventHub);
     }
   }
 
   if (sSelectionEventsEnabled) {
-    int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+    int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
     if (mDomSelections[index]) {
       // The Selection instance will hold a strong reference to its selectionchangelistener
       // so we don't have to worry about that!
       RefPtr<SelectionChangeListener> listener = new SelectionChangeListener;
       mDomSelections[index]->AddSelectionListener(listener);
     }
   }
 }
@@ -960,17 +960,17 @@ nsFrameSelection::MoveCaret(nsDirection 
 
   nsPresContext *context = mShell->GetPresContext();
   if (!context)
     return NS_ERROR_FAILURE;
 
   bool isCollapsed;
   nsPoint desiredPos(0, 0); //we must keep this around and revalidate it when its just UP/DOWN
 
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   RefPtr<Selection> sel = mDomSelections[index];
   if (!sel)
     return NS_ERROR_NULL_POINTER;
 
   int32_t scrollFlags = Selection::SCROLL_FOR_CARET_MOVE;
   nsINode* focusNode = sel->GetFocusNode();
   if (focusNode &&
       (focusNode->IsEditable() ||
@@ -1447,17 +1447,17 @@ nsFrameSelection::GetFrameFromLevel(nsIF
 
   return NS_OK;
 }
 
 
 nsresult
 nsFrameSelection::MaintainSelection(nsSelectionAmount aAmount)
 {
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   mMaintainedAmount = aAmount;
 
   const nsRange* anchorFocusRange =
     mDomSelections[index]->GetAnchorFocusRange();
   if (anchorFocusRange && aAmount != eSelectNoAmount) {
@@ -1551,17 +1551,17 @@ nsFrameSelection::AdjustForMaintainedSel
 {
   if (!mMaintainRange)
     return false;
 
   if (!aContent) {
     return false;
   }
 
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return false;
 
   nsINode* rangeStartNode = mMaintainRange->GetStartParent();
   nsINode* rangeEndNode = mMaintainRange->GetEndParent();
   int32_t rangeStartOffset = mMaintainRange->StartOffset();
   int32_t rangeEndOffset = mMaintainRange->EndOffset();
 
@@ -1617,17 +1617,17 @@ nsFrameSelection::HandleClick(nsIContent
   if (!mDragSelectingCells)
   {
     BidiLevelFromClick(aNewFocus, aContentOffset);
     PostReason(nsISelectionListener::MOUSEDOWN_REASON + nsISelectionListener::DRAG_REASON);
     if (aContinueSelection &&
         AdjustForMaintainedSelection(aNewFocus, aContentOffset))
       return NS_OK; //shift clicked to maintained selection. rejected.
 
-    int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+    int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
     AutoPrepareFocusRange prep(mDomSelections[index], aContinueSelection, aMultipleSelection);
     return TakeFocus(aNewFocus, aContentOffset, aContentEndOffset, aHint,
                      aContinueSelection, aMultipleSelection);
   }
   
   return NS_OK;
 }
 
@@ -1700,27 +1700,27 @@ nsFrameSelection::HandleDrag(nsIFrame *a
               true, false, offsets.associate);
 }
 
 nsresult
 nsFrameSelection::StartAutoScrollTimer(nsIFrame *aFrame,
                                        nsPoint   aPoint,
                                        uint32_t  aDelay)
 {
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   return mDomSelections[index]->StartAutoScrollTimer(aFrame, aPoint, aDelay);
 }
 
 void
 nsFrameSelection::StopAutoScrollTimer()
 {
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return;
 
   mDomSelections[index]->StopAutoScrollTimer();
 }
 
 /**
 hard to go from nodes to frames, easy the other way!
@@ -1744,17 +1744,17 @@ nsFrameSelection::TakeFocus(nsIContent* 
   // Clear all table selection data
   mSelectingTableCellMode = 0;
   mDragSelectingCells = false;
   mStartSelectedCell = nullptr;
   mEndSelectedCell = nullptr;
   mAppendStartSelectedCell = nullptr;
   mHint = aHint;
   
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   Maybe<Selection::AutoUserInitiated> userSelect;
   if (IsUserSelectionReason()) {
     userSelect.emplace(mDomSelections[index]);
   }
 
@@ -1857,17 +1857,17 @@ printf(" * TakeFocus - moving into new c
           mDomSelections[index]->Extend(aNewFocus, aContentOffset);
       }
     }
   }
 
   // Don't notify selection listeners if batching is on:
   if (GetBatching())
     return NS_OK;
-  return NotifySelectionListeners(SelectionType::SELECTION_NORMAL);
+  return NotifySelectionListeners(SelectionType::eNormal);
 }
 
 
 SelectionDetails*
 nsFrameSelection::LookUpSelection(nsIContent *aContent,
                                   int32_t aContentOffset,
                                   int32_t aContentLength,
                                   bool aSlowCheck) const
@@ -1897,17 +1897,17 @@ nsFrameSelection::SetDragState(bool aSta
 
   mDragState = aState;
     
   if (!mDragState)
   {
     mDragSelectingCells = false;
     // Notify that reason is mouse up.
     PostReason(nsISelectionListener::MOUSEUP_REASON);
-    NotifySelectionListeners(SelectionType::SELECTION_NORMAL);
+    NotifySelectionListeners(SelectionType::eNormal);
   }
 }
 
 Selection*
 nsFrameSelection::GetSelection(SelectionType aSelectionType) const
 {
   int8_t index = GetIndexFromSelectionType(aSelectionType);
   if (index < 0)
@@ -2125,17 +2125,17 @@ nsFrameSelection::CommonPageMove(bool aF
   //get the frame from the scrollable view
 
   nsIFrame* scrolledFrame = aScrollableFrame->GetScrolledFrame();
   if (!scrolledFrame)
     return;
 
   // find out where the caret is.
   // we should know mDesiredPos value of nsFrameSelection, but I havent seen that behavior in other windows applications yet.
-  nsISelection* domSel = GetSelection(SelectionType::SELECTION_NORMAL);
+  nsISelection* domSel = GetSelection(SelectionType::eNormal);
   if (!domSel) {
     return;
   }
 
   nsRect caretPos;
   nsIFrame* caretFrame = nsCaret::GetGeometry(domSel, &caretPos);
   if (!caretFrame) 
     return;
@@ -2190,17 +2190,17 @@ nsFrameSelection::PhysicalMove(int16_t a
     return NS_ERROR_FAILURE;
   }
 
   nsPresContext *context = mShell->GetPresContext();
   if (!context) {
     return NS_ERROR_FAILURE;
   }
 
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   RefPtr<Selection> sel = mDomSelections[index];
   if (!sel) {
     return NS_ERROR_NULL_POINTER;
   }
 
   // Map the abstract movement amounts (0-1) to direction-specific
   // selection units.
   static const nsSelectionAmount inlineAmount[] =
@@ -2347,17 +2347,17 @@ nsFrameSelection::SelectAll()
     if (!doc)
       return NS_ERROR_FAILURE;
     rootContent = doc->GetRootElement();
     if (!rootContent)
       return NS_ERROR_FAILURE;
   }
   int32_t numChildren = rootContent->GetChildCount();
   PostReason(nsISelectionListener::NO_REASON);
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   AutoPrepareFocusRange prep(mDomSelections[index], false, false);
   return TakeFocus(rootContent, 0, numChildren, CARET_ASSOCIATE_BEFORE, false, false);
 }
 
 //////////END FRAMESELECTION
 
 void
 nsFrameSelection::StartBatchChanges()
@@ -2370,17 +2370,17 @@ nsFrameSelection::EndBatchChanges(int16_
 {
   mBatching--;
   NS_ASSERTION(mBatching >=0,"Bad mBatching");
 
   if (mBatching == 0 && mChangesDuringBatching) {
     int16_t postReason = PopReason() | aReason;
     PostReason(postReason);
     mChangesDuringBatching = false;
-    NotifySelectionListeners(SelectionType::SELECTION_NORMAL);
+    NotifySelectionListeners(SelectionType::eNormal);
   }
 }
 
 
 nsresult
 nsFrameSelection::NotifySelectionListeners(SelectionType aSelectionType)
 {
   int8_t index = GetIndexFromSelectionType(aSelectionType);
@@ -2405,17 +2405,17 @@ nsFrameSelection::GetCellLayout(nsIConte
   nsITableCellLayout *cellLayoutObject =
     do_QueryFrame(aCellContent->GetPrimaryFrame());
   return cellLayoutObject;
 }
 
 nsresult
 nsFrameSelection::ClearNormalSelection()
 {
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   return mDomSelections[index]->RemoveAllRanges();
 }
 
 static nsIContent*
 GetFirstSelectedContent(nsRange* aRange)
@@ -2451,17 +2451,17 @@ nsFrameSelection::HandleTableSelection(n
 
   nsresult result = NS_OK;
 
   nsIContent *childContent = aParentContent->GetChildAt(aContentOffset);
 
   // When doing table selection, always set the direction to next so
   // we can be sure that anchorNode's offset always points to the
   // selected cell
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   mDomSelections[index]->SetDirection(eDirNext);
 
   // Stack-class to wrap all table selection changes in 
   //  BeginBatchChanges() / EndBatchChanges()
   SelectionBatcher selectionBatcher(mDomSelections[index]);
@@ -2794,17 +2794,17 @@ nsFrameSelection::SelectBlockOfCells(nsI
 nsresult
 nsFrameSelection::UnselectCells(nsIContent *aTableContent,
                                 int32_t aStartRowIndex,
                                 int32_t aStartColumnIndex,
                                 int32_t aEndRowIndex,
                                 int32_t aEndColumnIndex,
                                 bool aRemoveOutsideOfCellRange)
 {
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   nsTableOuterFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
   if (!tableFrame)
     return NS_ERROR_FAILURE;
 
   int32_t minRowIndex = std::min(aStartRowIndex, aEndRowIndex);
@@ -2874,17 +2874,17 @@ nsFrameSelection::UnselectCells(nsIConte
 
 nsresult
 nsFrameSelection::AddCellsToSelection(nsIContent *aTableContent,
                                       int32_t aStartRowIndex,
                                       int32_t aStartColumnIndex,
                                       int32_t aEndRowIndex,
                                       int32_t aEndColumnIndex)
 {
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   nsTableOuterFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
   if (!tableFrame) // Check that |table| is a table.
     return NS_ERROR_FAILURE;
 
   nsresult result = NS_OK;
@@ -3072,17 +3072,17 @@ nsFrameSelection::GetFirstCellNodeInRang
     return nullptr;
 
   return childContent;
 }
 
 nsRange*
 nsFrameSelection::GetFirstCellRange()
 {
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return nullptr;
 
   nsRange* firstRange = mDomSelections[index]->GetRangeAt(0);
   if (!GetFirstCellNodeInRange(firstRange)) {
     return nullptr;
   }
 
@@ -3090,17 +3090,17 @@ nsFrameSelection::GetFirstCellRange()
   mSelectedCellIndex = 1;
 
   return firstRange;
 }
 
 nsRange*
 nsFrameSelection::GetNextCellRange()
 {
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return nullptr;
 
   nsRange* range = mDomSelections[index]->GetRangeAt(mSelectedCellIndex);
 
   // Get first node in next range of selection - test if it's a cell
   if (!GetFirstCellNodeInRange(range)) {
     return nullptr;
@@ -3317,31 +3317,31 @@ nsFrameSelection::CreateAndAddRange(nsIN
   RefPtr<nsRange> range = new nsRange(aParentNode);
 
   // Set range around child at given offset
   nsresult result = range->SetStart(aParentNode, aOffset);
   if (NS_FAILED(result)) return result;
   result = range->SetEnd(aParentNode, aOffset+1);
   if (NS_FAILED(result)) return result;
   
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   return mDomSelections[index]->AddRange(range);
 }
 
 // End of Table Selection
 
 void
 nsFrameSelection::SetAncestorLimiter(nsIContent *aLimiter)
 {
   if (mAncestorLimiter != aLimiter) {
     mAncestorLimiter = aLimiter;
-    int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+    int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
     if (!mDomSelections[index])
       return;
 
     if (!IsValidSelectionPoint(this, mDomSelections[index]->GetFocusNode())) {
       ClearNormalSelection();
       if (mAncestorLimiter) {
         PostReason(nsISelectionListener::NO_REASON);
         TakeFocus(mAncestorLimiter, 0, 0, CARET_ASSOCIATE_BEFORE, false, false);
@@ -3359,17 +3359,17 @@ nsFrameSelection::SetAncestorLimiter(nsI
 
 nsresult
 nsFrameSelection::DeleteFromDocument()
 {
   nsresult res;
 
   // If we're already collapsed, then we do nothing (bug 719503).
   bool isCollapsed;
-  int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+  int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
   if (!mDomSelections[index])
     return NS_ERROR_NULL_POINTER;
 
   mDomSelections[index]->GetIsCollapsed( &isCollapsed);
   if (isCollapsed)
   {
     return NS_OK;
   }
@@ -3409,17 +3409,17 @@ nsFrameSelection::SetDelayedCaretData(Wi
   }
 }
 
 void
 nsFrameSelection::DisconnectFromPresShell()
 {
   RefPtr<AccessibleCaretEventHub> eventHub = mShell->GetAccessibleCaretEventHub();
   if (eventHub) {
-    int8_t index = GetIndexFromSelectionType(SelectionType::SELECTION_NORMAL);
+    int8_t index = GetIndexFromSelectionType(SelectionType::eNormal);
     mDomSelections[index]->RemoveSelectionListener(eventHub);
   }
 
   StopAutoScrollTimer();
   for (size_t i = 0; i < kPresentSelectionTypeCount; i++) {
     mDomSelections[i]->Clear(nullptr);
   }
   mShell = nullptr;
@@ -3433,27 +3433,27 @@ nsFrameSelection::DisconnectFromPresShel
 
 // mozilla::dom::Selection implementation
 
 // note: this can return a nil anchor node
 
 Selection::Selection()
   : mCachedOffsetForFrame(nullptr)
   , mDirection(eDirNext)
-  , mSelectionType(SelectionType::SELECTION_NORMAL)
+  , mSelectionType(SelectionType::eNormal)
   , mUserInitiated(false)
   , mSelectionChangeBlockerCount(0)
 {
 }
 
 Selection::Selection(nsFrameSelection* aList)
   : mFrameSelection(aList)
   , mCachedOffsetForFrame(nullptr)
   , mDirection(eDirNext)
-  , mSelectionType(SelectionType::SELECTION_NORMAL)
+  , mSelectionType(SelectionType::eNormal)
   , mUserInitiated(false)
   , mSelectionChangeBlockerCount(0)
 {
 }
 
 Selection::~Selection()
 {
   setAnchorFocusRange(-1);
@@ -3808,17 +3808,17 @@ Selection::AddItem(nsRange* aItem, int32
 
   NS_ASSERTION(aOutIndex, "aOutIndex can't be null");
 
   if (mUserInitiated) {
     AutoTArray<RefPtr<nsRange>, 4> rangesToAdd;
     *aOutIndex = -1;
 
     if (!aNoStartSelect &&
-        mSelectionType == SelectionType::SELECTION_NORMAL &&
+        mSelectionType == SelectionType::eNormal &&
         nsFrameSelection::sSelectionEventsEnabled && Collapsed() &&
         !IsBlockingSelectionChangeEvents()) {
       // First, we generate the ranges to add with a scratch range, which is a
       // clone of the original range passed in. We do this seperately, because the
       // selectstart event could have caused the world to change, and required
       // ranges to be re-generated
       RefPtr<nsRange> scratchRange = aItem->CloneRange();
       UserSelectRangesToAdd(scratchRange, rangesToAdd);
@@ -4919,17 +4919,17 @@ Selection::AddRange(nsRange& aRange, Err
 
   if (rangeIndex < 0) {
     return;
   }
 
   setAnchorFocusRange(rangeIndex);
   
   // Make sure the caret appears on the next line, if at a newline
-  if (mSelectionType == SelectionType::SELECTION_NORMAL) {
+  if (mSelectionType == SelectionType::eNormal) {
     SetInterlinePosition(true);
   }
 
   RefPtr<nsPresContext>  presContext = GetPresContext();
   selectFrames(presContext, &aRange, true);
 
   if (!mFrameSelection)
     return;//nothing to do
@@ -6425,17 +6425,17 @@ JSObject*
 Selection::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return mozilla::dom::SelectionBinding::Wrap(aCx, this, aGivenProto);
 }
 
 // AutoHideSelectionChanges
 AutoHideSelectionChanges::AutoHideSelectionChanges(const nsFrameSelection* aFrame)
   : AutoHideSelectionChanges(
-      aFrame ? aFrame->GetSelection(SelectionType::SELECTION_NORMAL) : nullptr)
+      aFrame ? aFrame->GetSelection(SelectionType::eNormal) : nullptr)
 {}
 
 // nsAutoCopyListener
 
 nsAutoCopyListener* nsAutoCopyListener::sInstance = nullptr;
 
 NS_IMPL_ISUPPORTS(nsAutoCopyListener, nsISelectionListener)
 
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -5632,17 +5632,17 @@ nsTextFrame::DrawSelectionDecorations(gf
 bool
 nsTextFrame::GetSelectionTextColors(SelectionType aSelectionType,
                                     nsTextPaintStyle& aTextPaintStyle,
                                     const TextRangeStyle &aRangeStyle,
                                     nscolor* aForeground,
                                     nscolor* aBackground)
 {
   switch (aSelectionType) {
-    case SelectionType::SELECTION_NORMAL:
+    case SelectionType::eNormal:
       return aTextPaintStyle.GetSelectionColors(aForeground, aBackground);
     case SelectionType::SELECTION_FIND:
       aTextPaintStyle.GetHighlightColors(aForeground, aBackground);
       return true;
     case SelectionType::SELECTION_URLSECONDARY:
       aTextPaintStyle.GetURLSecondaryColor(aForeground);
       *aBackground = NS_RGBA(0,0,0,0);
       return true;
@@ -5695,17 +5695,17 @@ nsTextFrame::GetSelectionTextColors(Sele
  * (NOT reset to null), and the function returns false.
  */
 static bool GetSelectionTextShadow(nsIFrame* aFrame,
                                    SelectionType aSelectionType,
                                    nsTextPaintStyle& aTextPaintStyle,
                                    nsCSSShadowArray** aShadow)
 {
   switch (aSelectionType) {
-    case SelectionType::SELECTION_NORMAL:
+    case SelectionType::eNormal:
       return aTextPaintStyle.GetSelectionShadow(aShadow);
     default:
       return false;
   }
 }
 
 /**
  * This class lets us iterate over chunks of text in a uniform selection state,
@@ -6900,17 +6900,17 @@ nsTextFrame::IsVisibleInSelection(nsISel
   SelectionDetails* details = GetSelectionDetails();
   bool found = false;
     
   // where are the selection points "really"
   SelectionDetails *sdptr = details;
   while (sdptr) {
     if (sdptr->mEnd > GetContentOffset() &&
         sdptr->mStart < GetContentEnd() &&
-        sdptr->mSelectionType == SelectionType::SELECTION_NORMAL) {
+        sdptr->mSelectionType == SelectionType::eNormal) {
       found = true;
       break;
     }
     sdptr = sdptr->mNext;
   }
   DestroySelectionDetails(details);
 
   return found;
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -1093,18 +1093,17 @@ nsPrintEngine::IsThereARangeSelection(ns
     presShell = aDOMWin->GetDocShell()->GetPresShell();
   }
 
   if (!presShell)
     return false;
 
   // check here to see if there is a range selection
   // so we know whether to turn on the "Selection" radio button
-  Selection* selection =
-    presShell->GetCurrentSelection(SelectionType::SELECTION_NORMAL);
+  Selection* selection = presShell->GetCurrentSelection(SelectionType::eNormal);
   if (!selection) {
     return false;
   }
 
   int32_t rangeCount = selection->RangeCount();
   if (!rangeCount) {
     return false;
   }
@@ -1955,19 +1954,19 @@ nsresult
 nsPrintEngine::UpdateSelectionAndShrinkPrintObject(nsPrintObject* aPO,
                                                    bool aDocumentIsTopLevel)
 {
   nsCOMPtr<nsIPresShell> displayShell = aPO->mDocShell->GetPresShell();
   // Transfer Selection Ranges to the new Print PresShell
   RefPtr<Selection> selection, selectionPS;
   // It's okay if there is no display shell, just skip copying the selection
   if (displayShell) {
-    selection = displayShell->GetCurrentSelection(SelectionType::SELECTION_NORMAL);
+    selection = displayShell->GetCurrentSelection(SelectionType::eNormal);
   }
-  selectionPS = aPO->mPresShell->GetCurrentSelection(SelectionType::SELECTION_NORMAL);
+  selectionPS = aPO->mPresShell->GetCurrentSelection(SelectionType::eNormal);
 
   // Reset all existing selection ranges that might have been added by calling
   // this function before.
   if (selectionPS) {
     selectionPS->RemoveAllRanges();
   }
   if (selection && selectionPS) {
     int32_t cnt = selection->RangeCount();
@@ -2368,19 +2367,19 @@ CloneRangeToSelection(nsRange* aRange, n
 
 static nsresult CloneSelection(nsIDocument* aOrigDoc, nsIDocument* aDoc)
 {
   nsIPresShell* origShell = aOrigDoc->GetShell();
   nsIPresShell* shell = aDoc->GetShell();
   NS_ENSURE_STATE(origShell && shell);
 
   RefPtr<Selection> origSelection =
-    origShell->GetCurrentSelection(SelectionType::SELECTION_NORMAL);
+    origShell->GetCurrentSelection(SelectionType::eNormal);
   RefPtr<Selection> selection =
-    shell->GetCurrentSelection(SelectionType::SELECTION_NORMAL);
+    shell->GetCurrentSelection(SelectionType::eNormal);
   NS_ENSURE_STATE(origSelection && selection);
 
   int32_t rangeCount = origSelection->RangeCount();
   for (int32_t i = 0; i < rangeCount; ++i) {
       CloneRangeToSelection(origSelection->GetRangeAt(i), aDoc, selection);
   }
   return NS_OK;
 }
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -116,17 +116,17 @@ ToSelectionType(TextRangeType aTextRange
     case TextRangeType::eSelectedRawClause:
       return SelectionType::SELECTION_IME_SELECTEDRAWTEXT;
     case TextRangeType::eConvertedClause:
       return SelectionType::SELECTION_IME_CONVERTEDTEXT;
     case TextRangeType::eSelectedClause:
       return SelectionType::SELECTION_IME_SELECTEDCONVERTEDTEXT;
     default:
       MOZ_CRASH("TextRangeType is invalid");
-      return SelectionType::SELECTION_NORMAL;
+      return SelectionType::eNormal;
   }
 }
 
 /******************************************************************************
  * As*Event() implementation
  ******************************************************************************/
 
 #define NS_ROOT_EVENT_CLASS(aPrefix, aName)