Bug 1278014 part.6 Rename SelectionType::SELECTION_SPELLCHECK to SelectionType::eSpellCheck r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 09 Jun 2016 18:37:36 +0900
changeset 377651 ddf076a9c1fe6c00d7404ac6432d0d2bb9e5b1b8
parent 377650 c9ebef101aab87cc3ddd9132bbf148071dde686a
child 377652 85aace2eb3d5cbdd0f468987a79860f7e8874a0b
push id20850
push usermasayuki@d-toybox.com
push dateSat, 11 Jun 2016 06:51:43 +0000
reviewerssmaug
bugs1278014
milestone50.0a1
Bug 1278014 part.6 Rename SelectionType::SELECTION_SPELLCHECK to SelectionType::eSpellCheck r?smaug MozReview-Commit-ID: 4n2jEVax37O
accessible/base/SelectionManager.cpp
accessible/generic/HyperTextAccessible.cpp
dom/base/nsISelectionController.idl
layout/generic/nsFrame.cpp
layout/generic/nsSelection.cpp
layout/generic/nsTextFrame.cpp
--- a/accessible/base/SelectionManager.cpp
+++ b/accessible/base/SelectionManager.cpp
@@ -59,18 +59,17 @@ SelectionManager::ClearControlSelectionL
     return;
 
   // Remove 'this' registered as selection listener for the normal selection.
   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);
+  Selection* spellSel = frameSel->GetSelection(SelectionType::eSpellCheck);
   spellSel->RemoveSelectionListener(this);
 }
 
 void
 SelectionManager::SetControlSelectionListener(dom::Element* aFocusedElm)
 {
   // When focus moves such that the caret is part of a new frame selection
   // this removes the old selection listener and attaches a new one for
@@ -86,49 +85,46 @@ SelectionManager::SetControlSelectionLis
   if (!frameSel)
     return;
 
   // Register 'this' as selection listener for the normal selection.
   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);
+  Selection* spellSel = frameSel->GetSelection(SelectionType::eSpellCheck);
   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::eNormal);
   normalSel->AddSelectionListener(this);
 
   // Register 'this' as selection listener for the spell check selection.
-  Selection* spellSel =
-    frameSel->GetSelection(SelectionType::SELECTION_SPELLCHECK);
+  Selection* spellSel = frameSel->GetSelection(SelectionType::eSpellCheck);
   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::eNormal);
   normalSel->RemoveSelectionListener(this);
 
   // Remove 'this' registered as selection listener for the spellcheck
   // selection.
-  Selection* spellSel =
-    frameSel->GetSelection(SelectionType::SELECTION_SPELLCHECK);
+  Selection* spellSel = frameSel->GetSelection(SelectionType::eSpellCheck);
   spellSel->RemoveSelectionListener(this);
 }
 
 void
 SelectionManager::ProcessTextSelChangeEvent(AccEvent* aEvent)
 {
   // Fire selection change event if it's not pure caret-move selection change,
   // i.e. the accessible has or had not collapsed selection.
@@ -221,15 +217,15 @@ SelectionManager::ProcessSelectionChange
     return;
   }
 
   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) {
+  } else if (selection->GetType() == SelectionType::eSpellCheck) {
     // XXX: fire an event for container accessible of the focus/anchor range
     // of the spelcheck selection.
     text->Document()->FireDelayedEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
                                        text);
   }
 }
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -2131,17 +2131,17 @@ HyperTextAccessible::GetSpellTextAttr(ns
                                       uint32_t* aStartOffset,
                                       uint32_t* aEndOffset,
                                       nsIPersistentProperties* aAttributes)
 {
   RefPtr<nsFrameSelection> fs = FrameSelection();
   if (!fs)
     return;
 
-  dom::Selection* domSel = fs->GetSelection(SelectionType::SELECTION_SPELLCHECK);
+  dom::Selection* domSel = fs->GetSelection(SelectionType::eSpellCheck);
   if (!domSel)
     return;
 
   int32_t rangeCount = domSel->RangeCount();
   if (rangeCount <= 0)
     return;
 
   uint32_t startOffset = 0, endOffset = 0;
--- a/dom/base/nsISelectionController.idl
+++ b/dom/base/nsISelectionController.idl
@@ -282,17 +282,17 @@ interface nsISelectionController : nsISe
 namespace mozilla {
 
 typedef short RawSelectionType;
 enum class SelectionType : RawSelectionType
 {
   eInvalid = -1,
   eNone = nsISelectionController::SELECTION_NONE,
   eNormal = nsISelectionController::SELECTION_NORMAL,
-  SELECTION_SPELLCHECK = nsISelectionController::SELECTION_SPELLCHECK,
+  eSpellCheck = 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,
   SELECTION_ACCESSIBILITY =
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3370,17 +3370,17 @@ nsFrame::HandlePress(nsPresContext* aPre
     while (curDetail)
     {
       //
       // If the user clicked inside a selection, then just
       // return without doing anything. We will handle placing
       // the caret later on when the mouse is released. We ignore
       // the spellcheck, find and url formatting selections.
       //
-      if (curDetail->mSelectionType != SelectionType::SELECTION_SPELLCHECK &&
+      if (curDetail->mSelectionType != SelectionType::eSpellCheck &&
           curDetail->mSelectionType != SelectionType::SELECTION_FIND &&
           curDetail->mSelectionType != SelectionType::SELECTION_URLSECONDARY &&
           curDetail->mSelectionType != SelectionType::SELECTION_URLSTRIKEOUT &&
           curDetail->mStart <= offsets.StartOffset() &&
           offsets.EndOffset() <= curDetail->mEnd)
       {
         inSelection = true;
       }
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -114,17 +114,17 @@ ToChar(SelectionType aSelectionType)
 {
   switch (aSelectionType) {
     case SelectionType::eInvalid:
       return "SelectionType::eInvalid";
     case SelectionType::eNone:
       return "SelectionType::eNone";
     case SelectionType::eNormal:
       return "SelectionType::eNormal";
-    case SelectionType::SELECTION_SPELLCHECK:
+    case SelectionType::eSpellCheck:
       return "SelectionType::eSpellCheck";
     case SelectionType::SELECTION_IME_RAWINPUT:
       return "SelectionType::eIMERawClause";
     case SelectionType::SELECTION_IME_SELECTEDRAWTEXT:
       return "SelectionType::eIMESelectedRawClause";
     case SelectionType::SELECTION_IME_CONVERTEDTEXT:
       return "SelectionType::eIMEConvertedClause";
     case SelectionType::SELECTION_IME_SELECTEDCONVERTEDTEXT:
@@ -143,17 +143,17 @@ ToChar(SelectionType aSelectionType)
 }
 
 static bool
 IsValidSelectionType(RawSelectionType aRawSelectionType)
 {
   switch (static_cast<SelectionType>(aRawSelectionType)) {
     case SelectionType::eNone:
     case SelectionType::eNormal:
-    case SelectionType::SELECTION_SPELLCHECK:
+    case SelectionType::eSpellCheck:
     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:
     case SelectionType::SELECTION_URLSTRIKEOUT:
@@ -348,17 +348,17 @@ nsresult NS_NewDomSelection(nsISelection
 }
 
 static int8_t
 GetIndexFromSelectionType(SelectionType aSelectionType)
 {
   switch (aSelectionType) {
     case SelectionType::eNormal:
       return 0;
-    case SelectionType::SELECTION_SPELLCHECK:
+    case SelectionType::eSpellCheck:
       return 1;
     case SelectionType::SELECTION_IME_RAWINPUT:
       return 2;
     case SelectionType::SELECTION_IME_SELECTEDRAWTEXT:
       return 3;
     case SelectionType::SELECTION_IME_CONVERTEDTEXT:
       return 4;
     case SelectionType::SELECTION_IME_SELECTEDCONVERTEDTEXT:
@@ -377,17 +377,17 @@ GetIndexFromSelectionType(SelectionType 
   /* NOTREACHED */
 }
 
 static SelectionType
 GetSelectionTypeFromIndex(int8_t aIndex)
 {
   static const SelectionType kSelectionTypes[] = {
     SelectionType::eNormal,
-    SelectionType::SELECTION_SPELLCHECK,
+    SelectionType::eSpellCheck,
     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
@@ -5016,17 +5016,17 @@ Selection::RemoveRange(nsRange& aRange, 
   if (&aRange == mAnchorFocusRange) {
     // Reset anchor to LAST range or clear it if there are no ranges.
     setAnchorFocusRange(cnt - 1);
 
     // When the selection is user-created it makes sense to scroll the range
     // into view. The spell-check selection, however, is created and destroyed
     // in the background. We don't want to scroll in this case or the view
     // might appear to be moving randomly (bug 337871).
-    if (mSelectionType != SelectionType::SELECTION_SPELLCHECK && cnt > 0) {
+    if (mSelectionType != SelectionType::eSpellCheck && cnt > 0) {
       ScrollIntoView(nsISelectionController::SELECTION_FOCUS_REGION);
     }
   }
 
   if (!mFrameSelection)
     return;//nothing to do
   rv = mFrameSelection->NotifySelectionListeners(GetType());
   if (NS_FAILED(rv)) {
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -347,17 +347,17 @@ public:
       case SelectionType::SELECTION_IME_RAWINPUT:
         return eIndexRawInput;
       case SelectionType::SELECTION_IME_SELECTEDRAWTEXT:
         return eIndexSelRawText;
       case SelectionType::SELECTION_IME_CONVERTEDTEXT:
         return eIndexConvText;
       case SelectionType::SELECTION_IME_SELECTEDCONVERTEDTEXT:
         return eIndexSelConvText;
-      case SelectionType::SELECTION_SPELLCHECK:
+      case SelectionType::eSpellCheck:
         return eIndexSpellChecker;
       default:
         NS_WARNING("non-IME selection type");
         return eIndexRawInput;
     }
   }
 
   nscolor GetSystemFieldForegroundColor();
@@ -5430,17 +5430,17 @@ nsTextFrame::ComputeSelectionUnderlineHe
                SelectionType aSelectionType)
 {
   switch (aSelectionType) {
     case SelectionType::SELECTION_IME_RAWINPUT:
     case SelectionType::SELECTION_IME_SELECTEDRAWTEXT:
     case SelectionType::SELECTION_IME_CONVERTEDTEXT:
     case SelectionType::SELECTION_IME_SELECTEDCONVERTEDTEXT:
       return aFontMetrics.underlineSize;
-    case SelectionType::SELECTION_SPELLCHECK: {
+    case SelectionType::eSpellCheck: {
       // The thickness of the spellchecker underline shouldn't honor the font
       // metrics.  It should be constant pixels value which is decided from the
       // default font size.  Note that if the actual font size is smaller than
       // the default font size, we should use the actual font size because the
       // computed value from the default font size can be too thick for the
       // current font size.
       int32_t defaultFontSize =
         aPresContext->AppUnitsToDevPixels(nsStyleFont(aPresContext).mFont.size);
@@ -5595,17 +5595,17 @@ nsTextFrame::DrawSelectionDecorations(gf
         }
       } else if (!weDefineSelectionUnderline) {
         // IME doesn't specify the selection style and we don't define selection
         // underline.
         return;
       }
       break;
     }
-    case SelectionType::SELECTION_SPELLCHECK:
+    case SelectionType::eSpellCheck:
       if (!weDefineSelectionUnderline)
         return;
       break;
     case SelectionType::SELECTION_URLSTRIKEOUT: {
       nscoord inflationMinFontSize =
         nsLayoutUtils::InflationMinFontSizeFor(this);
       float inflation =
         GetInflationForTextDecorations(this, inflationMinFontSize);
@@ -7079,17 +7079,17 @@ nsTextFrame::CombineSelectionUnderlineRe
         !(sd->mSelectionType & kRawSelectionTypesWithDecorations)) {
       continue;
     }
 
     float relativeSize;
     int32_t index =
       nsTextPaintStyle::GetUnderlineStyleIndexForSelectionType(
         sd->mSelectionType);
-    if (sd->mSelectionType == SelectionType::SELECTION_SPELLCHECK) {
+    if (sd->mSelectionType == SelectionType::eSpellCheck) {
       if (!nsTextPaintStyle::GetSelectionUnderline(aPresContext, index, nullptr,
                                                    &relativeSize,
                                                    &params.style)) {
         continue;
       }
     } else {
       // IME selections
       TextRangeStyle& rangeStyle = sd->mTextRangeStyle;