Backed out 2 changesets (bug 1862256) for causing mochitests failures in test_native_key_bindings_mac.html. CLOSED TREE
Backed out changeset b23e836dc19b (bug 1862256) Backed out changeset ccb29705b1d5 (bug 1862256)
This commit is contained in:
@@ -80,11 +80,6 @@ constexpr const char* sEndLineString = "cmd_endLine";
|
|||||||
constexpr const char* sSelectBeginLineString = "cmd_selectBeginLine";
|
constexpr const char* sSelectBeginLineString = "cmd_selectBeginLine";
|
||||||
constexpr const char* sSelectEndLineString = "cmd_selectEndLine";
|
constexpr const char* sSelectEndLineString = "cmd_selectEndLine";
|
||||||
|
|
||||||
constexpr const char* sBeginParagraphString = "cmd_beginParagraph";
|
|
||||||
constexpr const char* sEndParagraphString = "cmd_endParagraph";
|
|
||||||
constexpr const char* sSelectBeginParagraphString = "cmd_selectBeginParagraph";
|
|
||||||
constexpr const char* sSelectEndParagraphString = "cmd_selectEndParagraph";
|
|
||||||
|
|
||||||
constexpr const char* sSelectLinePreviousString = "cmd_selectLinePrevious";
|
constexpr const char* sSelectLinePreviousString = "cmd_selectLinePrevious";
|
||||||
constexpr const char* sSelectLineNextString = "cmd_selectLineNext";
|
constexpr const char* sSelectLineNextString = "cmd_selectLineNext";
|
||||||
|
|
||||||
@@ -308,11 +303,7 @@ static constexpr struct BrowseCommand {
|
|||||||
{Command::BeginLine, Command::EndLine,
|
{Command::BeginLine, Command::EndLine,
|
||||||
KeyboardScrollAction::eScrollComplete,
|
KeyboardScrollAction::eScrollComplete,
|
||||||
&nsISelectionController::CompleteScroll,
|
&nsISelectionController::CompleteScroll,
|
||||||
&nsISelectionController::IntraLineMove},
|
&nsISelectionController::IntraLineMove}};
|
||||||
{Command::BeginParagraph, Command::EndParagraph,
|
|
||||||
KeyboardScrollAction::eScrollComplete,
|
|
||||||
&nsISelectionController::CompleteScroll,
|
|
||||||
&nsISelectionController::IntraParagraphMove}};
|
|
||||||
|
|
||||||
nsresult nsSelectMoveScrollCommand::DoCommand(const char* aCommandName,
|
nsresult nsSelectMoveScrollCommand::DoCommand(const char* aCommandName,
|
||||||
nsISupports* aCommandContext) {
|
nsISupports* aCommandContext) {
|
||||||
@@ -429,15 +420,12 @@ nsresult nsPhysicalSelectMoveScrollCommand::DoCommand(
|
|||||||
static const struct SelectCommand {
|
static const struct SelectCommand {
|
||||||
Command reverse, forward;
|
Command reverse, forward;
|
||||||
nsresult (NS_STDCALL nsISelectionController::*select)(bool, bool);
|
nsresult (NS_STDCALL nsISelectionController::*select)(bool, bool);
|
||||||
} selectCommands[] = {
|
} selectCommands[] = {{Command::SelectCharPrevious, Command::SelectCharNext,
|
||||||
{Command::SelectCharPrevious, Command::SelectCharNext,
|
|
||||||
&nsISelectionController::CharacterMove},
|
&nsISelectionController::CharacterMove},
|
||||||
{Command::SelectWordPrevious, Command::SelectWordNext,
|
{Command::SelectWordPrevious, Command::SelectWordNext,
|
||||||
&nsISelectionController::WordMove},
|
&nsISelectionController::WordMove},
|
||||||
{Command::SelectBeginLine, Command::SelectEndLine,
|
{Command::SelectBeginLine, Command::SelectEndLine,
|
||||||
&nsISelectionController::IntraLineMove},
|
&nsISelectionController::IntraLineMove},
|
||||||
{Command::SelectBeginParagraph, Command::SelectEndParagraph,
|
|
||||||
&nsISelectionController::IntraParagraphMove},
|
|
||||||
{Command::SelectLinePrevious, Command::SelectLineNext,
|
{Command::SelectLinePrevious, Command::SelectLineNext,
|
||||||
&nsISelectionController::LineMove},
|
&nsISelectionController::LineMove},
|
||||||
{Command::SelectPageUp, Command::SelectPageDown,
|
{Command::SelectPageUp, Command::SelectPageDown,
|
||||||
@@ -1114,8 +1102,6 @@ nsresult nsWindowCommandRegistration::RegisterWindowCommands(
|
|||||||
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sWordNextString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sWordNextString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sBeginLineString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sBeginLineString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sEndLineString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sEndLineString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sBeginParagraphString);
|
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sEndParagraphString);
|
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sMovePageUpString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sMovePageUpString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sMovePageDownString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sMovePageDownString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sLinePreviousString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sLinePreviousString);
|
||||||
@@ -1139,8 +1125,6 @@ nsresult nsWindowCommandRegistration::RegisterWindowCommands(
|
|||||||
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectWordNextString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectWordNextString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectBeginLineString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectBeginLineString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectEndLineString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectEndLineString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectBeginParagraphString);
|
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectEndParagraphString);
|
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectLinePreviousString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectLinePreviousString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectLineNextString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectLineNextString);
|
||||||
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectPageUpString);
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectPageUpString);
|
||||||
|
|||||||
@@ -253,16 +253,6 @@ interface nsISelectionController : nsISelectionDisplay
|
|||||||
*/
|
*/
|
||||||
void intraLineMove(in boolean forward, in boolean extend);
|
void intraLineMove(in boolean forward, in boolean extend);
|
||||||
|
|
||||||
/** IntraParagraphMove will move the selection to the front of the paragraph or end of the paragraph
|
|
||||||
* in the document.
|
|
||||||
* this will also have the effect of collapsing the selection if the aExtend = false
|
|
||||||
* the "point" of selection that is extended is considered the "focus" point.
|
|
||||||
* or the last point adjusted by the selection.
|
|
||||||
* @param aForward forward or backward if false
|
|
||||||
* @param aExtend should it collapse the selection of extend it?
|
|
||||||
*/
|
|
||||||
void intraParagraphMove(in boolean forward, in boolean extend);
|
|
||||||
|
|
||||||
/** PageMove will move the selection one page forward/backward in the document.
|
/** PageMove will move the selection one page forward/backward in the document.
|
||||||
* this will also have the effect of collapsing the selection if the aExtend = false
|
* this will also have the effect of collapsing the selection if the aExtend = false
|
||||||
* the "point" of selection that is extended is considered the "focus" point.
|
* the "point" of selection that is extended is considered the "focus" point.
|
||||||
|
|||||||
@@ -372,7 +372,6 @@ class TextInputSelectionController final : public nsSupportsWeakReference,
|
|||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHOD LineMove(bool aForward,
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHOD LineMove(bool aForward,
|
||||||
bool aExtend) override;
|
bool aExtend) override;
|
||||||
NS_IMETHOD IntraLineMove(bool aForward, bool aExtend) override;
|
NS_IMETHOD IntraLineMove(bool aForward, bool aExtend) override;
|
||||||
NS_IMETHOD IntraParagraphMove(bool aForward, bool aExtend) override;
|
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT
|
||||||
NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
|
NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
|
||||||
NS_IMETHOD CompleteScroll(bool aForward) override;
|
NS_IMETHOD CompleteScroll(bool aForward) override;
|
||||||
@@ -653,15 +652,6 @@ TextInputSelectionController::IntraLineMove(bool aForward, bool aExtend) {
|
|||||||
return frameSelection->IntraLineMove(aForward, aExtend);
|
return frameSelection->IntraLineMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
TextInputSelectionController::IntraParagraphMove(bool aForward, bool aExtend) {
|
|
||||||
if (!mFrameSelection) {
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
}
|
|
||||||
RefPtr<nsFrameSelection> frameSelection = mFrameSelection;
|
|
||||||
return frameSelection->IntraParagraphMove(aForward, aExtend);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
TextInputSelectionController::PageMove(bool aForward, bool aExtend) {
|
TextInputSelectionController::PageMove(bool aForward, bool aExtend) {
|
||||||
// expected behavior for PageMove is to scroll AND move the caret
|
// expected behavior for PageMove is to scroll AND move the caret
|
||||||
|
|||||||
@@ -711,9 +711,6 @@ static const struct MoveCommand {
|
|||||||
Command::SelectWordNext, &nsISelectionController::WordMove},
|
Command::SelectWordNext, &nsISelectionController::WordMove},
|
||||||
{Command::BeginLine, Command::EndLine, Command::SelectBeginLine,
|
{Command::BeginLine, Command::EndLine, Command::SelectBeginLine,
|
||||||
Command::SelectEndLine, &nsISelectionController::IntraLineMove},
|
Command::SelectEndLine, &nsISelectionController::IntraLineMove},
|
||||||
{Command::BeginParagraph, Command::EndParagraph,
|
|
||||||
Command::SelectBeginParagraph, Command::SelectEndParagraph,
|
|
||||||
&nsISelectionController::IntraParagraphMove},
|
|
||||||
{Command::MovePageUp, Command::MovePageDown, Command::SelectPageUp,
|
{Command::MovePageUp, Command::MovePageDown, Command::SelectPageUp,
|
||||||
Command::SelectPageDown, &nsISelectionController::PageMove},
|
Command::SelectPageDown, &nsISelectionController::PageMove},
|
||||||
{Command::MoveTop, Command::MoveBottom, Command::SelectTop,
|
{Command::MoveTop, Command::MoveBottom, Command::SelectTop,
|
||||||
|
|||||||
@@ -144,10 +144,6 @@ class EditorCommand : public nsIControllerCommand {
|
|||||||
case Command::EndLine:
|
case Command::EndLine:
|
||||||
case Command::SelectBeginLine:
|
case Command::SelectBeginLine:
|
||||||
case Command::SelectEndLine:
|
case Command::SelectEndLine:
|
||||||
case Command::BeginParagraph:
|
|
||||||
case Command::EndParagraph:
|
|
||||||
case Command::SelectBeginParagraph:
|
|
||||||
case Command::SelectEndParagraph:
|
|
||||||
case Command::WordPrevious:
|
case Command::WordPrevious:
|
||||||
case Command::WordNext:
|
case Command::WordNext:
|
||||||
case Command::SelectWordPrevious:
|
case Command::SelectWordPrevious:
|
||||||
|
|||||||
@@ -82,10 +82,6 @@ nsresult EditorController::RegisterEditorCommands(
|
|||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_endLine");
|
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_endLine");
|
||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectBeginLine");
|
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectBeginLine");
|
||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectEndLine");
|
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectEndLine");
|
||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_beginParagraph");
|
|
||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_endParagraph");
|
|
||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectBeginParagraph");
|
|
||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectEndParagraph");
|
|
||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_wordPrevious");
|
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_wordPrevious");
|
||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_wordNext");
|
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_wordNext");
|
||||||
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectWordPrevious");
|
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectWordPrevious");
|
||||||
|
|||||||
@@ -2360,12 +2360,6 @@ PresShell::IntraLineMove(bool aForward, bool aExtend) {
|
|||||||
return frameSelection->IntraLineMove(aForward, aExtend);
|
return frameSelection->IntraLineMove(aForward, aExtend);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
PresShell::IntraParagraphMove(bool aForward, bool aExtend) {
|
|
||||||
RefPtr<nsFrameSelection> frameSelection = mSelection;
|
|
||||||
return frameSelection->IntraParagraphMove(aForward, aExtend);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::PageMove(bool aForward, bool aExtend) {
|
PresShell::PageMove(bool aForward, bool aExtend) {
|
||||||
nsIFrame* frame = nullptr;
|
nsIFrame* frame = nullptr;
|
||||||
|
|||||||
@@ -1365,7 +1365,6 @@ class PresShell final : public nsStubDocumentObserver,
|
|||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHOD LineMove(bool aForward,
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHOD LineMove(bool aForward,
|
||||||
bool aExtend) override;
|
bool aExtend) override;
|
||||||
NS_IMETHOD IntraLineMove(bool aForward, bool aExtend) override;
|
NS_IMETHOD IntraLineMove(bool aForward, bool aExtend) override;
|
||||||
NS_IMETHOD IntraParagraphMove(bool aForward, bool aExtend) override;
|
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT
|
||||||
NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
|
NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
|
||||||
NS_IMETHOD ScrollPage(bool aForward) override;
|
NS_IMETHOD ScrollPage(bool aForward) override;
|
||||||
|
|||||||
@@ -140,8 +140,6 @@ class SelectionMovementUtils final {
|
|||||||
case eSelectWordNoSpace:
|
case eSelectWordNoSpace:
|
||||||
case eSelectBeginLine:
|
case eSelectBeginLine:
|
||||||
case eSelectEndLine:
|
case eSelectEndLine:
|
||||||
case eSelectBeginParagraph:
|
|
||||||
case eSelectEndParagraph:
|
|
||||||
return true;
|
return true;
|
||||||
case eSelectLine:
|
case eSelectLine:
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -2011,16 +2011,6 @@ nsresult nsFrameSelection::IntraLineMove(bool aForward, bool aExtend) {
|
|||||||
eLogical);
|
eLogical);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsFrameSelection::IntraParagraphMove(bool aForward, bool aExtend) {
|
|
||||||
if (aForward) {
|
|
||||||
return MoveCaret(eDirNext, ExtendSelection(aExtend), eSelectEndParagraph,
|
|
||||||
eLogical);
|
|
||||||
}
|
|
||||||
|
|
||||||
return MoveCaret(eDirPrevious, ExtendSelection(aExtend),
|
|
||||||
eSelectBeginParagraph, eLogical);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename RangeType>
|
template <typename RangeType>
|
||||||
Result<RefPtr<RangeType>, nsresult>
|
Result<RefPtr<RangeType>, nsresult>
|
||||||
nsFrameSelection::CreateRangeExtendedToSomewhere(
|
nsFrameSelection::CreateRangeExtendedToSomewhere(
|
||||||
@@ -2029,8 +2019,7 @@ nsFrameSelection::CreateRangeExtendedToSomewhere(
|
|||||||
MOZ_ASSERT(aDirection == eDirNext || aDirection == eDirPrevious);
|
MOZ_ASSERT(aDirection == eDirNext || aDirection == eDirPrevious);
|
||||||
MOZ_ASSERT(aAmount == eSelectCharacter || aAmount == eSelectCluster ||
|
MOZ_ASSERT(aAmount == eSelectCharacter || aAmount == eSelectCluster ||
|
||||||
aAmount == eSelectWord || aAmount == eSelectBeginLine ||
|
aAmount == eSelectWord || aAmount == eSelectBeginLine ||
|
||||||
aAmount == eSelectEndLine || aAmount == eSelectBeginParagraph ||
|
aAmount == eSelectEndLine);
|
||||||
aAmount == eSelectEndParagraph);
|
|
||||||
MOZ_ASSERT(aMovementStyle == eLogical || aMovementStyle == eVisual ||
|
MOZ_ASSERT(aMovementStyle == eLogical || aMovementStyle == eVisual ||
|
||||||
aMovementStyle == eUsePrefStyle);
|
aMovementStyle == eUsePrefStyle);
|
||||||
|
|
||||||
|
|||||||
@@ -610,17 +610,6 @@ class nsFrameSelection final {
|
|||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult IntraLineMove(bool aForward,
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult IntraLineMove(bool aForward,
|
||||||
bool aExtend);
|
bool aExtend);
|
||||||
|
|
||||||
/**
|
|
||||||
* IntraParagraphMove will generally be called from the nsISelectionController
|
|
||||||
* implementations. the effect being the selection will move to beginning or
|
|
||||||
* end of paragraph
|
|
||||||
* @param aForward move forward in document.
|
|
||||||
* @param aExtend continue selection
|
|
||||||
*/
|
|
||||||
// TODO: replace with `MOZ_CAN_RUN_SCRIPT`.
|
|
||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult IntraParagraphMove(bool aForward,
|
|
||||||
bool aExtend);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CreateRangeExtendedToNextGraphemeClusterBoundary() returns range which is
|
* CreateRangeExtendedToNextGraphemeClusterBoundary() returns range which is
|
||||||
* extended from normal selection range to start of next grapheme cluster
|
* extended from normal selection range to start of next grapheme cluster
|
||||||
|
|||||||
@@ -9124,10 +9124,6 @@ nsresult nsIFrame::PeekOffsetForParagraph(PeekOffsetStruct* aPos) {
|
|||||||
aPos->mContentOffset = aPos->mResultContent->GetChildCount();
|
aPos->mContentOffset = aPos->mResultContent->GetChildCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aPos->mAttach = aPos->mDirection == eDirNext ? CaretAssociationHint::Before
|
|
||||||
: CaretAssociationHint::After;
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9500,8 +9496,7 @@ nsresult nsIFrame::PeekOffsetForLineEdge(PeekOffsetStruct* aPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsIFrame* baseFrame = nullptr;
|
nsIFrame* baseFrame = nullptr;
|
||||||
bool endOfLine = (eSelectEndLine == aPos->mAmount) ||
|
bool endOfLine = eSelectEndLine == aPos->mAmount;
|
||||||
(eSelectEndParagraph == aPos->mAmount);
|
|
||||||
|
|
||||||
if (aPos->mOptions.contains(PeekOffsetOption::Visual) &&
|
if (aPos->mOptions.contains(PeekOffsetOption::Visual) &&
|
||||||
PresContext()->BidiEnabled()) {
|
PresContext()->BidiEnabled()) {
|
||||||
@@ -9599,13 +9594,6 @@ nsresult nsIFrame::PeekOffset(PeekOffsetStruct* aPos) {
|
|||||||
case eSelectBeginLine:
|
case eSelectBeginLine:
|
||||||
case eSelectEndLine:
|
case eSelectEndLine:
|
||||||
return PeekOffsetForLineEdge(aPos);
|
return PeekOffsetForLineEdge(aPos);
|
||||||
case eSelectBeginParagraph:
|
|
||||||
case eSelectEndParagraph:
|
|
||||||
if (StaticPrefs::dom_input_caret_paragraph_movement()) {
|
|
||||||
return PeekOffsetForParagraph(aPos);
|
|
||||||
} else {
|
|
||||||
return PeekOffsetForLineEdge(aPos);
|
|
||||||
}
|
|
||||||
case eSelectParagraph:
|
case eSelectParagraph:
|
||||||
return PeekOffsetForParagraph(aPos);
|
return PeekOffsetForParagraph(aPos);
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
@@ -198,9 +198,7 @@ enum nsSelectionAmount {
|
|||||||
eSelectBeginLine = 5,
|
eSelectBeginLine = 5,
|
||||||
eSelectEndLine = 6,
|
eSelectEndLine = 6,
|
||||||
eSelectNoAmount = 7, // just bounce back current offset.
|
eSelectNoAmount = 7, // just bounce back current offset.
|
||||||
eSelectParagraph = 8, // select a "paragraph"
|
eSelectParagraph = 8 // select a "paragraph"
|
||||||
eSelectBeginParagraph = 9,
|
|
||||||
eSelectEndParagraph = 10
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@@ -4045,7 +4043,6 @@ class nsIFrame : public nsQueryFrame {
|
|||||||
nsresult PeekOffsetForWord(mozilla::PeekOffsetStruct* aPos, int32_t aOffset);
|
nsresult PeekOffsetForWord(mozilla::PeekOffsetStruct* aPos, int32_t aOffset);
|
||||||
nsresult PeekOffsetForLine(mozilla::PeekOffsetStruct* aPos);
|
nsresult PeekOffsetForLine(mozilla::PeekOffsetStruct* aPos);
|
||||||
nsresult PeekOffsetForLineEdge(mozilla::PeekOffsetStruct* aPos);
|
nsresult PeekOffsetForLineEdge(mozilla::PeekOffsetStruct* aPos);
|
||||||
nsresult PeekOffsetForParagraphEdge(mozilla::PeekOffsetStruct* aPos);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for the first paragraph boundary before or after the given position
|
* Search for the first paragraph boundary before or after the given position
|
||||||
|
|||||||
@@ -3003,12 +3003,6 @@
|
|||||||
value: true
|
value: true
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
# Text input caret movement style. Disable this to restore previous behaviour (line edges instead of paragraphs). Currently only effective on macOS.
|
|
||||||
- name: dom.input.caret_paragraph_movement
|
|
||||||
type: bool
|
|
||||||
value: true
|
|
||||||
mirror: always
|
|
||||||
|
|
||||||
# How often to check for CPOW timeouts (ms). CPOWs are only timed
|
# How often to check for CPOW timeouts (ms). CPOWs are only timed
|
||||||
# out by the hang monitor.
|
# out by the hang monitor.
|
||||||
- name: dom.ipc.cpow.timeout
|
- name: dom.ipc.cpow.timeout
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<title>Test for nsSelectionMoveCommands on wrapped text</title>
|
|
||||||
<script src=/resources/testharness.js></script>
|
|
||||||
<script src=/resources/testharnessreport.js></script>
|
|
||||||
|
|
||||||
<iframe id="edit" width="200" height="100" srcdoc="
|
|
||||||
<link rel='stylesheet' href='/fonts/ahem.css'>
|
|
||||||
<style>
|
|
||||||
html, body {
|
|
||||||
font-family: Ahem;
|
|
||||||
fontSize: '16px';
|
|
||||||
lineHeight: '16px';
|
|
||||||
height: '400px';
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<body contenteditable>
|
|
||||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
|
|
||||||
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
|
|
||||||
<br>
|
|
||||||
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
|
|
||||||
consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan
|
|
||||||
et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
|
|
||||||
dolore te feugait nulla facilisi.
|
|
||||||
<p>
|
|
||||||
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit
|
|
||||||
lobortis nisl ut aliquip ex ea commodo consequat.
|
|
||||||
</p>
|
|
||||||
<div>
|
|
||||||
<span>Nam</span> liber tempor cum soluta nobis eleifend option
|
|
||||||
<span>congue</span> nihil imperdiet doming id quod mazim placerat facer
|
|
||||||
<a>possim</a> assum.<span></span>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
"></iframe>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
let selection;
|
|
||||||
let body;
|
|
||||||
|
|
||||||
promise_setup(async () => {
|
|
||||||
if (edit.contentDocument.readyState !== "complete") {
|
|
||||||
await new Promise(resolve => edit.onload = resolve);
|
|
||||||
}
|
|
||||||
edit.focus();
|
|
||||||
|
|
||||||
selection = edit.contentDocument.getSelection();
|
|
||||||
body = edit.contentDocument.body;
|
|
||||||
});
|
|
||||||
|
|
||||||
promise_test(async () => {
|
|
||||||
selection.setPosition(body);
|
|
||||||
|
|
||||||
// Gecko stops at "the paragraph stopper" (either a block element or <br>)
|
|
||||||
// rather than within the text node.
|
|
||||||
// See: https://searchfox.org/mozilla-central/rev/113b09cdd5282b39db65b2f62abe843558b9471a/layout/generic/nsIFrame.cpp#9019
|
|
||||||
|
|
||||||
SpecialPowers.doCommand(window, "cmd_beginParagraph");
|
|
||||||
assert_equals(selection.anchorNode, body);
|
|
||||||
assert_equals(selection.anchorOffset, 0);
|
|
||||||
|
|
||||||
SpecialPowers.doCommand(window, "cmd_endParagraph");
|
|
||||||
assert_equals(selection.anchorNode, body);
|
|
||||||
assert_equals(selection.anchorOffset, 1);
|
|
||||||
}, "Moving across a single text node");
|
|
||||||
|
|
||||||
promise_test(async () => {
|
|
||||||
const textNode = body.childNodes[2];
|
|
||||||
selection.setPosition(textNode, 2);
|
|
||||||
|
|
||||||
SpecialPowers.doCommand(window, "cmd_beginParagraph");
|
|
||||||
assert_equals(selection.anchorNode, body);
|
|
||||||
assert_equals(selection.anchorOffset, 2);
|
|
||||||
|
|
||||||
SpecialPowers.doCommand(window, "cmd_endParagraph");
|
|
||||||
assert_equals(selection.anchorNode, body);
|
|
||||||
assert_equals(selection.anchorOffset, 3);
|
|
||||||
}, "Moving from a single text node");
|
|
||||||
|
|
||||||
promise_test(async () => {
|
|
||||||
const paragraphEl = body.children[1];
|
|
||||||
const textNode = paragraphEl.childNodes[0];
|
|
||||||
selection.setPosition(textNode, 2);
|
|
||||||
|
|
||||||
SpecialPowers.doCommand(window, "cmd_selectBeginParagraph");
|
|
||||||
assert_equals(selection.anchorNode, textNode);
|
|
||||||
assert_equals(selection.anchorOffset, 2);
|
|
||||||
assert_equals(selection.focusNode, paragraphEl);
|
|
||||||
assert_equals(selection.focusOffset, 0);
|
|
||||||
|
|
||||||
SpecialPowers.doCommand(window, "cmd_selectEndParagraph");
|
|
||||||
assert_equals(selection.anchorNode, textNode);
|
|
||||||
assert_equals(selection.anchorOffset, 2);
|
|
||||||
assert_equals(selection.focusNode, paragraphEl);
|
|
||||||
assert_equals(selection.focusOffset, paragraphEl.childNodes.length);
|
|
||||||
}, "Selecting from a single text node");
|
|
||||||
|
|
||||||
promise_test(async () => {
|
|
||||||
const divEl = body.children[2];
|
|
||||||
const textNode = divEl.childNodes[2];
|
|
||||||
selection.setPosition(textNode, 2);
|
|
||||||
console.log(textNode, selection.anchorNode);
|
|
||||||
|
|
||||||
SpecialPowers.doCommand(window, "cmd_selectBeginParagraph");
|
|
||||||
assert_equals(selection.anchorNode, textNode);
|
|
||||||
assert_equals(selection.anchorOffset, 2);
|
|
||||||
assert_equals(selection.focusNode, divEl);
|
|
||||||
assert_equals(selection.focusOffset, 0);
|
|
||||||
|
|
||||||
SpecialPowers.doCommand(window, "cmd_selectEndParagraph");
|
|
||||||
assert_equals(selection.anchorNode, textNode);
|
|
||||||
assert_equals(selection.anchorOffset, 2);
|
|
||||||
assert_equals(selection.focusNode, divEl);
|
|
||||||
assert_equals(selection.focusOffset, divEl.childNodes.length);
|
|
||||||
}, "Selecting across multiple elements");
|
|
||||||
</script>
|
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
// Mapped from commands of some platforms
|
// Mapped from commands of some platforms
|
||||||
NS_DEFINE_COMMAND(BeginLine, cmd_beginLine)
|
NS_DEFINE_COMMAND(BeginLine, cmd_beginLine)
|
||||||
NS_DEFINE_COMMAND(BeginParagraph, cmd_beginParagraph)
|
|
||||||
NS_DEFINE_COMMAND(CharNext, cmd_charNext)
|
NS_DEFINE_COMMAND(CharNext, cmd_charNext)
|
||||||
NS_DEFINE_COMMAND(CharPrevious, cmd_charPrevious)
|
NS_DEFINE_COMMAND(CharPrevious, cmd_charPrevious)
|
||||||
NS_DEFINE_COMMAND(Copy, cmd_copy)
|
NS_DEFINE_COMMAND(Copy, cmd_copy)
|
||||||
@@ -38,7 +37,6 @@ NS_DEFINE_COMMAND(DeleteToEndOfLine, cmd_deleteToEndOfLine)
|
|||||||
NS_DEFINE_COMMAND(DeleteWordBackward, cmd_deleteWordBackward)
|
NS_DEFINE_COMMAND(DeleteWordBackward, cmd_deleteWordBackward)
|
||||||
NS_DEFINE_COMMAND(DeleteWordForward, cmd_deleteWordForward)
|
NS_DEFINE_COMMAND(DeleteWordForward, cmd_deleteWordForward)
|
||||||
NS_DEFINE_COMMAND(EndLine, cmd_endLine)
|
NS_DEFINE_COMMAND(EndLine, cmd_endLine)
|
||||||
NS_DEFINE_COMMAND(EndParagraph, cmd_endParagraph)
|
|
||||||
NS_DEFINE_COMMAND(InsertParagraph, cmd_insertParagraph)
|
NS_DEFINE_COMMAND(InsertParagraph, cmd_insertParagraph)
|
||||||
NS_DEFINE_COMMAND(InsertLineBreak, cmd_insertLineBreak)
|
NS_DEFINE_COMMAND(InsertLineBreak, cmd_insertLineBreak)
|
||||||
NS_DEFINE_COMMAND(LineNext, cmd_lineNext)
|
NS_DEFINE_COMMAND(LineNext, cmd_lineNext)
|
||||||
@@ -58,12 +56,10 @@ NS_DEFINE_COMMAND(ScrollRight, cmd_scrollRight)
|
|||||||
NS_DEFINE_COMMAND(ScrollTop, cmd_scrollTop)
|
NS_DEFINE_COMMAND(ScrollTop, cmd_scrollTop)
|
||||||
NS_DEFINE_COMMAND(SelectAll, cmd_selectAll)
|
NS_DEFINE_COMMAND(SelectAll, cmd_selectAll)
|
||||||
NS_DEFINE_COMMAND(SelectBeginLine, cmd_selectBeginLine)
|
NS_DEFINE_COMMAND(SelectBeginLine, cmd_selectBeginLine)
|
||||||
NS_DEFINE_COMMAND(SelectBeginParagraph, cmd_selectBeginParagraph)
|
|
||||||
NS_DEFINE_COMMAND(SelectBottom, cmd_selectBottom)
|
NS_DEFINE_COMMAND(SelectBottom, cmd_selectBottom)
|
||||||
NS_DEFINE_COMMAND(SelectCharNext, cmd_selectCharNext)
|
NS_DEFINE_COMMAND(SelectCharNext, cmd_selectCharNext)
|
||||||
NS_DEFINE_COMMAND(SelectCharPrevious, cmd_selectCharPrevious)
|
NS_DEFINE_COMMAND(SelectCharPrevious, cmd_selectCharPrevious)
|
||||||
NS_DEFINE_COMMAND(SelectEndLine, cmd_selectEndLine)
|
NS_DEFINE_COMMAND(SelectEndLine, cmd_selectEndLine)
|
||||||
NS_DEFINE_COMMAND(SelectEndParagraph, cmd_selectEndParagraph)
|
|
||||||
NS_DEFINE_COMMAND(SelectLineNext, cmd_selectLineNext)
|
NS_DEFINE_COMMAND(SelectLineNext, cmd_selectLineNext)
|
||||||
NS_DEFINE_COMMAND(SelectLinePrevious, cmd_selectLinePrevious)
|
NS_DEFINE_COMMAND(SelectLinePrevious, cmd_selectLinePrevious)
|
||||||
NS_DEFINE_COMMAND(SelectPageDown, cmd_selectPageDown)
|
NS_DEFINE_COMMAND(SelectPageDown, cmd_selectPageDown)
|
||||||
|
|||||||
@@ -125,9 +125,9 @@ void NativeKeyBindings::Init(NativeKeyBindingsType aType) {
|
|||||||
SEL_TO_COMMAND(moveLeft:, Command::CharPrevious);
|
SEL_TO_COMMAND(moveLeft:, Command::CharPrevious);
|
||||||
SEL_TO_COMMAND(moveLeftAndModifySelection:, Command::SelectCharPrevious);
|
SEL_TO_COMMAND(moveLeftAndModifySelection:, Command::SelectCharPrevious);
|
||||||
SEL_TO_COMMAND(moveParagraphBackwardAndModifySelection:,
|
SEL_TO_COMMAND(moveParagraphBackwardAndModifySelection:,
|
||||||
Command::SelectBeginParagraph);
|
Command::SelectBeginLine);
|
||||||
SEL_TO_COMMAND(moveParagraphForwardAndModifySelection:,
|
SEL_TO_COMMAND(moveParagraphForwardAndModifySelection:,
|
||||||
Command::SelectEndParagraph);
|
Command::SelectEndLine);
|
||||||
SEL_TO_COMMAND(moveRight:, Command::CharNext);
|
SEL_TO_COMMAND(moveRight:, Command::CharNext);
|
||||||
SEL_TO_COMMAND(moveRightAndModifySelection:, Command::SelectCharNext);
|
SEL_TO_COMMAND(moveRightAndModifySelection:, Command::SelectCharNext);
|
||||||
SEL_TO_COMMAND(moveToBeginningOfDocument:, Command::MoveTop);
|
SEL_TO_COMMAND(moveToBeginningOfDocument:, Command::MoveTop);
|
||||||
@@ -136,16 +136,16 @@ void NativeKeyBindings::Init(NativeKeyBindingsType aType) {
|
|||||||
SEL_TO_COMMAND(moveToBeginningOfLine:, Command::BeginLine);
|
SEL_TO_COMMAND(moveToBeginningOfLine:, Command::BeginLine);
|
||||||
SEL_TO_COMMAND(moveToBeginningOfLineAndModifySelection:,
|
SEL_TO_COMMAND(moveToBeginningOfLineAndModifySelection:,
|
||||||
Command::SelectBeginLine);
|
Command::SelectBeginLine);
|
||||||
SEL_TO_COMMAND(moveToBeginningOfParagraph:, Command::BeginParagraph);
|
SEL_TO_COMMAND(moveToBeginningOfParagraph:, Command::BeginLine);
|
||||||
SEL_TO_COMMAND(moveToBeginningOfParagraphAndModifySelection:,
|
SEL_TO_COMMAND(moveToBeginningOfParagraphAndModifySelection:,
|
||||||
Command::SelectBeginParagraph);
|
Command::SelectBeginLine);
|
||||||
SEL_TO_COMMAND(moveToEndOfDocument:, Command::MoveBottom);
|
SEL_TO_COMMAND(moveToEndOfDocument:, Command::MoveBottom);
|
||||||
SEL_TO_COMMAND(moveToEndOfDocumentAndModifySelection:, Command::SelectBottom);
|
SEL_TO_COMMAND(moveToEndOfDocumentAndModifySelection:, Command::SelectBottom);
|
||||||
SEL_TO_COMMAND(moveToEndOfLine:, Command::EndLine);
|
SEL_TO_COMMAND(moveToEndOfLine:, Command::EndLine);
|
||||||
SEL_TO_COMMAND(moveToEndOfLineAndModifySelection:, Command::SelectEndLine);
|
SEL_TO_COMMAND(moveToEndOfLineAndModifySelection:, Command::SelectEndLine);
|
||||||
SEL_TO_COMMAND(moveToEndOfParagraph:, Command::EndParagraph);
|
SEL_TO_COMMAND(moveToEndOfParagraph:, Command::EndLine);
|
||||||
SEL_TO_COMMAND(moveToEndOfParagraphAndModifySelection:,
|
SEL_TO_COMMAND(moveToEndOfParagraphAndModifySelection:,
|
||||||
Command::SelectEndParagraph);
|
Command::SelectEndLine);
|
||||||
SEL_TO_COMMAND(moveToLeftEndOfLine:, Command::BeginLine);
|
SEL_TO_COMMAND(moveToLeftEndOfLine:, Command::BeginLine);
|
||||||
SEL_TO_COMMAND(moveToLeftEndOfLineAndModifySelection:,
|
SEL_TO_COMMAND(moveToLeftEndOfLineAndModifySelection:,
|
||||||
Command::SelectBeginLine);
|
Command::SelectBeginLine);
|
||||||
|
|||||||
@@ -2848,9 +2848,7 @@ bool TextInputHandler::HandleCommand(Command aCommand) {
|
|||||||
case Command::WordNext:
|
case Command::WordNext:
|
||||||
case Command::SelectWordNext:
|
case Command::SelectWordNext:
|
||||||
case Command::EndLine:
|
case Command::EndLine:
|
||||||
case Command::SelectEndLine:
|
case Command::SelectEndLine: {
|
||||||
case Command::EndParagraph:
|
|
||||||
case Command::SelectEndParagraph: {
|
|
||||||
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
|
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
|
||||||
keypressEvent.mKeyCode = NS_VK_RIGHT;
|
keypressEvent.mKeyCode = NS_VK_RIGHT;
|
||||||
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowRight;
|
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowRight;
|
||||||
@@ -2876,9 +2874,7 @@ bool TextInputHandler::HandleCommand(Command aCommand) {
|
|||||||
case Command::WordPrevious:
|
case Command::WordPrevious:
|
||||||
case Command::SelectWordPrevious:
|
case Command::SelectWordPrevious:
|
||||||
case Command::BeginLine:
|
case Command::BeginLine:
|
||||||
case Command::SelectBeginLine:
|
case Command::SelectBeginLine: {
|
||||||
case Command::BeginParagraph:
|
|
||||||
case Command::SelectBeginParagraph: {
|
|
||||||
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
|
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
|
||||||
keypressEvent.mKeyCode = NS_VK_LEFT;
|
keypressEvent.mKeyCode = NS_VK_LEFT;
|
||||||
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowLeft;
|
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowLeft;
|
||||||
|
|||||||
Reference in New Issue
Block a user