Bug 148254 - Web Inspector: Add warnings to section that require specific values of other properties
Summary: Web Inspector: Add warnings to section that require specific values of other ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks: 147563 148227 148231
  Show dependency treegraph
 
Reported: 2015-08-20 15:23 PDT by Devin Rousso
Modified: 2016-01-07 15:44 PST (History)
8 users (show)

See Also:


Attachments
Patch (21.92 KB, patch)
2016-01-02 21:32 PST, Devin Rousso
timothy: review+
Details | Formatted Diff | Diff
After Patch is Applied (39.24 KB, image/png)
2016-01-03 18:03 PST, Devin Rousso
no flags Details
Patch (21.66 KB, patch)
2016-01-07 13:40 PST, Devin Rousso
commit-queue: commit-queue-
Details | Formatted Diff | Diff
Patch (21.69 KB, patch)
2016-01-07 15:28 PST, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2015-08-20 15:23:46 PDT
As an example, the values in the "Flexbox" section require "display: flex;" to work.  Adding small notices that state this would be helpful in the case that the user is adding properties and not seeing any result.
Comment 1 Radar WebKit Bug Importer 2015-08-20 15:24:20 PDT
<rdar://problem/22369751>
Comment 2 Devin Rousso 2016-01-02 21:32:52 PST
Created attachment 268125 [details]
Patch
Comment 3 BJ Burg 2016-01-03 15:57:44 PST
Comment on attachment 268125 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268125&action=review

This is awesome. I would appreciate before/after screenshots for posterity, and it would make it easier to give design feedback.

For example, I wonder whether we should dim/ignore inputs to dependent properties and add a hyperlink that changes the value to something reasonable, so the user doesn't have to backtrack. But, it may be obvious enough with your visual design that this is unnecessary.

> Source/WebInspectorUI/ChangeLog:17
> +        (WebInspector.VisualStyleDetailsPanel.prototype._populateFlexboxSection):

Please explain a little bit why some of the events, etc are no longer necessary.

> Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js:432
> +        let positionDependencyValues = ["relative", "absolute", "fixed", "-webkit-sticky"];

I would prefer naming more along the lines of:

let allowedPositionValues = [...];
properties.zIndex.enableIfPropertyHasValue("position", allowedPositionValues)

I think it's fine that either parameter can be singular or plural; it's way more descriptive than 'addDependency'.

> Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js:413
> +            this._dependencies.set(property, propertyValues || []);

Please default this above, like for propertyNames.
Comment 4 BJ Burg 2016-01-03 16:00:53 PST
Comment on attachment 268125 [details]
Patch

Something that is probably a followup bug, is detecting similar situations where properties don't do anything (i.e., vertical-align in an inline context, top/left without out-of-flow parent, etc). This is probably harder to detect since inline and block contexts are not always easy to infer from the computed style.
Comment 5 Devin Rousso 2016-01-03 18:03:37 PST
Created attachment 268164 [details]
After Patch is Applied
Comment 6 Devin Rousso 2016-01-03 18:05:38 PST
Comment on attachment 268164 [details]
After Patch is Applied

(In reply to comment #3)
> This is awesome. I would appreciate before/after screenshots for posterity,
> and it would make it easier to give design feedback.

Sorry I forgot to upload them :P

> For example, I wonder whether we should dim/ignore inputs to dependent
> properties and add a hyperlink that changes the value to something
> reasonable, so the user doesn't have to backtrack. But, it may be obvious
> enough with your visual design that this is unnecessary.

So I would rather not change the appearance of any of the editors if they are missing a dependency, because it is also possible that a :hover will apply the necessary dependency (like going from "display: none;" to "display: flex;" on :hover).  I just want to inform the user that this won't actually do anything unless the required property has a value that works.
Comment 7 Timothy Hatcher 2016-01-06 10:50:27 PST
Comment on attachment 268125 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268125&action=review

> Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js:546
> +                title += "\n " + property.name + ": " + dependencyValues.join("/");

It is a little weird to show raw CSS here when the visual sidebar shows prettified keywords and values. It might cause the user to get lost trying to mentally map back to the names used i the visual sidebar (especially once localization is used for labels but not values).

> Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js:550
> +        this._warningElement.title = !!title.length ? WebInspector.UIString("Missing Dependencies (Computed):%s").format(title) : null;

What does "(Computed)" try to communicate here? I am not sure it is needed.
Comment 8 Devin Rousso 2016-01-06 14:22:45 PST
Comment on attachment 268125 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268125&action=review

>> Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js:546
>> +                title += "\n " + property.name + ": " + dependencyValues.join("/");
> 
> It is a little weird to show raw CSS here when the visual sidebar shows prettified keywords and values. It might cause the user to get lost trying to mentally map back to the names used i the visual sidebar (especially once localization is used for labels but not values).

That is a very good point.  I'm not sure how to go about future-proofing this though...maybe use UIString for the name and value(s) when they are passed in via addDependency() ?

>> Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js:550
>> +        this._warningElement.title = !!title.length ? WebInspector.UIString("Missing Dependencies (Computed):%s").format(title) : null;
> 
> What does "(Computed)" try to communicate here? I am not sure it is needed.

The idea behind the (Computed) was to try to explain that the dependency is based off of the final, aka computed, value of the CSS property.  Essentially, you don't have to have "display: flex;" in the same rule so long as it is set in one of the other rules and is not overridden (hence it is the Computed value).
Comment 9 Timothy Hatcher 2016-01-07 10:20:22 PST
Comment on attachment 268125 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=268125&action=review

>>> Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js:546
>>> +                title += "\n " + property.name + ": " + dependencyValues.join("/");
>> 
>> It is a little weird to show raw CSS here when the visual sidebar shows prettified keywords and values. It might cause the user to get lost trying to mentally map back to the names used i the visual sidebar (especially once localization is used for labels but not values).
> 
> That is a very good point.  I'm not sure how to go about future-proofing this though...maybe use UIString for the name and value(s) when they are passed in via addDependency() ?

Only property names are localized now. The keyword values are not, but the values are prettified with spaces and title case. You would need to make a global lookup map for this. This can land as-is. I think there are other tooltips that have the same issue.

>>> Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js:550
>>> +        this._warningElement.title = !!title.length ? WebInspector.UIString("Missing Dependencies (Computed):%s").format(title) : null;
>> 
>> What does "(Computed)" try to communicate here? I am not sure it is needed.
> 
> The idea behind the (Computed) was to try to explain that the dependency is based off of the final, aka computed, value of the CSS property.  Essentially, you don't have to have "display: flex;" in the same rule so long as it is set in one of the other rules and is not overridden (hence it is the Computed value).

I think we can drop (Computed) then.
Comment 10 Devin Rousso 2016-01-07 13:40:34 PST
Created attachment 268481 [details]
Patch
Comment 11 WebKit Commit Bot 2016-01-07 14:39:58 PST
Comment on attachment 268481 [details]
Patch

Rejecting attachment 268481 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 268481, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
5a845be809694d2a2d3564da3e4db9a299c
r194723 = a2b0d9948cf25af5fd569fd4f61b67395a1330db
r194725 = 19ab57dde83f40920c3eeaf4fb0e23afb78b1084
r194726 = 0c0c2eeb5734d1c94f24e01beb06b30f37d1ae1a
r194727 = fdf1507a9bd16159a20825dd6acaba6b332d437d
r194728 = 98af212366ebe4d6d545bb91b531751c851c6813
Done rebuilding .git/svn/refs/remotes/origin/master/.rev_map.268f45cc-cd09-0410-ab3c-d52691b4dbfc
First, rewinding head to replay your work on top of it...
Fast-forwarded master to refs/remotes/origin/master.

Full output: http://webkit-queues.webkit.org/results/664028
Comment 12 Devin Rousso 2016-01-07 15:28:15 PST
Created attachment 268500 [details]
Patch
Comment 13 WebKit Commit Bot 2016-01-07 15:44:44 PST
Comment on attachment 268500 [details]
Patch

Clearing flags on attachment: 268500

Committed r194737: <http://trac.webkit.org/changeset/194737>
Comment 14 WebKit Commit Bot 2016-01-07 15:44:49 PST
All reviewed patches have been landed.  Closing bug.