<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[224523] trunk/Source/WebInspectorUI</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/224523">224523</a></dd>
<dt>Author</dt> <dd>nvasilyev@apple.com</dd>
<dt>Date</dt> <dd>2017-11-06 17:19:11 -0800 (Mon, 06 Nov 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Styles Redesign: Display warnings
https://bugs.webkit.org/show_bug.cgi?id=179215

Reviewed by Brian Burg.

Display warning icons on the right of the property.

For now, the warning icons have only three title messages:
- Invalid property name;
- Invalid property value;
- Duplicate property.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css:
(.spreadsheet-style-declaration-editor .property):
(.spreadsheet-style-declaration-editor .property-toggle):
(.spreadsheet-style-declaration-editor .property.invalid-value:not(.disabled) .value):
(.spreadsheet-style-declaration-editor .property.has-warning):
(.spreadsheet-style-declaration-editor .property .warning):
Draw the warning arrow and icon using only one HTML element.
Don't set "top" property so the element remains vertically where it would be if it had "position: static".

(.spreadsheet-style-declaration-editor .property.has-warning .warning):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype._propertiesChanged):
(WI.SpreadsheetCSSStyleDeclarationEditor):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css:
(.spreadsheet-css-declaration):
(.spreadsheet-css-declaration :matches(.header, .header-media)):
(.spreadsheet-css-declaration .close-brace):
Make properties span the entire width of the styles sidebar. Unsupported properties have yellow
background. There should be no gaps between the property element and sidebar left and right edges.

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty):
(WI.SpreadsheetStyleProperty.prototype.updateStatus):
(WI.SpreadsheetStyleProperty.prototype._update):
(WI.SpreadsheetStyleProperty.prototype.updateClassNames): Deleted.
Rename updateClassNames to updateStatus since it modifies title attribute of the warning element.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetCSSStyleDeclarationEditorcss">trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetCSSStyleDeclarationEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetCSSStyleDeclarationSectioncss">trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetStylePropertyjs">trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (224522 => 224523)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog    2017-11-07 00:55:47 UTC (rev 224522)
+++ trunk/Source/WebInspectorUI/ChangeLog       2017-11-07 01:19:11 UTC (rev 224523)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2017-11-06  Nikita Vasilyev  <nvasilyev@apple.com>
+
+        Web Inspector: Styles Redesign: Display warnings
+        https://bugs.webkit.org/show_bug.cgi?id=179215
+
+        Reviewed by Brian Burg.
+
+        Display warning icons on the right of the property.
+
+        For now, the warning icons have only three title messages:
+        - Invalid property name;
+        - Invalid property value;
+        - Duplicate property.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css:
+        (.spreadsheet-style-declaration-editor .property):
+        (.spreadsheet-style-declaration-editor .property-toggle):
+        (.spreadsheet-style-declaration-editor .property.invalid-value:not(.disabled) .value):
+        (.spreadsheet-style-declaration-editor .property.has-warning):
+        (.spreadsheet-style-declaration-editor .property .warning):
+        Draw the warning arrow and icon using only one HTML element.
+        Don't set "top" property so the element remains vertically where it would be if it had "position: static".
+
+        (.spreadsheet-style-declaration-editor .property.has-warning .warning):
+        * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
+        (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._propertiesChanged):
+        (WI.SpreadsheetCSSStyleDeclarationEditor):
+        * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css:
+        (.spreadsheet-css-declaration):
+        (.spreadsheet-css-declaration :matches(.header, .header-media)):
+        (.spreadsheet-css-declaration .close-brace):
+        Make properties span the entire width of the styles sidebar. Unsupported properties have yellow
+        background. There should be no gaps between the property element and sidebar left and right edges.
+
+        * UserInterface/Views/SpreadsheetStyleProperty.js:
+        (WI.SpreadsheetStyleProperty):
+        (WI.SpreadsheetStyleProperty.prototype.updateStatus):
+        (WI.SpreadsheetStyleProperty.prototype._update):
+        (WI.SpreadsheetStyleProperty.prototype.updateClassNames): Deleted.
+        Rename updateClassNames to updateStatus since it modifies title attribute of the warning element.
+
</ins><span class="cx"> 2017-11-06  Ross Kirsling  <ross.kirsling@sony.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Two little Layers tab fixes
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (224522 => 224523)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js   2017-11-07 00:55:47 UTC (rev 224522)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js      2017-11-07 01:19:11 UTC (rev 224523)
</span><span class="lines">@@ -315,6 +315,7 @@
</span><span class="cx"> localizedStrings["Done"] = "Done";
</span><span class="cx"> localizedStrings["Download Web Archive"] = "Download Web Archive";
</span><span class="cx"> localizedStrings["Duplicate Selector"] = "Duplicate Selector";
</span><ins>+localizedStrings["Duplicate property"] = "Duplicate property";
</ins><span class="cx"> localizedStrings["Duplicate property “%s”.\nClick to delete this property."] = "Duplicate property “%s”.\nClick to delete this property.";
</span><span class="cx"> localizedStrings["Duration"] = "Duration";
</span><span class="cx"> localizedStrings["Dynamically calculated for the parent element"] = "Dynamically calculated for the parent element";
</span><span class="lines">@@ -986,6 +987,8 @@
</span><span class="cx"> localizedStrings["Unique"] = "Unique";
</span><span class="cx"> localizedStrings["Unknown error"] = "Unknown error";
</span><span class="cx"> localizedStrings["Unknown node"] = "Unknown node";
</span><ins>+localizedStrings["Unsupported property name"] = "Unsupported property name";
+localizedStrings["Unsupported property value"] = "Unsupported property value";
</ins><span class="cx"> localizedStrings["Unsupported property “%s”"] = "Unsupported property “%s”";
</span><span class="cx"> localizedStrings["Untitled"] = "Untitled";
</span><span class="cx"> localizedStrings["Use Default Media Styles"] = "Use Default Media Styles";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetCSSStyleDeclarationEditorcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css (224522 => 224523)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css 2017-11-07 00:55:47 UTC (rev 224522)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css    2017-11-07 01:19:11 UTC (rev 224523)
</span><span class="lines">@@ -29,7 +29,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .spreadsheet-style-declaration-editor .property {
</span><del>-    padding-left: 17px;
</del><ins>+    padding-right: var(--css-declaration-side-padding);
+    padding-left: calc(var(--css-declaration-side-padding) + 17px);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .spreadsheet-style-declaration-editor .name {
</span><span class="lines">@@ -59,7 +60,7 @@
</span><span class="cx"> .spreadsheet-style-declaration-editor .property-toggle {
</span><span class="cx">     visibility: hidden;
</span><span class="cx">     position: absolute;
</span><del>-    left: 1px;
</del><ins>+    left: calc(var(--css-declaration-side-padding) + 1px);
</ins><span class="cx">     width: 10px;
</span><span class="cx">     height: 10px;
</span><span class="cx">     margin: 0;
</span><span class="lines">@@ -89,6 +90,31 @@
</span><span class="cx">     -webkit-text-decoration-color: hsla(0, 100%, 50%, 0.5);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.spreadsheet-style-declaration-editor .property.has-warning {
+    background-color: hsl(51, 87%, 93%);
+}
+
+.spreadsheet-style-declaration-editor .property .warning {
+    display: none;
+}
+
+.spreadsheet-style-declaration-editor .property.has-warning .warning {
+    position: absolute;
+    right: 0;
+    display: inline-block;
+    width: calc(20px + var(--css-declaration-side-padding));
+    height: 13px;
+
+    background-image: url(../Images/Warning.svg);
+    background-color: hsl(43, 97%, 84%);
+    background-repeat: no-repeat;
+    background-size: 9px;
+    background-position-y: center;
+    background-position-x: 7px;
+
+    -webkit-clip-path: polygon(0% 50%, 6px 0%, 100% 0%, 100% 100%, 6px 100%);
+}
+
</ins><span class="cx"> .spreadsheet-style-declaration-editor .property.not-inherited {
</span><span class="cx">     opacity: 0.5;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetCSSStyleDeclarationEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js (224522 => 224523)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js  2017-11-07 00:55:47 UTC (rev 224522)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js     2017-11-07 01:19:11 UTC (rev 224523)
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx">     {
</span><span class="cx">         if (this.isFocused()) {
</span><span class="cx">             for (let propertyView of this._propertyViews)
</span><del>-                propertyView.updateClassNames();
</del><ins>+                propertyView.updateStatus();
</ins><span class="cx">         } else
</span><span class="cx">             this.needsLayout();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetCSSStyleDeclarationSectioncss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css (224522 => 224523)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css        2017-11-07 00:55:47 UTC (rev 224522)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css   2017-11-07 01:19:11 UTC (rev 224523)
</span><span class="lines">@@ -25,14 +25,20 @@
</span><span class="cx"> 
</span><span class="cx"> .spreadsheet-css-declaration {
</span><span class="cx">     margin: 0;
</span><del>-    padding: 4px 6px;
</del><ins>+    padding: 4px 0;
</ins><span class="cx">     font-family: Menlo, monospace;
</span><span class="cx">     color: hsl(0, 0%, 70%);
</span><span class="cx">     background: white;
</span><span class="cx">     border-bottom: 0.5px solid hsla(0, 0%, 0%, 0.2);
</span><span class="cx">     -webkit-user-select: text;
</span><ins>+
+    --css-declaration-side-padding: 6px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.spreadsheet-css-declaration :matches(.header, .header-media) {
+    padding: 0 var(--css-declaration-side-padding);
+}
+
</ins><span class="cx"> .spreadsheet-css-declaration .media-label {
</span><span class="cx">     color: black;
</span><span class="cx"> }
</span><span class="lines">@@ -102,3 +108,8 @@
</span><span class="cx">     box-shadow: hsla(0, 0%, 0%, 0.5) 0 1px 3px;
</span><span class="cx">     outline: none !important;
</span><span class="cx"> }
</span><ins>+
+.spreadsheet-css-declaration .close-brace {
+    display: inline-block;
+    padding-left: var(--css-declaration-side-padding);
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSpreadsheetStylePropertyjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (224522 => 224523)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js      2017-11-07 00:55:47 UTC (rev 224522)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2017-11-07 01:19:11 UTC (rev 224523)
</span><span class="lines">@@ -45,8 +45,8 @@
</span><span class="cx">         this._property.__propertyView = this;
</span><span class="cx"> 
</span><span class="cx">         this._update();
</span><del>-        property.addEventListener(WI.CSSProperty.Event.OverriddenStatusChanged, this._update, this);
-        property.addEventListener(WI.CSSProperty.Event.Changed, this.updateClassNames, this);
</del><ins>+        property.addEventListener(WI.CSSProperty.Event.OverriddenStatusChanged, this.updateStatus, this);
+        property.addEventListener(WI.CSSProperty.Event.Changed, this.updateStatus, this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx">         this._element.classList.add("highlighted");
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    updateClassNames()
</del><ins>+    updateStatus()
</ins><span class="cx">     {
</span><span class="cx">         let duplicatePropertyExistsBelow = (cssProperty) => {
</span><span class="cx">             let propertyFound = false;
</span><span class="lines">@@ -87,9 +87,15 @@
</span><span class="cx">         };
</span><span class="cx"> 
</span><span class="cx">         let classNames = [WI.SpreadsheetStyleProperty.StyleClassName];
</span><ins>+        let elementTitle = "";
</ins><span class="cx"> 
</span><del>-        if (this._property.overridden)
</del><ins>+        if (this._property.overridden) {
</ins><span class="cx">             classNames.push("overridden");
</span><ins>+            if (duplicatePropertyExistsBelow(this._property)) {
+                classNames.push("has-warning");
+                elementTitle = WI.UIString("Duplicate property");
+            }
+        }
</ins><span class="cx"> 
</span><span class="cx">         if (this._property.implicit)
</span><span class="cx">             classNames.push("implicit");
</span><span class="lines">@@ -104,10 +110,15 @@
</span><span class="cx">             if (WI.CSSCompletions.cssNameCompletions)
</span><span class="cx">                 propertyNameIsValid = WI.CSSCompletions.cssNameCompletions.isValidPropertyName(this._property.name);
</span><span class="cx"> 
</span><del>-            if (!propertyNameIsValid || duplicatePropertyExistsBelow(this._property))
</del><ins>+            classNames.push("has-warning");
+
+            if (!propertyNameIsValid) {
</ins><span class="cx">                 classNames.push("invalid-name");
</span><del>-            else
</del><ins>+                elementTitle = WI.UIString("Unsupported property name");
+            } else {
</ins><span class="cx">                 classNames.push("invalid-value");
</span><ins>+                elementTitle = WI.UIString("Unsupported property value");
+            }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (!this._property.enabled)
</span><span class="lines">@@ -114,6 +125,7 @@
</span><span class="cx">             classNames.push("disabled");
</span><span class="cx"> 
</span><span class="cx">         this._element.className = classNames.join(" ");
</span><ins>+        this._element.title = elementTitle;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Private
</span><span class="lines">@@ -131,7 +143,6 @@
</span><span class="cx">     _update()
</span><span class="cx">     {
</span><span class="cx">         this.element.removeChildren();
</span><del>-        this.updateClassNames();
</del><span class="cx"> 
</span><span class="cx">         if (this._property.editable) {
</span><span class="cx">             this._checkboxElement = this.element.appendChild(document.createElement("input"));
</span><span class="lines">@@ -174,8 +185,13 @@
</span><span class="cx"> 
</span><span class="cx">         this.element.append(";");
</span><span class="cx"> 
</span><del>-        if (!this._property.enabled)
</del><ins>+        if (this._property.enabled) {
+            this._warningElement = this.element.appendChild(document.createElement("span"));
+            this._warningElement.className = "warning";
+        } else
</ins><span class="cx">             this.element.append(" */");
</span><ins>+
+        this.updateStatus();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // SpreadsheetTextField delegate
</span></span></pre>
</div>
</div>

</body>
</html>