Bug 1199288 - Rename mApplyUserSelectStyle to mUserInitiated, r=smaug

This commit is contained in:
Michael Layzell 2015-09-22 13:24:50 -04:00
Родитель 971bca22ce
Коммит 2aa752dd26
4 изменённых файлов: 16 добавлений и 19 удалений

Просмотреть файл

@ -3531,7 +3531,7 @@ nsHTMLEditor::SelectAll()
nsCOMPtr<nsIDOMNode> rootElement = do_QueryInterface(rootContent, &rv);
NS_ENSURE_SUCCESS(rv, rv);
Maybe<mozilla::dom::Selection::AutoApplyUserSelectStyle> userSelection;
Maybe<mozilla::dom::Selection::AutoUserInitiated> userSelection;
if (!rootContent->IsEditable()) {
userSelection.emplace(selection);
}

Просмотреть файл

@ -2613,7 +2613,7 @@ NS_IMETHODIMP nsDocumentViewer::SelectAll()
rv = selection->RemoveAllRanges();
if (NS_FAILED(rv)) return rv;
mozilla::dom::Selection::AutoApplyUserSelectStyle userSelection(selection);
mozilla::dom::Selection::AutoUserInitiated userSelection(selection);
rv = selection->SelectAllChildren(bodyNode);
return rv;
}

Просмотреть файл

@ -103,7 +103,7 @@ public:
nsresult SubtractRange(RangeData* aRange, nsRange* aSubtract,
nsTArray<RangeData>* aOutput);
/**
* AddItem adds aRange to this Selection. If mApplyUserSelectStyle is true,
* AddItem adds aRange to this Selection. If mUserInitiated is true,
* 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.
@ -219,15 +219,15 @@ public:
nsresult NotifySelectionListeners();
friend struct AutoApplyUserSelectStyle;
struct MOZ_RAII AutoApplyUserSelectStyle
friend struct AutoUserInitiated;
struct MOZ_RAII AutoUserInitiated
{
explicit AutoApplyUserSelectStyle(Selection* aSelection
explicit AutoUserInitiated(Selection* aSelection
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mSavedValue(aSelection->mApplyUserSelectStyle)
: mSavedValue(aSelection->mUserInitiated)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
aSelection->mApplyUserSelectStyle = true;
aSelection->mUserInitiated = true;
}
AutoRestore<bool> mSavedValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
@ -321,7 +321,7 @@ private:
* It determines whether we exclude -moz-user-select:none nodes or not,
* as well as whether selectstart events will be fired.
*/
bool mApplyUserSelectStyle;
bool mUserInitiated;
// 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.

Просмотреть файл

@ -350,7 +350,7 @@ struct MOZ_RAII AutoPrepareFocusRange
if (aSelection->mFrameSelection->IsUserSelectionReason()) {
mUserSelect.emplace(aSelection);
}
bool userSelection = aSelection->mApplyUserSelectStyle;
bool userSelection = aSelection->mUserInitiated;
nsTArray<RangeData>& ranges = aSelection->mRanges;
if (!userSelection ||
@ -424,7 +424,7 @@ struct MOZ_RAII AutoPrepareFocusRange
}
}
Maybe<Selection::AutoApplyUserSelectStyle> mUserSelect;
Maybe<Selection::AutoUserInitiated> mUserSelect;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
@ -1682,7 +1682,7 @@ nsFrameSelection::TakeFocus(nsIContent* aNewFocus,
if (!mDomSelections[index])
return NS_ERROR_NULL_POINTER;
Maybe<Selection::AutoApplyUserSelectStyle> userSelect;
Maybe<Selection::AutoUserInitiated> userSelect;
if (IsUserSelectionReason()) {
userSelect.emplace(mDomSelections[index]);
}
@ -3331,7 +3331,7 @@ Selection::Selection()
: mCachedOffsetForFrame(nullptr)
, mDirection(eDirNext)
, mType(nsISelectionController::SELECTION_NORMAL)
, mApplyUserSelectStyle(false)
, mUserInitiated(false)
, mSelectionChangeBlockerCount(0)
{
}
@ -3341,7 +3341,7 @@ Selection::Selection(nsFrameSelection* aList)
, mCachedOffsetForFrame(nullptr)
, mDirection(eDirNext)
, mType(nsISelectionController::SELECTION_NORMAL)
, mApplyUserSelectStyle(false)
, mUserInitiated(false)
, mSelectionChangeBlockerCount(0)
{
}
@ -3700,10 +3700,7 @@ Selection::AddItem(nsRange* aItem, int32_t* aOutIndex, bool aNoStartSelect)
NS_ASSERTION(aOutIndex, "aOutIndex can't be null");
// XXX Rename mApplyUserSelectStyle? Not the best name (as it is also being
// used to detect here whether the event is user initiated for the purposes of
// dispatching the selectstart event).
if (mApplyUserSelectStyle) {
if (mUserInitiated) {
nsAutoTArray<nsRefPtr<nsRange>, 4> rangesToAdd;
*aOutIndex = -1;