RESOLVED FIXED Bug 193305
Web Inspector: Styles: easier way to select a single line
https://bugs.webkit.org/show_bug.cgi?id=193305
Summary Web Inspector: Styles: easier way to select a single line
Devin Rousso
Reported 2019-01-09 15:25:18 PST
If I have a single property within a rule, there's no way for me to highlight it so I can copy/paste it :(
Attachments
[Animated GIF] Select single property (14.08 KB, image/gif)
2019-01-10 13:14 PST, Nikita Vasilyev
no flags
Patch (3.44 KB, patch)
2019-02-08 15:30 PST, Nikita Vasilyev
hi: review+
hi: commit-queue-
[Video] With patch applied (1.08 MB, video/quicktime)
2019-02-08 15:34 PST, Nikita Vasilyev
no flags
Patch for landing (3.70 KB, patch)
2019-02-08 17:25 PST, Nikita Vasilyev
nvasilyev: commit-queue+
Patch for landing (3.69 KB, patch)
2019-02-08 17:26 PST, Nikita Vasilyev
no flags
Nikita Vasilyev
Comment 1 2019-01-10 13:14:37 PST
Created attachment 358823 [details] [Animated GIF] Select single property It's possible, but it's cumbersome. 1. Mousedown on the property 2. Move mouse cursor away from the property 3. Hover the property again
Nikita Vasilyev
Comment 2 2019-01-10 13:16:02 PST
*** Bug 191126 has been marked as a duplicate of this bug. ***
Devin Rousso
Comment 3 2019-01-10 13:19:38 PST
(In reply to Nikita Vasilyev from comment #1) > It's possible, but it's cumbersome. Oh wow, yeah that's not fun :( Glad to know that there is some way though :)
Nikita Vasilyev
Comment 4 2019-02-08 15:30:36 PST
Nikita Vasilyev
Comment 5 2019-02-08 15:34:24 PST
Created attachment 361544 [details] [Video] With patch applied
Devin Rousso
Comment 6 2019-02-08 16:58:00 PST
Comment on attachment 361542 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=361542&action=review r=me, nice! > Source/WebInspectorUI/ChangeLog:8 > + Start property selection if mouse cursor moved more than 8px after mousedown. Why 8px? I'm guessing it's related to the size of a single character, but perhaps we should be a bit more "exact" about it. Some explanation would be useful. > Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:49 > + this._boundHandleWindowMouseMove = this._handleWindowMouseMove.bind(this); Please lazy initialize this when it's first needed (although keep it as null in the constructor). > Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:411 > + this._mouseDownPoint = WI.Point.fromEvent(event); We should also define `_mouseDownPoint` as a `null` value in the constructor. > Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:412 > + window.addEventListener("mousemove", this._boundHandleWindowMouseMove, false); You can drop the `false`. > Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:433 > + console.assert(this._mouseDownPoint); Style: add a newline after. > Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:434 > + if (WI.Point.fromEvent(event).distance(this._mouseDownPoint) > 8) { NIT: I'd rather you put the "known" value first and compare it to the current value, like `this._mouseDownPoint.distance(WI.Point.fromEvent(event))`. This way, it's a little less "chaining" and a bit easier to read. NIT: we should invert this and make it an early return. > Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:435 > + if (!this._propertiesEditor.hasSelectedProperties()) Is it actually possible for `hasSelectedProperties()` to be true? We clear any selection when we "mousedown" so it should be cleared before are able to move the mouse (and therefore fire this listener). > Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:436 > + this._propertiesEditor.selectProperties(this._mouseDownIndex, this._mouseDownIndex); Should we check that `_mouseDownIndex` isn't `NaN`? We only set it to a value when there's a property underneath the mouse in "mousedown". I know we set `display: none` when there are no properties, but maybe we should assert just in case.
Nikita Vasilyev
Comment 7 2019-02-08 17:24:24 PST
Comment on attachment 361542 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=361542&action=review >> Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:435 >> + if (!this._propertiesEditor.hasSelectedProperties()) > > Is it actually possible for `hasSelectedProperties()` to be true? We clear any selection when we "mousedown" so it should be cleared before are able to move the mouse (and therefore fire this listener). Yes, it's possible if we hover another property before moving 8px.
Nikita Vasilyev
Comment 8 2019-02-08 17:25:36 PST Comment hidden (obsolete)
Nikita Vasilyev
Comment 9 2019-02-08 17:26:41 PST
Created attachment 361571 [details] Patch for landing
WebKit Commit Bot
Comment 10 2019-02-08 17:47:14 PST
Comment on attachment 361571 [details] Patch for landing Clearing flags on attachment: 361571 Committed r241226: <https://trac.webkit.org/changeset/241226>
WebKit Commit Bot
Comment 11 2019-02-08 17:47:16 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 12 2019-02-08 17:48:29 PST
Note You need to log in before you can comment on or make changes to this bug.