WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
153004
Web Inspector: Add support for the existing GradientEditor in the CSS Rules sidebar
https://bugs.webkit.org/show_bug.cgi?id=153004
Summary
Web Inspector: Add support for the existing GradientEditor in the CSS Rules s...
Devin Rousso
Reported
2016-01-11 21:27:08 PST
Gradients are supported in the Visual sidebar and on Resource views, but not in the Rules sidebar. This should be added there seeing as it is where most users will interact with gradients.
Attachments
Patch
(29.91 KB, patch)
2016-01-12 00:35 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(80.14 KB, patch)
2016-01-12 20:07 PST
,
Devin Rousso
timothy
: review+
Details
Formatted Diff
Diff
Patch
(79.31 KB, patch)
2016-01-13 12:14 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Devin Rousso
Comment 1
2016-01-12 00:35:35 PST
Created
attachment 268749
[details]
Patch
Blaze Burg
Comment 2
2016-01-12 10:58:53 PST
Comment on
attachment 268749
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=268749&action=review
Looking pretty good overall (with some naming suggestions). I would like a second look from Joe, Tim, or Matt.
> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:877 > + let swatch = new WebInspector.ColorSwatch(color, this._codeMirror.getOption("readOnly"));
(Applies throughout) The code quickly gets confusing because a "color" could actually be a gradient, and clicking the swatch could show different things. What about renaming it to WebInspector.InlineSwatch(value, readonly)? Then value could be a color or gradient.
> Source/WebInspectorUI/UserInterface/Views/CodeMirrorTextMarkers.js:95 > + let closedParenthesis = 0;
It would be easier to make sense of this code if it tracked the count of unmatched opening parenthesis. Maybe a comment above the if (closedParenthesis < 0) would make its purpose more obvious.
> Source/WebInspectorUI/UserInterface/Views/ColorSwatch.js:29 > + constructor(color, readOnly, isGradient)
:( I think it would be better to take a 'value' into this._value and make isGradient a getter that does an instanceof test. The parameter is redundant.
> Source/WebInspectorUI/UserInterface/Views/ColorSwatch.js:39 > + this._swatchElement.title = WebInspector.UIString("Click to select a gradient");
Nit: needs trailing period to match other tooltip.
> Source/WebInspectorUI/UserInterface/Views/ColorSwatch.js:66 > + this._color = this._addFallbackValueIfNeeded(color);
Try this: this._value = value || this._fallbackValue()
> Source/WebInspectorUI/UserInterface/Views/ColorSwatch.js:117 > + colorPicker[this._isGradient ? "gradient" : "color"] = this._color;
Nit: we generally tend to avoid computed properties with ternary expression, as it's harder to read (and grep).
Devin Rousso
Comment 3
2016-01-12 20:07:15 PST
Created
attachment 268851
[details]
Patch
Timothy Hatcher
Comment 4
2016-01-13 09:57:15 PST
Comment on
attachment 268851
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=268851&action=review
Awesome clean up!
> Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js:43 > + else > + this._swatchElement.title = WebInspector.UIString("Click to select a color. Shift-click to switch color formats.");
assert Type.Color
Timothy Hatcher
Comment 5
2016-01-13 09:57:54 PST
Comment on
attachment 268851
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=268851&action=review
>> Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js:43 >> + this._swatchElement.title = WebInspector.UIString("Click to select a color. Shift-click to switch color formats."); > > assert Type.Color
Could use a switch here and assert for the default case.
Devin Rousso
Comment 6
2016-01-13 12:13:12 PST
Comment on
attachment 268851
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=268851&action=review
>>> Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js:43 >>> + this._swatchElement.title = WebInspector.UIString("Click to select a color. Shift-click to switch color formats."); >> >> assert Type.Color > > Could use a switch here and assert for the default case.
I made the change, but I am just wondering if there is a good indicator of when to use a switch instead of an if? I know that there is some performance improvements on semi-large (3 to 10 options) possibility sets, but I wasn't sure how it effected JS. Is there a rule-of-thumb that WebInspector uses?
Devin Rousso
Comment 7
2016-01-13 12:14:41 PST
Created
attachment 268887
[details]
Patch
Blaze Burg
Comment 8
2016-01-13 12:36:05 PST
(In reply to
comment #6
)
> Comment on
attachment 268851
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=268851&action=review
> > >>> Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js:43 > >>> + this._swatchElement.title = WebInspector.UIString("Click to select a color. Shift-click to switch color formats."); > >> > >> assert Type.Color > > > > Could use a switch here and assert for the default case. > > I made the change, but I am just wondering if there is a good indicator of > when to use a switch instead of an if? I know that there is some > performance improvements on semi-large (3 to 10 options) possibility sets, > but I wasn't sure how it effected JS. Is there a rule-of-thumb that > WebInspector uses?
It's mostly about readability and whether the switch will catch new unhandled values in the future. Don't worry about the performance impact, it's probably negligible.
WebKit Commit Bot
Comment 9
2016-01-13 13:14:59 PST
Comment on
attachment 268887
[details]
Patch Clearing flags on attachment: 268887 Committed
r194977
: <
http://trac.webkit.org/changeset/194977
>
WebKit Commit Bot
Comment 10
2016-01-13 13:15:02 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11
2016-01-14 12:25:52 PST
<
rdar://problem/24192983
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug