Bug 974318 part.3 Remove nsIPrivateTextRange and nsIPrivateTextEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 04 Mar 2014 22:48:26 +0900
changeset 188971 3d78ee924b64ccbc9f0bd055d9bf35b5c06a2129
parent 188970 5abcc356d54aa646eb0461ed4844e358ec728191
child 188972 5a605f80e8da8d915e423a9cfa659895d69f97af
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs974318
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 974318 part.3 Remove nsIPrivateTextRange and nsIPrivateTextEvent r=smaug
dom/events/moz.build
dom/events/nsDOMTextEvent.cpp
dom/events/nsDOMTextEvent.h
dom/events/nsIPrivateTextEvent.h
dom/events/nsIPrivateTextRange.h
dom/events/nsPrivateTextRange.cpp
dom/events/nsPrivateTextRange.h
widget/TextRange.h
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -19,18 +19,16 @@ EXPORTS += [
     'nsDOMEventTargetHelper.h',
     'nsDOMKeyNameList.h',
     'nsEventDispatcher.h',
     'nsEventListenerManager.h',
     'nsEventNameList.h',
     'nsEventStateManager.h',
     'nsEventStates.h',
     'nsIJSEventListener.h',
-    'nsIPrivateTextEvent.h',
-    'nsIPrivateTextRange.h',
     'nsVKList.h',
 ]
 
 EXPORTS.mozilla += [
     'InternalMutationEvent.h',
 ]
 
 EXPORTS.mozilla.dom += [
@@ -91,17 +89,16 @@ UNIFIED_SOURCES += [
     'nsDOMEventTargetHelper.cpp',
     'nsDOMTextEvent.cpp',
     'nsEventDispatcher.cpp',
     'nsEventListenerManager.cpp',
     'nsEventListenerService.cpp',
     'nsIMEStateManager.cpp',
     'nsJSEventListener.cpp',
     'nsPaintRequest.cpp',
-    'nsPrivateTextRange.cpp',
     'PointerEvent.cpp',
     'ScrollAreaEvent.cpp',
     'SimpleGestureEvent.cpp',
     'TextComposition.cpp',
     'Touch.cpp',
     'TouchEvent.cpp',
     'TransitionEvent.cpp',
     'UIEvent.cpp',
--- a/dom/events/nsDOMTextEvent.cpp
+++ b/dom/events/nsDOMTextEvent.cpp
@@ -22,65 +22,24 @@ nsDOMTextEvent::nsDOMTextEvent(mozilla::
 
   if (aEvent) {
     mEventIsInternal = false;
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
-
-  //
-  // extract the IME composition string
-  //
-  WidgetTextEvent* te = mEvent->AsTextEvent();
-  mText = te->theText;
-
-  //
-  // build the range list -- ranges need to be DOM-ified since the
-  // IME transaction will hold a ref, the widget representation
-  // isn't persistent
-  //
-  mTextRange = new nsPrivateTextRangeList(te->RangeCount());
-  if (mTextRange) {
-    uint16_t i;
-
-    for(i = 0; i < te->rangeCount; i++) {
-      nsRefPtr<nsPrivateTextRange> tempPrivateTextRange = new
-        nsPrivateTextRange(te->mRanges->ElementAt(i));
-
-      if (tempPrivateTextRange) {
-        mTextRange->AppendTextRange(tempPrivateTextRange);
-      }
-    }
-  }
 }
 
 NS_IMPL_ADDREF_INHERITED(nsDOMTextEvent, UIEvent)
 NS_IMPL_RELEASE_INHERITED(nsDOMTextEvent, UIEvent)
 
 NS_INTERFACE_MAP_BEGIN(nsDOMTextEvent)
-  NS_INTERFACE_MAP_ENTRY(nsIPrivateTextEvent)
 NS_INTERFACE_MAP_END_INHERITING(UIEvent)
 
-NS_METHOD nsDOMTextEvent::GetText(nsString& aText)
-{
-  aText = mText;
-  return NS_OK;
-}
-
-NS_METHOD_(already_AddRefed<nsIPrivateTextRangeList>) nsDOMTextEvent::GetInputRange()
-{
-  if (mEvent->message == NS_TEXT_TEXT) {
-    nsRefPtr<nsPrivateTextRangeList> textRange = mTextRange;
-    return textRange.forget();
-  }
-  return nullptr;
-}
-
 nsresult NS_NewDOMTextEvent(nsIDOMEvent** aInstancePtrResult,
                             mozilla::dom::EventTarget* aOwner,
                             nsPresContext* aPresContext,
                             WidgetTextEvent* aEvent)
 {
   nsDOMTextEvent* it = new nsDOMTextEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(it, aInstancePtrResult);
 }
--- a/dom/events/nsDOMTextEvent.h
+++ b/dom/events/nsDOMTextEvent.h
@@ -7,33 +7,24 @@
 #define nsDOMTextEvent_h__
 
 #include "mozilla/dom/UIEvent.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "nsIPrivateTextEvent.h"
 #include "nsPrivateTextRange.h"
 
-class nsDOMTextEvent : public mozilla::dom::UIEvent,
-                       public nsIPrivateTextEvent
+class nsDOMTextEvent : public mozilla::dom::UIEvent
 {
   typedef mozilla::dom::UIEvent UIEvent;
 
 public:
   nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
                  nsPresContext* aPresContext,
                  mozilla::WidgetTextEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Forward to base class
   NS_FORWARD_TO_UIEVENT
-
-  // nsIPrivateTextEvent interface
-  NS_IMETHOD GetText(nsString& aText) MOZ_OVERRIDE;
-  NS_IMETHOD_(already_AddRefed<nsIPrivateTextRangeList>) GetInputRange() MOZ_OVERRIDE;
-  
-protected:
-  nsString mText;
-  nsRefPtr<nsPrivateTextRangeList> mTextRange;
 };
 
 #endif // nsDOMTextEvent_h__
deleted file mode 100644
--- a/dom/events/nsIPrivateTextEvent.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsIPrivateTextEvent_h__
-#define nsIPrivateTextEvent_h__
-
-#include "nsISupports.h"
-#include "nsIPrivateTextRange.h"
-
-#define NS_IPRIVATETEXTEVENT_IID \
-{ 0xb6840e02, 0x9e56, 0x49d8, \
-  { 0x84, 0xd, 0x5f, 0xc1, 0xcb, 0x6c, 0xff, 0xb3 } }
-
-class nsIPrivateTextEvent : public nsISupports {
-
-public:
-	NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRIVATETEXTEVENT_IID)
-
-	NS_IMETHOD GetText(nsString& aText) = 0;
-	NS_IMETHOD_(already_AddRefed<nsIPrivateTextRangeList>) GetInputRange() = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateTextEvent, NS_IPRIVATETEXTEVENT_IID)
-
-#endif // nsIPrivateTextEvent_h__
-
deleted file mode 100644
--- a/dom/events/nsIPrivateTextRange.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsIPrivateTextRange_h__
-#define nsIPrivateTextRange_h__
-
-#include "nsISupports.h"
-#include "nsString.h"
-#include "nsCOMPtr.h"
-#include "mozilla/EventForwards.h"
-
-#define NS_IPRIVATETEXTRANGE_IID \
-{ 0xf795a44d, 0x413a, 0x4c63, \
-  { 0xa6, 0xb0, 0x7a, 0xa3, 0x0c, 0xf5, 0xe9, 0xe0 } }
-
-class nsIPrivateTextRange : public nsISupports {
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRIVATETEXTRANGE_IID)
-
-  // Note that the range array may not specify a caret position; in that
-  // case there will be no range of type TEXTRANGE_CARETPOSITION in the array.
-  enum {
-    TEXTRANGE_CARETPOSITION = 1,
-    TEXTRANGE_RAWINPUT = 2,
-    TEXTRANGE_SELECTEDRAWTEXT = 3,
-    TEXTRANGE_CONVERTEDTEXT = 4,
-    TEXTRANGE_SELECTEDCONVERTEDTEXT = 5
-  };
-
-  NS_IMETHOD    GetRangeStart(uint16_t* aRangeStart)=0;
-  NS_IMETHOD    GetRangeEnd(uint16_t* aRangeEnd)=0;
-  NS_IMETHOD    GetRangeType(uint16_t* aRangeType)=0;
-  NS_IMETHOD    GetRangeStyle(mozilla::TextRangeStyle* aTextRangeStyle)=0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateTextRange, NS_IPRIVATETEXTRANGE_IID)
-
-#define NS_IPRIVATETEXTRANGELIST_IID \
-{0xb5a04b19, 0xed33, 0x4cd0, \
-{0x82, 0xa8, 0xb7, 0x00, 0x83, 0xef, 0xc4, 0x91}}
-
-class nsIPrivateTextRangeList : public nsISupports {
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRIVATETEXTRANGELIST_IID)
-
-  NS_IMETHOD_(uint16_t) GetLength()=0;
-  NS_IMETHOD_(already_AddRefed<nsIPrivateTextRange>) Item(uint16_t aIndex)=0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateTextRangeList,
-                              NS_IPRIVATETEXTRANGELIST_IID)
-
-#endif // nsIPrivateTextRange_h__
deleted file mode 100644
--- a/dom/events/nsPrivateTextRange.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsPrivateTextRange.h"
-#include "mozilla/TextEvents.h"
-
-using namespace mozilla;
-
-nsPrivateTextRange::nsPrivateTextRange(const TextRange &aTextRange)
-  : mRangeStart(uint16_t(aTextRange.mStartOffset)),
-    mRangeEnd(uint16_t(aTextRange.mEndOffset)),
-    mRangeType(uint16_t(aTextRange.mRangeType)),
-    mRangeStyle(aTextRange.mRangeStyle)
-{
-}
-
-nsPrivateTextRange::~nsPrivateTextRange(void)
-{
-}
-
-NS_IMPL_ISUPPORTS1(nsPrivateTextRange, nsIPrivateTextRange)
-
-NS_METHOD nsPrivateTextRange::GetRangeStart(uint16_t* aRangeStart)
-{
-	*aRangeStart = mRangeStart;
-	return NS_OK;
-}
-
-NS_METHOD nsPrivateTextRange::GetRangeEnd(uint16_t* aRangeEnd)
-{
-	*aRangeEnd = mRangeEnd;
-	return NS_OK;
-}
-
-NS_METHOD nsPrivateTextRange::GetRangeType(uint16_t* aRangeType)
-{
-	*aRangeType = mRangeType;
-	return NS_OK;
-}
-
-NS_METHOD nsPrivateTextRange::GetRangeStyle(TextRangeStyle* aTextRangeStyle)
-{
-	NS_ENSURE_ARG_POINTER(aTextRangeStyle);
-	*aTextRangeStyle = mRangeStyle;
-	return NS_OK;
-}
-
-NS_IMPL_ISUPPORTS1(nsPrivateTextRangeList, nsIPrivateTextRangeList)
-
-void nsPrivateTextRangeList::AppendTextRange(nsRefPtr<nsPrivateTextRange>& aRange)
-{
-	mList.AppendElement(aRange);
-}
-
-NS_METHOD_(uint16_t) nsPrivateTextRangeList::GetLength()
-{
-  return static_cast<uint16_t>(mList.Length());
-}
-
-NS_METHOD_(already_AddRefed<nsIPrivateTextRange>) nsPrivateTextRangeList::Item(uint16_t aIndex)
-{
-  nsRefPtr<nsPrivateTextRange> ret = mList.ElementAt(aIndex);
-  return ret.forget();
-}
-
deleted file mode 100644
--- a/dom/events/nsPrivateTextRange.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsPrivateTextRange_h__
-#define nsPrivateTextRange_h__
-
-#include "nsIPrivateTextRange.h"
-#include "nsTArray.h"
-#include "nsAutoPtr.h"
-#include "mozilla/Attributes.h"
-#include "mozilla/TextRange.h"
-
-class nsPrivateTextRange MOZ_FINAL : public nsIPrivateTextRange
-{
-	NS_DECL_ISUPPORTS
-public:
-
-	nsPrivateTextRange(const mozilla::TextRange &aTextRange);
-	virtual ~nsPrivateTextRange(void);
-
-	NS_IMETHOD GetRangeStart(uint16_t* aRangeStart) MOZ_OVERRIDE;
-	NS_IMETHOD GetRangeEnd(uint16_t* aRangeEnd) MOZ_OVERRIDE;
-	NS_IMETHOD GetRangeType(uint16_t* aRangeType) MOZ_OVERRIDE;
-	NS_IMETHOD GetRangeStyle(mozilla::TextRangeStyle* aRangeStyle) MOZ_OVERRIDE;
-
-protected:
-
-	uint16_t	mRangeStart;
-	uint16_t	mRangeEnd;
-	uint16_t	mRangeType;
-	mozilla::TextRangeStyle mRangeStyle;
-};
-
-class nsPrivateTextRangeList MOZ_FINAL : public nsIPrivateTextRangeList
-{
-	NS_DECL_ISUPPORTS
-public:
-	nsPrivateTextRangeList(uint16_t aLength) : mList(aLength) {}
-
-	void          AppendTextRange(nsRefPtr<nsPrivateTextRange>& aRange);
-
-	NS_IMETHOD_(uint16_t)    GetLength() MOZ_OVERRIDE;
-
-	NS_IMETHOD_(already_AddRefed<nsIPrivateTextRange>)    Item(uint16_t aIndex) MOZ_OVERRIDE;
-protected:
-	nsTArray<nsRefPtr<nsPrivateTextRange> > mList;
-};
-
-
-#endif
--- a/widget/TextRange.h
+++ b/widget/TextRange.h
@@ -121,17 +121,16 @@ struct TextRangeStyle
   nscolor mBackgroundColor;  // DEFINED_BACKGROUND_COLOR
   nscolor mUnderlineColor;   // DEFINED_UNDERLINE_COLOR
 };
 
 /******************************************************************************
  * mozilla::TextRange
  ******************************************************************************/
 
-// Sync with nsIPrivateTextRange.h when you change these constants.
 #define NS_TEXTRANGE_CARETPOSITION         0x01
 #define NS_TEXTRANGE_RAWINPUT              0x02
 #define NS_TEXTRANGE_SELECTEDRAWTEXT       0x03
 #define NS_TEXTRANGE_CONVERTEDTEXT         0x04
 #define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT 0x05
 
 struct TextRange
 {