Bug 185369

Summary: Web Inspector: Console drawer resizing is broken when console prompt has >1 line of code
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Matt Baker <mattbaker>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, hi, inspector-bugzilla-changes, mattbaker, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[Video] Screencast
none
Patch
none
[Video] With fix none

Nikita Vasilyev
Reported 2018-05-06 19:26:11 PDT
Created attachment 339701 [details] [Video] Screencast Steps: 1. Open Elements tab. 2. Press Escape key to open the console drawer. 3. Type `function a() {`, press Return several times 4. Try to resize the console drawer now. Notes: Console drawer resizing works as expected when it's empty or has only one line of code. This is not a recent regression.
Attachments
[Video] Screencast (4.77 MB, video/quicktime)
2018-05-06 19:26 PDT, Nikita Vasilyev
no flags
Patch (1.89 KB, patch)
2018-05-07 18:10 PDT, Matt Baker
no flags
[Video] With fix (500.10 KB, video/mp4)
2018-05-07 18:16 PDT, Matt Baker
no flags
Radar WebKit Bug Importer
Comment 1 2018-05-06 19:26:34 PDT
Matt Baker
Comment 2 2018-05-07 18:10:16 PDT
Matt Baker
Comment 3 2018-05-07 18:16:06 PDT
Created attachment 339784 [details] [Video] With fix
Nikita Vasilyev
Comment 4 2018-05-07 18:21:22 PDT
(In reply to Matt Baker from comment #2) > Created attachment 339783 [details] > Patch Works as expected. The code looks good. At 0:10 of the video you can see there's some z-index issues with the right sidebar tabs, but it's a separate issue.
Devin Rousso
Comment 5 2018-05-07 18:35:23 PDT
Comment on attachment 339783 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=339783&action=review r=me Nice fix! > Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:125 > + let quickConsoleHeight = window.innerHeight - (this.element.totalOffsetTop + this.height); NIT: I'd prefer this be rewritten without the parenthesis, as I first thought that the `this.element.totalOffsetTop` and `this.height` were somehow "related". A comment might also help explaining that "this gets the full height of the console prompt by taking into account the current position of the console drawer and its height with respect to the entire inspector area, so that the remainder is the height of the console prompt", or something like that. Shame that there's no easy way of getting the height from the `WI.ConsolePrompt` and passing it in here. This method works just fine though.
Matt Baker
Comment 6 2018-05-08 16:02:30 PDT
(In reply to Devin Rousso from comment #5) > Comment on attachment 339783 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=339783&action=review > > r=me > > Nice fix! > > > Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:125 > > + let quickConsoleHeight = window.innerHeight - (this.element.totalOffsetTop + this.height); > > NIT: I'd prefer this be rewritten without the parenthesis, as I first > thought that the `this.element.totalOffsetTop` and `this.height` were > somehow "related". The parenthesis are needed. Arithmetic operators are left-associative: jsc: >>> 1 - 1 + 1 1 >>> 1 - (1 + 1) -1
Devin Rousso
Comment 7 2018-05-08 16:23:52 PDT
(In reply to Matt Baker from comment #6) > (In reply to Devin Rousso from comment #5) > > Comment on attachment 339783 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=339783&action=review > > > > r=me > > > > Nice fix! > > > > > Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js:125 > > > + let quickConsoleHeight = window.innerHeight - (this.element.totalOffsetTop + this.height); > > > > NIT: I'd prefer this be rewritten without the parenthesis, as I first > > thought that the `this.element.totalOffsetTop` and `this.height` were > > somehow "related". > > The parenthesis are needed. Arithmetic operators are left-associative: > > jsc: > >>> 1 - 1 + 1 > 1 > > >>> 1 - (1 + 1) > -1 Oh lol, I should've specified that you'd have to flip the sign as well. let quickConsoleHeight = window.innerHeight - this.element.totalOffsetTop - this.height;
WebKit Commit Bot
Comment 8 2018-05-08 17:09:47 PDT
Comment on attachment 339783 [details] Patch Clearing flags on attachment: 339783 Committed r231527: <https://trac.webkit.org/changeset/231527>
WebKit Commit Bot
Comment 9 2018-05-08 17:09:48 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.