Changeset 285983 in webkit
- Timestamp:
- Nov 17, 2021 11:18:04 PM (8 months ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 10 added
- 5 edited
-
ChangeLog (modified) (1 diff)
-
UserInterface/Images/AlignmentCenter.svg (added)
-
UserInterface/Images/AlignmentEnd.svg (added)
-
UserInterface/Images/AlignmentSpaceAround.svg (added)
-
UserInterface/Images/AlignmentSpaceBetween.svg (added)
-
UserInterface/Images/AlignmentSpaceEvenly.svg (added)
-
UserInterface/Images/AlignmentStart.svg (added)
-
UserInterface/Images/AlignmentStretch.svg (added)
-
UserInterface/Images/AlignmentUnknown.svg (added)
-
UserInterface/Main.html (modified) (2 diffs)
-
UserInterface/Views/AlignmentEditor.css (added)
-
UserInterface/Views/AlignmentEditor.js (added)
-
UserInterface/Views/InlineSwatch.css (modified) (3 diffs)
-
UserInterface/Views/InlineSwatch.js (modified) (7 diffs)
-
UserInterface/Views/SpreadsheetStyleProperty.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r285975 r285983 1 2021-11-17 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Add a swatch for align-content 4 https://bugs.webkit.org/show_bug.cgi?id=230065 5 <rdar://problem/82891361> 6 7 Reviewed by Devin Rousso. 8 9 Introduce an inline swatch for `align-content`, that shows icons for common align-content values: 10 start, center, end, space-between, space-around, space-evenly, and stretch. 11 12 * UserInterface/Images/AlignmentCenter.svg: Added. 13 * UserInterface/Images/AlignmentEnd.svg: Added. 14 * UserInterface/Images/AlignmentSpaceAround.svg: Added. 15 * UserInterface/Images/AlignmentSpaceBetween.svg: Added. 16 * UserInterface/Images/AlignmentSpaceEvenly.svg: Added. 17 * UserInterface/Images/AlignmentStart.svg: Added. 18 * UserInterface/Images/AlignmentStretch.svg: Added. 19 * UserInterface/Images/AlignmentUnknown.svg: Added. 20 21 * UserInterface/Main.html: 22 * UserInterface/Views/AlignmentEditor.css: Added. 23 (.alignment-editor .glyph): 24 (.alignment-editor .glyph:not(:last-child)): 25 (.alignment-editor .glyph:active): 26 (.alignment-editor .glyph.selected): 27 (.alignment-editor .glyph.selected + .glyph): 28 (.alignment-editor .glyph.selected:active): 29 30 * UserInterface/Views/AlignmentEditor.js: Added. 31 (WI.AlignmentEditor): 32 (WI.AlignmentEditor.isAlignContentValue): 33 (WI.AlignmentEditor.prototype.get element): 34 (WI.AlignmentEditor.prototype.get value): 35 (WI.AlignmentEditor.prototype.set value): 36 (WI.AlignmentEditor.prototype._updateSelected): 37 38 * UserInterface/Views/InlineSwatch.css: 39 (.inline-swatch:not(.read-only):matches(.bezier, .box-shadow, .spring, .variable, .alignment):hover): 40 (.inline-swatch:not(.read-only):matches(.bezier, .box-shadow, .spring, .variable, .alignment):active): 41 (.inline-swatch:is(.image, .alignment) > span): 42 (@media (prefers-color-scheme: dark) .inline-swatch.box-shadow > svg,): 43 44 * UserInterface/Views/InlineSwatch.js: 45 (WI.InlineSwatch): 46 (WI.InlineSwatch.prototype.didDismissPopover): 47 (WI.InlineSwatch.prototype._updateSwatch): 48 (WI.InlineSwatch.prototype._valueEditorValueDidChange): 49 50 * UserInterface/Views/SpreadsheetStyleProperty.js: 51 (WI.SpreadsheetStyleProperty.prototype._replaceSpecialTokens): 52 (WI.SpreadsheetStyleProperty.prototype._addAlignmentTokens): 53 1 54 2021-11-17 Devin Rousso <drousso@apple.com> 2 55 -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r285711 r285983 35 35 <link rel="stylesheet" href="External/CodeMirror/codemirror.css"> 36 36 37 <link rel="stylesheet" href="Views/AlignmentEditor.css"> 37 38 <link rel="stylesheet" href="Views/AnimationCollectionContentView.css"> 38 39 <link rel="stylesheet" href="Views/AnimationContentView.css"> … … 619 620 620 621 <script src="Views/ActivateButtonNavigationItem.js"></script> 622 <script src="Views/AlignmentEditor.js"></script> 621 623 <script src="Views/AnimationCollectionContentView.js"></script> 622 624 <script src="Views/AnimationContentView.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.css
r259170 r285983 59 59 } 60 60 61 .inline-swatch:not(.read-only):matches(.bezier, .box-shadow, .spring, .variable ):hover {61 .inline-swatch:not(.read-only):matches(.bezier, .box-shadow, .spring, .variable, .alignment):hover { 62 62 filter: brightness(0.9); 63 63 } 64 64 65 .inline-swatch:not(.read-only):matches(.bezier, .box-shadow, .spring, .variable ):active {65 .inline-swatch:not(.read-only):matches(.bezier, .box-shadow, .spring, .variable, .alignment):active { 66 66 filter: brightness(0.8); 67 67 } … … 99 99 } 100 100 101 .inline-swatch .image> span {101 .inline-swatch:is(.image, .alignment) > span { 102 102 background-size: cover; 103 103 background-repeat: no-repeat; … … 121 121 122 122 @media (prefers-color-scheme: dark) { 123 .inline-swatch.box-shadow > svg { 123 .inline-swatch.box-shadow > svg, 124 .inline-swatch.alignment > span { 124 125 filter: invert(); 125 126 } -
trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js
r285215 r285983 71 71 break; 72 72 73 case WI.InlineSwatch.Type.Alignment: 74 // Handled later by _updateSwatch. 75 break; 76 73 77 case WI.InlineSwatch.Type.Gradient: 74 78 this._swatchElement.title = WI.UIString("Edit custom gradient"); … … 152 156 else if (this._valueEditor instanceof WI.SpringEditor) 153 157 this._valueEditor.removeEventListener(WI.SpringEditor.Event.SpringChanged, this._valueEditorValueDidChange, this); 158 else if (this._valueEditor instanceof WI.AlignmentEditor) 159 this._valueEditor.removeEventListener(WI.AlignmentEditor.Event.ValueChanged, this._valueEditorValueDidChange, this); 154 160 155 161 this._valueEditor = null; … … 182 188 let value = this.value; 183 189 184 if (this._type === WI.InlineSwatch.Type.Color || this._type === WI.InlineSwatch.Type.Gradient) 185 this._swatchInnerElement.style.background = value ? value.toString() : null; 186 else if (this._type === WI.InlineSwatch.Type.Image) 187 this._swatchInnerElement.style.setProperty("background-image", `url(${value.src})`); 188 189 if (this._type === WI.InlineSwatch.Type.Color) { 190 switch (this._type) { 191 case WI.InlineSwatch.Type.Color: 190 192 if (this._allowChangingColorFormats()) 191 193 this._swatchElement.title = WI.UIString("Click to select a color\nShift-click to switch color formats"); 192 194 else 193 195 this._swatchElement.title = WI.UIString("Click to select a color"); 196 // fallthrough 197 198 case WI.InlineSwatch.Type.Gradient: 199 this._swatchInnerElement.style.background = value ? value.toString() : null; 200 break; 201 202 case WI.InlineSwatch.Type.Image: 203 this._swatchInnerElement.style.setProperty("background-image", `url(${value.src})`); 204 break; 205 206 case WI.InlineSwatch.Type.Alignment: 207 let glyphPath = WI.AlignmentEditor.ValueGlyphs[value] || WI.AlignmentEditor.UnknownValueGlyph; 208 this._swatchInnerElement.style.backgroundImage = `url(${glyphPath})`; 209 break; 194 210 } 195 211 … … 286 302 break; 287 303 304 case WI.InlineSwatch.Type.Alignment: 305 // FIXME: <https://webkit.org/b/233054> Web Inspector: Add a swatch for align-items and align-self 306 // FIXME: <https://webkit.org/b/233055> Web Inspector: Add a swatch for justify-content, justify-items, and justify-self 307 this._valueEditor = new WI.AlignmentEditor; 308 this._valueEditor.addEventListener(WI.AlignmentEditor.Event.ValueChanged, this._valueEditorValueDidChange, this); 309 break; 310 288 311 case WI.InlineSwatch.Type.Variable: 289 312 this._valueEditor = {}; … … 330 353 case WI.InlineSwatch.Type.Spring: 331 354 this._valueEditor.spring = value; 355 break; 356 357 case WI.InlineSwatch.Type.Alignment: 358 this._valueEditor.value = value; 332 359 break; 333 360 … … 376 403 case WI.InlineSwatch.Type.Spring: 377 404 this._value = event.data.spring; 405 break; 406 407 case WI.InlineSwatch.Type.Alignment: 408 this._value = event.data.value; 378 409 break; 379 410 } … … 526 557 Variable: "inline-swatch-type-variable", 527 558 Image: "inline-swatch-type-image", 559 Alignment: "inline-swatch-type-alignment", 528 560 }; 529 561 -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
r285896 r285983 628 628 { 629 629 // FIXME: <https://webkit.org/b/178636> Web Inspector: Styles: Make inline widgets work with CSS functions (var(), calc(), etc.) 630 // FIXME: <https://webkit.org/b/233054> Web Inspector: Add a swatch for align-items and align-self 631 // FIXME: <https://webkit.org/b/233055> Web Inspector: Add a swatch for justify-content, justify-items, and justify-self 630 632 631 633 if (this._property.name === "box-shadow") 632 634 return this._addBoxShadowTokens(tokens); 635 636 if (this._property.name === "align-content") 637 return this._addAlignmentTokens(tokens); 633 638 634 639 if (this._property.isVariable || WI.CSSKeywordCompletions.isColorAwareProperty(this._property.name)) { … … 845 850 } 846 851 852 _addAlignmentTokens(tokens) 853 { 854 // FIXME: <https://webkit.org/b/233281> Web Inspector: Alignment swatch should handle multi-token values better 855 let text = this._resolveVariables(tokens.map((token) => token.value).join("")); 856 let swatch = this._createInlineSwatch(WI.InlineSwatch.Type.Alignment, this._addVariableTokens(tokens), text); 857 return [swatch]; 858 } 859 847 860 _addVariableTokens(tokens) 848 861 {
Note: See TracChangeset
for help on using the changeset viewer.