diff --git a/accessible/base/SelectionManager.cpp b/accessible/base/SelectionManager.cpp index 2c01d65b8fd4..d0053bf1dcc5 100644 --- a/accessible/base/SelectionManager.cpp +++ b/accessible/base/SelectionManager.cpp @@ -799,17 +799,6 @@ mCaretOffset 1 ) { -TextLeafPoint -caret -= -TextLeafPoint -: -: -GetCaret -( -caretCntr -) -; RefPtr < AccCaretMoveEvent @@ -827,9 +816,12 @@ selection IsCollapsed ( ) -caret -. -mIsEndOfLineInsertionPoint +caretCntr +- +> +IsCaretAtEndOfLine +( +) event - > diff --git a/accessible/base/TextLeafRange.cpp b/accessible/base/TextLeafRange.cpp index 4ba73a3bc3cf..a586cc4a972f 100644 --- a/accessible/base/TextLeafRange.cpp +++ b/accessible/base/TextLeafRange.cpp @@ -4966,6 +4966,16 @@ Accessible aAcc ) { +HyperTextAccessibleBase +* +ht +; +int32_t +htOffset +; +bool +isEndOfLine +; if ( LocalAccessible @@ -4980,8 +4990,6 @@ AsLocal ) ) { -HyperTextAccessible -* ht = HyperTextFor @@ -5001,7 +5009,6 @@ TextLeafPoint ) ; } -int32_t htOffset = ht @@ -5026,113 +5033,23 @@ TextLeafPoint ) ; } -TextLeafPoint -point -= -ht -- -> -ToTextLeafPoint -( -htOffset -) -; -nsIFrame -* -frame +isEndOfLine = -ht -- -> -GetFrame -( -) -; -RefPtr -< -nsFrameSelection -> -sel -= -frame -? -frame -- -> -GetFrameSelection -( -) -: -nullptr -; -if -( -sel -& -& -sel +localAcc - > -GetHint -( -) -= -= -CaretAssociationHint -: -: -Before -) -{ -if +AsHyperText ( -point -. -mOffset -= -= -0 ) -{ -point -. -mIsEndOfLineInsertionPoint -= -IsLocalAccAtLineStart -( -point -. -mAcc - > -AsLocal -( -) -) -& -& -! -point -. -IsParagraphStart +IsCaretAtEndOfLine ( ) ; } else { -point -. -mIsEndOfLineInsertionPoint -= -true -; -} -} -return -point -; -} DocAccessibleParent * remoteDoc @@ -5149,11 +5066,14 @@ Document ( ) ; -auto -[ +std +: +: +tie +( ht htOffset -] +) = remoteDoc - @@ -5174,6 +5094,16 @@ TextLeafPoint ) ; } +isEndOfLine += +remoteDoc +- +> +IsCaretAtEndOfLine +( +) +; +} TextLeafPoint point = @@ -5189,12 +5119,7 @@ point . mIsEndOfLineInsertionPoint = -remoteDoc -- -> -IsCaretAtEndOfLine -( -) +isEndOfLine ; return point diff --git a/accessible/generic/HyperTextAccessible-inl.h b/accessible/generic/HyperTextAccessible-inl.h index 3198d338f8a9..c7e56ad92552 100644 --- a/accessible/generic/HyperTextAccessible-inl.h +++ b/accessible/generic/HyperTextAccessible-inl.h @@ -86,6 +86,44 @@ aOffset ; } inline +bool +HyperTextAccessible +: +: +IsCaretAtEndOfLine +( +) +const +{ +RefPtr +< +nsFrameSelection +> +frameSelection += +FrameSelection +( +) +; +return +frameSelection +& +& +frameSelection +- +> +GetHint +( +) += += +CaretAssociationHint +: +: +Before +; +} +inline already_AddRefed < nsFrameSelection diff --git a/accessible/generic/HyperTextAccessible.h b/accessible/generic/HyperTextAccessible.h index dd4eb61899e2..93703a03abb6 100644 --- a/accessible/generic/HyperTextAccessible.h +++ b/accessible/generic/HyperTextAccessible.h @@ -410,6 +410,12 @@ nsIWidget aWidget ) ; +bool +IsCaretAtEndOfLine +( +) +const +; virtual int32_t SelectionCount diff --git a/accessible/tests/browser/text/browser_text_caret.js b/accessible/tests/browser/text/browser_text_caret.js index 5991eb6dbb9e..fce4f8c61ef0 100644 --- a/accessible/tests/browser/text/browser_text_caret.js +++ b/accessible/tests/browser/text/browser_text_caret.js @@ -62,28 +62,6 @@ empty / textarea > -< -div -id -= -" -contentEditable -" -contenteditable -> -a -< -span -> -b -< -/ -span -> -< -/ -div -> async function ( @@ -1153,172 +1131,6 @@ line " ) ; -const -contentEditable -= -findAccessibleChildByID -( -docAcc -" -contentEditable -" -[ -nsIAccessibleText -] -) -; -caretMoved -= -waitForEvent -( -EVENT_TEXT_CARET_MOVED -contentEditable -) -; -contentEditable -. -takeFocus -( -) -; -evt -= -await -caretMoved -; -is -( -contentEditable -. -caretOffset -0 -" -Initial -caret -offset -in -contentEditable -is -0 -" -) -; -evt -. -QueryInterface -( -nsIAccessibleCaretMoveEvent -) -; -ok -( -! -evt -. -isAtEndOfLine -" -Caret -is -not -at -end -of -line -" -) -; -testTextAtOffset -( -kCaretOffset -BOUNDARY_CHAR -" -a -" -0 -1 -contentEditable -kOk -kOk -kOk -) -; -caretMoved -= -waitForEvent -( -EVENT_TEXT_CARET_MOVED -contentEditable -) -; -EventUtils -. -synthesizeKey -( -" -KEY_ArrowRight -" -) -; -evt -= -await -caretMoved -; -is -( -contentEditable -. -caretOffset -1 -" -Caret -offset -is -1 -after -ArrowRight -" -) -; -evt -. -QueryInterface -( -nsIAccessibleCaretMoveEvent -) -; -ok -( -! -evt -. -isAtEndOfLine -" -Caret -is -not -at -end -of -line -" -) -; -testTextAtOffset -( -kCaretOffset -BOUNDARY_CHAR -" -b -" -1 -2 -contentEditable -kOk -kOk -kOk -) -; } { chrome