Bug 198938 - [lldb-webkit] Show whether frame is focused in Frame and Document summaries
Summary: [lldb-webkit] Show whether frame is focused in Frame and Document summaries
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Local Build
Hardware: iPhone / iPad iOS 12
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-17 16:26 PDT by Daniel Bates
Modified: 2019-08-23 09:51 PDT (History)
2 users (show)

See Also:


Attachments
Patch (4.08 KB, patch)
2019-06-17 16:30 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (4.24 KB, patch)
2019-08-23 09:51 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2019-06-17 16:26:41 PDT
I found it useful to know whether a Frame is focused or not when investigating bug #198922. Add this info to the Frame and Document summaries.
Comment 1 Daniel Bates 2019-06-17 16:30:52 PDT
Created attachment 372288 [details]
Patch
Comment 2 Simon Fraser (smfr) 2019-06-17 16:37:14 PDT
Comment on attachment 372288 [details]
Patch

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

> Tools/lldb/lldb_webkit.py:725
> +    def is_focused(self):
> +        page_ptr = self.valobj.GetChildMemberWithName('m_page')
> +        if not page_ptr or not bool(page_ptr.GetValueAsUnsigned(0)):
> +            return False
> +        # Every page has a FocusController.
> +        focus_controller_ptr = StdUniquePtrWrapper(page_ptr.GetChildMemberWithName('m_focusController'), dict())
> +        focused_frame_ptr = focus_controller_ptr.value().GetChildMemberWithName('m_focusedFrame').GetChildMemberWithName('m_ptr')
> +        return focused_frame_ptr.GetValueAsUnsigned(0) == self.valobj.GetAddress().GetFileAddress()

This seems very prone to breakage, for example if someone renamed m_focusedFrame. Can we instead add String Document::debugDescription() const, and call it from here?
Comment 3 Daniel Bates 2019-06-17 16:42:56 PDT
(In reply to Simon Fraser (smfr) from comment #2)
> Comment on attachment 372288 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=372288&action=review
> 
> > Tools/lldb/lldb_webkit.py:725
> > +    def is_focused(self):
> > +        page_ptr = self.valobj.GetChildMemberWithName('m_page')
> > +        if not page_ptr or not bool(page_ptr.GetValueAsUnsigned(0)):
> > +            return False
> > +        # Every page has a FocusController.
> > +        focus_controller_ptr = StdUniquePtrWrapper(page_ptr.GetChildMemberWithName('m_focusController'), dict())
> > +        focused_frame_ptr = focus_controller_ptr.value().GetChildMemberWithName('m_focusedFrame').GetChildMemberWithName('m_ptr')
> > +        return focused_frame_ptr.GetValueAsUnsigned(0) == self.valobj.GetAddress().GetFileAddress()
> 
> This seems very prone to breakage, for example if someone renamed
> m_focusedFrame. Can we instead add String Document::debugDescription()
> const, and call it from here?

With time... I can do anything you want 😀 I don't have such a luxury at the moment. R- the patch if this is a deal breaker and cannot be addressed at another junction.
Comment 4 Daniel Bates 2019-08-23 09:51:38 PDT
Created attachment 377130 [details]
Patch

I haven't had a chance to address Simon's remarks. Just posted an updated patch that I use locally for archiving.