Changeset 285896 in webkit
- Timestamp:
- Nov 16, 2021, 4:23:20 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/css/overridden-property.html (modified) (5 diffs)
-
LayoutTests/inspector/css/pseudo-element-matches-for-pseudo-element-node.html (modified) (1 diff)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js (modified) (3 diffs)
-
Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Models/Font.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r285885 r285896 1 2021-11-16 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Remove unused `dontCreateIfMissing` argument from CSSStyleDeclaration.prototype.propertyForName 4 https://bugs.webkit.org/show_bug.cgi?id=233198 5 6 Reviewed by Devin Rousso. 7 8 * inspector/css/overridden-property.html: 9 * inspector/css/pseudo-element-matches-for-pseudo-element-node.html: 10 1 11 2021-11-16 Rob Buis <rbuis@igalia.com> 2 12 -
trunk/LayoutTests/inspector/css/overridden-property.html
r278848 r285896 93 93 test(resolve, reject) { 94 94 getStyleDeclaration(".longhand-overridden-by-shorthand", (style) => { 95 const dontCreateIfMissing = true; 96 let borderTopColorProperty = style.propertyForName("border-top-color", dontCreateIfMissing); 95 let borderTopColorProperty = style.propertyForName("border-top-color"); 97 96 InspectorTest.expectTrue(borderTopColorProperty.overridden, "border-top-color is overridden."); 98 97 99 let borderColorProperty = style.propertyForName("border-color" , dontCreateIfMissing);98 let borderColorProperty = style.propertyForName("border-color"); 100 99 InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden."); 101 100 … … 109 108 test(resolve, reject) { 110 109 getStyleDeclaration(".longhand-overridden-by-important-shorthand", (style) => { 111 const dontCreateIfMissing = true; 112 let borderColorProperty = style.propertyForName("border-color", dontCreateIfMissing); 113 InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden."); 114 115 let borderTopColorProperty = style.propertyForName("border-top-color", dontCreateIfMissing); 110 let borderColorProperty = style.propertyForName("border-color"); 111 InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden."); 112 113 let borderTopColorProperty = style.propertyForName("border-top-color"); 116 114 InspectorTest.expectTrue(borderTopColorProperty.overridden, "border-top-color is overridden."); 117 115 … … 125 123 test(resolve, reject) { 126 124 getStyleDeclaration(".shorthand-overridden-by-important-longhand", (style) => { 127 const dontCreateIfMissing = true; 128 let borderTopColorProperty = style.propertyForName("border-top-color", dontCreateIfMissing); 125 let borderTopColorProperty = style.propertyForName("border-top-color"); 129 126 InspectorTest.expectFalse(borderTopColorProperty.overridden, "border-top-color is NOT overridden."); 130 127 131 let borderColorProperty = style.propertyForName("border-color" , dontCreateIfMissing);128 let borderColorProperty = style.propertyForName("border-color"); 132 129 InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden."); 133 130 … … 141 138 test(resolve, reject) { 142 139 getStyleDeclaration(".shorthand-not-overridden-by-longhand", (style) => { 143 const dontCreateIfMissing = true; 144 let borderColorProperty = style.propertyForName("border-color", dontCreateIfMissing); 145 InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden."); 146 147 let borderTopColorProperty = style.propertyForName("border-top-color", dontCreateIfMissing); 140 let borderColorProperty = style.propertyForName("border-color"); 141 InspectorTest.expectFalse(borderColorProperty.overridden, "border-color is NOT overridden."); 142 143 let borderTopColorProperty = style.propertyForName("border-top-color"); 148 144 InspectorTest.expectFalse(borderTopColorProperty.overridden, "border-top-color is NOT overridden."); 149 145 … … 157 153 test(resolve, reject) { 158 154 getStyleDeclaration(".mixed-case-variables-not-overridden", (style) => { 159 const dontCreateIfMissing = true; 160 let lowercaseVariableProperty = style.propertyForName("--foo", dontCreateIfMissing); 155 let lowercaseVariableProperty = style.propertyForName("--foo"); 161 156 InspectorTest.expectFalse(lowercaseVariableProperty.overridden, "`--foo` is NOT overridden."); 162 157 163 let uppercaseVariableProperty = style.propertyForName("--FOO" , dontCreateIfMissing);158 let uppercaseVariableProperty = style.propertyForName("--FOO"); 164 159 InspectorTest.expectFalse(uppercaseVariableProperty.overridden, "`--FOO` is NOT overridden."); 165 160 -
trunk/LayoutTests/inspector/css/pseudo-element-matches-for-pseudo-element-node.html
r253242 r285896 18 18 19 19 function logProperty(propertyName) { 20 const dontCreateIfMissing = true; 21 let property = nodeStyles.computedStyle.propertyForName(propertyName, dontCreateIfMissing); 20 let property = nodeStyles.computedStyle.propertyForName(propertyName); 22 21 InspectorTest.log(`PROPERTY: ${property.name}: ${property.value};`); 23 22 } -
trunk/Source/WebInspectorUI/ChangeLog
r285851 r285896 1 2021-11-16 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: Remove unused `dontCreateIfMissing` argument from CSSStyleDeclaration.prototype.propertyForName 4 https://bugs.webkit.org/show_bug.cgi?id=233198 5 6 Reviewed by Devin Rousso. 7 8 `dontCreateIfMissing` was always set to `true`. 9 10 * UserInterface/Models/CSSStyleDeclaration.js: 11 (WI.CSSStyleDeclaration.prototype.propertyForName): 12 Drive-by: inline findMatch function, which was only used once. 13 14 * UserInterface/Models/DOMNodeStyles.js: 15 (WI.DOMNodeStyles.prototype._parseStylePropertyPayload): 16 * UserInterface/Models/Font.js: 17 (WI.Font): 18 * UserInterface/Views/BoxModelDetailsSectionRow.js: 19 (WI.BoxModelDetailsSectionRow.prototype._getPropertyValue): 20 * UserInterface/Views/SpreadsheetStyleProperty.js: 21 (WI.SpreadsheetStyleProperty.prototype._addVariableTokens): 22 1 23 2021-11-15 Patrick Angle <pangle@apple.com> 2 24 -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSStyleDeclaration.js
r283723 r285896 302 302 } 303 303 304 propertyForName(name , dontCreateIfMissing)304 propertyForName(name) 305 305 { 306 306 console.assert(name); … … 314 314 // account for overridden properties. 315 315 316 function findMatch(properties) 317 { 318 for (var i = 0; i < properties.length; ++i) { 319 var property = properties[i]; 320 if (property.canonicalName !== name && property.name !== name) 321 continue; 322 if (bestMatchProperty && !bestMatchProperty.overridden && property.overridden) 323 continue; 324 bestMatchProperty = property; 325 } 326 } 327 328 var bestMatchProperty = null; 329 330 findMatch(this.enabledProperties); 331 332 if (bestMatchProperty) 333 return bestMatchProperty; 334 335 if (dontCreateIfMissing || !this.editable) 336 return null; 337 338 findMatch(this._pendingProperties, true); 339 340 if (bestMatchProperty) 341 return bestMatchProperty; 342 343 var newProperty = new WI.CSSProperty(NaN, null, name); 344 newProperty.ownerStyle = this; 345 346 this._pendingProperties.push(newProperty); 347 348 return newProperty; 316 let bestMatchProperty = null; 317 for (let property of this.enabledProperties) { 318 if (property.canonicalName !== name && property.name !== name) 319 continue; 320 if (bestMatchProperty && !bestMatchProperty.overridden && property.overridden) 321 continue; 322 bestMatchProperty = property; 323 } 324 325 return bestMatchProperty; 349 326 } 350 327 … … 386 363 continue; 387 364 388 let variableProperty = this.propertyForName(variableTokens[variableNameIndex].value , true);365 let variableProperty = this.propertyForName(variableTokens[variableNameIndex].value); 389 366 if (variableProperty) 390 367 return variableProperty.value.trim(); -
trunk/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js
r283899 r285896 546 546 if (styleDeclaration) { 547 547 // Use propertyForName when the index is NaN since propertyForName is fast in that case. 548 var property = isNaN(index) ? styleDeclaration.propertyForName(name , true) : styleDeclaration.enabledProperties[index];548 var property = isNaN(index) ? styleDeclaration.propertyForName(name) : styleDeclaration.enabledProperties[index]; 549 549 550 550 // Reuse a property if the index and name matches. Otherwise it is a different property -
trunk/Source/WebInspectorUI/UserInterface/Models/Font.js
r270637 r285896 207 207 _computedPropertyValueForName(domNodeStyle, name) 208 208 { 209 const dontCreateIfMissing = true; 210 return domNodeStyle.computedStyle?.propertyForName(name, dontCreateIfMissing)?.value || ""; 209 return domNodeStyle.computedStyle?.propertyForName(name)?.value || ""; 211 210 } 212 211 }; -
trunk/Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js
r272670 r285896 81 81 _getPropertyValue(style, propertyName) 82 82 { 83 const dontCreateIfMissing = true; 84 let property = style.propertyForName(propertyName, dontCreateIfMissing); 83 let property = style.propertyForName(propertyName); 85 84 if (!property) 86 85 return null; -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
r285851 r285896 871 871 872 872 if (WI.settings.experimentalEnableStylesJumpToVariableDeclaration.value && this._property.ownerStyle.type !== WI.CSSStyleDeclaration.Type.Computed && this._delegate && this._delegate.spreadsheetStylePropertySelectByProperty) { 873 const dontCreateIfMissing = true; 874 let effectiveVariableProperty = this._property.ownerStyle.nodeStyles.effectivePropertyForName(rawTokens[variableNameIndex].value, dontCreateIfMissing); 873 let effectiveVariableProperty = this._property.ownerStyle.nodeStyles.effectivePropertyForName(rawTokens[variableNameIndex].value); 875 874 if (effectiveVariableProperty) { 876 875 let arrowElement = WI.createGoToArrowButton();
Note:
See TracChangeset
for help on using the changeset viewer.