RESOLVED FIXED 187020
Web Inspector: REGRESSION (r213000): copy from Search results content view broken
https://bugs.webkit.org/show_bug.cgi?id=187020
Summary Web Inspector: REGRESSION (r213000): copy from Search results content view br...
Matt Baker
Reported 2018-06-25 15:07:48 PDT
Summary: Copy from Search results content view broken. The selected tree element always takes precedence over the TextEditor selection. Steps to Reproduce: 1. Inspect webkit.org, search for "body" 2. Select a tree element in the Search tab 3. Select some text in the editor 4. Copy Expected: => Selection in editor is copied Actual: => Tree element is copied Regressed in https://bugs.webkit.org/show_bug.cgi?id=167074.
Attachments
Patch (2.18 KB, patch)
2018-06-25 15:11 PDT, Matt Baker
no flags
Patch (2.31 KB, patch)
2018-06-28 14:02 PDT, Matt Baker
no flags
Matt Baker
Comment 1 2018-06-25 15:08:02 PDT
Matt Baker
Comment 2 2018-06-25 15:11:27 PDT
Joseph Pecoraro
Comment 3 2018-06-25 15:25:10 PDT
Comment on attachment 343547 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=343547&action=review > Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js:102 > handleCopyEvent(event) > { > + let currentContentView = this.contentBrowser.currentContentView; Is this specific to the SearchTab? If so why doesn't it happen in other tabs?
Timothy Hatcher
Comment 4 2018-06-25 15:26:39 PDT
Comment on attachment 343547 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=343547&action=review > Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js:113 > + let currentContentView = this.contentBrowser.currentContentView; > + if (currentContentView) { > + if (currentContentView instanceof WI.ClusterContentView) > + currentContentView = currentContentView.contentViewContainer.currentContentView; > + > + if (currentContentView.textEditor) { > + let range = currentContentView.textEditor.selectedTextRange; > + // If the TextEditor contains a selection, don't override the default copy behavior. > + if (range.startLine !== range.endLine || range.startColumn !== range.endColumn) > + return; > + } > + } This seems like it should be passed and handled at another level, since Search isn't the only client of cluster views and nested content browsers. For example, WI.ClusterContentView passes through handleCopyEvent already. Maybe ContentBrowser needs this most of this code? But it shouldn't know about TextEditor either. Hmm.
Matt Baker
Comment 5 2018-06-25 16:26:35 PDT
Comment on attachment 343547 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=343547&action=review >> Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js:102 >> + let currentContentView = this.contentBrowser.currentContentView; > > Is this specific to the SearchTab? If so why doesn't it happen in other tabs? It is. A check for handleCopyEvent support was added for TabContentView, and SearchTabContentView is the only implementor.
Matt Baker
Comment 6 2018-06-25 16:34:05 PDT
Comment on attachment 343547 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=343547&action=review >> Source/WebInspectorUI/UserInterface/Views/SearchTabContentView.js:113 >> + } > > This seems like it should be passed and handled at another level, since Search isn't the only client of cluster views and nested content browsers. > > For example, WI.ClusterContentView passes through handleCopyEvent already. Maybe ContentBrowser needs this most of this code? But it shouldn't know about TextEditor either. Hmm. This doesn't have anything to do with ClusterContentView or nesting. SearchTabContentView is implementing handleCopyEvent, which causes WI._copy to override the default behavior (coping the CodeMirror selection). What would your expectation be if this were performed at a higher level? Should WI._copy bail out early if focusedContentView has a text selection?
Matt Baker
Comment 7 2018-06-28 14:02:24 PDT
Timothy Hatcher
Comment 8 2018-06-28 15:11:14 PDT
Comment on attachment 343847 [details] Patch I like this better. This might be something we should do elsewhere or generally in WI._copy. But I don't see any other handleCopyEvent code paths that would have this same issue.
WebKit Commit Bot
Comment 9 2018-06-28 15:38:48 PDT
Comment on attachment 343847 [details] Patch Clearing flags on attachment: 343847 Committed r233334: <https://trac.webkit.org/changeset/233334>
WebKit Commit Bot
Comment 10 2018-06-28 15:38:49 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.