author | Boris Zbarsky <bzbarsky@mit.edu> |
Tue, 08 May 2018 13:52:42 -0400 | |
changeset 471673 | d3936f9ef030138e820dd5c72871deaa48fdb145 |
parent 471672 | 51d48d54b078354de5e56a2f9fe8d1dd0a206a91 |
child 471674 | b6e041cfea34b7805a159382f70ec1da792fca8c |
push id | 9374 |
push user | jlund@mozilla.com |
push date | Mon, 18 Jun 2018 21:43:20 +0000 |
treeherder | mozilla-beta@160e085dfb0b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mats |
bugs | 1387143 |
milestone | 62.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/Selection.cpp +++ b/dom/base/Selection.cpp @@ -2609,29 +2609,16 @@ 1 2 a deselect from 1 to 2 2 1 a = continue selection from 2 to 1 */ /* * Extend extends the selection away from the anchor. * We don't need to know the direction, because we always change the focus. */ -NS_IMETHODIMP -Selection::Extend(nsIDOMNode* aContainer, int32_t aOffset) -{ - nsCOMPtr<nsINode> container = do_QueryInterface(aContainer); - return Extend(container, aOffset); -} - -NS_IMETHODIMP -Selection::ExtendNative(nsINode* aContainer, int32_t aOffset) -{ - return Extend(aContainer, aOffset); -} - void Selection::ExtendJS(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv) { AutoRestore<bool> calledFromJSRestorer(mCalledByJS); mCalledByJS = true; Extend(aContainer, aOffset, aRv); } @@ -2929,26 +2916,16 @@ Selection::Extend(nsINode& aContainer, u // XXX Why doesn't this call Selection::NotifySelectionListener() directly? RefPtr<nsFrameSelection> frameSelection = mFrameSelection; res = frameSelection->NotifySelectionListeners(GetType()); if (NS_FAILED(res)) { aRv.Throw(res); } } -NS_IMETHODIMP -Selection::SelectAllChildren(nsIDOMNode* aNode) -{ - ErrorResult result; - nsCOMPtr<nsINode> node = do_QueryInterface(aNode); - NS_ENSURE_TRUE(node, NS_ERROR_INVALID_ARG); - SelectAllChildren(*node, result); - return result.StealNSResult(); -} - void Selection::SelectAllChildrenJS(nsINode& aNode, ErrorResult& aRv) { AutoRestore<bool> calledFromJSRestorer(mCalledByJS); mCalledByJS = true; SelectAllChildren(aNode, aRv); }
--- a/dom/base/Selection.h +++ b/dom/base/Selection.h @@ -389,18 +389,32 @@ public: */ void CollapseToStart(mozilla::ErrorResult& aRv); /** * Collapses the whole selection to a single point at the end * of the current selection (irrespective of direction). If content * is focused and editable, the caret will blink there. */ void CollapseToEnd(mozilla::ErrorResult& aRv); + + /** + * Extends the selection by moving the selection end to the specified node and + * offset, preserving the selection begin position. The new selection end + * result will always be from the anchorNode to the new focusNode, regardless + * of direction. + * + * @param aContainer The node where the selection will be extended to + * @param aOffset Where in aContainer to place the offset of the new selection end. + */ void Extend(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv); void AddRange(nsRange& aRange, mozilla::ErrorResult& aRv); + /** + * Adds all children of the specified node to the selection. + * @param aNode the parent of the children to be added to the selection. + */ void SelectAllChildren(nsINode& aNode, mozilla::ErrorResult& aRv); void SetBaseAndExtent(nsINode& aAnchorNode, uint32_t aAnchorOffset, nsINode& aFocusNode, uint32_t aFocusOffset, mozilla::ErrorResult& aRv); void AddSelectionChangeBlocker(); void RemoveSelectionChangeBlocker(); bool IsBlockingSelectionChangeEvents() const;
--- a/dom/base/nsISelection.idl +++ b/dom/base/nsISelection.idl @@ -24,32 +24,16 @@ class Selection; * * @version 1.0 */ [shim(Selection), uuid(e0a4d4b3-f34e-44bd-b1f2-4e3bde9b6915)] interface nsISelection : nsISupports { - /** - * Extends the selection by moving the selection end to the specified node and offset, - * preserving the selection begin position. The new selection end result will always - * be from the anchorNode to the new focusNode, regardless of direction. - * @param parentNode The node where the selection will be extended to - * @param offset Where in node to place the offset in the new selection end - */ - void extend(in nsIDOMNode parentNode, in long offset); - [noscript] void extendNative(in nsINode parentNode, in long offset); - - /** - * Adds all children of the specified node to the selection. - * @param parentNode the parent of the children to be added to the selection. - */ - void selectAllChildren(in nsIDOMNode parentNode); - %{C++ /** * AsSelection() returns a pointer to Selection class. * * In order to avoid circular dependency issues, this method is defined * in mozilla/dom/Selection.h. Consumers need to #include that header. */ inline mozilla::dom::Selection* AsSelection();