Bug 232755

Summary: [GTK][a11y] Add implementation of document interface when building with ATSPI
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, aperez, apinheiro, bugs-noreply, cfleizach, dmazzoni, ews-watchlist, jcraig, jdiggs, samuel_white
Priority: P2 Keywords: Gtk
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 232749    
Bug Blocks: 230253, 232782    
Attachments:
Description Flags
Patch
none
Patch
none
Patch aperez: review+

Description Carlos Garcia Campos 2021-11-05 06:12:56 PDT
Implement document
Comment 1 Carlos Garcia Campos 2021-11-05 06:17:29 PDT
Created attachment 443390 [details]
Patch

This won't apply because it depends on other bugs not fixed yet.
Comment 2 Carlos Garcia Campos 2021-11-19 05:45:40 PST
Created attachment 444809 [details]
Patch
Comment 3 Carlos Garcia Campos 2021-11-19 06:31:13 PST
Created attachment 444813 [details]
Patch
Comment 4 Adrian Perez 2021-11-19 06:42:01 PST
Comment on attachment 444813 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=444813&action=review

> Source/WebCore/accessibility/atspi/AccessibilityObjectDocumentAtspi.cpp:112
> +            return map;

I would first check m_coreObject and do the early return, after that we know
that it will not be null and avoid checking it again. I am thinking of this:

  if (!m_coreObject)
      return map;

  m_coreObject->updateBackingStore();
  auto* document = m_coreObject->document();
  // ...rest of the code as it was...

> Source/WebCore/accessibility/atspi/AccessibilityObjectDocumentAtspi.cpp:148
> +            return { };

Same here, there are two null-checks on m_coreObject one right after the other.
Comment 5 Carlos Garcia Campos 2021-11-19 06:46:20 PST
Comment on attachment 444813 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=444813&action=review

>> Source/WebCore/accessibility/atspi/AccessibilityObjectDocumentAtspi.cpp:112
>> +            return map;
> 
> I would first check m_coreObject and do the early return, after that we know
> that it will not be null and avoid checking it again. I am thinking of this:
> 
>   if (!m_coreObject)
>       return map;
> 
>   m_coreObject->updateBackingStore();
>   auto* document = m_coreObject->document();
>   // ...rest of the code as it was...

This is because updateBackingStore can make m_coreObject nullptr.

>> Source/WebCore/accessibility/atspi/AccessibilityObjectDocumentAtspi.cpp:148
>> +            return { };
> 
> Same here, there are two null-checks on m_coreObject one right after the other.

Same here, the pattern is repeated everywhere.
Comment 6 Adrian Perez 2021-11-19 06:49:46 PST
(In reply to Carlos Garcia Campos from comment #5)
> Comment on attachment 444813 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=444813&action=review
> 
> >> Source/WebCore/accessibility/atspi/AccessibilityObjectDocumentAtspi.cpp:112
> >> +            return map;
> > 
> > I would first check m_coreObject and do the early return, after that we know
> > that it will not be null and avoid checking it again. I am thinking of this:
> > 
> >   if (!m_coreObject)
> >       return map;
> > 
> >   m_coreObject->updateBackingStore();
> >   auto* document = m_coreObject->document();
> >   // ...rest of the code as it was...
> 
> This is because updateBackingStore can make m_coreObject nullptr.
> 
> >> Source/WebCore/accessibility/atspi/AccessibilityObjectDocumentAtspi.cpp:148
> >> +            return { };
> > 
> > Same here, there are two null-checks on m_coreObject one right after the other.
> 
> Same here, the pattern is repeated everywhere.

Right. Thanks for commenting on this :-)
Comment 7 Carlos Garcia Campos 2021-11-19 06:51:21 PST
Committed r286059 (244446@main): <https://commits.webkit.org/244446@main>