Bug 170090

Summary: Web Inspector: WebSockets: Messages log should remain being scrolled to the bottom when a new message is added
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, inspector-bugzilla-changes, mattbaker
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
mattbaker: review+
Patch none

Description Nikita Vasilyev 2017-03-24 17:40:02 PDT
Adding a new message to WebSockets content view should scroll it to the bottom when WebSockets content view was scrolled to the bottom right before the new message being added.

In this regard, WebSockets content view should behave the same as the Console.
Comment 1 Nikita Vasilyev 2017-03-27 17:00:53 PDT
Created attachment 305527 [details]
Patch
Comment 2 Matt Baker 2017-03-27 18:29:03 PDT
Comment on attachment 305527 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=305527&action=review

r=me, with some style suggestions.

> Source/WebInspectorUI/ChangeLog:16
> +        Batch WebSocketContentView DOM modifications using requestAnimationFrames.

"requestAnimationFrame" should be singular.

> Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js:103
> +        this._scheduledUpdateFramesIdentifier = requestAnimationFrame(() => this._updateFrames());

Utilities.js defines Object.onNextFrame, which does exactly this! You could probably switch to that and remove a bunch of boilerplate.

For an example see TreeElement.js:194.

> Source/WebInspectorUI/UserInterface/Views/WebSocketContentView.js:145
> +            isText: opcode === WebInspector.WebSocketResource.OpCodes.TextFrame,

Since its value is used above, `isText` could be a stand-alone variable, defined and initialized above `nodeText`:

let isText = opcode === WebInspector.WebSocketResource.OpCodes.TextFrame;
let nodeText = isText ? data : WebInspector.WebSocketContentView.textForOpcode(opcode);

let attributes = {isOutgoing, isText};
...
Comment 3 Nikita Vasilyev 2017-03-29 17:25:05 PDT
Created attachment 305813 [details]
Patch
Comment 4 WebKit Commit Bot 2017-03-29 18:06:34 PDT
Comment on attachment 305813 [details]
Patch

Clearing flags on attachment: 305813

Committed r214587: <http://trac.webkit.org/changeset/214587>
Comment 5 WebKit Commit Bot 2017-03-29 18:06:39 PDT
All reviewed patches have been landed.  Closing bug.