471 lines
22 KiB
Plaintext
471 lines
22 KiB
Plaintext
diff --git a/dom/base/nsGlobalWindowCommands.cpp b/dom/base/nsGlobalWindowCommands.cpp
|
|
index 5dd631d1e4545..c154d5b33735d 100644
|
|
--- a/dom/base/nsGlobalWindowCommands.cpp
|
|
+++ b/dom/base/nsGlobalWindowCommands.cpp
|
|
@@ -80,6 +80,11 @@ constexpr const char* sEndLineString = "cmd_endLine";
|
|
constexpr const char* sSelectBeginLineString = "cmd_selectBeginLine";
|
|
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* sSelectLineNextString = "cmd_selectLineNext";
|
|
|
|
@@ -303,7 +308,11 @@ static constexpr struct BrowseCommand {
|
|
{Command::BeginLine, Command::EndLine,
|
|
KeyboardScrollAction::eScrollComplete,
|
|
&nsISelectionController::CompleteScroll,
|
|
- &nsISelectionController::IntraLineMove}};
|
|
+ &nsISelectionController::IntraLineMove},
|
|
+ {Command::BeginParagraph, Command::EndParagraph,
|
|
+ KeyboardScrollAction::eScrollComplete,
|
|
+ &nsISelectionController::CompleteScroll,
|
|
+ &nsISelectionController::IntraParagraphMove}};
|
|
|
|
nsresult nsSelectMoveScrollCommand::DoCommand(const char* aCommandName,
|
|
nsISupports* aCommandContext) {
|
|
@@ -420,18 +429,21 @@ nsresult nsPhysicalSelectMoveScrollCommand::DoCommand(
|
|
static const struct SelectCommand {
|
|
Command reverse, forward;
|
|
nsresult (NS_STDCALL nsISelectionController::*select)(bool, bool);
|
|
-} selectCommands[] = {{Command::SelectCharPrevious, Command::SelectCharNext,
|
|
- &nsISelectionController::CharacterMove},
|
|
- {Command::SelectWordPrevious, Command::SelectWordNext,
|
|
- &nsISelectionController::WordMove},
|
|
- {Command::SelectBeginLine, Command::SelectEndLine,
|
|
- &nsISelectionController::IntraLineMove},
|
|
- {Command::SelectLinePrevious, Command::SelectLineNext,
|
|
- &nsISelectionController::LineMove},
|
|
- {Command::SelectPageUp, Command::SelectPageDown,
|
|
- &nsISelectionController::PageMove},
|
|
- {Command::SelectTop, Command::SelectBottom,
|
|
- &nsISelectionController::CompleteMove}};
|
|
+} selectCommands[] = {
|
|
+ {Command::SelectCharPrevious, Command::SelectCharNext,
|
|
+ &nsISelectionController::CharacterMove},
|
|
+ {Command::SelectWordPrevious, Command::SelectWordNext,
|
|
+ &nsISelectionController::WordMove},
|
|
+ {Command::SelectBeginLine, Command::SelectEndLine,
|
|
+ &nsISelectionController::IntraLineMove},
|
|
+ {Command::SelectBeginParagraph, Command::SelectEndParagraph,
|
|
+ &nsISelectionController::IntraParagraphMove},
|
|
+ {Command::SelectLinePrevious, Command::SelectLineNext,
|
|
+ &nsISelectionController::LineMove},
|
|
+ {Command::SelectPageUp, Command::SelectPageDown,
|
|
+ &nsISelectionController::PageMove},
|
|
+ {Command::SelectTop, Command::SelectBottom,
|
|
+ &nsISelectionController::CompleteMove}};
|
|
|
|
nsresult nsSelectCommand::DoCommand(const char* aCommandName,
|
|
nsISupports* aCommandContext) {
|
|
@@ -1099,6 +1111,8 @@ nsresult nsWindowCommandRegistration::RegisterWindowCommands(
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sWordNextString);
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sBeginLineString);
|
|
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, sMovePageDownString);
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sLinePreviousString);
|
|
@@ -1122,6 +1136,8 @@ nsresult nsWindowCommandRegistration::RegisterWindowCommands(
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectWordNextString);
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectBeginLineString);
|
|
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, sSelectLineNextString);
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectPageUpString);
|
|
diff --git a/dom/base/nsISelectionController.idl b/dom/base/nsISelectionController.idl
|
|
index e7f6dd05c4d96..f71486e14dbe4 100644
|
|
--- a/dom/base/nsISelectionController.idl
|
|
+++ b/dom/base/nsISelectionController.idl
|
|
@@ -239,6 +239,16 @@ interface nsISelectionController : nsISelectionDisplay
|
|
*/
|
|
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 = PR_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 PR_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.
|
|
* this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
|
|
* the "point" of selection that is extended is considered the "focus" point.
|
|
diff --git a/dom/html/TextControlState.cpp b/dom/html/TextControlState.cpp
|
|
index fb2f5e8dc2964..0e9cd9183cadb 100644
|
|
--- a/dom/html/TextControlState.cpp
|
|
+++ b/dom/html/TextControlState.cpp
|
|
@@ -370,6 +370,7 @@ class TextInputSelectionController final : public nsSupportsWeakReference,
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHOD LineMove(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
|
|
NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
|
|
NS_IMETHOD CompleteScroll(bool aForward) override;
|
|
@@ -649,6 +650,15 @@ TextInputSelectionController::IntraLineMove(bool aForward, bool 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
|
|
TextInputSelectionController::PageMove(bool aForward, bool aExtend) {
|
|
// expected behavior for PageMove is to scroll AND move the caret
|
|
diff --git a/editor/libeditor/EditorCommands.cpp b/editor/libeditor/EditorCommands.cpp
|
|
index beb4f060adc0f..7b87bd1191df2 100644
|
|
--- a/editor/libeditor/EditorCommands.cpp
|
|
+++ b/editor/libeditor/EditorCommands.cpp
|
|
@@ -708,6 +708,9 @@ static const struct MoveCommand {
|
|
Command::SelectWordNext, &nsISelectionController::WordMove},
|
|
{Command::BeginLine, Command::EndLine, Command::SelectBeginLine,
|
|
Command::SelectEndLine, &nsISelectionController::IntraLineMove},
|
|
+ {Command::BeginParagraph, Command::EndParagraph,
|
|
+ Command::SelectBeginParagraph, Command::SelectEndParagraph,
|
|
+ &nsISelectionController::IntraParagraphMove},
|
|
{Command::MovePageUp, Command::MovePageDown, Command::SelectPageUp,
|
|
Command::SelectPageDown, &nsISelectionController::PageMove},
|
|
{Command::MoveTop, Command::MoveBottom, Command::SelectTop,
|
|
diff --git a/editor/libeditor/EditorCommands.h b/editor/libeditor/EditorCommands.h
|
|
index 031f9057e6de3..0457720c887b4 100644
|
|
--- a/editor/libeditor/EditorCommands.h
|
|
+++ b/editor/libeditor/EditorCommands.h
|
|
@@ -144,6 +144,10 @@ class EditorCommand : public nsIControllerCommand {
|
|
case Command::EndLine:
|
|
case Command::SelectBeginLine:
|
|
case Command::SelectEndLine:
|
|
+ case Command::BeginParagraph:
|
|
+ case Command::EndParagraph:
|
|
+ case Command::SelectBeginParagraph:
|
|
+ case Command::SelectEndParagraph:
|
|
case Command::WordPrevious:
|
|
case Command::WordNext:
|
|
case Command::SelectWordPrevious:
|
|
diff --git a/editor/libeditor/EditorController.cpp b/editor/libeditor/EditorController.cpp
|
|
index 9bb440a615050..0282d05378c6d 100644
|
|
--- a/editor/libeditor/EditorController.cpp
|
|
+++ b/editor/libeditor/EditorController.cpp
|
|
@@ -82,6 +82,10 @@ nsresult EditorController::RegisterEditorCommands(
|
|
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_endLine");
|
|
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectBeginLine");
|
|
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_wordNext");
|
|
NS_REGISTER_COMMAND(SelectionMoveCommands, "cmd_selectWordPrevious");
|
|
diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp
|
|
index f481c6462fafd..bc7e3bc38c52d 100644
|
|
--- a/layout/base/PresShell.cpp
|
|
+++ b/layout/base/PresShell.cpp
|
|
@@ -2303,6 +2303,12 @@ PresShell::IntraLineMove(bool aForward, bool 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
|
|
PresShell::PageMove(bool aForward, bool aExtend) {
|
|
nsIFrame* frame = nullptr;
|
|
diff --git a/layout/base/PresShell.h b/layout/base/PresShell.h
|
|
index 20ebcbc7a3ebd..6adfeaa19c50c 100644
|
|
--- a/layout/base/PresShell.h
|
|
+++ b/layout/base/PresShell.h
|
|
@@ -1378,6 +1378,7 @@ class PresShell final : public nsStubDocumentObserver,
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHOD LineMove(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
|
|
NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
|
|
NS_IMETHOD ScrollPage(bool aForward) override;
|
|
diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp
|
|
index 45e9173bb55d7..2c5d5ea452ead 100644
|
|
--- a/layout/generic/nsFrameSelection.cpp
|
|
+++ b/layout/generic/nsFrameSelection.cpp
|
|
@@ -2205,6 +2205,14 @@ nsresult nsFrameSelection::IntraLineMove(bool aForward, bool aExtend) {
|
|
}
|
|
}
|
|
|
|
+nsresult nsFrameSelection::IntraParagraphMove(bool aForward, bool aExtend) {
|
|
+ if (aForward) {
|
|
+ return MoveCaret(eDirNext, aExtend, eSelectEndParagraph, eLogical);
|
|
+ } else {
|
|
+ return MoveCaret(eDirPrevious, aExtend, eSelectBeginParagraph, eLogical);
|
|
+ }
|
|
+}
|
|
+
|
|
template <typename RangeType>
|
|
Result<RefPtr<RangeType>, nsresult>
|
|
nsFrameSelection::CreateRangeExtendedToSomewhere(
|
|
diff --git a/layout/generic/nsFrameSelection.h b/layout/generic/nsFrameSelection.h
|
|
index 1125ccdefaf1d..669cf4b8c2580 100644
|
|
--- a/layout/generic/nsFrameSelection.h
|
|
+++ b/layout/generic/nsFrameSelection.h
|
|
@@ -601,6 +601,17 @@ class nsFrameSelection final {
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult IntraLineMove(bool aForward,
|
|
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
|
|
* extended from normal selection range to start of next grapheme cluster
|
|
@@ -944,6 +955,8 @@ class nsFrameSelection final {
|
|
case eSelectWordNoSpace:
|
|
case eSelectBeginLine:
|
|
case eSelectEndLine:
|
|
+ case eSelectBeginParagraph:
|
|
+ case eSelectEndParagraph:
|
|
return true;
|
|
case eSelectLine:
|
|
return false;
|
|
diff --git a/layout/generic/nsIFrame.cpp b/layout/generic/nsIFrame.cpp
|
|
index 3a336b25278ae..bd6435a18d05e 100644
|
|
--- a/layout/generic/nsIFrame.cpp
|
|
+++ b/layout/generic/nsIFrame.cpp
|
|
@@ -8879,6 +8879,60 @@ nsresult nsIFrame::PeekOffsetForParagraph(PeekOffsetStruct* aPos) {
|
|
return NS_OK;
|
|
}
|
|
|
|
+nsresult nsIFrame::PeekOffsetForParagraphEdge(PeekOffsetStruct* aPos) {
|
|
+ nsIFrame* frame = this;
|
|
+ nsContentAndOffset blockFrameOrBR;
|
|
+ blockFrameOrBR.mContent = nullptr;
|
|
+ bool reachedLimit = frame->IsBlockOutside() || IsEditingHost(frame);
|
|
+
|
|
+ auto traverse = [&aPos](nsIFrame* current) {
|
|
+ return aPos->mDirection == eDirPrevious ? current->GetPrevSibling()
|
|
+ : current->GetNextSibling();
|
|
+ };
|
|
+
|
|
+ // Go through containing frames until reaching a block frame.
|
|
+ // In each step, search the previous (or next) siblings for the closest
|
|
+ // "stop frame" (a block frame or a BRFrame).
|
|
+ // If found, set it to be the selection boundary and abort.
|
|
+ while (!reachedLimit) {
|
|
+ nsIFrame* parent = frame->GetParent();
|
|
+ // Treat a frame associated with the root content as if it were a block
|
|
+ // frame.
|
|
+ if (!frame->mContent || !frame->mContent->GetParent()) {
|
|
+ reachedLimit = true;
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ if (aPos->mDirection == eDirNext) {
|
|
+ // Try to find our own line-break before looking at our siblings.
|
|
+ blockFrameOrBR = FindLineBreakInText(frame, eDirNext);
|
|
+ }
|
|
+
|
|
+ nsIFrame* sibling = traverse(frame);
|
|
+ while (sibling && !blockFrameOrBR.mContent) {
|
|
+ blockFrameOrBR = FindLineBreakingFrame(sibling, aPos->mDirection);
|
|
+ sibling = traverse(sibling);
|
|
+ }
|
|
+ if (blockFrameOrBR.mContent) {
|
|
+ aPos->mResultContent = blockFrameOrBR.mContent;
|
|
+ aPos->mContentOffset = blockFrameOrBR.mOffset;
|
|
+ break;
|
|
+ }
|
|
+ frame = parent;
|
|
+ reachedLimit = frame && (frame->IsBlockOutside() || IsEditingHost(frame));
|
|
+ }
|
|
+
|
|
+ if (reachedLimit) { // no "stop frame" found
|
|
+ aPos->mResultContent = frame->GetContent();
|
|
+ if (aPos->mDirection == eDirPrevious) {
|
|
+ aPos->mContentOffset = 0;
|
|
+ } else if (aPos->mResultContent) {
|
|
+ aPos->mContentOffset = aPos->mResultContent->GetChildCount();
|
|
+ }
|
|
+ }
|
|
+ return NS_OK;
|
|
+}
|
|
+
|
|
// Determine movement direction relative to frame
|
|
static bool IsMovingInFrameDirection(const nsIFrame* frame,
|
|
nsDirection aDirection, bool aVisual) {
|
|
@@ -9317,6 +9371,13 @@ nsresult nsIFrame::PeekOffset(PeekOffsetStruct* aPos) {
|
|
case eSelectBeginLine:
|
|
case eSelectEndLine:
|
|
return PeekOffsetForLineEdge(aPos);
|
|
+ case eSelectBeginParagraph:
|
|
+ case eSelectEndParagraph:
|
|
+ if (StaticPrefs::dom_input_textarea_caret_paragraph_movement()) {
|
|
+ return PeekOffsetForParagraphEdge(aPos);
|
|
+ } else {
|
|
+ return PeekOffsetForLineEdge(aPos);
|
|
+ }
|
|
case eSelectParagraph:
|
|
return PeekOffsetForParagraph(aPos);
|
|
default: {
|
|
diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h
|
|
index bbf3db4f70a3f..ca0dc2cd9c54c 100644
|
|
--- a/layout/generic/nsIFrame.h
|
|
+++ b/layout/generic/nsIFrame.h
|
|
@@ -194,8 +194,10 @@ enum nsSelectionAmount {
|
|
|
|
eSelectBeginLine = 5,
|
|
eSelectEndLine = 6,
|
|
- eSelectNoAmount = 7, // just bounce back current offset.
|
|
- eSelectParagraph = 8 // select a "paragraph"
|
|
+ eSelectNoAmount = 7, // just bounce back current offset.
|
|
+ eSelectParagraph = 8, // select a "paragraph"
|
|
+ eSelectBeginParagraph = 9,
|
|
+ eSelectEndParagraph = 10
|
|
};
|
|
|
|
//----------------------------------------------------------------------
|
|
@@ -3868,6 +3870,7 @@ class nsIFrame : public nsQueryFrame {
|
|
nsresult PeekOffsetForWord(mozilla::PeekOffsetStruct* aPos, int32_t aOffset);
|
|
nsresult PeekOffsetForLine(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
|
|
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
|
|
index a44c2158b0e87..e9bedae883b59 100644
|
|
--- a/modules/libpref/init/StaticPrefList.yaml
|
|
+++ b/modules/libpref/init/StaticPrefList.yaml
|
|
@@ -2792,6 +2792,12 @@
|
|
value: true
|
|
mirror: always
|
|
|
|
+# Textarea caret movement style. Disable this to restore previous behavior (line edges instead of paragraphs). Currently only effective on macOS.
|
|
+- name: dom.input.textarea_caret_paragraph_movement
|
|
+ type: bool
|
|
+ value: true
|
|
+ mirror: always
|
|
+
|
|
# How often to check for CPOW timeouts (ms). CPOWs are only timed
|
|
# out by the hang monitor.
|
|
- name: dom.ipc.cpow.timeout
|
|
diff --git a/widget/CommandList.h b/widget/CommandList.h
|
|
index 243656bb013f4..68fcafbc4b39c 100644
|
|
--- a/widget/CommandList.h
|
|
+++ b/widget/CommandList.h
|
|
@@ -25,6 +25,7 @@
|
|
|
|
// Mapped from commands of some platforms
|
|
NS_DEFINE_COMMAND(BeginLine, cmd_beginLine)
|
|
+NS_DEFINE_COMMAND(BeginParagraph, cmd_beginParagraph)
|
|
NS_DEFINE_COMMAND(CharNext, cmd_charNext)
|
|
NS_DEFINE_COMMAND(CharPrevious, cmd_charPrevious)
|
|
NS_DEFINE_COMMAND(Copy, cmd_copy)
|
|
@@ -37,6 +38,7 @@ NS_DEFINE_COMMAND(DeleteToEndOfLine, cmd_deleteToEndOfLine)
|
|
NS_DEFINE_COMMAND(DeleteWordBackward, cmd_deleteWordBackward)
|
|
NS_DEFINE_COMMAND(DeleteWordForward, cmd_deleteWordForward)
|
|
NS_DEFINE_COMMAND(EndLine, cmd_endLine)
|
|
+NS_DEFINE_COMMAND(EndParagraph, cmd_endParagraph)
|
|
NS_DEFINE_COMMAND(InsertParagraph, cmd_insertParagraph)
|
|
NS_DEFINE_COMMAND(InsertLineBreak, cmd_insertLineBreak)
|
|
NS_DEFINE_COMMAND(LineNext, cmd_lineNext)
|
|
@@ -56,10 +58,12 @@ NS_DEFINE_COMMAND(ScrollRight, cmd_scrollRight)
|
|
NS_DEFINE_COMMAND(ScrollTop, cmd_scrollTop)
|
|
NS_DEFINE_COMMAND(SelectAll, cmd_selectAll)
|
|
NS_DEFINE_COMMAND(SelectBeginLine, cmd_selectBeginLine)
|
|
+NS_DEFINE_COMMAND(SelectBeginParagraph, cmd_selectBeginParagraph)
|
|
NS_DEFINE_COMMAND(SelectBottom, cmd_selectBottom)
|
|
NS_DEFINE_COMMAND(SelectCharNext, cmd_selectCharNext)
|
|
NS_DEFINE_COMMAND(SelectCharPrevious, cmd_selectCharPrevious)
|
|
NS_DEFINE_COMMAND(SelectEndLine, cmd_selectEndLine)
|
|
+NS_DEFINE_COMMAND(SelectEndParagraph, cmd_selectEndParagraph)
|
|
NS_DEFINE_COMMAND(SelectLineNext, cmd_selectLineNext)
|
|
NS_DEFINE_COMMAND(SelectLinePrevious, cmd_selectLinePrevious)
|
|
NS_DEFINE_COMMAND(SelectPageDown, cmd_selectPageDown)
|
|
diff --git a/widget/cocoa/NativeKeyBindings.mm b/widget/cocoa/NativeKeyBindings.mm
|
|
index e4bdf715e2fb8..e977928dad71a 100644
|
|
--- a/widget/cocoa/NativeKeyBindings.mm
|
|
+++ b/widget/cocoa/NativeKeyBindings.mm
|
|
@@ -125,9 +125,9 @@ void NativeKeyBindings::Init(NativeKeyBindingsType aType) {
|
|
SEL_TO_COMMAND(moveLeft:, Command::CharPrevious);
|
|
SEL_TO_COMMAND(moveLeftAndModifySelection:, Command::SelectCharPrevious);
|
|
SEL_TO_COMMAND(moveParagraphBackwardAndModifySelection:,
|
|
- Command::SelectBeginLine);
|
|
+ Command::SelectBeginParagraph);
|
|
SEL_TO_COMMAND(moveParagraphForwardAndModifySelection:,
|
|
- Command::SelectEndLine);
|
|
+ Command::SelectEndParagraph);
|
|
SEL_TO_COMMAND(moveRight:, Command::CharNext);
|
|
SEL_TO_COMMAND(moveRightAndModifySelection:, Command::SelectCharNext);
|
|
SEL_TO_COMMAND(moveToBeginningOfDocument:, Command::MoveTop);
|
|
@@ -136,16 +136,16 @@ void NativeKeyBindings::Init(NativeKeyBindingsType aType) {
|
|
SEL_TO_COMMAND(moveToBeginningOfLine:, Command::BeginLine);
|
|
SEL_TO_COMMAND(moveToBeginningOfLineAndModifySelection:,
|
|
Command::SelectBeginLine);
|
|
- SEL_TO_COMMAND(moveToBeginningOfParagraph:, Command::BeginLine);
|
|
+ SEL_TO_COMMAND(moveToBeginningOfParagraph:, Command::BeginParagraph);
|
|
SEL_TO_COMMAND(moveToBeginningOfParagraphAndModifySelection:,
|
|
- Command::SelectBeginLine);
|
|
+ Command::SelectBeginParagraph);
|
|
SEL_TO_COMMAND(moveToEndOfDocument:, Command::MoveBottom);
|
|
SEL_TO_COMMAND(moveToEndOfDocumentAndModifySelection:, Command::SelectBottom);
|
|
SEL_TO_COMMAND(moveToEndOfLine:, Command::EndLine);
|
|
SEL_TO_COMMAND(moveToEndOfLineAndModifySelection:, Command::SelectEndLine);
|
|
- SEL_TO_COMMAND(moveToEndOfParagraph:, Command::EndLine);
|
|
+ SEL_TO_COMMAND(moveToEndOfParagraph:, Command::EndParagraph);
|
|
SEL_TO_COMMAND(moveToEndOfParagraphAndModifySelection:,
|
|
- Command::SelectEndLine);
|
|
+ Command::SelectEndParagraph);
|
|
SEL_TO_COMMAND(moveToLeftEndOfLine:, Command::BeginLine);
|
|
SEL_TO_COMMAND(moveToLeftEndOfLineAndModifySelection:,
|
|
Command::SelectBeginLine);
|
|
diff --git a/widget/cocoa/TextInputHandler.mm b/widget/cocoa/TextInputHandler.mm
|
|
index d38bc59823be6..c25fcd2f63f86 100644
|
|
--- a/widget/cocoa/TextInputHandler.mm
|
|
+++ b/widget/cocoa/TextInputHandler.mm
|
|
@@ -2818,7 +2818,9 @@ bool TextInputHandler::HandleCommand(Command aCommand) {
|
|
case Command::WordNext:
|
|
case Command::SelectWordNext:
|
|
case Command::EndLine:
|
|
- case Command::SelectEndLine: {
|
|
+ case Command::SelectEndLine:
|
|
+ case Command::EndParagraph:
|
|
+ case Command::SelectEndParagraph: {
|
|
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
|
|
keypressEvent.mKeyCode = NS_VK_RIGHT;
|
|
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowRight;
|
|
@@ -2844,7 +2846,9 @@ bool TextInputHandler::HandleCommand(Command aCommand) {
|
|
case Command::WordPrevious:
|
|
case Command::SelectWordPrevious:
|
|
case Command::BeginLine:
|
|
- case Command::SelectBeginLine: {
|
|
+ case Command::SelectBeginLine:
|
|
+ case Command::BeginParagraph:
|
|
+ case Command::SelectBeginParagraph: {
|
|
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
|
|
keypressEvent.mKeyCode = NS_VK_LEFT;
|
|
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowLeft;
|