RESOLVED FIXED 232622
[GTK][a11y] Embedded objects are not correctly handled by text interface with ATSPI
https://bugs.webkit.org/show_bug.cgi?id=232622
Summary [GTK][a11y] Embedded objects are not correctly handled by text interface with...
Carlos Garcia Campos
Reported 2021-11-02 07:11:36 PDT
We are not correctly handling embedded objects (replaced elements) when converting text offsets to/from visible position.
Attachments
Patch (12.34 KB, patch)
2021-11-02 07:17 PDT, Carlos Garcia Campos
ews-feeder: commit-queue-
Patch (12.34 KB, patch)
2021-11-02 07:39 PDT, Carlos Garcia Campos
no flags
Patch (13.39 KB, patch)
2021-11-04 07:10 PDT, Carlos Garcia Campos
andresg_22: review+
Carlos Garcia Campos
Comment 1 2021-11-02 07:17:06 PDT
Carlos Garcia Campos
Comment 2 2021-11-02 07:39:31 PDT
Andres Gonzalez
Comment 3 2021-11-04 06:37:34 PDT
(In reply to Carlos Garcia Campos from comment #2) > Created attachment 443088 [details] > Patch --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -2145,7 +2145,12 @@ VisiblePosition AccessibilityRenderObject::visiblePositionForIndex(int index) co if (!node) return VisiblePosition(); +#if USE(ATSPI) + // We need to consider replaced elements for GTK, as they will be presented with the 'object replacement character' (0xFFFC). + return { makeDeprecatedLegacyPosition(resolveCharacterLocation(makeRangeSelectingNodeContents(*node), index, TextIteratorBehavior::EmitsObjectReplacementCharacters)) }; Can we use VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope) in editing.cpp adding a TextIteratorBehaviors parameter to it?
Carlos Garcia Campos
Comment 4 2021-11-04 06:42:47 PDT
(In reply to Andres Gonzalez from comment #3) > (In reply to Carlos Garcia Campos from comment #2) > > Created attachment 443088 [details] > > Patch > > --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp > +++ a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp > @@ -2145,7 +2145,12 @@ VisiblePosition > AccessibilityRenderObject::visiblePositionForIndex(int index) co > if (!node) > return VisiblePosition(); > > +#if USE(ATSPI) > + // We need to consider replaced elements for GTK, as they will be > presented with the 'object replacement character' (0xFFFC). > + return { > makeDeprecatedLegacyPosition(resolveCharacterLocation(makeRangeSelectingNodeC > ontents(*node), index, > TextIteratorBehavior::EmitsObjectReplacementCharacters)) }; > > Can we use > > VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope) > > in editing.cpp adding a TextIteratorBehaviors parameter to it? That was my initial idea, but it expects ContainerNode while we have just a Node and I'm not sure it's ok to change visiblePositionForIndex to receive a Node.
Andres Gonzalez
Comment 5 2021-11-04 06:50:51 PDT
(In reply to Carlos Garcia Campos from comment #4) > (In reply to Andres Gonzalez from comment #3) > > (In reply to Carlos Garcia Campos from comment #2) > > > Created attachment 443088 [details] > > > Patch > > > > --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp > > +++ a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp > > @@ -2145,7 +2145,12 @@ VisiblePosition > > AccessibilityRenderObject::visiblePositionForIndex(int index) co > > if (!node) > > return VisiblePosition(); > > > > +#if USE(ATSPI) > > + // We need to consider replaced elements for GTK, as they will be > > presented with the 'object replacement character' (0xFFFC). > > + return { > > makeDeprecatedLegacyPosition(resolveCharacterLocation(makeRangeSelectingNodeC > > ontents(*node), index, > > TextIteratorBehavior::EmitsObjectReplacementCharacters)) }; > > > > Can we use > > > > VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope) > > > > in editing.cpp adding a TextIteratorBehaviors parameter to it? > > That was my initial idea, but it expects ContainerNode while we have just a > Node and I'm not sure it's ok to change visiblePositionForIndex to receive a > Node. It should be ok since it is only used for SimpleRange makeRangeSelectingNodeContents(Node& node)
Carlos Garcia Campos
Comment 6 2021-11-04 06:53:54 PDT
(In reply to Andres Gonzalez from comment #5) > (In reply to Carlos Garcia Campos from comment #4) > > (In reply to Andres Gonzalez from comment #3) > > > (In reply to Carlos Garcia Campos from comment #2) > > > > Created attachment 443088 [details] > > > > Patch > > > > > > --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp > > > +++ a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp > > > @@ -2145,7 +2145,12 @@ VisiblePosition > > > AccessibilityRenderObject::visiblePositionForIndex(int index) co > > > if (!node) > > > return VisiblePosition(); > > > > > > +#if USE(ATSPI) > > > + // We need to consider replaced elements for GTK, as they will be > > > presented with the 'object replacement character' (0xFFFC). > > > + return { > > > makeDeprecatedLegacyPosition(resolveCharacterLocation(makeRangeSelectingNodeC > > > ontents(*node), index, > > > TextIteratorBehavior::EmitsObjectReplacementCharacters)) }; > > > > > > Can we use > > > > > > VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope) > > > > > > in editing.cpp adding a TextIteratorBehaviors parameter to it? > > > > That was my initial idea, but it expects ContainerNode while we have just a > > Node and I'm not sure it's ok to change visiblePositionForIndex to receive a > > Node. > > It should be ok since it is only used for > > SimpleRange makeRangeSelectingNodeContents(Node& node) Ok! I'll do it
Andres Gonzalez
Comment 7 2021-11-04 06:57:35 PDT
Why the TextIteratorBehaviors need to be different for ATSPI vx. ATK or Mac? This should all be platform independent. Not saying that you should make it platform-independent, but just want to understand the differences.
Carlos Garcia Campos
Comment 8 2021-11-04 07:10:33 PDT
Carlos Garcia Campos
Comment 9 2021-11-04 07:13:50 PDT
(In reply to Andres Gonzalez from comment #7) > Why the TextIteratorBehaviors need to be different for ATSPI vx. ATK or Mac? > This should all be platform independent. Not saying that you should make it > platform-independent, but just want to understand the differences. I don't know how it's expected to behave in mac, it should be the same for ATK and ATSPI, but I don't want to change the ATK behavior in this patch. The handling of replaced objects is already broken in ATK and fixing it would require more changes not included in this patch. The new ATSPI implementation will replace the ATK one, so I don't plan to fix ATK at this point.
Carlos Garcia Campos
Comment 10 2021-11-05 01:22:50 PDT
Note You need to log in before you can comment on or make changes to this bug.