зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1199288 - Rename mApplyUserSelectStyle to mUserInitiated, r=smaug
This commit is contained in:
Родитель
971bca22ce
Коммит
2aa752dd26
|
@ -3531,7 +3531,7 @@ nsHTMLEditor::SelectAll()
|
||||||
nsCOMPtr<nsIDOMNode> rootElement = do_QueryInterface(rootContent, &rv);
|
nsCOMPtr<nsIDOMNode> rootElement = do_QueryInterface(rootContent, &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
Maybe<mozilla::dom::Selection::AutoApplyUserSelectStyle> userSelection;
|
Maybe<mozilla::dom::Selection::AutoUserInitiated> userSelection;
|
||||||
if (!rootContent->IsEditable()) {
|
if (!rootContent->IsEditable()) {
|
||||||
userSelection.emplace(selection);
|
userSelection.emplace(selection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2613,7 +2613,7 @@ NS_IMETHODIMP nsDocumentViewer::SelectAll()
|
||||||
rv = selection->RemoveAllRanges();
|
rv = selection->RemoveAllRanges();
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
mozilla::dom::Selection::AutoApplyUserSelectStyle userSelection(selection);
|
mozilla::dom::Selection::AutoUserInitiated userSelection(selection);
|
||||||
rv = selection->SelectAllChildren(bodyNode);
|
rv = selection->SelectAllChildren(bodyNode);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
nsresult SubtractRange(RangeData* aRange, nsRange* aSubtract,
|
nsresult SubtractRange(RangeData* aRange, nsRange* aSubtract,
|
||||||
nsTArray<RangeData>* aOutput);
|
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
|
* 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
|
* into multiple ranges to exclude those before adding the resulting ranges
|
||||||
* to this Selection.
|
* to this Selection.
|
||||||
|
@ -219,15 +219,15 @@ public:
|
||||||
|
|
||||||
nsresult NotifySelectionListeners();
|
nsresult NotifySelectionListeners();
|
||||||
|
|
||||||
friend struct AutoApplyUserSelectStyle;
|
friend struct AutoUserInitiated;
|
||||||
struct MOZ_RAII AutoApplyUserSelectStyle
|
struct MOZ_RAII AutoUserInitiated
|
||||||
{
|
{
|
||||||
explicit AutoApplyUserSelectStyle(Selection* aSelection
|
explicit AutoUserInitiated(Selection* aSelection
|
||||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||||
: mSavedValue(aSelection->mApplyUserSelectStyle)
|
: mSavedValue(aSelection->mUserInitiated)
|
||||||
{
|
{
|
||||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||||
aSelection->mApplyUserSelectStyle = true;
|
aSelection->mUserInitiated = true;
|
||||||
}
|
}
|
||||||
AutoRestore<bool> mSavedValue;
|
AutoRestore<bool> mSavedValue;
|
||||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||||
|
@ -321,7 +321,7 @@ private:
|
||||||
* It determines whether we exclude -moz-user-select:none nodes or not,
|
* It determines whether we exclude -moz-user-select:none nodes or not,
|
||||||
* as well as whether selectstart events will be fired.
|
* 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
|
// 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.
|
// 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()) {
|
if (aSelection->mFrameSelection->IsUserSelectionReason()) {
|
||||||
mUserSelect.emplace(aSelection);
|
mUserSelect.emplace(aSelection);
|
||||||
}
|
}
|
||||||
bool userSelection = aSelection->mApplyUserSelectStyle;
|
bool userSelection = aSelection->mUserInitiated;
|
||||||
|
|
||||||
nsTArray<RangeData>& ranges = aSelection->mRanges;
|
nsTArray<RangeData>& ranges = aSelection->mRanges;
|
||||||
if (!userSelection ||
|
if (!userSelection ||
|
||||||
|
@ -424,7 +424,7 @@ struct MOZ_RAII AutoPrepareFocusRange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<Selection::AutoApplyUserSelectStyle> mUserSelect;
|
Maybe<Selection::AutoUserInitiated> mUserSelect;
|
||||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1682,7 +1682,7 @@ nsFrameSelection::TakeFocus(nsIContent* aNewFocus,
|
||||||
if (!mDomSelections[index])
|
if (!mDomSelections[index])
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
Maybe<Selection::AutoApplyUserSelectStyle> userSelect;
|
Maybe<Selection::AutoUserInitiated> userSelect;
|
||||||
if (IsUserSelectionReason()) {
|
if (IsUserSelectionReason()) {
|
||||||
userSelect.emplace(mDomSelections[index]);
|
userSelect.emplace(mDomSelections[index]);
|
||||||
}
|
}
|
||||||
|
@ -3331,7 +3331,7 @@ Selection::Selection()
|
||||||
: mCachedOffsetForFrame(nullptr)
|
: mCachedOffsetForFrame(nullptr)
|
||||||
, mDirection(eDirNext)
|
, mDirection(eDirNext)
|
||||||
, mType(nsISelectionController::SELECTION_NORMAL)
|
, mType(nsISelectionController::SELECTION_NORMAL)
|
||||||
, mApplyUserSelectStyle(false)
|
, mUserInitiated(false)
|
||||||
, mSelectionChangeBlockerCount(0)
|
, mSelectionChangeBlockerCount(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -3341,7 +3341,7 @@ Selection::Selection(nsFrameSelection* aList)
|
||||||
, mCachedOffsetForFrame(nullptr)
|
, mCachedOffsetForFrame(nullptr)
|
||||||
, mDirection(eDirNext)
|
, mDirection(eDirNext)
|
||||||
, mType(nsISelectionController::SELECTION_NORMAL)
|
, mType(nsISelectionController::SELECTION_NORMAL)
|
||||||
, mApplyUserSelectStyle(false)
|
, mUserInitiated(false)
|
||||||
, mSelectionChangeBlockerCount(0)
|
, mSelectionChangeBlockerCount(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -3700,10 +3700,7 @@ Selection::AddItem(nsRange* aItem, int32_t* aOutIndex, bool aNoStartSelect)
|
||||||
|
|
||||||
NS_ASSERTION(aOutIndex, "aOutIndex can't be null");
|
NS_ASSERTION(aOutIndex, "aOutIndex can't be null");
|
||||||
|
|
||||||
// XXX Rename mApplyUserSelectStyle? Not the best name (as it is also being
|
if (mUserInitiated) {
|
||||||
// used to detect here whether the event is user initiated for the purposes of
|
|
||||||
// dispatching the selectstart event).
|
|
||||||
if (mApplyUserSelectStyle) {
|
|
||||||
nsAutoTArray<nsRefPtr<nsRange>, 4> rangesToAdd;
|
nsAutoTArray<nsRefPtr<nsRange>, 4> rangesToAdd;
|
||||||
*aOutIndex = -1;
|
*aOutIndex = -1;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче