Changeset 248146 in webkit
- Timestamp:
- Aug 1, 2019 8:50:15 PM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r248144 r248146 1 2019-08-01 Zhifei Fang <zhifei_fang@apple.com> 2 3 results.webkit.org: Force update cache when timeline updated 4 https://bugs.webkit.org/show_bug.cgi?id=200363 5 6 Reviewed by Jonathan Bedard. 7 8 * resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js: 9 (offscreenCachedRenderFactory): Add ability to force the redraw. 10 (Timeline.CanvasSeriesComponent): Force redraw when scales or dots are updated. 11 (Timeline.CanvasXAxisComponent): Force redraw when scales are updated. Add missing exporter for export scales update API 12 1 13 2019-08-01 Alex Christensen <achristensen@webkit.org> 2 14 -
trunk/Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js
r248134 r248146 132 132 // and copy the viewport area from of it 133 133 // It will trigger redrawCache when cache don't have enough space 134 return (redrawCache, element, stateDiff, state ) => {134 return (redrawCache, element, stateDiff, state, forceRedrawCache = false) => { 135 135 const width = typeof stateDiff.width === 'number' ? stateDiff.width : state.width; 136 136 if (width <= 0) … … 142 142 const context = element.getContext('2d'); 143 143 let cachePosLeft = scrollLeft - cachedScrollLeft; 144 let needToRedrawCache = forceRedrawCache; 144 145 145 146 if (element.logicWidth != width) { 146 147 // Setup the dpr in case of blur 147 148 setupCanvasWidthWithDpr(element, width); 148 149 // We draw everything on cache 150 redrawCache(offscreenCanvas, element, stateDiff, state, () => { 151 cachedScrollLeft = scrollLeft < padding ? scrollLeft : scrollLeft - padding; 152 cachePosLeft = scrollLeft - cachedScrollLeft; 153 if (cachePosLeft < 0) 154 cachePosLeft = 0; 155 context.clearRect(0, 0, element.width, element.height); 156 context.drawImage(offscreenCanvas, cachePosLeft * getDevicePixelRatio(), 0, element.width, element.height, 0, 0, width * getDevicePixelRatio(), element.height); 157 }); 158 149 needToRedrawCache = true; 159 150 } else if (cachePosLeft < 0 || cachePosLeft + width > totalWidth) { 160 151 if (scrollLeft < 0 ) 161 152 return; 162 redrawCache(offscreenCanvas, element, stateDiff, state, () => { 153 needToRedrawCache = true; 154 } 155 156 if (needToRedrawCache) { 157 // We draw everything on cache 158 redrawCache(offscreenCanvas, element, stateDiff, state, () => { 163 159 cachedScrollLeft = scrollLeft < padding ? scrollLeft : scrollLeft - padding; 164 160 cachePosLeft = scrollLeft - cachedScrollLeft; … … 368 364 onStateUpdate: (element, stateDiff, state) => { 369 365 const context = element.getContext("2d"); 366 let forceRedrawCache = false; 370 367 if (stateDiff.scales || stateDiff.dots || typeof stateDiff.scrollLeft === 'number' || typeof stateDiff.width === 'number') { 371 368 console.assert(dots.length <= scales.length); 372 requestAnimationFrame(() => offscreenCachedRender(redrawCache, element, stateDiff, state)); 369 if (stateDiff.scales || stateDiff.dots) { 370 forceRedrawCache = true; 371 } 372 requestAnimationFrame(() => offscreenCachedRender(redrawCache, element, stateDiff, state, forceRedrawCache)); 373 373 } 374 374 } … … 712 712 }, 713 713 onStateUpdate: (element, stateDiff, state) => { 714 let forceRedrawCache = false; 714 715 if (stateDiff.scales || typeof stateDiff.scrollLeft === 'number' || typeof stateDiff.width === 'number') { 715 if (stateDiff.scales) 716 if (stateDiff.scales) { 716 717 state.scalesMapLinkList = getScalesMapLinkList(stateDiff.scales); 717 requestAnimationFrame(() => offscreenCachedRender(redrawCache, element, stateDiff, state)); 718 forceRedrawCache = true; 719 } 720 requestAnimationFrame(() => offscreenCachedRender(redrawCache, element, stateDiff, state, forceRedrawCache)); 718 721 } 719 722 } … … 723 726 series: ListProviderReceiver((updateContainerWidth, onContainerScroll, onResize) => { 724 727 updateContainerWidth(scales.length * scaleWidth * getDevicePixelRatio()); 728 const updateData = (scales) => { 729 updateContainerWidth(scales.length * scaleWidth * getDevicePixelRatio()); 730 canvasRef.setState({ 731 scales: scales 732 }); 733 } 734 if (typeof option.exporter === "function") 735 option.exporter(updateData); 725 736 onContainerScroll.action((e) => { 726 737 canvasRef.setState({scrollLeft: e.target.scrollLeft / getDevicePixelRatio()});
Note: See TracChangeset
for help on using the changeset viewer.