зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1185307 part.1 Add nsISelection::AsSelection() r=smaug
This patch adds nsISelection::AsSelection() for safer "upcast". MozReview-Commit-ID: LlxoMaU0oE --HG-- extra : rebase_source : 8b2fce25888bb256970ea1cb741a9f6fbe6dc542
This commit is contained in:
Родитель
f8210c2a4e
Коммит
7b7ebc96f8
|
@ -11,6 +11,14 @@ interface nsIDOMNode;
|
|||
interface nsIDOMRange;
|
||||
interface nsINode;
|
||||
|
||||
%{C++
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Selection;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
%}
|
||||
|
||||
/**
|
||||
* Interface for manipulating and querying the current selected range
|
||||
* of nodes within the document.
|
||||
|
@ -150,4 +158,13 @@ interface nsISelection : nsISupports
|
|||
*/
|
||||
void modify(in DOMString alter, in DOMString direction,
|
||||
in DOMString granularity);
|
||||
|
||||
%{C++
|
||||
/**
|
||||
* AsSelection() returns a pointer to Selection class if the instance is
|
||||
* derived from it. Otherwise, nullptr but it should never happen
|
||||
* since Selection is the only class implementing nsISelection.
|
||||
*/
|
||||
virtual mozilla::dom::Selection* AsSelection() = 0;
|
||||
%}
|
||||
};
|
||||
|
|
|
@ -65,6 +65,8 @@ public:
|
|||
NS_DECL_NSISELECTION
|
||||
NS_DECL_NSISELECTIONPRIVATE
|
||||
|
||||
virtual Selection* AsSelection() override { return this; }
|
||||
|
||||
nsresult EndBatchChangesInternal(int16_t aReason = nsISelectionListener::NO_REASON);
|
||||
|
||||
nsIDocument* GetParentObject() const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче