зеркало из https://github.com/mozilla/gecko-dev.git
Bug 895274 part.118 Rename NS_PASTE to ePaste r=smaug
This commit is contained in:
Родитель
08fd7190da
Коммит
fdc5c4d6f8
|
@ -632,7 +632,7 @@ nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION(aEventMessage == eCut || aEventMessage == eCopy ||
|
NS_ASSERTION(aEventMessage == eCut || aEventMessage == eCopy ||
|
||||||
aEventMessage == NS_PASTE,
|
aEventMessage == ePaste,
|
||||||
"Invalid clipboard event type");
|
"Invalid clipboard event type");
|
||||||
|
|
||||||
nsCOMPtr<nsIPresShell> presShell = aPresShell;
|
nsCOMPtr<nsIPresShell> presShell = aPresShell;
|
||||||
|
@ -688,7 +688,7 @@ nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
|
||||||
nsRefPtr<DataTransfer> clipboardData;
|
nsRefPtr<DataTransfer> clipboardData;
|
||||||
if (chromeShell || Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
|
if (chromeShell || Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
|
||||||
clipboardData =
|
clipboardData =
|
||||||
new DataTransfer(piWindow, aEventMessage, aEventMessage == NS_PASTE,
|
new DataTransfer(piWindow, aEventMessage, aEventMessage == ePaste,
|
||||||
aClipboardType);
|
aClipboardType);
|
||||||
|
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
|
@ -703,7 +703,7 @@ nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
|
||||||
// No need to do anything special during a paste. Either an event listener
|
// No need to do anything special during a paste. Either an event listener
|
||||||
// took care of it and cancelled the event, or the caller will handle it.
|
// took care of it and cancelled the event, or the caller will handle it.
|
||||||
// Return true to indicate that the event wasn't cancelled.
|
// Return true to indicate that the event wasn't cancelled.
|
||||||
if (aEventMessage == NS_PASTE) {
|
if (aEventMessage == ePaste) {
|
||||||
// Clear and mark the clipboardData as readonly. This prevents someone
|
// Clear and mark the clipboardData as readonly. This prevents someone
|
||||||
// from reading the clipboard contents after the paste event has fired.
|
// from reading the clipboard contents after the paste event has fired.
|
||||||
if (clipboardData) {
|
if (clipboardData) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ class nsCopySupport
|
||||||
/**
|
/**
|
||||||
* Fires a cut, copy or paste event, on the given presshell, depending
|
* Fires a cut, copy or paste event, on the given presshell, depending
|
||||||
* on the value of aEventMessage, which should be either eCut, eCopy or
|
* on the value of aEventMessage, which should be either eCut, eCopy or
|
||||||
* NS_PASTE, and perform the default copy action if the event was not
|
* ePaste, and perform the default copy action if the event was not
|
||||||
* cancelled.
|
* cancelled.
|
||||||
*
|
*
|
||||||
* If aSelection is specified, then this selection is used as the target
|
* If aSelection is specified, then this selection is used as the target
|
||||||
|
|
|
@ -109,7 +109,7 @@ ClipboardEvent::GetClipboardData()
|
||||||
} else {
|
} else {
|
||||||
event->clipboardData =
|
event->clipboardData =
|
||||||
new DataTransfer(ToSupports(this), event->mMessage,
|
new DataTransfer(ToSupports(this), event->mMessage,
|
||||||
event->mMessage == NS_PASTE,
|
event->mMessage == ePaste,
|
||||||
nsIClipboard::kGlobalClipboard);
|
nsIClipboard::kGlobalClipboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ DataTransfer::DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
|
||||||
aEventMessage == eLegacyDragGesture) {
|
aEventMessage == eLegacyDragGesture) {
|
||||||
mReadOnly = false;
|
mReadOnly = false;
|
||||||
} else if (mIsExternal) {
|
} else if (mIsExternal) {
|
||||||
if (aEventMessage == NS_PASTE) {
|
if (aEventMessage == ePaste) {
|
||||||
CacheExternalClipboardFormats();
|
CacheExternalClipboardFormats();
|
||||||
} else if (aEventMessage >= eDragDropEventFirst &&
|
} else if (aEventMessage >= eDragDropEventFirst &&
|
||||||
aEventMessage <= eDragDropEventLast) {
|
aEventMessage <= eDragDropEventLast) {
|
||||||
|
@ -271,7 +271,7 @@ DataTransfer::GetFiles(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
if (mEventMessage != eDrop &&
|
if (mEventMessage != eDrop &&
|
||||||
mEventMessage != eLegacyDragDrop &&
|
mEventMessage != eLegacyDragDrop &&
|
||||||
mEventMessage != NS_PASTE) {
|
mEventMessage != ePaste) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +544,7 @@ DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv)
|
||||||
// Only the first item is valid for clipboard events
|
// Only the first item is valid for clipboard events
|
||||||
if (aIndex > 0 &&
|
if (aIndex > 0 &&
|
||||||
(mEventMessage == eCut || mEventMessage == eCopy ||
|
(mEventMessage == eCut || mEventMessage == eCopy ||
|
||||||
mEventMessage == NS_PASTE)) {
|
mEventMessage == ePaste)) {
|
||||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ DataTransfer::MozGetDataAt(const nsAString& aFormat, uint32_t aIndex,
|
||||||
// Only the first item is valid for clipboard events
|
// Only the first item is valid for clipboard events
|
||||||
if (aIndex > 0 &&
|
if (aIndex > 0 &&
|
||||||
(mEventMessage == eCut || mEventMessage == eCopy ||
|
(mEventMessage == eCut || mEventMessage == eCopy ||
|
||||||
mEventMessage == NS_PASTE)) {
|
mEventMessage == ePaste)) {
|
||||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ DataTransfer::MozGetDataAt(const nsAString& aFormat, uint32_t aIndex,
|
||||||
nsIPrincipal* principal = nullptr;
|
nsIPrincipal* principal = nullptr;
|
||||||
if (mIsCrossDomainSubFrameDrop ||
|
if (mIsCrossDomainSubFrameDrop ||
|
||||||
(mEventMessage != eDrop && mEventMessage != eLegacyDragDrop &&
|
(mEventMessage != eDrop && mEventMessage != eLegacyDragDrop &&
|
||||||
mEventMessage != NS_PASTE &&
|
mEventMessage != ePaste &&
|
||||||
!nsContentUtils::IsCallerChrome())) {
|
!nsContentUtils::IsCallerChrome())) {
|
||||||
principal = nsContentUtils::SubjectPrincipal();
|
principal = nsContentUtils::SubjectPrincipal();
|
||||||
}
|
}
|
||||||
|
@ -697,7 +697,7 @@ DataTransfer::MozSetDataAt(const nsAString& aFormat, nsIVariant* aData,
|
||||||
// Only the first item is valid for clipboard events
|
// Only the first item is valid for clipboard events
|
||||||
if (aIndex > 0 &&
|
if (aIndex > 0 &&
|
||||||
(mEventMessage == eCut || mEventMessage == eCopy ||
|
(mEventMessage == eCut || mEventMessage == eCopy ||
|
||||||
mEventMessage == NS_PASTE)) {
|
mEventMessage == ePaste)) {
|
||||||
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
return NS_ERROR_DOM_INDEX_SIZE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,7 +743,7 @@ DataTransfer::MozClearDataAt(const nsAString& aFormat, uint32_t aIndex,
|
||||||
// Only the first item is valid for clipboard events
|
// Only the first item is valid for clipboard events
|
||||||
if (aIndex > 0 &&
|
if (aIndex > 0 &&
|
||||||
(mEventMessage == eCut || mEventMessage == eCopy ||
|
(mEventMessage == eCut || mEventMessage == eCopy ||
|
||||||
mEventMessage == NS_PASTE)) {
|
mEventMessage == ePaste)) {
|
||||||
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -759,7 +759,7 @@ DataTransfer::MozClearDataAtHelper(const nsAString& aFormat, uint32_t aIndex,
|
||||||
MOZ_ASSERT(aIndex < mItems.Length());
|
MOZ_ASSERT(aIndex < mItems.Length());
|
||||||
MOZ_ASSERT(aIndex == 0 ||
|
MOZ_ASSERT(aIndex == 0 ||
|
||||||
(mEventMessage != eCut && mEventMessage != eCopy &&
|
(mEventMessage != eCut && mEventMessage != eCopy &&
|
||||||
mEventMessage != NS_PASTE));
|
mEventMessage != ePaste));
|
||||||
|
|
||||||
nsAutoString format;
|
nsAutoString format;
|
||||||
GetRealFormat(aFormat, format);
|
GetRealFormat(aFormat, format);
|
||||||
|
@ -1258,7 +1258,7 @@ DataTransfer::CacheExternalDragFormats()
|
||||||
void
|
void
|
||||||
DataTransfer::CacheExternalClipboardFormats()
|
DataTransfer::CacheExternalClipboardFormats()
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mEventMessage == NS_PASTE,
|
NS_ASSERTION(mEventMessage == ePaste,
|
||||||
"caching clipboard data for invalid event");
|
"caching clipboard data for invalid event");
|
||||||
|
|
||||||
// Called during the constructor for paste events to cache the formats
|
// Called during the constructor for paste events to cache the formats
|
||||||
|
@ -1318,7 +1318,7 @@ DataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex)
|
||||||
trans->Init(nullptr);
|
trans->Init(nullptr);
|
||||||
trans->AddDataFlavor(format);
|
trans->AddDataFlavor(format);
|
||||||
|
|
||||||
if (mEventMessage == NS_PASTE) {
|
if (mEventMessage == ePaste) {
|
||||||
MOZ_ASSERT(aIndex == 0, "index in clipboard must be 0");
|
MOZ_ASSERT(aIndex == 0, "index in clipboard must be 0");
|
||||||
|
|
||||||
nsCOMPtr<nsIClipboard> clipboard = do_GetService("@mozilla.org/widget/clipboard;1");
|
nsCOMPtr<nsIClipboard> clipboard = do_GetService("@mozilla.org/widget/clipboard;1");
|
||||||
|
|
|
@ -430,7 +430,7 @@ EVENT(cut,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eClipboardEventClass)
|
eClipboardEventClass)
|
||||||
EVENT(paste,
|
EVENT(paste,
|
||||||
NS_PASTE,
|
ePaste,
|
||||||
EventNameType_HTMLXUL,
|
EventNameType_HTMLXUL,
|
||||||
eClipboardEventClass)
|
eClipboardEventClass)
|
||||||
// Gecko-specific extensions that apply to elements
|
// Gecko-specific extensions that apply to elements
|
||||||
|
|
|
@ -1323,8 +1323,9 @@ bool nsHTMLEditor::HavePrivateHTMLFlavor(nsIClipboard *aClipboard)
|
||||||
|
|
||||||
NS_IMETHODIMP nsHTMLEditor::Paste(int32_t aSelectionType)
|
NS_IMETHODIMP nsHTMLEditor::Paste(int32_t aSelectionType)
|
||||||
{
|
{
|
||||||
if (!FireClipboardEvent(NS_PASTE, aSelectionType))
|
if (!FireClipboardEvent(ePaste, aSelectionType)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Get Clipboard Service
|
// Get Clipboard Service
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
@ -1406,8 +1407,9 @@ NS_IMETHODIMP nsHTMLEditor::PasteTransferable(nsITransferable *aTransferable)
|
||||||
{
|
{
|
||||||
// Use an invalid value for the clipboard type as data comes from aTransferable
|
// Use an invalid value for the clipboard type as data comes from aTransferable
|
||||||
// and we don't currently implement a way to put that in the data transfer yet.
|
// and we don't currently implement a way to put that in the data transfer yet.
|
||||||
if (!FireClipboardEvent(NS_PASTE, nsIClipboard::kGlobalClipboard))
|
if (!FireClipboardEvent(ePaste, nsIClipboard::kGlobalClipboard)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// handle transferable hooks
|
// handle transferable hooks
|
||||||
nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
|
nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
|
||||||
|
@ -1424,8 +1426,9 @@ NS_IMETHODIMP nsHTMLEditor::PasteTransferable(nsITransferable *aTransferable)
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(int32_t aSelectionType)
|
NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(int32_t aSelectionType)
|
||||||
{
|
{
|
||||||
if (!FireClipboardEvent(NS_PASTE, aSelectionType))
|
if (!FireClipboardEvent(ePaste, aSelectionType)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
ForceCompositionEnd();
|
ForceCompositionEnd();
|
||||||
|
|
||||||
|
|
|
@ -322,8 +322,9 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
|
||||||
|
|
||||||
NS_IMETHODIMP nsPlaintextEditor::Paste(int32_t aSelectionType)
|
NS_IMETHODIMP nsPlaintextEditor::Paste(int32_t aSelectionType)
|
||||||
{
|
{
|
||||||
if (!FireClipboardEvent(NS_PASTE, aSelectionType))
|
if (!FireClipboardEvent(ePaste, aSelectionType)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Get Clipboard Service
|
// Get Clipboard Service
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
@ -355,8 +356,9 @@ NS_IMETHODIMP nsPlaintextEditor::PasteTransferable(nsITransferable *aTransferabl
|
||||||
{
|
{
|
||||||
// Use an invalid value for the clipboard type as data comes from aTransferable
|
// Use an invalid value for the clipboard type as data comes from aTransferable
|
||||||
// and we don't currently implement a way to put that in the data transfer yet.
|
// and we don't currently implement a way to put that in the data transfer yet.
|
||||||
if (!FireClipboardEvent(NS_PASTE, -1))
|
if (!FireClipboardEvent(ePaste, -1)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsModifiable())
|
if (!IsModifiable())
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -1173,7 +1173,7 @@ nsPlaintextEditor::FireClipboardEvent(EventMessage aEventMessage,
|
||||||
int32_t aSelectionType,
|
int32_t aSelectionType,
|
||||||
bool* aActionTaken)
|
bool* aActionTaken)
|
||||||
{
|
{
|
||||||
if (aEventMessage == NS_PASTE) {
|
if (aEventMessage == ePaste) {
|
||||||
ForceCompositionEnd();
|
ForceCompositionEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ NS_EVENT_MESSAGE(eXULCommand, eXULCommandEventFirst)
|
||||||
NS_EVENT_MESSAGE(eClipboardEventFirst, 3100)
|
NS_EVENT_MESSAGE(eClipboardEventFirst, 3100)
|
||||||
NS_EVENT_MESSAGE(eCopy, eClipboardEventFirst)
|
NS_EVENT_MESSAGE(eCopy, eClipboardEventFirst)
|
||||||
NS_EVENT_MESSAGE(eCut, eClipboardEventFirst + 1)
|
NS_EVENT_MESSAGE(eCut, eClipboardEventFirst + 1)
|
||||||
NS_EVENT_MESSAGE(NS_PASTE, eClipboardEventFirst + 2)
|
NS_EVENT_MESSAGE(ePaste, eClipboardEventFirst + 2)
|
||||||
|
|
||||||
// Query the content information
|
// Query the content information
|
||||||
NS_EVENT_MESSAGE(NS_QUERY_CONTENT_EVENT_START, 3200)
|
NS_EVENT_MESSAGE(NS_QUERY_CONTENT_EVENT_START, 3200)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче