Bug 960871 part.1 Rename WidgetTextEvent::theText to WidgetTextEvent::mData r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 07 Oct 2014 19:01:46 +0900
changeset 209136 aad7264777993babeac9991c80cd29ea9a421f38
parent 209135 435e1a7b1a347e2ca5a564f4c45625e50fef3e05
child 209137 3b622a7464cc84dbb5ad860fc01aff62311cd92d
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssmaug
bugs960871
milestone35.0a1
Bug 960871 part.1 Rename WidgetTextEvent::theText to WidgetTextEvent::mData r=smaug
dom/base/CompositionStringSynthesizer.cpp
dom/events/TextComposition.cpp
dom/ipc/TabParent.cpp
editor/libeditor/nsPlaintextEditor.cpp
widget/TextEvents.h
widget/android/nsWindow.cpp
widget/cocoa/TextInputHandler.mm
widget/gtk/nsGtkIMModule.cpp
widget/gtk/nsWindow.cpp
widget/nsGUIEventIPC.h
widget/windows/nsIMM32Handler.cpp
widget/windows/nsTextStore.cpp
widget/xpwidgets/PuppetWidget.cpp
--- a/dom/base/CompositionStringSynthesizer.cpp
+++ b/dom/base/CompositionStringSynthesizer.cpp
@@ -132,17 +132,17 @@ CompositionStringSynthesizer::DispatchEv
       ClearInternal();
       return NS_ERROR_ILLEGAL_VALUE;
     }
     mClauses->AppendElement(mCaret);
   }
 
   WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
   textEvent.time = PR_IntervalNow();
-  textEvent.theText = mString;
+  textEvent.mData = mString;
   if (!mClauses->IsEmpty()) {
     textEvent.mRanges = mClauses;
   }
 
   // XXX How should we set false for this on b2g?
   textEvent.mFlags.mIsSynthesizedForTests = true;
 
   nsEventStatus status = nsEventStatus_eIgnore;
--- a/dom/events/TextComposition.cpp
+++ b/dom/events/TextComposition.cpp
@@ -62,26 +62,26 @@ TextComposition::MatchesNativeContext(ns
 
 bool
 TextComposition::MaybeDispatchCompositionUpdate(const WidgetTextEvent* aEvent)
 {
   if (Destroyed()) {
     return false;
   }
 
-  if (mLastData == aEvent->theText) {
+  if (mLastData == aEvent->mData) {
     return true;
   }
 
   WidgetCompositionEvent compositionUpdate(aEvent->mFlags.mIsTrusted,
                                            NS_COMPOSITION_UPDATE,
                                            aEvent->widget);
   compositionUpdate.time = aEvent->time;
   compositionUpdate.timeStamp = aEvent->timeStamp;
-  compositionUpdate.data = aEvent->theText;
+  compositionUpdate.data = aEvent->mData;
   compositionUpdate.mFlags.mIsSynthesizedForTests =
     aEvent->mFlags.mIsSynthesizedForTests;
 
   nsEventStatus status = nsEventStatus_eConsumeNoDefault;
   mLastData = compositionUpdate.data;
   EventDispatcher::Dispatch(mNode, mPresContext,
                             &compositionUpdate, nullptr, &status, nullptr);
   return !Destroyed();
@@ -144,17 +144,17 @@ TextComposition::DispatchEvent(WidgetGUI
   // 2. non-empty string is committed at requesting cancel.
   if (!aIsSynthesized && (mIsRequestingCommit || mIsRequestingCancel)) {
     nsString* committingData = nullptr;
     switch (aEvent->message) {
       case NS_COMPOSITION_END:
         committingData = &aEvent->AsCompositionEvent()->data;
         break;
       case NS_TEXT_TEXT:
-        committingData = &aEvent->AsTextEvent()->theText;
+        committingData = &aEvent->AsTextEvent()->mData;
         break;
       default:
         NS_WARNING("Unexpected event comes during committing or "
                    "canceling composition");
         break;
     }
     if (committingData) {
       if (mIsRequestingCommit && committingData->IsEmpty() &&
@@ -282,17 +282,17 @@ TextComposition::RequestToCommit(nsIWidg
       // Emulates to commit or cancel the composition
       // FYI: These events may be discarded by PresShell if it's not safe to
       //      dispatch the event.
       nsCOMPtr<nsIWidget> widget(aWidget);
       nsAutoString commitData(aDiscard ? EmptyString() : lastData);
       bool changingData = lastData != commitData;
 
       WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
-      textEvent.theText = commitData;
+      textEvent.mData = commitData;
       textEvent.mFlags.mIsSynthesizedForTests = true;
 
       MaybeDispatchCompositionUpdate(&textEvent);
 
       // If changing the data or committing string isn't empty, we need to
       // dispatch text event for setting the composition string without
       // IME selection.
       if (!Destroyed() && !widget->Destroyed() &&
@@ -341,17 +341,17 @@ TextComposition::NotifyIME(IMEMessage aM
 
 void
 TextComposition::EditorWillHandleTextEvent(const WidgetTextEvent* aTextEvent)
 {
   mIsComposing = aTextEvent->IsComposing();
   mRanges = aTextEvent->mRanges;
   mIsEditorHandlingEvent = true;
 
-  MOZ_ASSERT(mLastData == aTextEvent->theText,
+  MOZ_ASSERT(mLastData == aTextEvent->mData,
     "The text of a text event must be same as previous data attribute value "
     "of the latest compositionupdate event");
 }
 
 void
 TextComposition::EditorDidHandleTextEvent()
 {
   mString = mLastData;
@@ -450,17 +450,17 @@ TextComposition::CompositionEventDispatc
         mTextComposition->IsSynthesizedForTests();
       IMEStateManager::DispatchCompositionEvent(mEventTarget, presContext,
                                                 &compEvent, &status, nullptr,
                                                 mIsSynthesizedEvent);
       break;
     }
     case NS_TEXT_TEXT: {
       WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
-      textEvent.theText = mData;
+      textEvent.mData = mData;
       textEvent.mFlags.mIsSynthesizedForTests =
         mTextComposition->IsSynthesizedForTests();
       IMEStateManager::DispatchCompositionEvent(mEventTarget, presContext,
                                                 &textEvent, &status, nullptr,
                                                 mIsSynthesizedEvent);
       break;
     }
     default:
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1583,27 +1583,27 @@ TabParent::SendCompositionEvent(WidgetCo
  */
 bool
 TabParent::SendTextEvent(WidgetTextEvent& event)
 {
   if (mIsDestroyed) {
     return false;
   }
   if (mIMECompositionEnding) {
-    mIMECompositionText = event.theText;
+    mIMECompositionText = event.mData;
     return true;
   }
 
   // We must be able to simulate the selection because
   // we might not receive selection updates in time
   if (!mIMEComposing) {
     mIMECompositionStart = std::min(mIMESelectionAnchor, mIMESelectionFocus);
   }
   mIMESelectionAnchor = mIMESelectionFocus =
-      mIMECompositionStart + event.theText.Length();
+      mIMECompositionStart + event.mData.Length();
 
   event.mSeqno = ++mIMESeqno;
   return PBrowserParent::SendTextEvent(event);
 }
 
 bool
 TabParent::SendSelectionEvent(WidgetSelectionEvent& event)
 {
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -874,17 +874,17 @@ nsPlaintextEditor::UpdateIMEComposition(
 
   NotifyEditorObservers(eNotifyEditorObserversOfBefore);
 
   nsRefPtr<nsCaret> caretP = ps->GetCaret();
 
   {
     nsAutoPlaceHolderBatch batch(this, nsGkAtoms::IMETxnName);
 
-    rv = InsertText(widgetTextEvent->theText);
+    rv = InsertText(widgetTextEvent->mData);
 
     if (caretP) {
       caretP->SetSelection(selection);
     }
   }
 
   // If still composing, we should fire input event via observer.
   // Note that if committed, we don't need to notify it since it will be
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -237,17 +237,17 @@ public:
     // Not copying widget, it is a weak reference.
     WidgetTextEvent* result = new WidgetTextEvent(false, message, nullptr);
     result->AssignTextEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
   // The composition string or the commit string.
-  nsString theText;
+  nsString mData;
   // Indicates whether the event signifies printable text.
   // XXX This is not a standard, and most platforms don't set this properly.
   //     So, perhaps, we can get rid of this.
   bool isChar;
 
   nsRefPtr<TextRangeArray> mRanges;
 
   void AssignTextEventData(const WidgetTextEvent& aEvent, bool aCopyTargets)
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -680,17 +680,17 @@ nsWindow::DispatchEvent(WidgetGUIEvent* 
         case NS_COMPOSITION_END:
             MOZ_ASSERT(mIMEComposing);
             mIMEComposing = false;
             mIMEComposingStart = -1;
             mIMEComposingText.Truncate();
             break;
         case NS_TEXT_TEXT:
             MOZ_ASSERT(mIMEComposing);
-            mIMEComposingText = aEvent->AsTextEvent()->theText;
+            mIMEComposingText = aEvent->AsTextEvent()->mData;
             break;
         }
         return status;
     }
     return nsEventStatus_eIgnore;
 }
 
 NS_IMETHODIMP
@@ -1704,17 +1704,17 @@ nsWindow::RemoveIMEComposition()
         return;
 
     nsRefPtr<nsWindow> kungFuDeathGrip(this);
     AutoIMEMask selMask(mIMEMaskSelectionUpdate);
     AutoIMEMask textMask(mIMEMaskTextUpdate);
 
     WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
     InitEvent(textEvent, nullptr);
-    textEvent.theText = mIMEComposingText;
+    textEvent.mData = mIMEComposingText;
     DispatchEvent(&textEvent);
 
     WidgetCompositionEvent event(true, NS_COMPOSITION_END, this);
     InitEvent(event, nullptr);
     DispatchEvent(&event);
 }
 
 void
@@ -1842,24 +1842,24 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
                     DispatchEvent(&event);
                     mIMEComposingStart = ae->Start();
                 }
             }
 
             {
                 WidgetTextEvent event(true, NS_TEXT_TEXT, this);
                 InitEvent(event, nullptr);
-                event.theText = ae->Characters();
+                event.mData = ae->Characters();
 
                 if (ae->Action() == AndroidGeckoEvent::IME_COMPOSE_TEXT) {
                     // Because we're leaving the composition open, we need to
                     // include proper text ranges to make the editor happy.
                     TextRange range;
                     range.mStartOffset = 0;
-                    range.mEndOffset = event.theText.Length();
+                    range.mEndOffset = event.mData.Length();
                     range.mRangeType = NS_TEXTRANGE_RAWINPUT;
                     event.mRanges = new TextRangeArray();
                     event.mRanges->AppendElement(range);
                 }
 
                 DispatchEvent(&event);
             }
 
@@ -1981,39 +1981,39 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
 
                 {
                     WidgetQueryContentEvent queryEvent(true,
                                                        NS_QUERY_SELECTED_TEXT,
                                                        this);
                     InitEvent(queryEvent, nullptr);
                     DispatchEvent(&queryEvent);
                     MOZ_ASSERT(queryEvent.mSucceeded && !queryEvent.mWasAsync);
-                    event.theText = queryEvent.mReply.mString;
+                    event.mData = queryEvent.mReply.mString;
 
                     mIMEComposingStart = queryEvent.mReply.mOffset;
                 }
 
                 {
                     WidgetCompositionEvent event(
                         true, NS_COMPOSITION_START, this);
                     InitEvent(event, nullptr);
                     DispatchEvent(&event);
                 }
 
             } else {
                 // If the new composition matches the existing composition,
                 // reuse the old composition.
-                event.theText = mIMEComposingText;
+                event.mData = mIMEComposingText;
             }
 
 #ifdef DEBUG_ANDROID_IME
-            const NS_ConvertUTF16toUTF8 theText8(event.theText);
-            const char* text = theText8.get();
+            const NS_ConvertUTF16toUTF8 data(event.mData);
+            const char* text = data.get();
             ALOGIME("IME: IME_SET_TEXT: text=\"%s\", length=%u, range=%u",
-                    text, event.theText.Length(), event.mRanges->Length());
+                    text, event.mData.Length(), event.mRanges->Length());
 #endif // DEBUG_ANDROID_IME
 
             DispatchEvent(&event);
 
             // Notify SelectionHandler of final caret position
             // Required in cases of keyboards providing autoCorrections
             AndroidGeckoEvent* broadcastEvent =
                 AndroidGeckoEvent::MakeBroadcastEvent(
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2713,21 +2713,21 @@ IMEInputHandler::DispatchTextEvent(const
      TrueOrFalse(aDoCommit), TrueOrFalse(Destroyed())));
 
   NS_ENSURE_TRUE(!Destroyed(), false);
 
   nsRefPtr<IMEInputHandler> kungFuDeathGrip(this);
 
   WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
   textEvent.time = PR_IntervalNow();
-  textEvent.theText = aText;
+  textEvent.mData = aText;
   if (!aDoCommit) {
     textEvent.mRanges = CreateTextRangeArray(aAttrString, aSelectedRange);
   }
-  mLastDispatchedCompositionString = textEvent.theText;
+  mLastDispatchedCompositionString = textEvent.mData;
   return DispatchEvent(textEvent);
 }
 
 void
 IMEInputHandler::InitCompositionEvent(WidgetCompositionEvent& aCompositionEvent)
 {
   aCompositionEvent.time = PR_IntervalNow();
 }
--- a/widget/gtk/nsGtkIMModule.cpp
+++ b/widget/gtk/nsGtkIMModule.cpp
@@ -1106,17 +1106,17 @@ nsGtkIMModule::DispatchTextEvent(const n
         }
     }
 
     WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mLastFocusedWindow);
     InitEvent(textEvent);
 
     uint32_t targetOffset = mCompositionStart;
 
-    textEvent.theText = mDispatchedCompositionString = aCompositionString;
+    textEvent.mData = mDispatchedCompositionString = aCompositionString;
 
     if (!aIsCommit) {
         // NOTE: SetTextRangeList() assumes that mDispatchedCompositionString
         //       has been updated already.
         textEvent.mRanges = CreateTextRangeArray();
         targetOffset += textEvent.mRanges->TargetClauseOffset();
     }
 
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3045,17 +3045,17 @@ nsWindow::OnKeyPressEvent(GdkEventKey *a
             DispatchEvent(&event, status);
         }
         else {
             WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
             char16_t textString[3];
             textString[0] = H_SURROGATE(event.charCode);
             textString[1] = L_SURROGATE(event.charCode);
             textString[2] = 0;
-            textEvent.theText = textString;
+            textEvent.mData = textString;
             textEvent.time = event.time;
             DispatchEvent(&textEvent, status);
         }
     }
 
     // If the event was consumed, return.
     if (status == nsEventStatus_eConsumeNoDefault) {
         return TRUE;
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -445,32 +445,32 @@ template<>
 struct ParamTraits<mozilla::WidgetTextEvent>
 {
   typedef mozilla::WidgetTextEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
     WriteParam(aMsg, aParam.mSeqno);
-    WriteParam(aMsg, aParam.theText);
+    WriteParam(aMsg, aParam.mData);
     WriteParam(aMsg, aParam.isChar);
     bool hasRanges = !!aParam.mRanges;
     WriteParam(aMsg, hasRanges);
     if (hasRanges) {
       WriteParam(aMsg, *aParam.mRanges.get());
     }
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     bool hasRanges;
     if (!ReadParam(aMsg, aIter,
                    static_cast<mozilla::WidgetGUIEvent*>(aResult)) ||
         !ReadParam(aMsg, aIter, &aResult->mSeqno) ||
-        !ReadParam(aMsg, aIter, &aResult->theText) ||
+        !ReadParam(aMsg, aIter, &aResult->mData) ||
         !ReadParam(aMsg, aIter, &aResult->isChar) ||
         !ReadParam(aMsg, aIter, &hasRanges)) {
       return false;
     }
 
     if (!hasRanges) {
       aResult->mRanges = nullptr;
     } else {
--- a/widget/windows/nsIMM32Handler.cpp
+++ b/widget/windows/nsIMM32Handler.cpp
@@ -1593,17 +1593,17 @@ nsIMM32Handler::DispatchTextEvent(nsWind
   WidgetTextEvent event(true, NS_TEXT_TEXT, aWindow);
 
   aWindow->InitEvent(event, &point);
 
   if (aCheckAttr) {
     event.mRanges = CreateTextRangeArray();
   }
 
-  event.theText = mLastDispatchedCompositionString = mCompositionString;
+  event.mData = mLastDispatchedCompositionString = mCompositionString;
 
   aWindow->DispatchWindowEvent(&event);
 
   // Calling SetIMERelatedWindowsPos will be failure on e10s at this point.
   // text event will notify NOTIFY_IME_OF_COMPOSITION_UPDATE, then
   // it will call SetIMERelatedWindowsPos.
 }
 
--- a/widget/windows/nsTextStore.cpp
+++ b/widget/windows/nsTextStore.cpp
@@ -1647,21 +1647,21 @@ nsTextStore::FlushPendingActions()
         action.mData.ReplaceSubstring(NS_LITERAL_STRING("\r\n"),
                                       NS_LITERAL_STRING("\n"));
 
         PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
                ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
                 "dispatching text event...", this));
         WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
         mWidget->InitEvent(textEvent);
-        textEvent.theText = action.mData;
+        textEvent.mData = action.mData;
         if (action.mRanges->IsEmpty()) {
           TextRange wholeRange;
           wholeRange.mStartOffset = 0;
-          wholeRange.mEndOffset = textEvent.theText.Length();
+          wholeRange.mEndOffset = textEvent.mData.Length();
           wholeRange.mRangeType = NS_TEXTRANGE_RAWINPUT;
           action.mRanges->AppendElement(wholeRange);
         }
         textEvent.mRanges = action.mRanges;
         mWidget->DispatchWindowEvent(&textEvent);
         // Be aware, the mWidget might already have been destroyed.
         break;
       }
@@ -1674,28 +1674,28 @@ nsTextStore::FlushPendingActions()
         action.mData.ReplaceSubstring(NS_LITERAL_STRING("\r\n"),
                                       NS_LITERAL_STRING("\n"));
 
         PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
                ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
                 "dispatching text event...", this));
         WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
         mWidget->InitEvent(textEvent);
-        textEvent.theText = action.mData;
+        textEvent.mData = action.mData;
         mWidget->DispatchWindowEvent(&textEvent);
         if (!mWidget || mWidget->Destroyed()) {
           break;
         }
 
         PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
                ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
                 "dispatching compositionend event...", this));
         WidgetCompositionEvent compositionEnd(true, NS_COMPOSITION_END,
                                               mWidget);
-        compositionEnd.data = textEvent.theText;
+        compositionEnd.data = textEvent.mData;
         mWidget->InitEvent(compositionEnd);
         mWidget->DispatchWindowEvent(&compositionEnd);
         if (!mWidget || mWidget->Destroyed()) {
           break;
         }
         break;
       }
       case PendingAction::SELECTION_SET: {
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -383,17 +383,17 @@ PuppetWidget::IMEEndComposition(bool aCa
 
   nsEventStatus status;
   WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
   InitEvent(textEvent, nullptr);
   textEvent.mSeqno = mIMELastReceivedSeqno;
   // SendEndIMEComposition is always called since ResetInputState
   // should always be called even if we aren't composing something.
   if (!mTabChild ||
-      !mTabChild->SendEndIMEComposition(aCancel, &textEvent.theText)) {
+      !mTabChild->SendEndIMEComposition(aCancel, &textEvent.mData)) {
     return NS_ERROR_FAILURE;
   }
 
   if (!mIMEComposing)
     return NS_OK;
 
   DispatchEvent(&textEvent, status);