2017-10-27 01:08:41 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-04-07 01:54:38 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2012-06-08 18:20:55 +04:00
|
|
|
#ifndef mozilla_Selection_h__
|
|
|
|
#define mozilla_Selection_h__
|
2012-04-07 01:54:38 +04:00
|
|
|
|
|
|
|
#include "nsIWeakReference.h"
|
|
|
|
|
2014-09-10 21:07:36 +04:00
|
|
|
#include "mozilla/AutoRestore.h"
|
2017-11-07 09:29:15 +03:00
|
|
|
#include "mozilla/RangeBoundary.h"
|
2014-09-10 21:07:36 +04:00
|
|
|
#include "mozilla/TextRange.h"
|
2017-01-20 12:39:57 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2012-04-07 01:54:38 +04:00
|
|
|
#include "nsISelection.h"
|
|
|
|
#include "nsISelectionController.h"
|
2015-12-01 23:25:06 +03:00
|
|
|
#include "nsISelectionListener.h"
|
2012-04-07 01:54:38 +04:00
|
|
|
#include "nsISelectionPrivate.h"
|
2012-06-07 19:00:58 +04:00
|
|
|
#include "nsRange.h"
|
2013-08-07 00:19:11 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2013-12-17 18:12:33 +04:00
|
|
|
#include "nsWrapperCache.h"
|
2012-04-07 01:54:38 +04:00
|
|
|
|
|
|
|
struct CachedOffsetForFrame;
|
|
|
|
class nsAutoScrollTimer;
|
|
|
|
class nsIContentIterator;
|
2017-03-14 04:36:21 +03:00
|
|
|
class nsIDocument;
|
2012-04-07 01:54:38 +04:00
|
|
|
class nsIFrame;
|
2013-08-07 00:19:11 +04:00
|
|
|
class nsFrameSelection;
|
2017-03-14 04:36:21 +03:00
|
|
|
class nsPIDOMWindowOuter;
|
2012-04-07 01:54:38 +04:00
|
|
|
struct SelectionDetails;
|
2017-05-10 17:48:50 +03:00
|
|
|
struct SelectionCustomColors;
|
2017-02-25 13:33:34 +03:00
|
|
|
class nsCopySupport;
|
|
|
|
class nsHTMLCopyEncoder;
|
2012-04-07 01:54:38 +04:00
|
|
|
|
2013-12-17 18:12:33 +04:00
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
2017-08-07 10:33:59 +03:00
|
|
|
class HTMLEditor;
|
2015-02-21 07:27:59 +03:00
|
|
|
struct AutoPrepareFocusRange;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2013-12-17 18:12:33 +04:00
|
|
|
|
2012-04-07 01:54:38 +04:00
|
|
|
struct RangeData
|
|
|
|
{
|
2014-08-08 03:48:38 +04:00
|
|
|
explicit RangeData(nsRange* aRange)
|
2012-04-07 01:54:38 +04:00
|
|
|
: mRange(aRange)
|
|
|
|
{}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsRange> mRange;
|
2013-10-01 11:22:59 +04:00
|
|
|
mozilla::TextRangeStyle mTextRangeStyle;
|
2012-04-07 01:54:38 +04:00
|
|
|
};
|
|
|
|
|
2014-04-10 20:09:40 +04:00
|
|
|
// Note, the ownership of mozilla::dom::Selection depends on which way the
|
|
|
|
// object is created. When nsFrameSelection has created Selection,
|
|
|
|
// addreffing/releasing the Selection object is aggregated to nsFrameSelection.
|
|
|
|
// Otherwise normal addref/release is used. This ensures that nsFrameSelection
|
|
|
|
// is never deleted before its Selections.
|
2012-06-08 18:20:55 +04:00
|
|
|
namespace mozilla {
|
2014-04-10 20:09:40 +04:00
|
|
|
namespace dom {
|
2012-06-08 18:20:55 +04:00
|
|
|
|
2017-09-12 01:19:22 +03:00
|
|
|
class Selection final : public nsISelection,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsWrapperCache,
|
2017-09-12 01:19:22 +03:00
|
|
|
public nsISelectionPrivate,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsSupportsWeakReference
|
2012-04-07 01:54:38 +04:00
|
|
|
{
|
2014-06-24 02:40:01 +04:00
|
|
|
protected:
|
|
|
|
virtual ~Selection();
|
|
|
|
|
2012-04-07 01:54:38 +04:00
|
|
|
public:
|
2012-06-08 18:20:55 +04:00
|
|
|
Selection();
|
2014-08-08 03:48:38 +04:00
|
|
|
explicit Selection(nsFrameSelection *aList);
|
2013-12-17 18:12:33 +04:00
|
|
|
|
2012-04-07 01:54:38 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2017-09-12 01:19:22 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Selection, nsISelection)
|
2012-04-07 01:54:38 +04:00
|
|
|
NS_DECL_NSISELECTION
|
|
|
|
NS_DECL_NSISELECTIONPRIVATE
|
|
|
|
|
2017-09-08 06:10:44 +03:00
|
|
|
// match this up with EndbatchChanges. will stop ui updates while multiple
|
|
|
|
// selection methods are called
|
|
|
|
void StartBatchChanges();
|
|
|
|
|
|
|
|
// match this up with StartBatchChanges
|
|
|
|
void EndBatchChanges(int16_t aReason = nsISelectionListener::NO_REASON);
|
2015-12-01 23:25:06 +03:00
|
|
|
|
2013-12-17 18:12:33 +04:00
|
|
|
nsIDocument* GetParentObject() const;
|
|
|
|
|
2012-04-07 01:54:38 +04:00
|
|
|
// utility methods for scrolling the selection into view
|
2012-12-19 22:44:58 +04:00
|
|
|
nsPresContext* GetPresContext() const;
|
2012-12-19 04:55:11 +04:00
|
|
|
nsIPresShell* GetPresShell() const;
|
2013-02-16 00:09:28 +04:00
|
|
|
nsFrameSelection* GetFrameSelection() const { return mFrameSelection; }
|
2012-04-07 01:54:38 +04:00
|
|
|
// Returns a rect containing the selection region, and frame that that
|
|
|
|
// position is relative to. For SELECTION_ANCHOR_REGION or
|
|
|
|
// SELECTION_FOCUS_REGION the rect is a zero-width rectangle. For
|
|
|
|
// SELECTION_WHOLE_SELECTION the rect contains both the anchor and focus
|
|
|
|
// region rects.
|
|
|
|
nsIFrame* GetSelectionAnchorGeometry(SelectionRegion aRegion, nsRect *aRect);
|
|
|
|
// Returns the position of the region (SELECTION_ANCHOR_REGION or
|
|
|
|
// SELECTION_FOCUS_REGION only), and frame that that position is relative to.
|
|
|
|
// The 'position' is a zero-width rectangle.
|
|
|
|
nsIFrame* GetSelectionEndPointGeometry(SelectionRegion aRegion, nsRect *aRect);
|
|
|
|
|
|
|
|
nsresult PostScrollSelectionIntoViewEvent(
|
|
|
|
SelectionRegion aRegion,
|
2012-10-07 22:45:51 +04:00
|
|
|
int32_t aFlags,
|
2012-04-07 01:54:38 +04:00
|
|
|
nsIPresShell::ScrollAxis aVertical,
|
|
|
|
nsIPresShell::ScrollAxis aHorizontal);
|
|
|
|
enum {
|
|
|
|
SCROLL_SYNCHRONOUS = 1<<1,
|
|
|
|
SCROLL_FIRST_ANCESTOR_ONLY = 1<<2,
|
2017-03-21 04:12:41 +03:00
|
|
|
SCROLL_DO_FLUSH = 1<<3, // only matters if SCROLL_SYNCHRONOUS is passed too
|
2016-02-04 04:36:24 +03:00
|
|
|
SCROLL_OVERFLOW_HIDDEN = 1<<5,
|
|
|
|
SCROLL_FOR_CARET_MOVE = 1<<6
|
2012-04-07 01:54:38 +04:00
|
|
|
};
|
2017-03-21 04:12:41 +03:00
|
|
|
// If aFlags doesn't contain SCROLL_SYNCHRONOUS, then we'll flush when
|
|
|
|
// the scroll event fires so we make sure to scroll to the right place.
|
|
|
|
// Otherwise, if SCROLL_DO_FLUSH is also in aFlags, then this method will
|
|
|
|
// flush layout and you MUST hold a strong ref on 'this' for the duration
|
|
|
|
// of this call. This might destroy arbitrary layout objects.
|
2012-04-07 01:54:38 +04:00
|
|
|
nsresult ScrollIntoView(SelectionRegion aRegion,
|
|
|
|
nsIPresShell::ScrollAxis aVertical =
|
|
|
|
nsIPresShell::ScrollAxis(),
|
|
|
|
nsIPresShell::ScrollAxis aHorizontal =
|
|
|
|
nsIPresShell::ScrollAxis(),
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aFlags = 0);
|
2012-04-07 01:54:38 +04:00
|
|
|
nsresult SubtractRange(RangeData* aRange, nsRange* aSubtract,
|
|
|
|
nsTArray<RangeData>* aOutput);
|
2014-09-10 21:07:36 +04:00
|
|
|
/**
|
2015-09-22 20:24:50 +03:00
|
|
|
* AddItem adds aRange to this Selection. If mUserInitiated is true,
|
2014-09-10 21:07:36 +04:00
|
|
|
* then aRange is first scanned for -moz-user-select:none nodes and split up
|
|
|
|
* into multiple ranges to exclude those before adding the resulting ranges
|
|
|
|
* to this Selection.
|
|
|
|
*/
|
2015-08-12 20:26:01 +03:00
|
|
|
nsresult AddItem(nsRange* aRange, int32_t* aOutIndex, bool aNoStartSelect = false);
|
2014-09-10 21:07:36 +04:00
|
|
|
nsresult RemoveItem(nsRange* aRange);
|
2012-04-07 01:54:38 +04:00
|
|
|
nsresult RemoveCollapsedRanges();
|
|
|
|
nsresult Clear(nsPresContext* aPresContext);
|
2017-11-07 09:29:15 +03:00
|
|
|
nsresult Collapse(nsINode* aContainer, int32_t aOffset)
|
|
|
|
{
|
|
|
|
if (!aContainer) {
|
|
|
|
return NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
return Collapse(RawRangeBoundary(aContainer, aOffset));
|
|
|
|
}
|
|
|
|
nsresult Collapse(const RawRangeBoundary& aPoint)
|
|
|
|
{
|
|
|
|
ErrorResult result;
|
|
|
|
Collapse(aPoint, result);
|
|
|
|
return result.StealNSResult();
|
|
|
|
}
|
2017-07-11 17:33:04 +03:00
|
|
|
nsresult Extend(nsINode* aContainer, int32_t aOffset);
|
2016-09-30 16:36:10 +03:00
|
|
|
nsRange* GetRangeAt(int32_t aIndex) const;
|
2012-04-07 01:54:38 +04:00
|
|
|
|
|
|
|
// Get the anchor-to-focus range if we don't care which end is
|
|
|
|
// anchor and which end is focus.
|
|
|
|
const nsRange* GetAnchorFocusRange() const {
|
|
|
|
return mAnchorFocusRange;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDirection GetDirection(){return mDirection;}
|
|
|
|
void SetDirection(nsDirection aDir){mDirection = aDir;}
|
|
|
|
nsresult SetAnchorFocusToRange(nsRange *aRange);
|
|
|
|
void ReplaceAnchorFocusRange(nsRange *aRange);
|
2015-03-18 10:26:00 +03:00
|
|
|
void AdjustAnchorFocusForMultiRange(nsDirection aDirection);
|
2012-04-07 01:54:38 +04:00
|
|
|
|
2017-08-23 13:09:07 +03:00
|
|
|
nsresult GetPrimaryFrameForAnchorNode(nsIFrame** aReturnFrame);
|
|
|
|
nsresult GetPrimaryFrameForFocusNode(nsIFrame** aReturnFrame,
|
|
|
|
int32_t* aOffset, bool aVisual);
|
2017-01-20 18:28:02 +03:00
|
|
|
|
|
|
|
UniquePtr<SelectionDetails> LookUpSelection(
|
|
|
|
nsIContent* aContent,
|
|
|
|
int32_t aContentOffset,
|
|
|
|
int32_t aContentLength,
|
|
|
|
UniquePtr<SelectionDetails> aDetailsHead,
|
|
|
|
SelectionType aSelectionType,
|
|
|
|
bool aSlowCheck);
|
|
|
|
|
2012-04-07 01:54:38 +04:00
|
|
|
NS_IMETHOD Repaint(nsPresContext* aPresContext);
|
|
|
|
|
|
|
|
// Note: StartAutoScrollTimer might destroy arbitrary frames etc.
|
|
|
|
nsresult StartAutoScrollTimer(nsIFrame *aFrame,
|
|
|
|
nsPoint& aPoint,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aDelay);
|
2012-04-07 01:54:38 +04:00
|
|
|
|
|
|
|
nsresult StopAutoScrollTimer();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-12-17 18:12:33 +04:00
|
|
|
|
|
|
|
// WebIDL methods
|
|
|
|
nsINode* GetAnchorNode();
|
|
|
|
uint32_t AnchorOffset();
|
|
|
|
nsINode* GetFocusNode();
|
|
|
|
uint32_t FocusOffset();
|
|
|
|
|
2017-09-07 06:07:43 +03:00
|
|
|
nsIContent* GetChildAtAnchorOffset();
|
2017-09-29 20:56:35 +03:00
|
|
|
nsIContent* GetChildAtFocusOffset();
|
2017-09-07 06:07:43 +03:00
|
|
|
|
2017-08-15 04:30:23 +03:00
|
|
|
/*
|
|
|
|
* IsCollapsed -- is the whole selection just one point, or unset?
|
|
|
|
*/
|
|
|
|
bool IsCollapsed() const
|
|
|
|
{
|
|
|
|
uint32_t cnt = mRanges.Length();
|
|
|
|
if (cnt == 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cnt != 1) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mRanges[0].mRange->Collapsed();
|
|
|
|
}
|
2013-12-17 18:12:33 +04:00
|
|
|
|
2017-03-10 10:55:12 +03:00
|
|
|
// *JS() methods are mapped to Selection.*().
|
|
|
|
// They may move focus only when the range represents normal selection.
|
|
|
|
// These methods shouldn't be used by non-JS callers.
|
2017-07-11 17:33:04 +03:00
|
|
|
void CollapseJS(nsINode* aContainer, uint32_t aOffset,
|
2017-03-10 10:55:12 +03:00
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
void CollapseToStartJS(mozilla::ErrorResult& aRv);
|
|
|
|
void CollapseToEndJS(mozilla::ErrorResult& aRv);
|
|
|
|
|
2017-07-11 17:33:04 +03:00
|
|
|
void ExtendJS(nsINode& aContainer, uint32_t aOffset,
|
2017-03-10 10:55:12 +03:00
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
void SelectAllChildrenJS(nsINode& aNode, mozilla::ErrorResult& aRv);
|
2013-12-17 18:12:33 +04:00
|
|
|
|
|
|
|
void DeleteFromDocument(mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
uint32_t RangeCount() const
|
|
|
|
{
|
|
|
|
return mRanges.Length();
|
|
|
|
}
|
2017-08-03 17:13:24 +03:00
|
|
|
|
|
|
|
void GetType(nsAString& aOutType) const;
|
|
|
|
|
2013-12-17 18:12:33 +04:00
|
|
|
nsRange* GetRangeAt(uint32_t aIndex, mozilla::ErrorResult& aRv);
|
2017-03-10 10:55:12 +03:00
|
|
|
void AddRangeJS(nsRange& aRange, mozilla::ErrorResult& aRv);
|
2013-12-17 18:12:33 +04:00
|
|
|
void RemoveRange(nsRange& aRange, mozilla::ErrorResult& aRv);
|
|
|
|
void RemoveAllRanges(mozilla::ErrorResult& aRv);
|
|
|
|
|
Bug 1393816 - part1: Cache a range until new range is created in Selection r=smaug
When setting value of <input type="text">, nsTextEditorState removes all
ranges of normal selection first. Then, TextEditor sets the value. Finally,
TextEditor collapses the selection at the end of the text.
In bug 1386471, we got that there are some problems to remove the call of
Selection::RemoveAllRanges() in nsTextEditorState. Therefore, we need another
approach to improve Selection::Collapse().
The approach of this patch is, when removing all ranges from normal selection,
Selection can cache an nsRange instance if there is an instance which is not
referenced from other than the Selection (i.e., it'll be removed when
Selection::Clear() is called). Then, Selection::Collapse() can reuse it. With
this fix, Selection::Collapse() can reduce allocation cost and may reduce some
other cost like adding it to mutation observer.
However, keeping nsRange instance may cause increasing mutation observer's cost
since nsRange will be adjusted its start node/offset and end node/offset with
mutation observer to guarantee that the range is always valid. So, we can
cache such range only when the caller (or its callee) will set selection range
later. Therefore, this patch adds Selection::RemoveAllRangesTemporarily()
and make only nsTextEditorState::SetValue() and
ContentEventHandler::OnSelectionEvent() use it.
MozReview-Commit-ID: FjWrbz4S1ld
--HG--
extra : rebase_source : 83677640525e0b1a84bdd7fce63ff4704b9cc22b
2017-08-25 13:21:39 +03:00
|
|
|
/**
|
|
|
|
* RemoveAllRangesTemporarily() is useful if the caller will add one or more
|
|
|
|
* ranges later. This tries to cache a removing range if it's possible.
|
|
|
|
* If a range is not referred by anything else this selection, the range
|
|
|
|
* can be reused later. Otherwise, this works as same as RemoveAllRanges().
|
|
|
|
*/
|
|
|
|
nsresult RemoveAllRangesTemporarily();
|
|
|
|
|
2013-12-17 18:12:33 +04:00
|
|
|
void Stringify(nsAString& aResult);
|
|
|
|
|
2014-09-16 23:11:52 +04:00
|
|
|
bool ContainsNode(nsINode& aNode, bool aPartlyContained, mozilla::ErrorResult& aRv);
|
2013-12-17 18:12:33 +04:00
|
|
|
|
2016-09-30 16:36:10 +03:00
|
|
|
/**
|
|
|
|
* Check to see if the given point is contained within the selection area. In
|
|
|
|
* particular, this iterates through all the rects that make up the selection,
|
|
|
|
* not just the bounding box, and checks to see if the given point is contained
|
|
|
|
* in any one of them.
|
|
|
|
* @param aPoint The point to check, relative to the root frame.
|
|
|
|
*/
|
|
|
|
bool ContainsPoint(const nsPoint& aPoint);
|
|
|
|
|
2013-12-17 18:12:33 +04:00
|
|
|
void Modify(const nsAString& aAlter, const nsAString& aDirection,
|
|
|
|
const nsAString& aGranularity, mozilla::ErrorResult& aRv);
|
|
|
|
|
2017-03-10 10:55:12 +03:00
|
|
|
void SetBaseAndExtentJS(nsINode& aAnchorNode, uint32_t aAnchorOffset,
|
|
|
|
nsINode& aFocusNode, uint32_t aFocusOffset,
|
|
|
|
mozilla::ErrorResult& aRv);
|
2016-12-19 18:48:37 +03:00
|
|
|
|
2013-12-17 18:12:33 +04:00
|
|
|
bool GetInterlinePosition(mozilla::ErrorResult& aRv);
|
|
|
|
void SetInterlinePosition(bool aValue, mozilla::ErrorResult& aRv);
|
|
|
|
|
2015-05-22 07:37:16 +03:00
|
|
|
Nullable<int16_t> GetCaretBidiLevel(mozilla::ErrorResult& aRv) const;
|
|
|
|
void SetCaretBidiLevel(const Nullable<int16_t>& aCaretBidiLevel, mozilla::ErrorResult& aRv);
|
|
|
|
|
2013-12-17 18:12:33 +04:00
|
|
|
void ToStringWithFormat(const nsAString& aFormatType,
|
|
|
|
uint32_t aFlags,
|
|
|
|
int32_t aWrapColumn,
|
|
|
|
nsAString& aReturn,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
void AddSelectionListener(nsISelectionListener* aListener,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
void RemoveSelectionListener(nsISelectionListener* aListener,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
2016-06-11 05:06:37 +03:00
|
|
|
RawSelectionType RawType() const
|
|
|
|
{
|
|
|
|
return ToRawSelectionType(mSelectionType);
|
|
|
|
}
|
|
|
|
SelectionType Type() const { return mSelectionType; }
|
2013-12-17 18:12:33 +04:00
|
|
|
|
|
|
|
void GetRangesForInterval(nsINode& aBeginNode, int32_t aBeginOffset,
|
|
|
|
nsINode& aEndNode, int32_t aEndOffset,
|
|
|
|
bool aAllowAdjacent,
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<nsRange>>& aReturn,
|
2013-12-17 18:12:33 +04:00
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
void ScrollIntoView(int16_t aRegion, bool aIsSynchronous,
|
|
|
|
int16_t aVPercent, int16_t aHPercent,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
2017-05-10 17:48:50 +03:00
|
|
|
void SetColors(const nsAString& aForeColor, const nsAString& aBackColor,
|
|
|
|
const nsAString& aAltForeColor, const nsAString& aAltBackColor,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
|
|
|
void ResetColors(mozilla::ErrorResult& aRv);
|
|
|
|
|
2017-03-10 10:55:12 +03:00
|
|
|
// Non-JS callers should use the following methods.
|
2017-11-07 09:29:15 +03:00
|
|
|
void Collapse(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
Collapse(RawRangeBoundary(&aContainer, aOffset), aRv);
|
|
|
|
}
|
|
|
|
void Collapse(const RawRangeBoundary& aPoint, ErrorResult& aRv);
|
2017-03-10 10:55:12 +03:00
|
|
|
void CollapseToStart(mozilla::ErrorResult& aRv);
|
|
|
|
void CollapseToEnd(mozilla::ErrorResult& aRv);
|
2017-07-11 17:33:04 +03:00
|
|
|
void Extend(nsINode& aContainer, uint32_t aOffset, ErrorResult& aRv);
|
2017-03-10 10:55:12 +03:00
|
|
|
void AddRange(nsRange& aRange, mozilla::ErrorResult& aRv);
|
|
|
|
void SelectAllChildren(nsINode& aNode, mozilla::ErrorResult& aRv);
|
|
|
|
void SetBaseAndExtent(nsINode& aAnchorNode, uint32_t aAnchorOffset,
|
|
|
|
nsINode& aFocusNode, uint32_t aFocusOffset,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
|
2015-08-12 20:26:01 +03:00
|
|
|
void AddSelectionChangeBlocker();
|
|
|
|
void RemoveSelectionChangeBlocker();
|
|
|
|
bool IsBlockingSelectionChangeEvents() const;
|
2017-08-24 10:56:12 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the painting style for the range. The range must be a range in
|
|
|
|
* the selection. The textRangeStyle will be used by text frame
|
|
|
|
* when it is painting the selection.
|
|
|
|
*/
|
|
|
|
nsresult SetTextRangeStyle(nsRange* aRange,
|
|
|
|
const TextRangeStyle& aTextRangeStyle);
|
|
|
|
|
2012-04-07 01:54:38 +04:00
|
|
|
private:
|
2012-06-08 18:20:55 +04:00
|
|
|
friend class ::nsAutoScrollTimer;
|
2012-04-07 01:54:38 +04:00
|
|
|
|
|
|
|
// Note: DoAutoScroll might destroy arbitrary frames etc.
|
|
|
|
nsresult DoAutoScroll(nsIFrame *aFrame, nsPoint& aPoint);
|
|
|
|
|
2017-08-10 15:02:08 +03:00
|
|
|
// We are not allowed to be in nodes whose root is not our document
|
|
|
|
bool HasSameRoot(nsINode& aNode);
|
|
|
|
|
2017-02-25 13:33:34 +03:00
|
|
|
// XXX Please don't add additional uses of this method, it's only for
|
|
|
|
// XXX supporting broken code (bug 1245883) in the following classes:
|
|
|
|
friend class ::nsCopySupport;
|
|
|
|
friend class ::nsHTMLCopyEncoder;
|
|
|
|
void AddRangeInternal(nsRange& aRange, nsIDocument* aDocument, ErrorResult&);
|
|
|
|
|
2017-08-23 13:09:07 +03:00
|
|
|
// This is helper method for GetPrimaryFrameForFocusNode.
|
|
|
|
// If aVisual is true, this returns caret frame.
|
|
|
|
// If false, this returns primary frame.
|
|
|
|
nsresult GetPrimaryOrCaretFrameForNodeOffset(nsIContent* aContent,
|
|
|
|
uint32_t aOffset,
|
|
|
|
nsIFrame** aReturnFrame,
|
|
|
|
int32_t* aOffsetUsed,
|
|
|
|
bool aVisual) const;
|
|
|
|
|
2012-04-07 01:54:38 +04:00
|
|
|
public:
|
2016-06-11 05:06:37 +03:00
|
|
|
SelectionType GetType() const { return mSelectionType; }
|
|
|
|
void SetType(SelectionType aSelectionType)
|
2016-06-07 16:42:06 +03:00
|
|
|
{
|
2016-06-11 05:06:37 +03:00
|
|
|
mSelectionType = aSelectionType;
|
2016-06-07 16:42:06 +03:00
|
|
|
}
|
2012-04-07 01:54:38 +04:00
|
|
|
|
2017-05-10 17:48:50 +03:00
|
|
|
SelectionCustomColors* GetCustomColors() const { return mCustomColors.get(); }
|
|
|
|
|
2017-03-10 10:55:12 +03:00
|
|
|
nsresult NotifySelectionListeners(bool aCalledByJS);
|
|
|
|
nsresult NotifySelectionListeners();
|
2012-04-07 01:54:38 +04:00
|
|
|
|
2015-09-22 20:24:50 +03:00
|
|
|
friend struct AutoUserInitiated;
|
|
|
|
struct MOZ_RAII AutoUserInitiated
|
2014-09-10 21:07:36 +04:00
|
|
|
{
|
2015-09-22 20:24:50 +03:00
|
|
|
explicit AutoUserInitiated(Selection* aSelection
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
|
|
|
: mSavedValue(aSelection->mUserInitiated)
|
2014-09-10 21:07:36 +04:00
|
|
|
{
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
2015-09-22 20:24:50 +03:00
|
|
|
aSelection->mUserInitiated = true;
|
2014-09-10 21:07:36 +04:00
|
|
|
}
|
|
|
|
AutoRestore<bool> mSavedValue;
|
|
|
|
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
|
|
|
};
|
2015-08-12 20:26:01 +03:00
|
|
|
|
2012-04-07 01:54:38 +04:00
|
|
|
private:
|
2015-02-21 07:27:59 +03:00
|
|
|
friend struct mozilla::AutoPrepareFocusRange;
|
2012-04-07 01:54:38 +04:00
|
|
|
class ScrollSelectionIntoViewEvent;
|
|
|
|
friend class ScrollSelectionIntoViewEvent;
|
|
|
|
|
2016-04-26 03:23:21 +03:00
|
|
|
class ScrollSelectionIntoViewEvent : public Runnable {
|
2012-04-07 01:54:38 +04:00
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2012-06-08 18:20:55 +04:00
|
|
|
ScrollSelectionIntoViewEvent(Selection* aSelection,
|
2012-04-07 01:54:38 +04:00
|
|
|
SelectionRegion aRegion,
|
|
|
|
nsIPresShell::ScrollAxis aVertical,
|
|
|
|
nsIPresShell::ScrollAxis aHorizontal,
|
2012-10-07 22:45:51 +04:00
|
|
|
int32_t aFlags)
|
2017-06-12 22:34:10 +03:00
|
|
|
: Runnable("dom::Selection::ScrollSelectionIntoViewEvent")
|
|
|
|
, mSelection(aSelection)
|
|
|
|
, mRegion(aRegion)
|
|
|
|
, mVerticalScroll(aVertical)
|
|
|
|
, mHorizontalScroll(aHorizontal)
|
|
|
|
, mFlags(aFlags)
|
|
|
|
{
|
2012-06-08 18:20:55 +04:00
|
|
|
NS_ASSERTION(aSelection, "null parameter");
|
2012-04-07 01:54:38 +04:00
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
void Revoke() { mSelection = nullptr; }
|
2012-04-07 01:54:38 +04:00
|
|
|
private:
|
2012-06-08 18:20:55 +04:00
|
|
|
Selection *mSelection;
|
2012-04-07 01:54:38 +04:00
|
|
|
SelectionRegion mRegion;
|
|
|
|
nsIPresShell::ScrollAxis mVerticalScroll;
|
|
|
|
nsIPresShell::ScrollAxis mHorizontalScroll;
|
2012-10-07 22:45:51 +04:00
|
|
|
int32_t mFlags;
|
2012-04-07 01:54:38 +04:00
|
|
|
};
|
|
|
|
|
2017-05-30 07:26:09 +03:00
|
|
|
/**
|
|
|
|
* Set mAnchorFocusRange to mRanges[aIndex] if aIndex is a valid index.
|
|
|
|
* Set mAnchorFocusRange to nullptr if aIndex is negative.
|
|
|
|
* Otherwise, i.e., if aIndex is positive but out of bounds of mRanges, do
|
|
|
|
* nothing.
|
|
|
|
*/
|
|
|
|
void SetAnchorFocusRange(int32_t aIndex);
|
2017-05-28 03:37:10 +03:00
|
|
|
void SelectFramesForContent(nsIContent* aContent, bool aSelected);
|
2017-05-29 06:27:09 +03:00
|
|
|
nsresult SelectAllFramesForContent(nsIContentIterator* aInnerIter,
|
|
|
|
nsIContent *aContent,
|
|
|
|
bool aSelected);
|
|
|
|
nsresult SelectFrames(nsPresContext* aPresContext,
|
|
|
|
nsRange* aRange,
|
|
|
|
bool aSelect);
|
2017-05-29 07:11:57 +03:00
|
|
|
nsresult GetTableCellLocationFromRange(nsRange* aRange,
|
|
|
|
int32_t* aSelectionType,
|
|
|
|
int32_t* aRow,
|
|
|
|
int32_t* aCol);
|
2017-05-29 07:31:11 +03:00
|
|
|
nsresult AddTableCellRange(nsRange* aRange,
|
|
|
|
bool* aDidAddRange,
|
|
|
|
int32_t* aOutIndex);
|
2012-04-07 01:54:38 +04:00
|
|
|
|
|
|
|
nsresult FindInsertionPoint(
|
|
|
|
nsTArray<RangeData>* aElementArray,
|
2012-08-22 19:56:38 +04:00
|
|
|
nsINode* aPointNode, int32_t aPointOffset,
|
|
|
|
nsresult (*aComparator)(nsINode*,int32_t,nsRange*,int32_t*),
|
|
|
|
int32_t* aPoint);
|
|
|
|
bool EqualsRangeAtPoint(nsINode* aBeginNode, int32_t aBeginOffset,
|
|
|
|
nsINode* aEndNode, int32_t aEndOffset,
|
|
|
|
int32_t aRangeIndex);
|
|
|
|
nsresult GetIndicesForInterval(nsINode* aBeginNode, int32_t aBeginOffset,
|
|
|
|
nsINode* aEndNode, int32_t aEndOffset,
|
2012-07-12 19:56:30 +04:00
|
|
|
bool aAllowAdjacent,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t* aStartIndex, int32_t* aEndIndex);
|
2012-04-07 01:54:38 +04:00
|
|
|
RangeData* FindRangeData(nsIDOMRange* aRange);
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
void UserSelectRangesToAdd(nsRange* aItem, nsTArray<RefPtr<nsRange> >& rangesToAdd);
|
2015-08-12 20:26:01 +03:00
|
|
|
|
2014-09-10 21:07:36 +04:00
|
|
|
/**
|
|
|
|
* Helper method for AddItem.
|
|
|
|
*/
|
|
|
|
nsresult AddItemInternal(nsRange* aRange, int32_t* aOutIndex);
|
|
|
|
|
2017-03-14 04:36:21 +03:00
|
|
|
nsIDocument* GetDocument() const;
|
|
|
|
nsPIDOMWindowOuter* GetWindow() const;
|
2017-08-07 10:33:59 +03:00
|
|
|
HTMLEditor* GetHTMLEditor() const;
|
2017-03-14 04:36:21 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GetCommonEditingHostForAllRanges() returns common editing host of all
|
|
|
|
* ranges if there is. If at least one of the ranges is in non-editable
|
|
|
|
* element, returns nullptr. See following examples for the detail:
|
|
|
|
*
|
|
|
|
* <div id="a" contenteditable>
|
|
|
|
* an[cestor
|
|
|
|
* <div id="b" contenteditable="false">
|
|
|
|
* non-editable
|
|
|
|
* <div id="c" contenteditable>
|
|
|
|
* desc]endant
|
|
|
|
* in this case, this returns div#a because div#c is also in div#a.
|
|
|
|
*
|
|
|
|
* <div id="a" contenteditable>
|
|
|
|
* an[ce]stor
|
|
|
|
* <div id="b" contenteditable="false">
|
|
|
|
* non-editable
|
|
|
|
* <div id="c" contenteditable>
|
|
|
|
* de[sc]endant
|
|
|
|
* in this case, this returns div#a because second range is also in div#a
|
|
|
|
* and common ancestor of the range (i.e., div#c) is editable.
|
|
|
|
*
|
|
|
|
* <div id="a" contenteditable>
|
|
|
|
* an[ce]stor
|
|
|
|
* <div id="b" contenteditable="false">
|
|
|
|
* [non]-editable
|
|
|
|
* <div id="c" contenteditable>
|
|
|
|
* de[sc]endant
|
|
|
|
* in this case, this returns nullptr because the second range is in
|
|
|
|
* non-editable area.
|
|
|
|
*/
|
|
|
|
Element* GetCommonEditingHostForAllRanges();
|
|
|
|
|
2012-04-07 01:54:38 +04:00
|
|
|
// These are the ranges inside this selection. They are kept sorted in order
|
|
|
|
// of DOM start position.
|
|
|
|
//
|
|
|
|
// This data structure is sorted by the range beginnings. As the ranges are
|
|
|
|
// disjoint, it is also implicitly sorted by the range endings. This allows
|
|
|
|
// us to perform binary searches when searching for existence of a range,
|
|
|
|
// giving us O(log n) search time.
|
|
|
|
//
|
|
|
|
// Inserting a new range requires finding the overlapping interval, requiring
|
|
|
|
// two binary searches plus up to an additional 6 DOM comparisons. If this
|
|
|
|
// proves to be a performance concern, then an interval tree may be a
|
|
|
|
// possible solution, allowing the calculation of the overlap interval in
|
|
|
|
// O(log n) time, though this would require rebalancing and other overhead.
|
2017-07-28 20:24:51 +03:00
|
|
|
AutoTArray<RangeData, 1> mRanges;
|
2012-04-07 01:54:38 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsRange> mAnchorFocusRange;
|
Bug 1393816 - part1: Cache a range until new range is created in Selection r=smaug
When setting value of <input type="text">, nsTextEditorState removes all
ranges of normal selection first. Then, TextEditor sets the value. Finally,
TextEditor collapses the selection at the end of the text.
In bug 1386471, we got that there are some problems to remove the call of
Selection::RemoveAllRanges() in nsTextEditorState. Therefore, we need another
approach to improve Selection::Collapse().
The approach of this patch is, when removing all ranges from normal selection,
Selection can cache an nsRange instance if there is an instance which is not
referenced from other than the Selection (i.e., it'll be removed when
Selection::Clear() is called). Then, Selection::Collapse() can reuse it. With
this fix, Selection::Collapse() can reduce allocation cost and may reduce some
other cost like adding it to mutation observer.
However, keeping nsRange instance may cause increasing mutation observer's cost
since nsRange will be adjusted its start node/offset and end node/offset with
mutation observer to guarantee that the range is always valid. So, we can
cache such range only when the caller (or its callee) will set selection range
later. Therefore, this patch adds Selection::RemoveAllRangesTemporarily()
and make only nsTextEditorState::SetValue() and
ContentEventHandler::OnSelectionEvent() use it.
MozReview-Commit-ID: FjWrbz4S1ld
--HG--
extra : rebase_source : 83677640525e0b1a84bdd7fce63ff4704b9cc22b
2017-08-25 13:21:39 +03:00
|
|
|
// mCachedRange is set by RemoveAllRangesTemporarily() and used by
|
2017-08-25 18:12:38 +03:00
|
|
|
// Collapse() and SetBaseAndExtent(). If there is a range which will be
|
|
|
|
// released by Clear(), RemoveAllRangesTemporarily() stores it with this.
|
|
|
|
// If Collapse() is called without existing ranges, it'll reuse this range
|
|
|
|
// for saving the creation cost.
|
Bug 1393816 - part1: Cache a range until new range is created in Selection r=smaug
When setting value of <input type="text">, nsTextEditorState removes all
ranges of normal selection first. Then, TextEditor sets the value. Finally,
TextEditor collapses the selection at the end of the text.
In bug 1386471, we got that there are some problems to remove the call of
Selection::RemoveAllRanges() in nsTextEditorState. Therefore, we need another
approach to improve Selection::Collapse().
The approach of this patch is, when removing all ranges from normal selection,
Selection can cache an nsRange instance if there is an instance which is not
referenced from other than the Selection (i.e., it'll be removed when
Selection::Clear() is called). Then, Selection::Collapse() can reuse it. With
this fix, Selection::Collapse() can reduce allocation cost and may reduce some
other cost like adding it to mutation observer.
However, keeping nsRange instance may cause increasing mutation observer's cost
since nsRange will be adjusted its start node/offset and end node/offset with
mutation observer to guarantee that the range is always valid. So, we can
cache such range only when the caller (or its callee) will set selection range
later. Therefore, this patch adds Selection::RemoveAllRangesTemporarily()
and make only nsTextEditorState::SetValue() and
ContentEventHandler::OnSelectionEvent() use it.
MozReview-Commit-ID: FjWrbz4S1ld
--HG--
extra : rebase_source : 83677640525e0b1a84bdd7fce63ff4704b9cc22b
2017-08-25 13:21:39 +03:00
|
|
|
RefPtr<nsRange> mCachedRange;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsFrameSelection> mFrameSelection;
|
|
|
|
RefPtr<nsAutoScrollTimer> mAutoScrollTimer;
|
2017-06-09 07:15:49 +03:00
|
|
|
FallibleTArray<nsCOMPtr<nsISelectionListener>> mSelectionListeners;
|
2012-04-07 01:54:38 +04:00
|
|
|
nsRevocableEventPtr<ScrollSelectionIntoViewEvent> mScrollEvent;
|
2017-05-10 17:48:50 +03:00
|
|
|
CachedOffsetForFrame* mCachedOffsetForFrame;
|
2012-04-07 01:54:38 +04:00
|
|
|
nsDirection mDirection;
|
2016-06-11 05:06:37 +03:00
|
|
|
SelectionType mSelectionType;
|
2017-05-10 17:48:50 +03:00
|
|
|
UniquePtr<SelectionCustomColors> mCustomColors;
|
|
|
|
|
2014-09-10 21:07:36 +04:00
|
|
|
/**
|
|
|
|
* True if the current selection operation was initiated by user action.
|
2015-08-12 20:26:01 +03:00
|
|
|
* It determines whether we exclude -moz-user-select:none nodes or not,
|
|
|
|
* as well as whether selectstart events will be fired.
|
2014-09-10 21:07:36 +04:00
|
|
|
*/
|
2015-09-22 20:24:50 +03:00
|
|
|
bool mUserInitiated;
|
2015-08-12 20:26:01 +03:00
|
|
|
|
2017-03-10 10:55:12 +03:00
|
|
|
/**
|
|
|
|
* When the selection change is caused by a call of Selection API,
|
|
|
|
* mCalledByJS is true. Otherwise, false.
|
|
|
|
*/
|
|
|
|
bool mCalledByJS;
|
|
|
|
|
2015-08-12 20:26:01 +03:00
|
|
|
// Non-zero if we don't want any changes we make to the selection to be
|
|
|
|
// visible to content. If non-zero, content won't be notified about changes.
|
|
|
|
uint32_t mSelectionChangeBlockerCount;
|
2012-04-07 01:54:38 +04:00
|
|
|
};
|
|
|
|
|
2015-02-04 23:34:00 +03:00
|
|
|
// Stack-class to turn on/off selection batching.
|
2015-03-21 19:28:04 +03:00
|
|
|
class MOZ_STACK_CLASS SelectionBatcher final
|
2015-02-04 23:34:00 +03:00
|
|
|
{
|
|
|
|
private:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<Selection> mSelection;
|
2015-02-04 23:34:00 +03:00
|
|
|
public:
|
|
|
|
explicit SelectionBatcher(Selection* aSelection)
|
|
|
|
{
|
|
|
|
mSelection = aSelection;
|
|
|
|
if (mSelection) {
|
|
|
|
mSelection->StartBatchChanges();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
~SelectionBatcher()
|
|
|
|
{
|
|
|
|
if (mSelection) {
|
2017-09-08 06:10:44 +03:00
|
|
|
mSelection->EndBatchChanges();
|
2015-02-04 23:34:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-03-28 15:34:26 +03:00
|
|
|
class MOZ_RAII AutoHideSelectionChanges final
|
2015-08-12 20:26:01 +03:00
|
|
|
{
|
|
|
|
private:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<Selection> mSelection;
|
2015-08-12 20:26:01 +03:00
|
|
|
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
|
|
|
public:
|
|
|
|
explicit AutoHideSelectionChanges(const nsFrameSelection* aFrame);
|
|
|
|
|
|
|
|
explicit AutoHideSelectionChanges(Selection* aSelection
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
|
|
|
: mSelection(aSelection)
|
|
|
|
{
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
|
|
|
mSelection = aSelection;
|
|
|
|
if (mSelection) {
|
|
|
|
mSelection->AddSelectionChangeBlocker();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
~AutoHideSelectionChanges()
|
|
|
|
{
|
|
|
|
if (mSelection) {
|
|
|
|
mSelection->RemoveSelectionChangeBlocker();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-04-10 20:09:40 +04:00
|
|
|
} // namespace dom
|
2017-08-02 00:19:19 +03:00
|
|
|
|
|
|
|
inline bool
|
2017-08-24 13:14:04 +03:00
|
|
|
IsValidRawSelectionType(RawSelectionType aRawSelectionType)
|
2017-08-02 00:19:19 +03:00
|
|
|
{
|
2017-08-24 13:14:04 +03:00
|
|
|
return aRawSelectionType >= nsISelectionController::SELECTION_NONE &&
|
|
|
|
aRawSelectionType <= nsISelectionController::SELECTION_URLSTRIKEOUT;
|
2017-08-02 00:19:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
inline SelectionType
|
|
|
|
ToSelectionType(RawSelectionType aRawSelectionType)
|
|
|
|
{
|
2017-08-24 13:14:04 +03:00
|
|
|
if (!IsValidRawSelectionType(aRawSelectionType)) {
|
2017-08-02 00:19:19 +03:00
|
|
|
return SelectionType::eInvalid;
|
|
|
|
}
|
|
|
|
return static_cast<SelectionType>(aRawSelectionType);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline RawSelectionType
|
|
|
|
ToRawSelectionType(SelectionType aSelectionType)
|
|
|
|
{
|
2017-08-24 13:14:04 +03:00
|
|
|
MOZ_ASSERT(aSelectionType != SelectionType::eInvalid);
|
2017-08-02 00:19:19 +03:00
|
|
|
return static_cast<RawSelectionType>(aSelectionType);
|
|
|
|
}
|
|
|
|
|
2017-08-24 13:14:04 +03:00
|
|
|
inline RawSelectionType
|
|
|
|
ToRawSelectionType(TextRangeType aTextRangeType)
|
2017-08-02 00:19:19 +03:00
|
|
|
{
|
|
|
|
return ToRawSelectionType(ToSelectionType(aTextRangeType));
|
|
|
|
}
|
|
|
|
|
2017-08-24 13:14:04 +03:00
|
|
|
inline SelectionTypeMask
|
|
|
|
ToSelectionTypeMask(SelectionType aSelectionType)
|
2017-08-02 00:19:19 +03:00
|
|
|
{
|
2017-08-24 13:14:04 +03:00
|
|
|
MOZ_ASSERT(aSelectionType != SelectionType::eInvalid);
|
|
|
|
return aSelectionType == SelectionType::eNone ? 0 :
|
|
|
|
(1 << (static_cast<uint8_t>(aSelectionType) - 1));
|
2017-08-02 00:19:19 +03:00
|
|
|
}
|
|
|
|
|
2012-06-08 18:20:55 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2017-08-02 00:12:57 +03:00
|
|
|
inline mozilla::dom::Selection*
|
|
|
|
nsISelection::AsSelection()
|
|
|
|
{
|
|
|
|
return static_cast<mozilla::dom::Selection*>(this);
|
|
|
|
}
|
|
|
|
|
2012-06-08 18:20:55 +04:00
|
|
|
#endif // mozilla_Selection_h__
|