Bug 182588 - Web Inspector: Styles: Typing value and quickly moving focus away may display outdated value in UI
Summary: Web Inspector: Styles: Typing value and quickly moving focus away may display...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P1 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-02-07 16:26 PST by Nikita Vasilyev
Modified: 2018-02-08 15:18 PST (History)
4 users (show)

See Also:


Attachments
[Animated GIF] Bug (130.00 KB, image/gif)
2018-02-07 16:26 PST, Nikita Vasilyev
no flags Details
Patch (2.10 KB, patch)
2018-02-07 17:57 PST, Nikita Vasilyev
no flags Details | Formatted Diff | Diff
[Animated GIF] With patch applied (74.81 KB, image/gif)
2018-02-07 18:06 PST, Nikita Vasilyev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.