mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1755481: rename nsIClipboard::getData
to nsIClipboard::getSomeData
and document it. r=mccr8
Before, it was confusing. One could have assumed that the method gets the data for all flavors. Differential Revision: https://phabricator.services.mozilla.com/D138776
This commit is contained in:
parent
cd4ff2c4e5
commit
8aa76ff1d7
@ -162,7 +162,8 @@ void DataTransferItem::FillInExternalData() {
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = clipboard->GetData(trans, mDataTransfer->ClipboardType());
|
||||
nsresult rv =
|
||||
clipboard->GetSomeData(trans, mDataTransfer->ClipboardType());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
|
@ -3319,7 +3319,7 @@ mozilla::ipc::IPCResult ContentParent::RecvGetClipboard(
|
||||
trans->AddDataFlavor(aTypes[t].get());
|
||||
}
|
||||
|
||||
clipboard->GetData(trans, aWhichClipboard);
|
||||
clipboard->GetSomeData(trans, aWhichClipboard);
|
||||
nsContentUtils::TransferableToIPCTransferable(trans, aDataTransfer, true,
|
||||
nullptr, this);
|
||||
return IPC_OK();
|
||||
|
@ -2093,9 +2093,9 @@ nsresult HTMLEditor::PasteInternal(int32_t aClipboardType) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Get the Data from the clipboard
|
||||
rv = clipboard->GetData(transferable, aClipboardType);
|
||||
rv = clipboard->GetSomeData(transferable, aClipboardType);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("nsIClipboard::GetData() failed");
|
||||
NS_WARNING("nsIClipboard::GetSomeData() failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -2126,9 +2126,9 @@ nsresult HTMLEditor::PasteInternal(int32_t aClipboardType) {
|
||||
NS_WARNING_ASSERTION(
|
||||
NS_SUCCEEDED(rvIgnored),
|
||||
"nsITransferable::AddDataFlavor(kHTMLContext) failed, but ignored");
|
||||
rvIgnored = clipboard->GetData(contextTransferable, aClipboardType);
|
||||
rvIgnored = clipboard->GetSomeData(contextTransferable, aClipboardType);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
||||
"nsIClipboard::GetData() failed, but ignored");
|
||||
"nsIClipboard::GetSomeData() failed, but ignored");
|
||||
nsCOMPtr<nsISupports> contextDataObj;
|
||||
rv = contextTransferable->GetTransferData(kHTMLContext,
|
||||
getter_AddRefs(contextDataObj));
|
||||
@ -2156,9 +2156,9 @@ nsresult HTMLEditor::PasteInternal(int32_t aClipboardType) {
|
||||
NS_WARNING_ASSERTION(
|
||||
NS_SUCCEEDED(rvIgnored),
|
||||
"nsITransferable::AddDataFlavor(kHTMLInfo) failed, but ignored");
|
||||
clipboard->GetData(infoTransferable, aClipboardType);
|
||||
clipboard->GetSomeData(infoTransferable, aClipboardType);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
||||
"nsIClipboard::GetData() failed, but ignored");
|
||||
"nsIClipboard::GetSomeData() failed, but ignored");
|
||||
nsCOMPtr<nsISupports> infoDataObj;
|
||||
rv = infoTransferable->GetTransferData(kHTMLInfo,
|
||||
getter_AddRefs(infoDataObj));
|
||||
@ -2288,9 +2288,9 @@ nsresult HTMLEditor::PasteNoFormattingAsAction(int32_t aSelectionType,
|
||||
}
|
||||
|
||||
// Get the Data from the clipboard
|
||||
rv = clipboard->GetData(transferable, aSelectionType);
|
||||
rv = clipboard->GetSomeData(transferable, aSelectionType);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("nsIClipboard::GetData() failed");
|
||||
NS_WARNING("nsIClipboard::GetSomeData() failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -2543,9 +2543,9 @@ nsresult HTMLEditor::PasteAsPlaintextQuotation(int32_t aSelectionType) {
|
||||
"nsITransferable::AddDataFlavor(kUnicodeMime) failed, but ignored");
|
||||
|
||||
// Get the Data from the clipboard
|
||||
rvIgnored = clipboard->GetData(transferable, aSelectionType);
|
||||
rvIgnored = clipboard->GetSomeData(transferable, aSelectionType);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rvIgnored),
|
||||
"nsIClipboard::GetData() failed, but ignored");
|
||||
"nsIClipboard::GetSomeData() failed, but ignored");
|
||||
|
||||
// Now we ask the transferable for the data
|
||||
// it still owns the data, we just have a pointer to it.
|
||||
|
@ -517,7 +517,7 @@ nsresult TextEditor::PasteAsQuotationAsAction(int32_t aClipboardType,
|
||||
}
|
||||
|
||||
// Get the Data from the clipboard
|
||||
clipboard->GetData(trans, aClipboardType);
|
||||
clipboard->GetSomeData(trans, aClipboardType);
|
||||
|
||||
// Now we ask the transferable for the data
|
||||
// it still owns the data, we just have a pointer to it.
|
||||
|
@ -206,9 +206,9 @@ nsresult TextEditor::PasteAsAction(int32_t aClipboardType,
|
||||
return NS_OK; // XXX Why?
|
||||
}
|
||||
// Get the Data from the clipboard.
|
||||
rv = clipboard->GetData(transferable, aClipboardType);
|
||||
rv = clipboard->GetSomeData(transferable, aClipboardType);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("nsIClipboard::GetData() failed, but ignored");
|
||||
NS_WARNING("nsIClipboard::GetSomeData() failed, but ignored");
|
||||
return NS_OK; // XXX Why?
|
||||
}
|
||||
// XXX Why don't we check this first?
|
||||
|
@ -78,7 +78,8 @@ nsClipboard::SetData(nsITransferable* aTransferable, nsIClipboardOwner* anOwner,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) {
|
||||
nsClipboard::GetSomeData(nsITransferable* aTransferable,
|
||||
int32_t aWhichClipboard) {
|
||||
if (aWhichClipboard != kGlobalClipboard) return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
if (!jni::IsAvailable()) {
|
||||
|
@ -743,7 +743,7 @@ nsClipboard::SetData(nsITransferable* aTransferable, nsIClipboardOwner* anOwner,
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) {
|
||||
nsClipboard::GetSomeData(nsITransferable* aTransferable, int32_t aWhichClipboard) {
|
||||
NS_ASSERTION(aTransferable, "clipboard given a null transferable");
|
||||
|
||||
bool selectClipPresent;
|
||||
|
@ -420,8 +420,9 @@ bool nsClipboard::FilterImportedFlavors(int32_t aWhichClipboard,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsClipboard::GetData(nsITransferable* aTransferable, int32_t aWhichClipboard) {
|
||||
LOGCLIP("nsClipboard::GetData (%s)\n",
|
||||
nsClipboard::GetSomeData(nsITransferable* aTransferable,
|
||||
int32_t aWhichClipboard) {
|
||||
LOGCLIP("nsClipboard::GetSomeData (%s)\n",
|
||||
aWhichClipboard == kSelectionClipboard ? "primary" : "clipboard");
|
||||
|
||||
// TODO: Ensure we don't re-enter here.
|
||||
|
@ -46,8 +46,8 @@ HeadlessClipboard::SetData(nsITransferable* aTransferable,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HeadlessClipboard::GetData(nsITransferable* aTransferable,
|
||||
int32_t aWhichClipboard) {
|
||||
HeadlessClipboard::GetSomeData(nsITransferable* aTransferable,
|
||||
int32_t aWhichClipboard) {
|
||||
if (aWhichClipboard != kGlobalClipboard) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ NS_IMETHODIMP nsBaseClipboard::SetData(nsITransferable* aTransferable,
|
||||
* Gets the transferable object
|
||||
*
|
||||
*/
|
||||
NS_IMETHODIMP nsBaseClipboard::GetData(nsITransferable* aTransferable,
|
||||
int32_t aWhichClipboard) {
|
||||
NS_IMETHODIMP nsBaseClipboard::GetSomeData(nsITransferable* aTransferable,
|
||||
int32_t aWhichClipboard) {
|
||||
NS_ASSERTION(aTransferable, "clipboard given a null transferable");
|
||||
|
||||
MOZ_LOG(sBaseClipboardLog, LogLevel::Debug, ("%s", __FUNCTION__));
|
||||
|
@ -42,8 +42,8 @@ nsClipboardProxy::SetData(nsITransferable* aTransferable,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsClipboardProxy::GetData(nsITransferable* aTransferable,
|
||||
int32_t aWhichClipboard) {
|
||||
nsClipboardProxy::GetSomeData(nsITransferable* aTransferable,
|
||||
int32_t aWhichClipboard) {
|
||||
nsTArray<nsCString> types;
|
||||
aTransferable->FlavorsTransferableCanImport(types);
|
||||
|
||||
|
@ -33,14 +33,16 @@ interface nsIClipboard : nsISupports
|
||||
in long aWhichClipboard ) ;
|
||||
|
||||
/**
|
||||
* Given a transferable, get the clipboard data.
|
||||
* Filters the flavors aTransferable can import (see
|
||||
* `nsITransferable::flavorsTransferableCanImport`) and gets the data for the
|
||||
* first flavor. That data is set for aTransferable.
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @param aWhichClipboard Specifies the clipboard to which this operation applies.
|
||||
* @result NS_Ok if no errors
|
||||
* @result NS_OK if no errors
|
||||
*/
|
||||
|
||||
void getData ( in nsITransferable aTransferable, in long aWhichClipboard ) ;
|
||||
void getSomeData ( in nsITransferable aTransferable, in long aWhichClipboard ) ;
|
||||
|
||||
/**
|
||||
* This empties the clipboard and notifies the clipboard owner.
|
||||
|
Loading…
Reference in New Issue
Block a user