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

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

Issue 257853002: Update the <canvas> IDLs wrt 'unrestricted' (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 c->beginLayer(1, state().m_globalComposite); 1641 c->beginLayer(1, state().m_globalComposite);
1642 CompositeOperator previousOperator = c->compositeOperation(); 1642 CompositeOperator previousOperator = c->compositeOperation();
1643 c->setCompositeOperation(CompositeSourceOver); 1643 c->setCompositeOperation(CompositeSourceOver);
1644 strokePrimitive(area, c); 1644 strokePrimitive(area, c);
1645 c->setCompositeOperation(previousOperator); 1645 c->setCompositeOperation(previousOperator);
1646 c->endLayer(); 1646 c->endLayer();
1647 } 1647 }
1648 1648
1649 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createLinearGradient(float x0, float y0, float x1, float y1, ExceptionState& exceptionState) 1649 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createLinearGradient(float x0, float y0, float x1, float y1, ExceptionState& exceptionState)
1650 { 1650 {
1651 // FIXME: These exceptions will be thrown by generated bindings code once cr bug.com/354298 is fixed.
Justin Novosad 2014/04/25 14:44:29 Shouldn't we keep these comments until we are read
fs 2014/04/25 15:50:15 Yes? "Full" (==actual) support for 'unrestricted'
1651 if (!std::isfinite(x0)) 1652 if (!std::isfinite(x0))
1652 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(x0, "x0")); 1653 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(x0, "x0"));
1653 else if (!std::isfinite(y0)) 1654 else if (!std::isfinite(y0))
1654 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(y0, "y0")); 1655 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(y0, "y0"));
1655 else if (!std::isfinite(x1)) 1656 else if (!std::isfinite(x1))
1656 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(x1, "x1")); 1657 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(x1, "x1"));
1657 else if (!std::isfinite(y1)) 1658 else if (!std::isfinite(y1))
1658 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(y1, "y1")); 1659 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(y1, "y1"));
1659 1660
1660 if (exceptionState.hadException()) 1661 if (exceptionState.hadException())
1661 return nullptr; 1662 return nullptr;
1662 1663
1663 RefPtr<CanvasGradient> gradient = CanvasGradient::create(FloatPoint(x0, y0), FloatPoint(x1, y1)); 1664 RefPtr<CanvasGradient> gradient = CanvasGradient::create(FloatPoint(x0, y0), FloatPoint(x1, y1));
1664 return gradient.release(); 1665 return gradient.release();
1665 } 1666 }
1666 1667
1667 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionState& exceptionS tate) 1668 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1, ExceptionState& exceptionS tate)
1668 { 1669 {
1670 // FIXME: These exceptions (except the IndexSizeError) will be thrown by
1671 // generated bindings code once crbug.com/354298 is fixed.
1669 if (!std::isfinite(x0)) 1672 if (!std::isfinite(x0))
1670 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(x0, "x0")); 1673 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(x0, "x0"));
1671 else if (!std::isfinite(y0)) 1674 else if (!std::isfinite(y0))
1672 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(y0, "y0")); 1675 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(y0, "y0"));
1673 else if (!std::isfinite(r0)) 1676 else if (!std::isfinite(r0))
1674 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(r0, "r0")); 1677 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(r0, "r0"));
1675 else if (!std::isfinite(x1)) 1678 else if (!std::isfinite(x1))
1676 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(x1, "x1")); 1679 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(x1, "x1"));
1677 else if (!std::isfinite(y1)) 1680 else if (!std::isfinite(y1))
1678 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(y1, "y1")); 1681 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(y1, "y1"));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 1793
1791 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(Pass RefPtrWillBeRawPtr<ImageData> imageData) const 1794 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(Pass RefPtrWillBeRawPtr<ImageData> imageData) const
1792 { 1795 {
1793 return createEmptyImageData(imageData->size()); 1796 return createEmptyImageData(imageData->size());
1794 } 1797 }
1795 1798
1796 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(floa t sw, float sh, ExceptionState& exceptionState) const 1799 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(floa t sw, float sh, ExceptionState& exceptionState) const
1797 { 1800 {
1798 if (!sw || !sh) 1801 if (!sw || !sh)
1799 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width")); 1802 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width"));
1803 // FIXME: These exceptions will be thrown by generated bindings code once
1804 // crbug.com/354298 is fixed.
1800 else if (!std::isfinite(sw)) 1805 else if (!std::isfinite(sw))
1801 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sw, "source width")); 1806 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sw, "source width"));
1802 else if (!std::isfinite(sh)) 1807 else if (!std::isfinite(sh))
1803 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sh, "source height")); 1808 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sh, "source height"));
1804 1809
1805 if (exceptionState.hadException()) 1810 if (exceptionState.hadException())
1806 return nullptr; 1811 return nullptr;
1807 1812
1808 FloatSize logicalSize(fabs(sw), fabs(sh)); 1813 FloatSize logicalSize(fabs(sw), fabs(sh));
1809 if (!logicalSize.isExpressibleAsIntSize()) 1814 if (!logicalSize.isExpressibleAsIntSize())
1810 return nullptr; 1815 return nullptr;
1811 1816
1812 IntSize size = expandedIntSize(logicalSize); 1817 IntSize size = expandedIntSize(logicalSize);
1813 if (size.width() < 1) 1818 if (size.width() < 1)
1814 size.setWidth(1); 1819 size.setWidth(1);
1815 if (size.height() < 1) 1820 if (size.height() < 1)
1816 size.setHeight(1); 1821 size.setHeight(1);
1817 1822
1818 return createEmptyImageData(size); 1823 return createEmptyImageData(size);
1819 } 1824 }
1820 1825
1821 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::getImageData(float s x, float sy, float sw, float sh, ExceptionState& exceptionState) const 1826 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::getImageData(float s x, float sy, float sw, float sh, ExceptionState& exceptionState) const
1822 { 1827 {
1823 if (!canvas()->originClean()) 1828 if (!canvas()->originClean())
1824 exceptionState.throwSecurityError("The canvas has been tainted by cross- origin data."); 1829 exceptionState.throwSecurityError("The canvas has been tainted by cross- origin data.");
1825 else if (!sw || !sh) 1830 else if (!sw || !sh)
1826 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width")); 1831 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width"));
1832 // FIXME: These exceptions will be thrown by generated bindings code once
1833 // crbug.com/354298 is fixed.
1827 else if (!std::isfinite(sx)) 1834 else if (!std::isfinite(sx))
1828 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sx, "source X")); 1835 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sx, "source X"));
1829 else if (!std::isfinite(sy)) 1836 else if (!std::isfinite(sy))
1830 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sy, "source Y")); 1837 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sy, "source Y"));
1831 else if (!std::isfinite(sw)) 1838 else if (!std::isfinite(sw))
1832 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sw, "source width")); 1839 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sw, "source width"));
1833 else if (!std::isfinite(sh)) 1840 else if (!std::isfinite(sh))
1834 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sh, "source height")); 1841 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sh, "source height"));
1835 1842
1836 if (exceptionState.hadException()) 1843 if (exceptionState.hadException())
(...skipping 29 matching lines...) Expand all
1866 } 1873 }
1867 1874
1868 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, ExceptionState& exceptionState) 1875 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, ExceptionState& exceptionState)
1869 { 1876 {
1870 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), exceptionSta te); 1877 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), exceptionSta te);
1871 } 1878 }
1872 1879
1873 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, float dirtyX, float dirtyY, 1880 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, float dirtyX, float dirtyY,
1874 float dirtyWidth, float dirtyHeight, ExceptionState& exceptionState) 1881 float dirtyWidth, float dirtyHeight, ExceptionState& exceptionState)
1875 { 1882 {
1883 // FIXME: These exceptions will be thrown by generated bindings code once
1884 // crbug.com/354298 is fixed.
1876 if (!std::isfinite(dx)) 1885 if (!std::isfinite(dx))
1877 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dx, "dx")); 1886 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dx, "dx"));
1878 else if (!std::isfinite(dy)) 1887 else if (!std::isfinite(dy))
1879 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dy, "dy")); 1888 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dy, "dy"));
1880 else if (!std::isfinite(dirtyX)) 1889 else if (!std::isfinite(dirtyX))
1881 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dirtyX, "dirtyX")); 1890 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dirtyX, "dirtyX"));
1882 else if (!std::isfinite(dirtyY)) 1891 else if (!std::isfinite(dirtyY))
1883 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dirtyY, "dirtyY")); 1892 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dirtyY, "dirtyY"));
1884 else if (!std::isfinite(dirtyWidth)) 1893 else if (!std::isfinite(dirtyWidth))
1885 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dirtyWidth, "dirtyWidth")); 1894 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(dirtyWidth, "dirtyWidth"));
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 c->setAlphaAsFloat(1.0); 2435 c->setAlphaAsFloat(1.0);
2427 c->clearShadow(); 2436 c->clearShadow();
2428 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); 2437 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal);
2429 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2438 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2430 c->restore(); 2439 c->restore();
2431 2440
2432 didDraw(dirtyRect); 2441 didDraw(dirtyRect);
2433 } 2442 }
2434 2443
2435 } // namespace WebCore 2444 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698