Changeset 243826 in webkit


Ignore:
Timestamp:
Apr 3, 2019, 2:03:58 PM (6 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Single click on links in non-read-only TextEditors should not follow links
https://bugs.webkit.org/show_bug.cgi?id=123364
<rdar://problem/15323913>

Reviewed by Timothy Hatcher.

  • UserInterface/Base/Main.js:

(WI._updateModifierKeys):
Add classes to the body whenever alt, shift, or ctrl are pressed.

  • UserInterface/Views/CodeMirrorEditor.js:

(WI.CodeMirrorEditor.create):
Add a read-only class if the CodeMirror is readonly.

  • UserInterface/Views/SyntaxHighlightingDefaultTheme.css:

(.cm-s-default .cm-link,):
(.read-only.cm-s-default .cm-link:hover,):
(.cm-s-default .cm-link:hover,): Deleted.

  • UserInterface/Views/TextEditor.js:

(WI.TextEditor.prototype.set readOnly):
(WI.TextEditor.prototype._openClickedLinks):

Location:
trunk/Source/WebInspectorUI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r243819 r243826  
     12019-04-03  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Single click on links in non-read-only TextEditors should not follow links
     4        https://bugs.webkit.org/show_bug.cgi?id=123364
     5        <rdar://problem/15323913>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * UserInterface/Base/Main.js:
     10        (WI._updateModifierKeys):
     11        Add classes to the body whenever alt, shift, or ctrl are pressed.
     12
     13        * UserInterface/Views/CodeMirrorEditor.js:
     14        (WI.CodeMirrorEditor.create):
     15        Add a `read-only` class if the `CodeMirror` is readonly.
     16
     17        * UserInterface/Views/SyntaxHighlightingDefaultTheme.css:
     18        (.cm-s-default .cm-link,):
     19        (.read-only.cm-s-default .cm-link:hover,):
     20        (.cm-s-default .cm-link:hover,): Deleted.
     21
     22        * UserInterface/Views/TextEditor.js:
     23        (WI.TextEditor.prototype.set readOnly):
     24        (WI.TextEditor.prototype._openClickedLinks):
     25
    1262019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
    227
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r243355 r243826  
    16521652WI._updateModifierKeys = function(event)
    16531653{
    1654     let metaKeyDidChange = this.modifierKeys.metaKey !== event.metaKey;
    1655     let didChange = this.modifierKeys.altKey !== event.altKey || metaKeyDidChange || this.modifierKeys.shiftKey !== event.shiftKey;
    1656 
    1657     this.modifierKeys = {altKey: event.altKey, metaKey: event.metaKey, shiftKey: event.shiftKey};
    1658 
    1659     if (metaKeyDidChange)
    1660         document.body.classList.toggle("meta-key-pressed", this.modifierKeys.metaKey);
    1661 
    1662     if (didChange)
     1654    let keys = {
     1655        altKey: event.altKey,
     1656        metaKey: event.metaKey,
     1657        ctrlKey: event.ctrlKey,
     1658        shiftKey: event.shiftKey,
     1659    };
     1660
     1661    let changed = !Object.shallowEqual(this.modifierKeys, keys);
     1662
     1663    this.modifierKeys = keys;
     1664
     1665    document.body.classList.toggle("alt-key-pressed", this.modifierKeys.altKey);
     1666    document.body.classList.toggle("ctrl-key-pressed", this.modifierKeys.ctrlKey);
     1667    document.body.classList.toggle("meta-key-pressed", this.modifierKeys.metaKey);
     1668    document.body.classList.toggle("shift-key-pressed", this.modifierKeys.shiftKey);
     1669
     1670    if (changed)
    16631671        this.notifications.dispatchEventToListeners(WI.Notification.GlobalModifierKeysDidChange, event);
    16641672};
  • trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js

    r233920 r243826  
    3232        // Clients can override this if custom layout for RTL is available.
    3333        element.setAttribute("dir", "ltr");
     34        element.classList.toggle("read-only", options.readOnly);
    3435
    3536        let codeMirror = new CodeMirror(element, options);
  • trunk/Source/WebInspectorUI/UserInterface/Views/SyntaxHighlightingDefaultTheme.css

    r239760 r243826  
    8383.syntax-highlighted a {
    8484    text-decoration: none;
    85     cursor: pointer;
    8685}
    8786
    88 .cm-s-default .cm-link:hover,
     87.read-only.cm-s-default .cm-link:hover,
     88.mac-platform.meta-key-pressed :not(.read-only).cm-s-default .cm-link:hover,
     89:not(.mac-platform).control-key-pressed :not(.read-only).cm-s-default .cm-link:hover,
    8990.syntax-highlighted a:hover {
    9091    text-decoration: underline;
     92    cursor: pointer;
    9193}
    9294
  • trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js

    r242018 r243826  
    181181    {
    182182        this._codeMirror.setOption("readOnly", readOnly);
     183        this._codeMirror.getWrapperElement().classList.toggle("read-only", !!readOnly);
    183184    }
    184185
     
    16881689    _openClickedLinks(event)
    16891690    {
     1691        if (!this.readOnly && !event.commandOrControlKey)
     1692            return;
     1693
    16901694        // Get the position in the text and the token at that position.
    16911695        var position = this._codeMirror.coordsChar({left: event.pageX, top: event.pageY});
Note: See TracChangeset for help on using the changeset viewer.