Bug 950386 - Move mozilla::Selection to mozilla::dom::Selection; r=ehsan

This commit is contained in:
Aryeh Gregor 2014-04-10 19:09:40 +03:00
parent 54d22813e9
commit 45fbfe5e45
48 changed files with 125 additions and 100 deletions

View File

@ -12,7 +12,7 @@
#include "States.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
using namespace mozilla;
using namespace mozilla::a11y;
@ -127,7 +127,7 @@ AccShowEvent::
////////////////////////////////////////////////////////////////////////////////
AccTextSelChangeEvent::AccTextSelChangeEvent(HyperTextAccessible* aTarget,
Selection* aSelection,
dom::Selection* aSelection,
int32_t aReason) :
AccEvent(nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED, aTarget,
eAutoDetect, eCoalesceTextSelChange),

View File

@ -12,7 +12,9 @@
namespace mozilla {
namespace dom {
class Selection;
}
namespace a11y {
@ -367,7 +369,8 @@ private:
class AccTextSelChangeEvent : public AccEvent
{
public:
AccTextSelChangeEvent(HyperTextAccessible* aTarget, Selection* aSelection,
AccTextSelChangeEvent(HyperTextAccessible* aTarget,
dom::Selection* aSelection,
int32_t aReason);
virtual ~AccTextSelChangeEvent();
@ -386,7 +389,7 @@ public:
bool IsCaretMoveOnly() const;
private:
nsRefPtr<Selection> mSel;
nsRefPtr<dom::Selection> mSel;
int32_t mReason;
friend class EventQueue;

View File

@ -14,11 +14,12 @@
#include "nsIAccessibleTypes.h"
#include "nsIDOMDocument.h"
#include "nsIPresShell.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::a11y;
using mozilla::dom::Selection;
struct mozilla::a11y::SelData MOZ_FINAL
{

View File

@ -42,7 +42,7 @@ HyperTextAccessible::IsValidRange(int32_t aStartOffset, int32_t aEndOffset)
inline bool
HyperTextAccessible::AddToSelection(int32_t aStartOffset, int32_t aEndOffset)
{
Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
return domSel &&
SetSelectionBoundsAt(domSel->GetRangeCount(), aStartOffset, aEndOffset);
}
@ -149,7 +149,7 @@ HyperTextAccessible::FrameSelection() const
return frame ? frame->GetFrameSelection() : nullptr;
}
inline Selection*
inline dom::Selection*
HyperTextAccessible::DOMSelection() const
{
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();

View File

@ -33,7 +33,7 @@
#include "nsTextFragment.h"
#include "mozilla/dom/Element.h"
#include "mozilla/EventStates.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/MathAlgorithms.h"
#include "gfxSkipChars.h"
#include <algorithm>
@ -1117,7 +1117,7 @@ HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos)
if (isFocusable)
TakeFocus();
Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
NS_ENSURE_STATE(domSel);
// Set up the selection.
@ -1164,7 +1164,7 @@ HyperTextAccessible::CaretOffset() const
// Turn the focus node and offset of the selection into caret hypretext
// offset.
Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
NS_ENSURE_TRUE(domSel, -1);
nsINode* focusNode = domSel->GetFocusNode();
@ -1194,7 +1194,7 @@ HyperTextAccessible::CaretLineNumber()
if (!frameSelection)
return -1;
Selection* domSel =
dom::Selection* domSel =
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
if (!domSel)
return - 1;
@ -1310,7 +1310,7 @@ HyperTextAccessible::GetSelectionDOMRanges(int16_t aType,
frameSelection->GetDisplaySelection() <= nsISelectionController::SELECTION_HIDDEN)
return;
Selection* domSel = frameSelection->GetSelection(aType);
dom::Selection* domSel = frameSelection->GetSelection(aType);
if (!domSel)
return;
@ -1397,7 +1397,7 @@ HyperTextAccessible::SetSelectionBoundsAt(int32_t aSelectionNum,
int32_t startOffset = ConvertMagicOffset(aStartOffset);
int32_t endOffset = ConvertMagicOffset(aEndOffset);
Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
if (!domSel)
return false;
@ -1426,7 +1426,7 @@ HyperTextAccessible::SetSelectionBoundsAt(int32_t aSelectionNum,
bool
HyperTextAccessible::RemoveFromSelection(int32_t aSelectionNum)
{
Selection* domSel = DOMSelection();
dom::Selection* domSel = DOMSelection();
if (!domSel)
return false;
@ -1521,7 +1521,7 @@ HyperTextAccessible::SelectionRanges(nsTArray<a11y::TextRange>* aRanges) const
{
NS_ASSERTION(aRanges->Length() != 0, "TextRange array supposed to be empty");
Selection* sel = DOMSelection();
dom::Selection* sel = DOMSelection();
if (!sel)
return;
@ -1848,7 +1848,7 @@ HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
if (!fs)
return NS_OK;
Selection* domSel = fs->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
dom::Selection* domSel = fs->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
if (!domSel)
return NS_OK;

View File

@ -489,7 +489,7 @@ protected:
* Return frame/DOM selection object for the accessible.
*/
already_AddRefed<nsFrameSelection> FrameSelection() const;
Selection* DOMSelection() const;
dom::Selection* DOMSelection() const;
/**
* Return selection ranges within the accessible subtree.

View File

@ -109,12 +109,12 @@ template<class T> class nsReadingIterator;
namespace mozilla {
class ErrorResult;
class EventListenerManager;
class Selection;
namespace dom {
class DocumentFragment;
class Element;
class EventTarget;
class Selection;
} // namespace dom
namespace layers {
@ -2086,7 +2086,7 @@ public:
* @param aOutStartOffset Output start offset
* @param aOutEndOffset Output end offset
*/
static void GetSelectionInTextControl(mozilla::Selection* aSelection,
static void GetSelectionInTextControl(mozilla::dom::Selection* aSelection,
Element* aRoot,
int32_t& aOutStartOffset,
int32_t& aOutEndOffset);

View File

@ -50,7 +50,7 @@
#include "mozilla/Likely.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/TextEvents.h"
#include "nsAString.h"
#include "nsAttrName.h"

View File

@ -49,7 +49,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
using namespace mozilla;
using namespace mozilla::dom;

View File

@ -38,7 +38,7 @@
#include "nsIScriptContext.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptSecurityManager.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsISelectionPrivate.h"
#include "nsITransferable.h" // for kUnicodeMime
#include "nsContentUtils.h"

View File

@ -35,7 +35,7 @@
#include "nsServiceManagerUtils.h"
#include "nsIEditor.h"
#include "nsTextEditRules.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/EventListenerManager.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"

View File

@ -234,7 +234,7 @@ public:
{
// Deprecated
}
mozilla::Selection* GetSelection(mozilla::ErrorResult& aRv);
mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aRv);
// The XPCOM CaptureEvents works fine for us.
// The XPCOM ReleaseEvents works fine for us.
// We're picking up GetLocation from Document

View File

@ -27,7 +27,7 @@
#include "nsIBaseWindow.h"
#include "nsViewManager.h"
#include "nsFrameSelection.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsXULPopupManager.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIPrincipal.h"

View File

@ -172,7 +172,7 @@
#include "nsIDragService.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsFrameLoader.h"
#include "nsISupportsPrimitives.h"
#include "nsXPCOMCID.h"

View File

@ -104,7 +104,6 @@ class nsWindowSizes;
namespace mozilla {
class DOMEventTargetHelper;
class Selection;
namespace dom {
class BarProp;
class Console;
@ -114,6 +113,7 @@ class Gamepad;
class MediaQueryList;
class Navigator;
class OwningExternalOrWindowProxy;
class Selection;
class SpeechSynthesis;
class WakeLock;
namespace indexedDB {
@ -882,7 +882,7 @@ public:
mozilla::ErrorResult& aError);
nsIDOMStorage* GetSessionStorage(mozilla::ErrorResult& aError);
nsIDOMStorage* GetLocalStorage(mozilla::ErrorResult& aError);
mozilla::Selection* GetSelection(mozilla::ErrorResult& aError);
mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aError);
mozilla::dom::indexedDB::IDBFactory* GetIndexedDB(mozilla::ErrorResult& aError);
already_AddRefed<nsICSSDeclaration>
GetComputedStyle(mozilla::dom::Element& aElt, const nsAString& aPseudoElt,

View File

@ -974,7 +974,6 @@ DOMInterfaces = {
},
'Selection': {
'nativeType': 'mozilla::Selection',
'resultNotAddRefed': [ 'anchorNode', 'focusNode', 'getRangeAt' ],
},

View File

@ -7,7 +7,7 @@
#include "DeleteRangeTxn.h"
#include "DeleteTextTxn.h"
#include "mozilla/Assertions.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/mozalloc.h"
#include "nsCOMPtr.h"
#include "nsDebug.h"
@ -22,6 +22,7 @@
class nsIDOMRange;
using namespace mozilla;
using namespace mozilla::dom;
// note that aEditor is not refcounted
DeleteRangeTxn::DeleteRangeTxn()

View File

@ -5,7 +5,7 @@
#include "DeleteTextTxn.h"
#include "mozilla/Assertions.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsAutoPtr.h"
#include "nsDebug.h"
#include "nsEditor.h"
@ -17,6 +17,7 @@
#include "nsAString.h"
using namespace mozilla;
using namespace mozilla::dom;
DeleteTextTxn::DeleteTextTxn() :
EditTxn(),

View File

@ -7,9 +7,10 @@
#include "nsEditor.h"
#include "IMETextTxn.h"
#include "nsGkAtoms.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
using namespace mozilla;
using namespace mozilla::dom;
PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn(),
mAbsorb(true),

View File

@ -48,7 +48,7 @@ public:
nsIEditor::EDirection aDirection) = 0;
NS_IMETHOD AfterEdit(EditAction action,
nsIEditor::EDirection aDirection) = 0;
NS_IMETHOD WillDoAction(mozilla::Selection* aSelection, nsRulesInfo* aInfo,
NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo,
bool* aCancel, bool* aHandled) = 0;
NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult)=0;
NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty)=0;

View File

@ -26,7 +26,7 @@
#include "mozInlineSpellChecker.h" // for mozInlineSpellChecker
#include "mozilla/IMEStateManager.h" // for IMEStateManager
#include "mozilla/Preferences.h" // for Preferences
#include "mozilla/Selection.h" // for Selection, etc
#include "mozilla/dom/Selection.h" // for Selection, etc
#include "mozilla/Services.h" // for GetObserverService
#include "mozilla/TextComposition.h" // for TextComposition
#include "mozilla/TextEvents.h"

View File

@ -67,13 +67,13 @@ class nsString;
class nsTransactionManager;
namespace mozilla {
class Selection;
class TextComposition;
namespace dom {
class DataTransfer;
class Element;
class EventTarget;
class Selection;
} // namespace dom
} // namespace mozilla
@ -435,7 +435,7 @@ public:
/** routines for managing the preservation of selection across
* various editor actions */
bool ArePreservingSelection();
void PreserveSelectionAcrossActions(mozilla::Selection* aSel);
void PreserveSelectionAcrossActions(mozilla::dom::Selection* aSel);
nsresult RestorePreservedSelection(nsISelection *aSel);
void StopPreservingSelection();
@ -623,17 +623,17 @@ public:
static nsCOMPtr<nsIDOMNode> GetNodeAtRangeOffsetPoint(nsIDOMNode* aParentOrNode, int32_t aOffset);
static nsresult GetStartNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outStartNode, int32_t *outStartOffset);
static nsresult GetStartNodeAndOffset(mozilla::Selection* aSelection,
static nsresult GetStartNodeAndOffset(mozilla::dom::Selection* aSelection,
nsINode** aStartNode,
int32_t* aStartOffset);
static nsresult GetEndNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outEndNode, int32_t *outEndOffset);
static nsresult GetEndNodeAndOffset(mozilla::Selection* aSelection,
static nsresult GetEndNodeAndOffset(mozilla::dom::Selection* aSelection,
nsINode** aEndNode,
int32_t* aEndOffset);
#if DEBUG_JOE
static void DumpNode(nsIDOMNode *aNode, int32_t indent=0);
#endif
mozilla::Selection* GetSelection();
mozilla::dom::Selection* GetSelection();
// Helpers to add a node to the selection.
// Used by table cell selection methods

View File

@ -3,7 +3,7 @@
* 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/. */
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsCOMArray.h"
#include "nsComponentManagerUtils.h"
#include "nsEditorUtils.h"
@ -24,6 +24,7 @@ class nsIDOMRange;
class nsISupports;
using namespace mozilla;
using namespace mozilla::dom;
/******************************************************************************
* nsAutoSelectionReset

View File

@ -56,12 +56,12 @@ class MOZ_STACK_CLASS nsAutoSelectionReset
{
private:
/** ref-counted reference to the selection that we are supposed to restore */
nsRefPtr<mozilla::Selection> mSel;
nsRefPtr<mozilla::dom::Selection> mSel;
nsEditor *mEd; // non-owning ref to nsEditor
public:
/** constructor responsible for remembering all state needed to restore aSel */
nsAutoSelectionReset(mozilla::Selection* aSel, nsEditor* aEd);
nsAutoSelectionReset(mozilla::dom::Selection* aSel, nsEditor* aEd);
/** destructor restores mSel to its former state */
~nsAutoSelectionReset();

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/Selection.h" // for Selection
#include "mozilla/dom/Selection.h" // for Selection
#include "nsAString.h" // for nsAString_internal::Length
#include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc
#include "nsCycleCollectionParticipant.h"
@ -21,6 +21,7 @@
#include "nsSelectionState.h"
using namespace mozilla;
using namespace mozilla::dom;
/***************************************************************************
* class for recording selection info. stores selection as collection of

View File

@ -18,8 +18,10 @@ class nsIDOMRange;
class nsISelection;
class nsRange;
namespace mozilla {
namespace dom {
class Selection;
}
}
/***************************************************************************
* class for recording selection info. stores selection as collection of
@ -59,7 +61,7 @@ class nsSelectionState
void DoTraverse(nsCycleCollectionTraversalCallback &cb);
void DoUnlink() { MakeEmpty(); }
void SaveSelection(mozilla::Selection *aSel);
void SaveSelection(mozilla::dom::Selection *aSel);
nsresult RestoreSelection(nsISelection *aSel);
bool IsCollapsed();
bool IsEqual(nsSelectionState *aSelState);

View File

@ -5,7 +5,7 @@
#include <math.h>
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Element.h"
#include "mozilla/mozalloc.h"
#include "nsAString.h"
@ -52,6 +52,7 @@
#include <algorithm>
using namespace mozilla;
using namespace mozilla::dom;
#define BLACK_BG_RGB_TRIGGER 0xd0

View File

@ -11,7 +11,7 @@
#include "mozilla/Base64.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsAString.h"
#include "nsAutoPtr.h"
#include "nsCOMArray.h"

View File

@ -9,7 +9,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Element.h"
#include "mozilla/mozalloc.h"
#include "nsAString.h"
@ -61,6 +61,7 @@ class nsISupports;
class nsRulesInfo;
using namespace mozilla;
using namespace mozilla::dom;
//const static char* kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
//const static char* kMOZEditorBogusNodeValue="TRUE";

View File

@ -33,9 +33,9 @@ class nsPlaintextEditor;
class nsRange;
class nsRulesInfo;
namespace mozilla {
class Selection;
namespace dom {
class Element;
class Selection;
} // namespace dom
} // namespace mozilla
struct DOMPoint;
@ -79,7 +79,7 @@ public:
nsIEditor::EDirection aDirection);
NS_IMETHOD AfterEdit(EditAction action,
nsIEditor::EDirection aDirection);
NS_IMETHOD WillDoAction(mozilla::Selection* aSelection, nsRulesInfo* aInfo,
NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo,
bool* aCancel, bool* aHandled);
NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult);
NS_IMETHOD DocumentModified();
@ -127,19 +127,19 @@ protected:
// nsHTMLEditRules implementation methods
nsresult WillInsert(nsISelection *aSelection, bool *aCancel);
nsresult WillInsertText( EditAction aAction,
mozilla::Selection* aSelection,
mozilla::dom::Selection* aSelection,
bool *aCancel,
bool *aHandled,
const nsAString *inString,
nsAString *outString,
int32_t aMaxLength);
nsresult WillLoadHTML(nsISelection *aSelection, bool *aCancel);
nsresult WillInsertBreak(mozilla::Selection* aSelection,
nsresult WillInsertBreak(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult StandardBreakImpl(nsIDOMNode *aNode, int32_t aOffset, nsISelection *aSelection);
nsresult DidInsertBreak(nsISelection *aSelection, nsresult aResult);
nsresult SplitMailCites(nsISelection *aSelection, bool aPlaintext, bool *aHandled);
nsresult WillDeleteSelection(mozilla::Selection* aSelection,
nsresult WillDeleteSelection(mozilla::dom::Selection* aSelection,
nsIEditor::EDirection aAction,
nsIEditor::EStripWrappers aStripWrappers,
bool* aCancel, bool* aHandled);
@ -154,36 +154,36 @@ protected:
nsresult MoveNodeSmart(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset);
nsresult MoveContents(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset);
nsresult DeleteNonTableElements(nsINode* aNode);
nsresult WillMakeList(mozilla::Selection* aSelection,
nsresult WillMakeList(mozilla::dom::Selection* aSelection,
const nsAString* aListType,
bool aEntireList,
const nsAString* aBulletType,
bool* aCancel, bool* aHandled,
const nsAString* aItemType = nullptr);
nsresult WillRemoveList(mozilla::Selection* aSelection,
nsresult WillRemoveList(mozilla::dom::Selection* aSelection,
bool aOrdered, bool* aCancel, bool* aHandled);
nsresult WillIndent(mozilla::Selection* aSelection,
nsresult WillIndent(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillCSSIndent(mozilla::Selection* aSelection,
nsresult WillCSSIndent(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillHTMLIndent(mozilla::Selection* aSelection,
nsresult WillHTMLIndent(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillOutdent(mozilla::Selection* aSelection,
nsresult WillOutdent(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillAlign(mozilla::Selection* aSelection,
nsresult WillAlign(mozilla::dom::Selection* aSelection,
const nsAString* alignType,
bool* aCancel, bool* aHandled);
nsresult WillAbsolutePosition(mozilla::Selection* aSelection,
nsresult WillAbsolutePosition(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillRemoveAbsolutePosition(mozilla::Selection* aSelection,
nsresult WillRemoveAbsolutePosition(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillRelativeChangeZIndex(mozilla::Selection* aSelection,
nsresult WillRelativeChangeZIndex(mozilla::dom::Selection* aSelection,
int32_t aChange,
bool* aCancel, bool* aHandled);
nsresult WillMakeDefListItem(mozilla::Selection* aSelection,
nsresult WillMakeDefListItem(mozilla::dom::Selection* aSelection,
const nsAString* aBlockType, bool aEntireList,
bool* aCancel, bool* aHandled);
nsresult WillMakeBasicBlock(mozilla::Selection* aSelection,
nsresult WillMakeBasicBlock(mozilla::dom::Selection* aSelection,
const nsAString* aBlockType,
bool* aCancel, bool* aHandled);
nsresult DidMakeBasicBlock(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult);

View File

@ -69,13 +69,14 @@
#include "nsIFrame.h"
#include "nsIParserService.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "nsTextFragment.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::widget;
// Some utilities to handle annoying overloading of "A" tag for link and named anchor

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "TypeInState.h"
#include "mozilla/Assertions.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Element.h"
#include "mozilla/mozalloc.h"
#include "nsAString.h"
@ -52,6 +52,7 @@
class nsISupports;
using namespace mozilla;
using namespace mozilla::dom;
static bool
IsEmptyTextNode(nsHTMLEditor* aThis, nsINode* aNode)

View File

@ -6,7 +6,7 @@
#include <stdio.h>
#include "mozilla/Assertions.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Element.h"
#include "nsAString.h"
#include "nsAlgorithm.h"
@ -42,6 +42,7 @@
#include <algorithm>
using namespace mozilla;
using namespace mozilla::dom;
/***************************************************************************
* stack based helper class for restoring selection after table edit

View File

@ -336,7 +336,7 @@ class MOZ_STACK_CLASS nsWSRunObject
int32_t aOffset,
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aPriorNode);
nsresult GetPreviousWSNode(DOMPoint aPoint,
nsresult GetPreviousWSNode(::DOMPoint aPoint,
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aPriorNode);
nsresult GetNextWSNode(nsIDOMNode *aStartNode,
@ -346,7 +346,7 @@ class MOZ_STACK_CLASS nsWSRunObject
int32_t aOffset,
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aNextNode);
nsresult GetNextWSNode(DOMPoint aPoint,
nsresult GetNextWSNode(::DOMPoint aPoint,
nsIDOMNode *aBlockParent,
nsCOMPtr<nsIDOMNode> *aNextNode);
nsresult PrepareToDeleteRangePriv(nsWSRunObject* aEndObject);

View File

@ -6,7 +6,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/TextComposition.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Element.h"
@ -64,6 +64,7 @@ class nsISupports;
class nsISupportsArray;
using namespace mozilla;
using namespace mozilla::dom;
nsPlaintextEditor::nsPlaintextEditor()
: nsEditor()

View File

@ -6,7 +6,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/TextComposition.h"
#include "mozilla/dom/Element.h"
#include "nsAString.h"
@ -43,6 +43,7 @@
#include "nsUnicharUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
#define CANCEL_OPERATION_IF_READONLY_OR_DISABLED \
if (IsReadonly() || IsDisabled()) \

View File

@ -21,7 +21,9 @@ class nsIDOMElement;
class nsIDOMNode;
class nsISelection;
namespace mozilla {
namespace dom {
class Selection;
} // namespace dom
} // namespace mozilla
/** Object that encapsulates HTML text-specific editing rules.
@ -53,8 +55,8 @@ public:
nsIEditor::EDirection aDirection);
NS_IMETHOD AfterEdit(EditAction action,
nsIEditor::EDirection aDirection);
NS_IMETHOD WillDoAction(mozilla::Selection* aSelection, nsRulesInfo* aInfo,
bool* aCancel, bool* aHandled);
NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection,
nsRulesInfo* aInfo, bool* aCancel, bool* aHandled);
NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult);
NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty);
NS_IMETHOD DocumentModified();
@ -102,7 +104,7 @@ protected:
// nsTextEditRules implementation methods
nsresult WillInsertText( EditAction aAction,
mozilla::Selection* aSelection,
mozilla::dom::Selection* aSelection,
bool *aCancel,
bool *aHandled,
const nsAString *inString,
@ -111,14 +113,14 @@ protected:
nsresult DidInsertText(nsISelection *aSelection, nsresult aResult);
nsresult GetTopEnclosingPre(nsIDOMNode *aNode, nsIDOMNode** aOutPreNode);
nsresult WillInsertBreak(mozilla::Selection* aSelection, bool* aCancel,
nsresult WillInsertBreak(mozilla::dom::Selection* aSelection, bool* aCancel,
bool *aHandled, int32_t aMaxLength);
nsresult DidInsertBreak(nsISelection *aSelection, nsresult aResult);
nsresult WillInsert(nsISelection *aSelection, bool *aCancel);
nsresult DidInsert(nsISelection *aSelection, nsresult aResult);
nsresult WillDeleteSelection(mozilla::Selection* aSelection,
nsresult WillDeleteSelection(mozilla::dom::Selection* aSelection,
nsIEditor::EDirection aCollapsedAction,
bool *aCancel,
bool *aHandled);
@ -167,7 +169,7 @@ protected:
/** returns a truncated insertion string if insertion would place us
over aMaxLength */
nsresult TruncateInsertionIfNeeded(mozilla::Selection* aSelection,
nsresult TruncateInsertionIfNeeded(mozilla::dom::Selection* aSelection,
const nsAString *aInString,
nsAString *aOutString,
int32_t aMaxLength,

View File

@ -12,7 +12,7 @@
#include "nsIDOMNode.h"
#include "nsIEditor.h"
#include "nsIPresShell.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsISelectionPrivate.h"
#include "nsISupportsImpl.h"
#include "nsPlaintextEditor.h"
@ -21,6 +21,7 @@
#include "nscore.h"
using namespace mozilla;
using namespace mozilla::dom;
// Test for distance between caret and text that will be deleted
nsresult

View File

@ -29,7 +29,7 @@
#include "nsTextFragment.h"
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include <algorithm>
// The bidi indicator hangs off the caret to one side, to show which
@ -1101,7 +1101,7 @@ nsCaret::GetFrameSelection()
if (!sel)
return nullptr;
return static_cast<Selection*>(sel.get())->GetFrameSelection();
return static_cast<dom::Selection*>(sel.get())->GetFrameSelection();
}
void

View File

@ -95,11 +95,11 @@ typedef short SelectionType;
namespace mozilla {
class EventStates;
class Selection;
namespace dom {
class Element;
class Touch;
class Selection;
class ShadowRoot;
} // namespace dom
@ -775,7 +775,7 @@ public:
*/
int16_t GetSelectionFlags() const { return mSelectionFlags; }
virtual mozilla::Selection* GetCurrentSelection(SelectionType aType) = 0;
virtual mozilla::dom::Selection* GetCurrentSelection(SelectionType aType) = 0;
/**
* Interface to dispatch events via the presshell

View File

@ -62,7 +62,7 @@
#include "nsCOMArray.h"
#include "nsContainerFrame.h"
#include "nsISelection.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsGkAtoms.h"
#include "nsIDOMRange.h"
#include "nsIDOMDocument.h"

View File

@ -76,7 +76,7 @@ public:
virtual NS_HIDDEN_(nsresult) SetPreferenceStyleRules(bool aForceReflow) MOZ_OVERRIDE;
NS_IMETHOD GetSelection(SelectionType aType, nsISelection** aSelection);
virtual mozilla::Selection* GetCurrentSelection(SelectionType aType) MOZ_OVERRIDE;
virtual mozilla::dom::Selection* GetCurrentSelection(SelectionType aType) MOZ_OVERRIDE;
NS_IMETHOD SetDisplaySelection(int16_t aToggle) MOZ_OVERRIDE;
NS_IMETHOD GetDisplaySelection(int16_t *aToggle) MOZ_OVERRIDE;

View File

@ -40,7 +40,7 @@
#include "nsPresState.h"
#include "nsContentList.h"
#include "nsAttrValueInlines.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsContentUtils.h"
#include "nsTextNode.h"
#include "nsStyleSet.h"
@ -1015,7 +1015,7 @@ nsTextControlFrame::GetSelectionRange(int32_t* aSelectionStart,
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
Selection* sel = static_cast<Selection*>(selection.get());
dom::Selection* sel = static_cast<dom::Selection*>(selection.get());
if (aDirection) {
nsDirection direction = sel->GetSelectionDirection();
if (direction == eDirNext) {

View File

@ -38,12 +38,13 @@ struct RangeData
mozilla::TextRangeStyle mTextRangeStyle;
};
// Note, the ownership of mozilla::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.
// 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.
namespace mozilla {
namespace dom {
class Selection : public nsISelectionPrivate,
public nsWrapperCache,
@ -280,6 +281,7 @@ private:
SelectionType mType;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_Selection_h__

View File

@ -34,7 +34,7 @@ EXPORTS += [
'WritingModes.h',
]
EXPORTS.mozilla += [
EXPORTS.mozilla.dom += [
'Selection.h',
]

View File

@ -7,7 +7,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/TextRange.h"
#include "nsIFrame.h"
#include "nsIContent.h"
@ -174,8 +174,10 @@ struct nsPrevNextBidiLevels
};
namespace mozilla {
namespace dom {
class Selection;
}
}
class nsIScrollableFrame;
/**
@ -353,7 +355,7 @@ public:
* no query interface for selection. must use this method now.
* @param aSelectionType enum value defined in nsISelection for the seleciton you want.
*/
mozilla::Selection* GetSelection(SelectionType aType) const;
mozilla::dom::Selection* GetSelection(SelectionType aType) const;
/**
* ScrollSelectionIntoView scrolls a region of the selection,
@ -619,7 +621,7 @@ private:
return retval;
}
friend class mozilla::Selection;
friend class mozilla::dom::Selection;
#ifdef DEBUG
void printSelection(); // for debugging
#endif /* DEBUG */
@ -646,7 +648,7 @@ private:
// so remember to use nsCOMPtr when needed.
nsresult NotifySelectionListeners(SelectionType aType); // add parameters to say collapsed etc?
nsRefPtr<mozilla::Selection> mDomSelections[nsISelectionController::NUM_SELECTIONTYPES];
nsRefPtr<mozilla::dom::Selection> mDomSelections[nsISelectionController::NUM_SELECTIONTYPES];
// Table selection support.
nsITableCellLayout* GetCellLayout(nsIContent *aCellContent) const;

View File

@ -8,7 +8,7 @@
* Implementation of selection: nsISelection,nsISelectionPrivate and nsFrameSelection
*/
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventStates.h"
@ -78,6 +78,7 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
#include "mozilla/dom/SelectionBinding.h"
using namespace mozilla;
using namespace mozilla::dom;
//#define DEBUG_TABLE 1
@ -2972,7 +2973,7 @@ nsFrameSelection::DeleteFromDocument()
return NS_OK;
}
nsRefPtr<mozilla::Selection> selection = mDomSelections[index];
nsRefPtr<Selection> selection = mDomSelections[index];
for (int32_t rangeIdx = 0; rangeIdx < selection->GetRangeCount(); ++rangeIdx) {
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
res = range->DeleteContents();
@ -3023,7 +3024,7 @@ nsFrameSelection::DisconnectFromPresShell()
#pragma mark -
#endif
// mozilla::Selection implementation
// mozilla::dom::Selection implementation
// note: this can return a nil anchor node

View File

@ -10,7 +10,7 @@
#include "nsCRT.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/Selection.h"
#include "mozilla/dom/Selection.h"
#include "nsIScriptGlobalObject.h"
#include "nsPIDOMWindow.h"
#include "nsIDocShell.h"