Summary: | WebPage::getFocusedElementInformation should be robust when the focused element changes during layout | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Wenson Hsieh <wenson_hsieh> | ||||||
Component: | HTML Editing | Assignee: | Wenson Hsieh <wenson_hsieh> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | bdakin, commit-queue, ddkilzer, megan_gardner, rniwa, thorton, webkit-bug-importer, wenson_hsieh | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Wenson Hsieh
2020-02-11 13:46:12 PST
Created attachment 390421 [details]
Speculative fix
Comment on attachment 390421 [details] Speculative fix View in context: https://bugs.webkit.org/attachment.cgi?id=390421&action=review > Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2988 > + auto focusedElement = m_focusedElement; auto makes it impossible to tell if this retains the element or not. But it needs to, right? Comment on attachment 390421 [details] Speculative fix View in context: https://bugs.webkit.org/attachment.cgi?id=390421&action=review >> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2988 >> + auto focusedElement = m_focusedElement; > > auto makes it impossible to tell if this retains the element or not. But it needs to, right? Since m_focusedElement is a RefPtr<Element>, auto will just copy it (and ensure that it is reffed). If you think it's more clear, I can change this to `auto focusedElement = m_focusedElement.copyRef();` (In reply to Wenson Hsieh from comment #3) > Comment on attachment 390421 [details] > Speculative fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=390421&action=review > > >> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2988 > >> + auto focusedElement = m_focusedElement; > > > > auto makes it impossible to tell if this retains the element or not. But it needs to, right? > > Since m_focusedElement is a RefPtr<Element>, auto will just copy it (and > ensure that it is reffed). Right, but it's impossible to read the code above and tell that it is correct without referring to another file :D (In reply to Tim Horton from comment #4) > (In reply to Wenson Hsieh from comment #3) > > Comment on attachment 390421 [details] > > Speculative fix > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=390421&action=review > > > > >> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:2988 > > >> + auto focusedElement = m_focusedElement; > > > > > > auto makes it impossible to tell if this retains the element or not. But it needs to, right? > > > > Since m_focusedElement is a RefPtr<Element>, auto will just copy it (and > > ensure that it is reffed). > > Right, but it's impossible to read the code above and tell that it is > correct without referring to another file :D Please do call copyRef(). Created attachment 390456 [details]
Patch for landing
Changed to call copyRef() explicitly. Thanks for the review! Comment on attachment 390456 [details] Patch for landing Clearing flags on attachment: 390456 Committed r256401: <https://trac.webkit.org/changeset/256401> |