зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1649121: part 88) Declare some methods around `DataTransfer` `const`. r=masayuki
Helps reasoning about them. Differential Revision: https://phabricator.services.mozilla.com/D90528
This commit is contained in:
Родитель
88a65a9f0d
Коммит
60e705c860
|
@ -336,7 +336,8 @@ bool DataTransfer::HasType(const nsAString& aType) const {
|
|||
bool DataTransfer::HasFile() const { return mItems->HasFile(); }
|
||||
|
||||
void DataTransfer::GetData(const nsAString& aFormat, nsAString& aData,
|
||||
nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv) {
|
||||
nsIPrincipal& aSubjectPrincipal,
|
||||
ErrorResult& aRv) const {
|
||||
// return an empty string if data for the format was not found
|
||||
aData.Truncate();
|
||||
|
||||
|
@ -481,7 +482,7 @@ already_AddRefed<DOMStringList> DataTransfer::MozTypesAt(
|
|||
|
||||
nsresult DataTransfer::GetDataAtNoSecurityCheck(const nsAString& aFormat,
|
||||
uint32_t aIndex,
|
||||
nsIVariant** aData) {
|
||||
nsIVariant** aData) const {
|
||||
return GetDataAtInternal(aFormat, aIndex,
|
||||
nsContentUtils::GetSystemPrincipal(), aData);
|
||||
}
|
||||
|
@ -489,7 +490,7 @@ nsresult DataTransfer::GetDataAtNoSecurityCheck(const nsAString& aFormat,
|
|||
nsresult DataTransfer::GetDataAtInternal(const nsAString& aFormat,
|
||||
uint32_t aIndex,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
nsIVariant** aData) {
|
||||
nsIVariant** aData) const {
|
||||
*aData = nullptr;
|
||||
|
||||
if (aFormat.IsEmpty()) {
|
||||
|
|
|
@ -202,7 +202,7 @@ class DataTransfer final : public nsISupports, public nsWrapperCache {
|
|||
bool HasFile() const;
|
||||
|
||||
void GetData(const nsAString& aFormat, nsAString& aData,
|
||||
nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv);
|
||||
nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv) const;
|
||||
|
||||
void SetData(const nsAString& aFormat, const nsAString& aData,
|
||||
nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv);
|
||||
|
@ -281,7 +281,7 @@ class DataTransfer final : public nsISupports, public nsWrapperCache {
|
|||
mozilla::dom::Element* GetDragTarget() const { return mDragTarget; }
|
||||
|
||||
nsresult GetDataAtNoSecurityCheck(const nsAString& aFormat, uint32_t aIndex,
|
||||
nsIVariant** aData);
|
||||
nsIVariant** aData) const;
|
||||
|
||||
DataTransferItemList* Items() const { return mItems; }
|
||||
|
||||
|
@ -421,7 +421,7 @@ class DataTransfer final : public nsISupports, public nsWrapperCache {
|
|||
FileList* GetFilesInternal(ErrorResult& aRv, nsIPrincipal* aSubjectPrincipal);
|
||||
nsresult GetDataAtInternal(const nsAString& aFormat, uint32_t aIndex,
|
||||
nsIPrincipal* aSubjectPrincipal,
|
||||
nsIVariant** aData);
|
||||
nsIVariant** aData) const;
|
||||
|
||||
nsresult SetDataAtInternal(const nsAString& aFormat, nsIVariant* aData,
|
||||
uint32_t aIndex, nsIPrincipal* aSubjectPrincipal);
|
||||
|
|
|
@ -4172,9 +4172,10 @@ class HTMLEditor final : public TextEditor,
|
|||
* InsertFromDataTransfer() is called only when user drops data into
|
||||
* this editor. Don't use this method for other purposes.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT nsresult InsertFromDataTransfer(
|
||||
dom::DataTransfer* aDataTransfer, int32_t aIndex, Document* aSourceDoc,
|
||||
const EditorDOMPoint& aDroppedAt, bool aDoDeleteSelection);
|
||||
MOZ_CAN_RUN_SCRIPT nsresult
|
||||
InsertFromDataTransfer(const dom::DataTransfer* aDataTransfer, int32_t aIndex,
|
||||
Document* aSourceDoc, const EditorDOMPoint& aDroppedAt,
|
||||
bool aDoDeleteSelection);
|
||||
|
||||
bool HavePrivateHTMLFlavor(nsIClipboard* clipboard);
|
||||
|
||||
|
|
|
@ -1771,7 +1771,7 @@ nsresult HTMLEditor::InsertFromTransferable(nsITransferable* aTransferable,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static void GetStringFromDataTransfer(DataTransfer* aDataTransfer,
|
||||
static void GetStringFromDataTransfer(const DataTransfer* aDataTransfer,
|
||||
const nsAString& aType, int32_t aIndex,
|
||||
nsString& aOutputString) {
|
||||
nsCOMPtr<nsIVariant> variant;
|
||||
|
@ -1788,7 +1788,7 @@ static void GetStringFromDataTransfer(DataTransfer* aDataTransfer,
|
|||
nsContentUtils::PlatformToDOMLineBreaks(aOutputString);
|
||||
}
|
||||
|
||||
nsresult HTMLEditor::InsertFromDataTransfer(DataTransfer* aDataTransfer,
|
||||
nsresult HTMLEditor::InsertFromDataTransfer(const DataTransfer* aDataTransfer,
|
||||
int32_t aIndex,
|
||||
Document* aSourceDoc,
|
||||
const EditorDOMPoint& aDroppedAt,
|
||||
|
|
Загрузка…
Ссылка в новой задаче