⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 243208 in webkit


Ignore:
Timestamp:
Mar 20, 2019, 9:28:16 AM (7 years ago)
Author:
Devin Rousso
Message:

Web Inspector: changes to CSS resources only take affect once editing stops
https://bugs.webkit.org/show_bug.cgi?id=195774
<rdar://problem/48905413>

Reviewed by Timothy Hatcher.

  • UserInterface/Controllers/CSSManager.js:

(WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges.styleSheetFound):
(WI.CSSManager.prototype._resourceContentDidChange):
(WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent):
(WI.CSSManager.prototype._updateResourceContent):
Use a Throttler instead of a 500ms debounce.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r243207 r243208  
     12019-03-20  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: changes to CSS resources only take affect once editing stops
     4        https://bugs.webkit.org/show_bug.cgi?id=195774
     5        <rdar://problem/48905413>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Controllers/CSSManager.js:
     10        (WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges.styleSheetFound):
     11        (WI.CSSManager.prototype._resourceContentDidChange):
     12        (WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent):
     13        (WI.CSSManager.prototype._updateResourceContent):
     14        Use a `Throttler` instead of a 500ms debounce.
     15
    1162019-03-20  Devin Rousso  <drousso@apple.com>
    217
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js

    r243038 r243208  
    642642            function styleSheetFound(styleSheet)
    643643            {
    644                 resource.__pendingChangeTimeout = undefined;
     644                resource.__pendingChangeTimeout.cancel();
    645645
    646646                console.assert(styleSheet);
     
    658658        }
    659659
    660         if (resource.__pendingChangeTimeout)
    661             clearTimeout(resource.__pendingChangeTimeout);
    662         resource.__pendingChangeTimeout = setTimeout(applyStyleSheetChanges.bind(this), 500);
     660        if (!resource.__pendingChangeTimeout)
     661            resource.__pendingChangeTimeout = new Throttler(applyStyleSheetChanges.bind(this), 100);
     662        resource.__pendingChangeTimeout.fire();
    663663    }
    664664
     
    669669        function fetchedStyleSheetContent(parameters)
    670670        {
     671            styleSheet.__pendingChangeTimeout.cancel();
     672
    671673            let representedObject = parameters.sourceCode;
    672             representedObject.__pendingChangeTimeout = undefined;
    673674
    674675            console.assert(representedObject.url);
     
    717718        }
    718719
    719         if (styleSheet.__pendingChangeTimeout)
    720             clearTimeout(styleSheet.__pendingChangeTimeout);
    721         styleSheet.__pendingChangeTimeout = setTimeout(applyStyleSheetChanges.bind(this), 500);
     720        if (!styleSheet.__pendingChangeTimeout)
     721            styleSheet.__pendingChangeTimeout = new Throttler(applyStyleSheetChanges.bind(this), 100);
     722        styleSheet.__pendingChangeTimeout.fire();
    722723    }
    723724};
Note: See TracChangeset for help on using the changeset viewer.