Bug 230204

Summary: [macOS] Avoid computing post-layout EditorState data unless necessary
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: akeerthi, bdakin, hi, megan_gardner, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 230238    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Just for EWS
none
For EWS
none
For EWS none

Wenson Hsieh
Reported 2021-09-12 11:51:35 PDT
.
Attachments
Patch (14.42 KB, patch)
2021-09-13 18:29 PDT, Wenson Hsieh
no flags
Just for EWS (14.51 KB, patch)
2021-09-13 18:30 PDT, Wenson Hsieh
no flags
For EWS (16.91 KB, patch)
2021-09-14 08:37 PDT, Wenson Hsieh
no flags
For EWS (18.21 KB, patch)
2021-09-14 13:36 PDT, Wenson Hsieh
no flags
Radar WebKit Bug Importer
Comment 1 2021-09-13 16:55:59 PDT
Wenson Hsieh
Comment 2 2021-09-13 18:29:00 PDT Comment hidden (obsolete)
Wenson Hsieh
Comment 3 2021-09-13 18:30:31 PDT Comment hidden (obsolete)
Wenson Hsieh
Comment 4 2021-09-14 08:37:58 PDT
Devin Rousso
Comment 5 2021-09-14 13:13:30 PDT
Comment on attachment 438144 [details] For EWS View in context: https://bugs.webkit.org/attachment.cgi?id=438144&action=review r=me, neat stuff :) > Source/WebKit/WebProcess/WebPage/WebPage.cpp:1234 > - result.isContentEditable = selection.isContentEditable(); > + result.isContentEditable = selection.hasEditableStyle(); These appear to have different `UserSelectAllTreatment`. Is that a problem? > Source/WebKit/WebProcess/WebPage/WebPage.cpp:1327 > + auto isEditable = frame->selection().selection().hasEditableStyle() ? EditorStateIsContentEditable::Yes : EditorStateIsContentEditable::No; ditto (:1231) > Source/WebKit/WebProcess/WebPage/WebPage.cpp:3561 > m_hasEverFocusedElementDueToUserInteractionSincePageTransition = false; NIT: Shouldn't this really be inside a `HAVE(TOUCH_BAR)`? > Source/WebKit/WebProcess/WebPage/WebPage.cpp:5979 > - m_hasEverFocusedElementDueToUserInteractionSincePageTransition |= m_userIsInteracting; > + if (m_userIsInteracting && m_focusedElement) > + m_hasEverFocusedElementDueToUserInteractionSincePageTransition = true; This seems like a actual functional difference. Is it something we can/should test? > Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:1089 > + if (m_needsFontAttributes) NIT: it'd be nice if we could add comments explaining why these things require computing post layout data
Wenson Hsieh
Comment 6 2021-09-14 13:27:31 PDT
Comment on attachment 438144 [details] For EWS View in context: https://bugs.webkit.org/attachment.cgi?id=438144&action=review >> Source/WebKit/WebProcess/WebPage/WebPage.cpp:1234 >> + result.isContentEditable = selection.hasEditableStyle(); > > These appear to have different `UserSelectAllTreatment`. Is that a problem? I don't think this will be an issue since we already use this option when grabbing the `rootEditableElement()`, computing editing style, and other adjacent codepaths. (`isContentRichlyEditable()` also uses this option, so it would be consistent with that) >> Source/WebKit/WebProcess/WebPage/WebPage.cpp:3561 >> m_hasEverFocusedElementDueToUserInteractionSincePageTransition = false; > > NIT: Shouldn't this really be inside a `HAVE(TOUCH_BAR)`? Moved this into `HAVE(TOUCH_BAR)` instead. >> Source/WebKit/WebProcess/WebPage/WebPage.cpp:5979 >> + m_hasEverFocusedElementDueToUserInteractionSincePageTransition = true; > > This seems like a actual functional difference. Is it something we can/should test? It's not actually clear to me what the functional difference would be, since this should only prevent us from setting `m_hasEverFocusedElementDueToUserInteractionSincePageTransition` to true in cases where we wouldn't have tried to show the text editing controls on the Touch Bar anyways. >> Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:1089 >> + if (m_needsFontAttributes) > > NIT: it'd be nice if we could add comments explaining why these things require computing post layout data This is because font attributes are plumbed through post-layout data. I'll add comments clarifying this.
Wenson Hsieh
Comment 7 2021-09-14 13:36:19 PDT
EWS
Comment 8 2021-09-14 15:43:05 PDT
Committed r282419 (241678@main): <https://commits.webkit.org/241678@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 438162 [details].
Note You need to log in before you can comment on or make changes to this bug.