Bug 1224994 part.2 Rename TSFTextStore::LockedContent() to TSFTextStore::ContentForTSFRef() r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 29 Jun 2016 17:18:44 +0900
changeset 383441 601dcf7c025ca081507325231fb1ef24159bdb99
parent 383440 b73c6dcf8f0572f030548388a6d4ffafcaf7837b
child 383442 7ad6e31ef0507219114111a079a4c66541879a93
push id22031
push usermasayuki@d-toybox.com
push dateMon, 04 Jul 2016 06:55:01 +0000
reviewersm_kato
bugs1224994
milestone50.0a1
Bug 1224994 part.2 Rename TSFTextStore::LockedContent() to TSFTextStore::ContentForTSFRef() r?m_kato MozReview-Commit-ID: JC4lgZu38e9
widget/windows/TSFTextStore.cpp
widget/windows/TSFTextStore.h
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -1973,60 +1973,60 @@ TSFTextStore::GetSelection(ULONG ulIndex
   *pSelection = currentSel.ACP();
   *pcFetched = 1;
   MOZ_LOG(sTextStoreLog, LogLevel::Info,
          ("TSF: 0x%p   TSFTextStore::GetSelection() succeeded", this));
   return S_OK;
 }
 
 TSFTextStore::Content&
-TSFTextStore::LockedContent()
+TSFTextStore::ContentForTSFRef()
 {
   // This should be called when the document is locked or the content hasn't
   // been abandoned yet.
   if (NS_WARN_IF(!IsReadLocked() && !mContentForTSF.IsInitialized())) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   TSFTextStore::LockedContent(), FAILED, due to "
+           ("TSF: 0x%p   TSFTextStore::ContentForTSFRef(), FAILED, due to "
             "called wrong timing, IsReadLocked()=%s, "
             "mContentForTSF.IsInitialized()=%s",
             this, GetBoolName(IsReadLocked()),
             GetBoolName(mContentForTSF.IsInitialized())));
     mContentForTSF.Clear();
     return mContentForTSF;
   }
 
   Selection& currentSel = CurrentSelection();
   if (currentSel.IsDirty()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
-           ("TSF: 0x%p   TSFTextStore::LockedContent(), FAILED, due to "
+           ("TSF: 0x%p   TSFTextStore::ContentForTSFRef(), FAILED, due to "
             "CurrentSelection() failure", this));
     mContentForTSF.Clear();
     return mContentForTSF;
   }
 
   if (!mContentForTSF.IsInitialized()) {
     nsAutoString text;
     if (NS_WARN_IF(!GetCurrentText(text))) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
-             ("TSF: 0x%p   TSFTextStore::LockedContent(), FAILED, due to "
+             ("TSF: 0x%p   TSFTextStore::ContentForTSFRef(), FAILED, due to "
               "GetCurrentText() failure", this));
       mContentForTSF.Clear();
       return mContentForTSF;
     }
 
     mContentForTSF.Init(text);
     // Basically, the locked content should be cleared after the document is
     // unlocked.  However, in e10s mode, content will be modified
     // asynchronously.  In such case, mDeferClearingLockedContent may be
     // true even after the document is unlocked.
     mDeferClearingLockedContent = false;
   }
 
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
-         ("TSF: 0x%p   TSFTextStore::LockedContent(): "
+         ("TSF: 0x%p   TSFTextStore::ContentForTSFRef(): "
           "mContentForTSF={ mText=\"%s\" (Length()=%u), "
           "mLastCompositionString=\"%s\" (Length()=%u), "
           "mMinTextModifiedOffset=%u }",
           this, mContentForTSF.Text().Length() <= 20 ?
             NS_ConvertUTF16toUTF8(mContentForTSF.Text()).get() : "<omitted>",
           mContentForTSF.Text().Length(),
           NS_ConvertUTF16toUTF8(mContentForTSF.LastCompositionString()).get(),
           mContentForTSF.LastCompositionString().Length(),
@@ -2319,21 +2319,21 @@ TSFTextStore::RestartComposition(ITfComp
   MOZ_ASSERT(keepComposingStartOffset <= keepComposingEndOffset,
     "Why keepComposingEndOffset is smaller than keepComposingStartOffset?");
   LONG keepComposingLength = keepComposingEndOffset - keepComposingStartOffset;
   // Remove the overlapped part from the commit string.
   nsAutoString commitString(mComposition.mString);
   commitString.Cut(keepComposingStartOffset - mComposition.mStart,
                    keepComposingLength);
   // Update the composition string.
-  Content& lockedContent = LockedContent();
+  Content& lockedContent = ContentForTSFRef();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::RestartComposition() FAILED "
-            "due to LockedContent() failure", this));
+            "due to ContentForTSFRef() failure", this));
     return E_FAIL;
   }
   lockedContent.ReplaceTextWith(mComposition.mStart,
                                 mComposition.mString.Length(),
                                 commitString);
   // Record a compositionupdate action for commit the part of composing string.
   PendingAction* action = LastOrNewPendingCompositionUpdate();
   action->mData = mComposition.mString;
@@ -2777,21 +2777,21 @@ TSFTextStore::GetText(LONG acpStart,
   if (pchPlain && cchPlainReq) *pchPlain = 0;
   if (pulRunInfoOut) *pulRunInfoOut = 0;
   if (pacpNext) *pacpNext = acpStart;
   if (prgRunInfo && ulRunInfoReq) {
     prgRunInfo->uCount = 0;
     prgRunInfo->type = TS_RT_PLAIN;
   }
 
-  Content& lockedContent = LockedContent();
+  Content& lockedContent = ContentForTSFRef();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::GetText() FAILED due to "
-            "LockedContent() failure", this));
+            "ContentForTSFRef() failure", this));
     return E_FAIL;
   }
   if (lockedContent.Text().Length() < static_cast<uint32_t>(acpStart)) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::GetText() FAILED due to "
             "acpStart is larger offset than the actual text length", this));
     return TS_E_INVALIDPOS;
   }
@@ -3243,21 +3243,21 @@ TSFTextStore::GetEndACP(LONG* pacp)
 
   if (!pacp) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::GetEndACP() FAILED due to "
             "null argument", this));
     return E_INVALIDARG;
   }
 
-  Content& lockedContent = LockedContent();
+  Content& lockedContent = ContentForTSFRef();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::GetEndACP() FAILED due to "
-            "LockedContent() failure", this));
+            "ContentForTSFRef() failure", this));
     return E_FAIL;
   }
   *pacp = static_cast<LONG>(lockedContent.Text().Length());
   return S_OK;
 }
 
 STDMETHODIMP
 TSFTextStore::GetActiveView(TsViewCookie* pvcView)
@@ -3402,21 +3402,21 @@ TSFTextStore::GetACPFromPoint(TsViewCook
     //     the other is after the offset, we could resolve the offset.
     //     However, dispatching 2 eQueryTextRect may be expensive.
 
     // So, use tentative offset for now.
     offset = charAtPt.mReply.mTentativeCaretOffset;
 
     // However, if it's after the last character, we need to decrement the
     // offset.
-    Content& lockedContent = LockedContent();
+    Content& lockedContent = ContentForTSFRef();
     if (!lockedContent.IsInitialized()) {
       MOZ_LOG(sTextStoreLog, LogLevel::Error,
              ("TSF: 0x%p   TSFTextStore::GetACPFromPoint() FAILED due to "
-              "LockedContent() failure", this));
+              "ContentForTSFRef() failure", this));
       return E_FAIL;
     }
     if (lockedContent.Text().Length() <= offset) {
       // If the tentative caret is after the last character, let's return
       // the last character's offset.
       offset = lockedContent.Text().Length() - 1;
     }
   }
@@ -3905,21 +3905,21 @@ TSFTextStore::InsertTextAtSelectionInter
                                             TS_TEXTCHANGE* aTextChange)
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
          ("TSF: 0x%p   TSFTextStore::InsertTextAtSelectionInternal("
           "aInsertStr=\"%s\", aTextChange=0x%p), IsComposing=%s",
           this, NS_ConvertUTF16toUTF8(aInsertStr).get(), aTextChange,
           GetBoolName(mComposition.IsComposing())));
 
-  Content& lockedContent = LockedContent();
+  Content& lockedContent = ContentForTSFRef();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::InsertTextAtSelectionInternal() failed "
-            "due to LockedContent() failure()", this));
+            "due to ContentForTSFRef() failure()", this));
     return false;
   }
 
   TS_SELECTION_ACP oldSelection = lockedContent.Selection().ACP();
   if (!mComposition.IsComposing()) {
     // Use a temporary composition to contain the text
     PendingAction* compositionStart = mPendingActions.AppendElement();
     compositionStart->mType = PendingAction::COMPOSITION_START;
@@ -4012,21 +4012,21 @@ TSFTextStore::RecordCompositionStartActi
 {
   MOZ_LOG(sTextStoreLog, LogLevel::Debug,
          ("TSF: 0x%p   TSFTextStore::RecordCompositionStartAction("
           "aComposition=0x%p, aStart=%d, aLength=%d, aPreserveSelection=%s), "
           "mComposition.mView=0x%p",
           this, aComposition, aStart, aLength, GetBoolName(aPreserveSelection),
           mComposition.mView.get()));
 
-  Content& lockedContent = LockedContent();
+  Content& lockedContent = ContentForTSFRef();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::RecordCompositionStartAction() FAILED "
-            "due to LockedContent() failure", this));
+            "due to ContentForTSFRef() failure", this));
     return E_FAIL;
   }
 
   CompleteLastActionIfStillIncomplete();
 
   // TIP may have inserted text at selection before calling
   // OnStartComposition().  In this case, we've already created a pair of
   // pending compositionstart and pending compositionend.  If the pending
@@ -4104,21 +4104,21 @@ TSFTextStore::RecordCompositionEndAction
 
   MOZ_ASSERT(mComposition.IsComposing());
 
   CompleteLastActionIfStillIncomplete();
   PendingAction* action = mPendingActions.AppendElement();
   action->mType = PendingAction::COMPOSITION_END;
   action->mData = mComposition.mString;
 
-  Content& lockedContent = LockedContent();
+  Content& lockedContent = ContentForTSFRef();
   if (!lockedContent.IsInitialized()) {
     MOZ_LOG(sTextStoreLog, LogLevel::Error,
            ("TSF: 0x%p   TSFTextStore::RecordCompositionEndAction() FAILED due "
-            "to LockedContent() failure", this));
+            "to ContentForTSFRef() failure", this));
     return E_FAIL;
   }
   lockedContent.EndComposition(*action);
 
   // If this composition was restart but the composition doesn't modify
   // anything, we should remove the pending composition for preventing to
   // dispatch redundant composition events.
   for (size_t i = mPendingActions.Length(), j = 1; i > 0; --i, ++j) {
--- a/widget/windows/TSFTextStore.h
+++ b/widget/windows/TSFTextStore.h
@@ -540,17 +540,17 @@ protected:
   // Use CurrentSelection() instead.  This is marked as dirty when the
   // selection or content is changed without document lock.
   Selection mSelection;
 
   // Get "current selection".  If the document is locked, this initializes
   // mSelection with the selection at the first call during a lock and returns
   // it.  However, mSelection is NOT modified immediately.  When pending
   // changes are flushed at unlocking the document, cached mSelection is
-  // modified.  Note that this is also called by LockedContent().
+  // modified.  Note that this is also called by ContentForTSFRef().
   Selection& CurrentSelection();
 
   struct PendingAction final
   {
     enum ActionType : uint8_t
     {
       COMPOSITION_START,
       COMPOSITION_UPDATE,
@@ -784,22 +784,22 @@ protected:
     uint32_t mMinTextModifiedOffset;
 
     bool mInitialized;
   };
   // mContentForTSF starts to cache content of the document at first query of
   // the content during a document lock.  The information is expected by TSF
   // and TIP.  Therefore, this is useful for answering the query from TSF or
   // TIP.  This is abandoned after document is unlocked and dispatched events
-  // are handled.  This is initialized by LockedContent() automatically.
+  // are handled.  This is initialized by ContentForTSFRef() automatically.
   // So, don't access this member directly except at calling Clear(),
   // IsInitialized(), IsLayoutChangedAfter() or IsLayoutChanged().
   Content mContentForTSF;
 
-  Content& LockedContent();
+  Content& ContentForTSFRef();
 
   // While the documet is locked, this returns the text stored by
   // mContentForTSF.  Otherwise, return the current text content.
   bool GetCurrentText(nsAString& aTextContent);
 
   class MouseTracker final
   {
   public: