Changeset 237574 in webkit
- Timestamp:
- Oct 29, 2018 5:10:53 PM (6 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r237571 r237574 1 2018-10-29 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Canvas: show warning when path moves offscreen 4 https://bugs.webkit.org/show_bug.cgi?id=191016 5 6 Reviewed by Joseph Pecoraro. 7 8 * UserInterface/Models/RecordingAction.js: 9 (WI.RecordingAction): 10 (WI.RecordingAction.deriveCurrentState): 11 (WI.RecordingAction.prototype.get isVisual): 12 (WI.RecordingAction.prototype.get warning): Added. 13 (WI.RecordingAction.prototype.process.checkInvalidCurrentAxisPoint): Added. 14 (WI.RecordingAction.prototype.process): 15 (WI.RecordingAction.prototype.get hasVisibleEffect): Deleted. 16 Replace `hasVisibleEffect` with a more general `warning` value, so that it can be used for 17 more types of warnings. 18 19 * UserInterface/Views/RecordingActionTreeElement.js: 20 (WI.RecordingActionTreeElement.prototype.onattach): 21 * UserInterface/Views/RecordingActionTreeElement.css: 22 (.item.action.visual.warning:not(.invalid) > .status > .warning): Added. 23 (.item.action.visual.no-visible-effect:not(.invalid) > .status > .warning): Deleted. 24 25 * Localizations/en.lproj/localizedStrings.js: 26 1 27 2018-10-29 Devin Rousso <drousso@apple.com> 2 28 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r237431 r237574 852 852 localizedStrings["The “%s”\ntable is empty."] = "The “%s”\ntable is empty."; 853 853 localizedStrings["This action causes no visual change"] = "This action causes no visual change"; 854 localizedStrings["This action moves the path outside the visible area"] = "This action moves the path outside the visible area"; 854 855 localizedStrings["This object is a root"] = "This object is a root"; 855 856 localizedStrings["This object is referenced by internal objects"] = "This object is referenced by internal objects"; -
trunk/Source/WebInspectorUI/UserInterface/Models/RecordingAction.js
r237198 r237574 45 45 this._isGetter = false; 46 46 this._isVisual = false; 47 this._hasVisibleEffect = undefined;48 47 49 48 this._states = []; 50 49 this._stateModifiers = new Set; 51 50 51 this._warning = null; 52 52 this._swizzled = false; 53 53 this._processed = false; … … 136 136 let matrix = context.getTransform(); 137 137 138 let state = { 139 currentX: context.currentX, 140 currentY: context.currentY, 141 direction: context.direction, 142 fillStyle: context.fillStyle, 143 font: context.font, 144 globalAlpha: context.globalAlpha, 145 globalCompositeOperation: context.globalCompositeOperation, 146 imageSmoothingEnabled: context.imageSmoothingEnabled, 147 imageSmoothingQuality: context.imageSmoothingQuality, 148 lineCap: context.lineCap, 149 lineDash: context.getLineDash(), 150 lineDashOffset: context.lineDashOffset, 151 lineJoin: context.lineJoin, 152 lineWidth: context.lineWidth, 153 miterLimit: context.miterLimit, 154 shadowBlur: context.shadowBlur, 155 shadowColor: context.shadowColor, 156 shadowOffsetX: context.shadowOffsetX, 157 shadowOffsetY: context.shadowOffsetY, 158 strokeStyle: context.strokeStyle, 159 textAlign: context.textAlign, 160 textBaseline: context.textBaseline, 161 transform: [matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f], 162 webkitImageSmoothingEnabled: context.webkitImageSmoothingEnabled, 163 webkitLineDash: context.webkitLineDash, 164 webkitLineDashOffset: context.webkitLineDashOffset, 165 }; 138 let state = {}; 139 140 if (WI.ImageUtilities.supportsCanvasPathDebugging()) { 141 state.currentX = context.currentX; 142 state.currentY = context.currentY; 143 } 144 145 state.direction = context.direction; 146 state.fillStyle = context.fillStyle; 147 state.font = context.font; 148 state.globalAlpha = context.globalAlpha; 149 state.globalCompositeOperation = context.globalCompositeOperation; 150 state.imageSmoothingEnabled = context.imageSmoothingEnabled; 151 state.imageSmoothingQuality = context.imageSmoothingQuality; 152 state.lineCap = context.lineCap; 153 state.lineDash = context.getLineDash(); 154 state.lineDashOffset = context.lineDashOffset; 155 state.lineJoin = context.lineJoin; 156 state.lineWidth = context.lineWidth; 157 state.miterLimit = context.miterLimit; 158 state.shadowBlur = context.shadowBlur; 159 state.shadowColor = context.shadowColor; 160 state.shadowOffsetX = context.shadowOffsetX; 161 state.shadowOffsetY = context.shadowOffsetY; 162 state.strokeStyle = context.strokeStyle; 163 state.textAlign = context.textAlign; 164 state.textBaseline = context.textBaseline; 165 state.transform = [matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f]; 166 state.webkitImageSmoothingEnabled = context.webkitImageSmoothingEnabled; 167 state.webkitLineDash = context.webkitLineDash; 168 state.webkitLineDashOffset = context.webkitLineDashOffset; 166 169 167 170 if (WI.ImageUtilities.supportsCanvasPathDebugging()) … … 196 199 get isGetter() { return this._isGetter; } 197 200 get isVisual() { return this._isVisual; } 198 get hasVisibleEffect() { return this._hasVisibleEffect; }199 201 get states() { return this._states; } 200 202 get stateModifiers() { return this._stateModifiers; } 203 get warning() { return this._warning; } 201 204 202 205 get ready() … … 216 219 if (this._valid && this._isVisual) { 217 220 let contentBefore = recording.visualActionIndexes.length ? recording.actions[recording.visualActionIndexes.lastValue].snapshot : recording.initialState.content; 218 this._hasVisibleEffect = this._snapshot !== contentBefore; 221 if (this._snapshot === contentBefore) 222 this._warning = WI.UIString("This action causes no visual change"); 219 223 } 220 224 return; … … 245 249 this.apply(context); 246 250 247 if (shouldCheckHasVisualEffect) 248 this._hasVisibleEffect = !Array.shallowEqual(contentBefore, getContent()); 251 if (shouldCheckHasVisualEffect) { 252 let contentAfter = getContent(); 253 if (Array.shallowEqual(contentBefore, contentAfter)) 254 this._warning = WI.UIString("This action causes no visual change"); 255 } 249 256 250 257 if (recording.type === WI.Recording.Type.Canvas2D) { … … 260 267 this._states.push(currentState); 261 268 269 let lastState = null; 262 270 if (lastAction) { 263 l et lastState = lastAction.states.lastValue;271 lastState = lastAction.states.lastValue; 264 272 for (let key in currentState) { 265 273 if (!(key in lastState) || (currentState[key] !== lastState[key] && !Object.shallowEqual(currentState[key], lastState[key]))) 266 274 this._stateModifiers.add(key); 267 275 } 276 } 277 278 if (WI.ImageUtilities.supportsCanvasPathDebugging()) { 279 let currentX = currentState.currentX; 280 let invalidX = (currentX < 0 || currentX >= context.canvas.width) && (!lastState || currentX !== lastState.currentX); 281 282 let currentY = currentState.currentY; 283 let invalidY = (currentY < 0 || currentY >= context.canvas.height) && (!lastState || currentY !== lastState.currentY); 284 285 if (invalidX || invalidY) 286 this._warning = WI.UIString("This action moves the path outside the visible area"); 268 287 } 269 288 } -
trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.css
r237050 r237574 221 221 } 222 222 223 .item.action. visual.no-visible-effect:not(.invalid) > .status > .warning {223 .item.action.warning:not(.invalid) > .status > .warning { 224 224 width: 12px; 225 225 height: 12px; -
trunk/Source/WebInspectorUI/UserInterface/Views/RecordingActionTreeElement.js
r236715 r237574 408 408 this.element.dataset.index = this._index.toLocaleString(); 409 409 410 if (this.representedObject.valid && this.representedObject.isVisual && !this.representedObject.hasVisibleEffect) { 411 this.addClassName("no-visible-effect"); 412 413 const title = WI.UIString("This action causes no visual change"); 414 this.status = WI.ImageUtilities.useSVGSymbol("Images/Warning.svg", "warning", title); 410 if (this.representedObject.valid && this.representedObject.warning) { 411 this.addClassName("warning"); 412 this.status = WI.ImageUtilities.useSVGSymbol("Images/Warning.svg", "warning", this.representedObject.warning); 415 413 } 416 414 }
Note: See TracChangeset
for help on using the changeset viewer.