Bug 182588

Summary: Web Inspector: Styles: Typing value and quickly moving focus away may display outdated value in UI
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, inspector-bugzilla-changes, mattbaker, webkit-bug-importer
Priority: P1 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[Animated GIF] Bug
none
Patch
none
[Animated GIF] With patch applied none

Description Nikita Vasilyev 2018-02-07 16:26:18 PST
Created attachment 333332 [details]
[Animated GIF] Bug

Steps:
1. Add a new property "border".
2. Press Tab.
3. Quickly type "10px solid" and press Tab.

Expected:
Styles sidebar shows "border: 10px solid".

Actual:
Styles sidebar may show "border: ;".

Notes:
To make this bug easier to reproduce, change `WI.SpreadsheetStyleProperty.CommitCoalesceDelay = 250` to `1000`.
This is what I did in the attached animated GIF.
Comment 1 Radar WebKit Bug Importer 2018-02-07 16:29:12 PST
<rdar://problem/37332161>
Comment 2 Nikita Vasilyev 2018-02-07 16:32:06 PST
    spreadsheetTextFieldDidChange(textField)
    {
        if (textField === this._valueTextField)
            this.debounce(WI.SpreadsheetStyleProperty.CommitCoalesceDelay)._handleValueChange();

Because of the debounce function, values may get saved after losing the focus. When repaint happens, it displays old values.

We may get away by simply not using the debounce for values.
Comment 3 Nikita Vasilyev 2018-02-07 17:57:05 PST
Created attachment 333345 [details]
Patch
Comment 4 Nikita Vasilyev 2018-02-07 18:04:26 PST
Updates appear faster without the debounce, it feels better UX overall.

If we do have to throttle, it should be front-end to back-end payload (CSSAgent.setStyleText), not view to model.
Comment 5 Nikita Vasilyev 2018-02-07 18:06:01 PST
Created attachment 333346 [details]
[Animated GIF] With patch applied
Comment 6 Matt Baker 2018-02-08 14:54:47 PST
Comment on attachment 333345 [details]
Patch

r=me
Comment 7 WebKit Commit Bot 2018-02-08 15:18:33 PST
Comment on attachment 333345 [details]
Patch

Clearing flags on attachment: 333345

Committed r228296: <https://trac.webkit.org/changeset/228296>
Comment 8 WebKit Commit Bot 2018-02-08 15:18:34 PST
All reviewed patches have been landed.  Closing bug.