Changeset 196798 in webkit


Ignore:
Timestamp:
Feb 18, 2016 9:26:53 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Styles Sidebar focus jumps when trying to edit a color
https://bugs.webkit.org/show_bug.cgi?id=154404
<rdar://problem/24725744>

Patch by Devin Rousso <Devin Rousso> on 2016-02-18
Reviewed by Timothy Hatcher.

Clicking an inline swatch in the CSS Rules sidebar causes any focused
editor, if any, to become blurred and therefore fire its handler function.
This causes an issue because when a CodeMirror instance in the styles
sidebar becomes blurred, it is possible for the entire Rules sidebar to
refresh and recreate all of the sections (r187714), meaning that it will
reselect whatever editor was previously selected before the refresh,
causing the swatch popup to be blurred and therefore dismiss.

  • UserInterface/Views/CSSStyleDeclarationSection.js:

(WebInspector.CSSStyleDeclarationSection.prototype.cssStyleDeclarationTextEditorBlurActiveEditor):

  • UserInterface/Views/CSSStyleDeclarationTextEditor.js:

(WebInspector.CSSStyleDeclarationTextEditor.prototype._createInlineSwatches.createSwatch):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._inlineSwatchBeforeClicked):
Add listener for new event and call to delegate function for handling it.

  • UserInterface/Views/InlineSwatch.js:

(WebInspector.InlineSwatch.prototype._swatchElementClicked):
Now fires an event before the clicked logic happens, but still after the
click event is fired on the element.

  • UserInterface/Views/RulesStyleDetailsPanel.js:

(WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionBlurActiveEditor):
Clears the previously focused editor so when a reset happens no editor
is refocused.

Location:
trunk/Source/WebInspectorUI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r196788 r196798  
     12016-02-18  Devin Rousso  <dcrousso+webkit@gmail.com>
     2
     3        Web Inspector: Styles Sidebar focus jumps when trying to edit a color
     4        https://bugs.webkit.org/show_bug.cgi?id=154404
     5        <rdar://problem/24725744>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        Clicking an inline swatch in the CSS Rules sidebar causes any focused
     10        editor, if any, to become blurred and therefore fire its handler function.
     11        This causes an issue because when a CodeMirror instance in the styles
     12        sidebar becomes blurred, it is possible for the entire Rules sidebar to
     13        refresh and recreate all of the sections (r187714), meaning that it will
     14        reselect whatever editor was previously selected before the refresh,
     15        causing the swatch popup to be blurred and therefore dismiss.
     16
     17        * UserInterface/Views/CSSStyleDeclarationSection.js:
     18        (WebInspector.CSSStyleDeclarationSection.prototype.cssStyleDeclarationTextEditorBlurActiveEditor):
     19
     20        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
     21        (WebInspector.CSSStyleDeclarationTextEditor.prototype._createInlineSwatches.createSwatch):
     22        (WebInspector.CSSStyleDeclarationTextEditor.prototype._inlineSwatchBeforeClicked):
     23        Add listener for new event and call to delegate function for handling it.
     24
     25        * UserInterface/Views/InlineSwatch.js:
     26        (WebInspector.InlineSwatch.prototype._swatchElementClicked):
     27        Now fires an event before the clicked logic happens, but still after the
     28        click event is fired on the element.
     29
     30        * UserInterface/Views/RulesStyleDetailsPanel.js:
     31        (WebInspector.RulesStyleDetailsPanel.prototype.cssStyleDeclarationSectionBlurActiveEditor):
     32        Clears the previously focused editor so when a reset happens no editor
     33        is refocused.
     34
    1352016-02-18  Joseph Pecoraro  <pecoraro@apple.com>
    236
  • trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js

    r196739 r196798  
    325325    }
    326326
     327    cssStyleDeclarationTextEditorBlurActiveEditor()
     328    {
     329        if (typeof this._delegate.cssStyleDeclarationSectionBlurActiveEditor === "function")
     330            this._delegate.cssStyleDeclarationSectionBlurActiveEditor(this);
     331    }
     332
    327333    cssStyleDeclarationTextEditorSwitchRule(reverse)
    328334    {
  • trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js

    r196746 r196798  
    872872        function createSwatch(swatch, marker, valueObject, valueString)
    873873        {
     874            swatch.addEventListener(WebInspector.InlineSwatch.Event.BeforeClicked, this._inlineSwatchBeforeClicked, this);
    874875            swatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged, this._inlineSwatchValueChanged, this);
    875876
     
    13031304    }
    13041305
     1306    _inlineSwatchBeforeClicked(event)
     1307    {
     1308        if (this._delegate && typeof this._delegate.cssStyleDeclarationTextEditorBlurActiveEditor === "function")
     1309            this._delegate.cssStyleDeclarationTextEditorBlurActiveEditor();
     1310    }
     1311
    13051312    _inlineSwatchValueChanged(event)
    13061313    {
  • trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js

    r194977 r196798  
    107107    _swatchElementClicked(event)
    108108    {
     109        this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.BeforeClicked);
     110
    109111        if (this._type === WebInspector.InlineSwatch.Type.Color && event.shiftKey && this._value) {
    110112            let nextFormat = this._value.nextFormat();
     
    265267
    266268WebInspector.InlineSwatch.Event = {
     269    BeforeClicked: "inline-swatch-before-clicked",
    267270    ValueChanged: "inline-swatch-value-changed"
    268271};
  • trunk/Source/WebInspectorUI/UserInterface/Views/RulesStyleDetailsPanel.js

    r194717 r196798  
    321321    }
    322322
     323    cssStyleDeclarationSectionBlurActiveEditor()
     324    {
     325        this._previousFocusedSection = null;
     326    }
     327
    323328    cssStyleDeclarationSectionEditorNextRule(currentSection)
    324329    {
Note: See TracChangeset for help on using the changeset viewer.