Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Web Inspector: Color swatch shouldn't show tooltip when read-only
https://bugs.webkit.org/show_bug.cgi?id=257764
rdar://110409252

Reviewed by Patrick Angle.

Added a check to make sure inline color swatch is not read only before adding tooltips.

* Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js:
(WI.InlineSwatch.prototype._updateSwatch):

Canonical link: https://commits.webkit.org/265039@main
  • Loading branch information
AnujPanta1 authored and patrickangle committed Jun 9, 2023
1 parent c976622 commit 5753a82
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js
Expand Up @@ -195,13 +195,15 @@ WI.InlineSwatch = class InlineSwatch extends WI.Object

switch (this._type) {
case WI.InlineSwatch.Type.Color:
let title = WI.UIString("Click to select a color.");
if (this._allowChangingColorFormats())
title += "\n" + WI.UIString("Shift-click to switch color formats.");
if (InspectorFrontendHost.canPickColorFromScreen())
title += "\n" + WI.UIString("Option-click to pick color from screen.");

this._swatchElement.title = title;
if (!this._readOnly) {
let title = WI.UIString("Click to select a color.");
if (this._allowChangingColorFormats())
title += "\n" + WI.UIString("Shift-click to switch color formats.");
if (InspectorFrontendHost.canPickColorFromScreen())
title += "\n" + WI.UIString("Option-click to pick color from screen.");

this._swatchElement.title = title;
}
// fallthrough

case WI.InlineSwatch.Type.Gradient:
Expand Down

0 comments on commit 5753a82

Please sign in to comment.