Changeset 19876 in webkit
- Timestamp:
- Feb 26, 2007, 9:23:22 PM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r19875 r19876 1 2007-02-26 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Maciej. 4 5 Fix for <rdar://problem/4827378>: Canvas with large height 6 uses lots of memory, computer almost stops responding 7 8 Put cap on maximum area of canvas, size is similar too the 9 maximum size allowed by firefox (firefox seems to to cut off 10 at area == 32767 * 9358). 11 12 Also protect renderer against the possibility of a null context 13 (this was triggering a CG warning) 14 15 * html/HTMLCanvasElement.cpp: 16 (WebCore::HTMLCanvasElement::createDrawingContext): 17 Apply maximum canvas area 18 (WebCore::HTMLCanvasElement::createPlatformImage): 19 Protect against null CG Context 20 1 21 2007-02-26 Mitz Pettel <mitz@webkit.org> 2 22 -
trunk/WebCore/html/HTMLCanvasElement.cpp
r18417 r19876 50 50 const int defaultHeight = 150; 51 51 52 // Firefox limits width/height to 32767 pixels, but slows down dramatically before it 53 // reaches that limit we limit by area instead, giving us larger max dimensions, in exchange 54 // for reduce maximum canvas size. 55 const float maxCanvasArea = 32768 * 8192; // Maximum canvas area in CSS pixels 56 52 57 HTMLCanvasElement::HTMLCanvasElement(Document* doc) 53 58 : HTMLElement(canvasTag, doc) … … 179 184 float hf = ceilf(unscaledHeight * pageScaleFactor); 180 185 181 if (!(wf > 0 && wf < UINT_MAX && hf > 0 && hf < UINT_MAX))186 if (!(wf >= 1 && hf >= 1 && wf * hf <= maxCanvasArea)) 182 187 return; 183 188 … … 215 220 if (!context) 216 221 return 0; 217 CGContextFlush(context->platformContext()); 218 return CGBitmapContextCreateImage(context->platformContext()); 222 223 CGContextRef contextRef = context->platformContext(); 224 if (!contextRef) 225 return 0; 226 227 CGContextFlush(contextRef); 228 229 return CGBitmapContextCreateImage(contextRef); 219 230 } 220 231
Note:
See TracChangeset
for help on using the changeset viewer.