Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 259773008: Add support for type checking of floating point arguments as [TypeChecking=Unrestricted] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove outdated test Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 return nullptr; 1802 return nullptr;
1803 } 1803 }
1804 1804
1805 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(Pass RefPtrWillBeRawPtr<ImageData> imageData) const 1805 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(Pass RefPtrWillBeRawPtr<ImageData> imageData) const
1806 { 1806 {
1807 return createEmptyImageData(imageData->size()); 1807 return createEmptyImageData(imageData->size());
1808 } 1808 }
1809 1809
1810 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(floa t sw, float sh, ExceptionState& exceptionState) const 1810 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(floa t sw, float sh, ExceptionState& exceptionState) const
1811 { 1811 {
1812 if (!sw || !sh) 1812 if (!sw || !sh) {
1813 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width")); 1813 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width"));
1814 // FIXME: These exceptions will be thrown by generated bindings code once
1815 // crbug.com/354298 is fixed.
1816 else if (!std::isfinite(sw))
1817 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sw, "source width"));
1818 else if (!std::isfinite(sh))
1819 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sh, "source height"));
1820
1821 if (exceptionState.hadException())
1822 return nullptr; 1814 return nullptr;
1815 }
1823 1816
1824 FloatSize logicalSize(fabs(sw), fabs(sh)); 1817 FloatSize logicalSize(fabs(sw), fabs(sh));
1825 if (!logicalSize.isExpressibleAsIntSize()) 1818 if (!logicalSize.isExpressibleAsIntSize())
1826 return nullptr; 1819 return nullptr;
1827 1820
1828 IntSize size = expandedIntSize(logicalSize); 1821 IntSize size = expandedIntSize(logicalSize);
1829 if (size.width() < 1) 1822 if (size.width() < 1)
1830 size.setWidth(1); 1823 size.setWidth(1);
1831 if (size.height() < 1) 1824 if (size.height() < 1)
1832 size.setHeight(1); 1825 size.setHeight(1);
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 c->setAlphaAsFloat(1.0); 2439 c->setAlphaAsFloat(1.0);
2447 c->clearShadow(); 2440 c->clearShadow();
2448 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); 2441 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal);
2449 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2442 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2450 c->restore(); 2443 c->restore();
2451 2444
2452 didDraw(dirtyRect); 2445 didDraw(dirtyRect);
2453 } 2446 }
2454 2447
2455 } // namespace WebCore 2448 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | Source/core/html/canvas/CanvasRenderingContext2D.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698