mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 974318 part.3 Remove nsIPrivateTextRange and nsIPrivateTextEvent r=smaug
This commit is contained in:
parent
59ea783e22
commit
97dc5061e4
@ -24,8 +24,6 @@ EXPORTS += [
|
||||
'nsEventStateManager.h',
|
||||
'nsEventStates.h',
|
||||
'nsIJSEventListener.h',
|
||||
'nsIPrivateTextEvent.h',
|
||||
'nsIPrivateTextRange.h',
|
||||
'nsVKList.h',
|
||||
]
|
||||
|
||||
@ -96,7 +94,6 @@ UNIFIED_SOURCES += [
|
||||
'nsIMEStateManager.cpp',
|
||||
'nsJSEventListener.cpp',
|
||||
'nsPaintRequest.cpp',
|
||||
'nsPrivateTextRange.cpp',
|
||||
'PointerEvent.cpp',
|
||||
'ScrollAreaEvent.cpp',
|
||||
'SimpleGestureEvent.cpp',
|
||||
|
@ -27,55 +27,14 @@ nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
|
||||
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,
|
||||
|
@ -12,8 +12,7 @@
|
||||
#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;
|
||||
|
||||
@ -26,14 +25,6 @@ public:
|
||||
|
||||
// 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__
|
||||
|
@ -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__
|
||||
|
@ -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__
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
@ -126,7 +126,6 @@ struct TextRangeStyle
|
||||
* 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
|
||||
|
Loading…
Reference in New Issue
Block a user