<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209048] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209048">209048</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2016-11-28 17:03:48 -0800 (Mon, 28 Nov 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Make CanvasRenderingContext2D use WebIDL unions / Variants for createPattern and drawImage
https://bugs.webkit.org/show_bug.cgi?id=165086
Reviewed by Darin Adler.
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::size):
Add overloads of size for each type of CanvasSource.
(WebCore::CanvasRenderingContext2D::drawImage):
(WebCore::CanvasRenderingContext2D::createPattern):
* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2D.idl:
Use variants to reduce code duplication and match spec language in drawImage and createPattern.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp">trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dh">trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Didl">trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209047 => 209048)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-29 00:23:07 UTC (rev 209047)
+++ trunk/Source/WebCore/ChangeLog        2016-11-29 01:03:48 UTC (rev 209048)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-11-27 Sam Weinig <sam@webkit.org>
+
+ Make CanvasRenderingContext2D use WebIDL unions / Variants for createPattern and drawImage
+ https://bugs.webkit.org/show_bug.cgi?id=165086
+
+ Reviewed by Darin Adler.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::size):
+ Add overloads of size for each type of CanvasSource.
+ (WebCore::CanvasRenderingContext2D::drawImage):
+ (WebCore::CanvasRenderingContext2D::createPattern):
+ * html/canvas/CanvasRenderingContext2D.h:
+ * html/canvas/CanvasRenderingContext2D.idl:
+ Use variants to reduce code duplication and match spec language in drawImage and createPattern.
+
</ins><span class="cx"> 2016-11-28 Beth Dakin <bdakin@apple.com>
</span><span class="cx">
</span><span class="cx"> Blacklist Netflix for TouchBar support
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (209047 => 209048)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2016-11-29 00:23:07 UTC (rev 209047)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp        2016-11-29 01:03:48 UTC (rev 209048)
</span><span class="lines">@@ -1318,7 +1318,7 @@
</span><span class="cx"> ImageSizeBeforeDevicePixelRatio
</span><span class="cx"> };
</span><span class="cx">
</span><del>-static LayoutSize size(HTMLImageElement& imageElement, ImageSizeType sizeType)
</del><ins>+static LayoutSize size(HTMLImageElement& imageElement, ImageSizeType sizeType = ImageSizeBeforeDevicePixelRatio)
</ins><span class="cx"> {
</span><span class="cx"> LayoutSize size;
</span><span class="cx"> if (CachedImage* cachedImage = imageElement.cachedImage()) {
</span><span class="lines">@@ -1330,6 +1330,11 @@
</span><span class="cx"> return size;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static FloatSize size(HTMLCanvasElement& canvasElement)
+{
+ return FloatSize(canvasElement.size());
+}
+
</ins><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx"> static FloatSize size(HTMLVideoElement& video)
</span><span class="cx"> {
</span><span class="lines">@@ -1347,21 +1352,38 @@
</span><span class="cx"> std::max(rect.height(), -rect.height()));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLImageElement& imageElement, float x, float y)
</del><ins>+ExceptionOr<void> CanvasRenderingContext2D::drawImage(CanvasImageSource&& image, float dx, float dy)
</ins><span class="cx"> {
</span><del>- LayoutSize destRectSize = size(imageElement, ImageSizeAfterDevicePixelRatio);
- return drawImage(imageElement, x, y, destRectSize.width(), destRectSize.height());
</del><ins>+ return WTF::switchOn(image,
+ [&] (RefPtr<HTMLImageElement>& imageElement) -> ExceptionOr<void> {
+ LayoutSize destRectSize = size(*imageElement, ImageSizeAfterDevicePixelRatio);
+ LayoutSize sourceRectSize = size(*imageElement, ImageSizeBeforeDevicePixelRatio);
+ return this->drawImage(*imageElement, FloatRect { 0, 0, sourceRectSize.width(), sourceRectSize.height() }, FloatRect { dx, dy, destRectSize.width(), destRectSize.height() });
+ },
+ [&] (auto& element) -> ExceptionOr<void> {
+ FloatSize elementSize = size(*element);
+ return this->drawImage(*element, FloatRect { 0, 0, elementSize.width(), elementSize.height() }, FloatRect { dx, dy, elementSize.width(), elementSize.height() });
+ }
+ );
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLImageElement& imageElement, float x, float y, float width, float height)
</del><ins>+ExceptionOr<void> CanvasRenderingContext2D::drawImage(CanvasImageSource&& image, float dx, float dy, float dw, float dh)
</ins><span class="cx"> {
</span><del>- LayoutSize sourceRectSize = size(imageElement, ImageSizeBeforeDevicePixelRatio);
- return drawImage(imageElement, FloatRect { 0, 0, sourceRectSize.width(), sourceRectSize.height() }, FloatRect { x, y, width, height });
</del><ins>+ return WTF::switchOn(image,
+ [&] (auto& element) -> ExceptionOr<void> {
+ FloatSize elementSize = size(*element);
+ return this->drawImage(*element, FloatRect { 0, 0, elementSize.width(), elementSize.height() }, FloatRect { dx, dy, dw, dh });
+ }
+ );
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLImageElement& imageElement, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
</del><ins>+ExceptionOr<void> CanvasRenderingContext2D::drawImage(CanvasImageSource&& image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
</ins><span class="cx"> {
</span><del>- return drawImage(imageElement, FloatRect { sx, sy, sw, sh }, FloatRect { dx, dy, dw, dh });
</del><ins>+ return WTF::switchOn(image,
+ [&] (auto& element) -> ExceptionOr<void> {
+ return this->drawImage(*element, FloatRect { sx, sy, sw, sh }, FloatRect { dx, dy, dw, dh });
+ }
+ );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLImageElement& imageElement, const FloatRect& srcRect, const FloatRect& dstRect)
</span><span class="lines">@@ -1446,21 +1468,6 @@
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLCanvasElement& sourceCanvas, float x, float y)
-{
- return drawImage(sourceCanvas, 0, 0, sourceCanvas.width(), sourceCanvas.height(), x, y, sourceCanvas.width(), sourceCanvas.height());
-}
-
-ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLCanvasElement& sourceCanvas, float x, float y, float width, float height)
-{
- return drawImage(sourceCanvas, FloatRect(0, 0, sourceCanvas.width(), sourceCanvas.height()), FloatRect { x, y, width, height });
-}
-
-ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLCanvasElement& sourceCanvas, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
-{
- return drawImage(sourceCanvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh));
-}
-
</del><span class="cx"> ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLCanvasElement& sourceCanvas, const FloatRect& srcRect, const FloatRect& dstRect)
</span><span class="cx"> {
</span><span class="cx"> FloatRect srcCanvasRect = FloatRect(FloatPoint(), sourceCanvas.size());
</span><span class="lines">@@ -1518,23 +1525,6 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx">
</span><del>-ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLVideoElement& video, float x, float y)
-{
- FloatSize videoSize = size(video);
- return drawImage(video, x, y, videoSize.width(), videoSize.height());
-}
-
-ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLVideoElement& video, float x, float y, float width, float height)
-{
- FloatSize videoSize = size(video);
- return drawImage(video, FloatRect { 0, 0, videoSize.width(), videoSize.height() }, FloatRect { x, y, width, height });
-}
-
-ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLVideoElement& video, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh)
-{
- return drawImage(video, FloatRect { sx, sy, sw, sh }, FloatRect { dx, dy, dw, dh });
-}
-
</del><span class="cx"> ExceptionOr<void> CanvasRenderingContext2D::drawImage(HTMLVideoElement& video, const FloatRect& srcRect, const FloatRect& dstRect)
</span><span class="cx"> {
</span><span class="cx"> if (video.readyState() == HTMLMediaElement::HAVE_NOTHING || video.readyState() == HTMLMediaElement::HAVE_METADATA)
</span><span class="lines">@@ -1748,12 +1738,19 @@
</span><span class="cx"> return WTFMove(gradient);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<RefPtr<CanvasPattern>> CanvasRenderingContext2D::createPattern(HTMLImageElement& imageElement, const String& repetitionType)
</del><ins>+ExceptionOr<RefPtr<CanvasPattern>> CanvasRenderingContext2D::createPattern(CanvasImageSource&& image, const String& repetition)
</ins><span class="cx"> {
</span><span class="cx"> bool repeatX, repeatY;
</span><del>- if (!CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY))
</del><ins>+ if (!CanvasPattern::parseRepetitionType(repetition, repeatX, repeatY))
</ins><span class="cx"> return Exception { SYNTAX_ERR };
</span><span class="cx">
</span><ins>+ return WTF::switchOn(image,
+ [&](auto& element) -> ExceptionOr<RefPtr<CanvasPattern>> { return this->createPattern(*element, repeatX, repeatY); }
+ );
+}
+
+ExceptionOr<RefPtr<CanvasPattern>> CanvasRenderingContext2D::createPattern(HTMLImageElement& imageElement, bool repeatX, bool repeatY)
+{
</ins><span class="cx"> auto* cachedImage = imageElement.cachedImage();
</span><span class="cx">
</span><span class="cx"> // If the image loading hasn't started or the image is not complete, it is not fully decodable.
</span><span class="lines">@@ -1777,29 +1774,21 @@
</span><span class="cx"> return RefPtr<CanvasPattern> { CanvasPattern::create(*cachedImage->imageForRenderer(imageElement.renderer()), repeatX, repeatY, originClean) };
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<Ref<CanvasPattern>> CanvasRenderingContext2D::createPattern(HTMLCanvasElement& canvas, const String& repetitionType)
</del><ins>+ExceptionOr<RefPtr<CanvasPattern>> CanvasRenderingContext2D::createPattern(HTMLCanvasElement& canvas, bool repeatX, bool repeatY)
</ins><span class="cx"> {
</span><span class="cx"> if (!canvas.width() || !canvas.height() || !canvas.buffer())
</span><span class="cx"> return Exception { INVALID_STATE_ERR };
</span><span class="cx">
</span><del>- bool repeatX, repeatY;
- if (!CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY))
- return Exception { SYNTAX_ERR };
-
- return CanvasPattern::create(*canvas.copiedImage(), repeatX, repeatY, canvas.originClean());
</del><ins>+ return RefPtr<CanvasPattern> { CanvasPattern::create(*canvas.copiedImage(), repeatX, repeatY, canvas.originClean()) };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx">
</span><del>-ExceptionOr<RefPtr<CanvasPattern>> CanvasRenderingContext2D::createPattern(HTMLVideoElement& videoElement, const String& repetitionType)
</del><ins>+ExceptionOr<RefPtr<CanvasPattern>> CanvasRenderingContext2D::createPattern(HTMLVideoElement& videoElement, bool repeatX, bool repeatY)
</ins><span class="cx"> {
</span><span class="cx"> if (videoElement.readyState() < HTMLMediaElement::HAVE_CURRENT_DATA)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- bool repeatX, repeatY;
- if (!CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY))
- return Exception { SYNTAX_ERR };
-
</del><span class="cx"> checkOrigin(&videoElement);
</span><span class="cx"> bool originClean = canvas().originClean();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Dh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (209047 => 209048)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h        2016-11-29 00:23:07 UTC (rev 209047)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h        2016-11-29 01:03:48 UTC (rev 209048)
</span><span class="lines">@@ -55,6 +55,12 @@
</span><span class="cx"> class ImageData;
</span><span class="cx"> class TextMetrics;
</span><span class="cx">
</span><ins>+#if ENABLE(VIDEO)
+using CanvasImageSource = Variant<RefPtr<HTMLImageElement>, RefPtr<HTMLVideoElement>, RefPtr<HTMLCanvasElement>>;
+#else
+using CanvasImageSource = Variant<RefPtr<HTMLImageElement>, RefPtr<HTMLCanvasElement>>;
+#endif
+
</ins><span class="cx"> class CanvasRenderingContext2D final : public CanvasRenderingContext, public CanvasPath {
</span><span class="cx"> public:
</span><span class="cx"> CanvasRenderingContext2D(HTMLCanvasElement&, bool usesCSSCompatibilityParseMode, bool usesDashboardCompatibilityMode);
</span><span class="lines">@@ -156,21 +162,9 @@
</span><span class="cx">
</span><span class="cx"> void clearShadow();
</span><span class="cx">
</span><del>- ExceptionOr<void> drawImage(HTMLImageElement&, float x, float y);
- ExceptionOr<void> drawImage(HTMLImageElement&, float x, float y, float width, float height);
- ExceptionOr<void> drawImage(HTMLImageElement&, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
- ExceptionOr<void> drawImage(HTMLImageElement&, const FloatRect& srcRect, const FloatRect& dstRect);
- ExceptionOr<void> drawImage(HTMLCanvasElement&, float x, float y);
- ExceptionOr<void> drawImage(HTMLCanvasElement&, float x, float y, float width, float height);
- ExceptionOr<void> drawImage(HTMLCanvasElement&, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
- ExceptionOr<void> drawImage(HTMLCanvasElement&, const FloatRect& srcRect, const FloatRect& dstRect);
- ExceptionOr<void> drawImage(HTMLImageElement&, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const BlendMode&);
-#if ENABLE(VIDEO)
- ExceptionOr<void> drawImage(HTMLVideoElement&, float x, float y);
- ExceptionOr<void> drawImage(HTMLVideoElement&, float x, float y, float width, float height);
- ExceptionOr<void> drawImage(HTMLVideoElement&, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
- ExceptionOr<void> drawImage(HTMLVideoElement&, const FloatRect& srcRect, const FloatRect& dstRect);
-#endif
</del><ins>+ ExceptionOr<void> drawImage(CanvasImageSource&&, float dx, float dy);
+ ExceptionOr<void> drawImage(CanvasImageSource&&, float dx, float dy, float dw, float dh);
+ ExceptionOr<void> drawImage(CanvasImageSource&&, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
</ins><span class="cx">
</span><span class="cx"> void drawImageFromRect(HTMLImageElement&, float sx = 0, float sy = 0, float sw = 0, float sh = 0, float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString());
</span><span class="cx">
</span><span class="lines">@@ -180,11 +174,7 @@
</span><span class="cx">
</span><span class="cx"> ExceptionOr<Ref<CanvasGradient>> createLinearGradient(float x0, float y0, float x1, float y1);
</span><span class="cx"> ExceptionOr<Ref<CanvasGradient>> createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1);
</span><del>- ExceptionOr<RefPtr<CanvasPattern>> createPattern(HTMLImageElement&, const String& repetitionType);
- ExceptionOr<Ref<CanvasPattern>> createPattern(HTMLCanvasElement&, const String& repetitionType);
-#if ENABLE(VIDEO)
- ExceptionOr<RefPtr<CanvasPattern>> createPattern(HTMLVideoElement&, const String& repetitionType);
-#endif
</del><ins>+ ExceptionOr<RefPtr<CanvasPattern>> createPattern(CanvasImageSource&&, const String& repetition);
</ins><span class="cx">
</span><span class="cx"> ExceptionOr<RefPtr<ImageData>> createImageData(ImageData*) const;
</span><span class="cx"> ExceptionOr<RefPtr<ImageData>> createImageData(float width, float height) const;
</span><span class="lines">@@ -331,6 +321,19 @@
</span><span class="cx"> void applyStrokePattern();
</span><span class="cx"> void applyFillPattern();
</span><span class="cx">
</span><ins>+ ExceptionOr<RefPtr<CanvasPattern>> createPattern(HTMLImageElement&, bool repeatX, bool repeatY);
+ ExceptionOr<RefPtr<CanvasPattern>> createPattern(HTMLCanvasElement&, bool repeatX, bool repeatY);
+#if ENABLE(VIDEO)
+ ExceptionOr<RefPtr<CanvasPattern>> createPattern(HTMLVideoElement&, bool repeatX, bool repeatY);
+#endif
+
+ ExceptionOr<void> drawImage(HTMLImageElement&, const FloatRect& srcRect, const FloatRect& dstRect);
+ ExceptionOr<void> drawImage(HTMLImageElement&, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const BlendMode&);
+ ExceptionOr<void> drawImage(HTMLCanvasElement&, const FloatRect& srcRect, const FloatRect& dstRect);
+#if ENABLE(VIDEO)
+ ExceptionOr<void> drawImage(HTMLVideoElement&, const FloatRect& srcRect, const FloatRect& dstRect);
+#endif
+
</ins><span class="cx"> void drawTextInternal(const String& text, float x, float y, bool fill, std::optional<float> maxWidth = std::nullopt);
</span><span class="cx">
</span><span class="cx"> // The relationship between FontCascade and CanvasRenderingContext2D::FontProxy must hold certain invariants.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasCanvasRenderingContext2Didl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (209047 => 209048)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl        2016-11-29 00:23:07 UTC (rev 209047)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl        2016-11-29 01:03:48 UTC (rev 209048)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,6 +26,13 @@
</span><span class="cx"> enum ImageSmoothingQuality { "low", "medium", "high" };
</span><span class="cx"> enum CanvasWindingRule { "nonzero", "evenodd" };
</span><span class="cx">
</span><ins>+// FIXME: This should include SVGImageElement and ImageBitmap.
+#if defined(ENABLE_VIDEO) && ENABLE_VIDEO
+typedef (HTMLImageElement or HTMLVideoElement or HTMLCanvasElement) CanvasImageSource;
+#else
+typedef (HTMLImageElement or HTMLCanvasElement) CanvasImageSource;
+#endif
+
</ins><span class="cx"> [
</span><span class="cx"> CustomIsReachable,
</span><span class="cx"> JSGenerateToJSObject,
</span><span class="lines">@@ -53,9 +60,6 @@
</span><span class="cx">
</span><span class="cx"> attribute DOMString globalCompositeOperation;
</span><span class="cx">
</span><del>- [MayThrowException] CanvasGradient createLinearGradient(float x0, float y0, float x1, float y1);
- [MayThrowException] CanvasGradient createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1);
-
</del><span class="cx"> attribute unrestricted float lineWidth;
</span><span class="cx"> attribute DOMString lineCap;
</span><span class="cx"> attribute DOMString lineJoin;
</span><span class="lines">@@ -132,16 +136,13 @@
</span><span class="cx">
</span><span class="cx"> void strokeRect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
</span><span class="cx">
</span><del>- [MayThrowException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y);
- [MayThrowException] void drawImage(HTMLImageElement image, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
- [MayThrowException] void drawImage(HTMLImageElement image, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
- [MayThrowException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y);
- [MayThrowException] void drawImage(HTMLCanvasElement canvas, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
- [MayThrowException] void drawImage(HTMLCanvasElement canvas, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
- [Conditional=VIDEO, MayThrowException] void drawImage(HTMLVideoElement video, unrestricted float x, unrestricted float y);
- [Conditional=VIDEO, MayThrowException] void drawImage(HTMLVideoElement video, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
- [Conditional=VIDEO, MayThrowException] void drawImage(HTMLVideoElement video, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
</del><ins>+ // FIXME: This should move to the CanvasDrawImage interface.
+ // FIXME: All the unrestricted float arguments below should be unrestricted doubles.
+ [MayThrowException] void drawImage(CanvasImageSource image, unrestricted float x, unrestricted float y);
+ [MayThrowException] void drawImage(CanvasImageSource image, unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
+ [MayThrowException] void drawImage(CanvasImageSource image, unrestricted float sx, unrestricted float sy, unrestricted float sw, unrestricted float sh, unrestricted float dx, unrestricted float dy, unrestricted float dw, unrestricted float dh);
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> void drawImageFromRect(HTMLImageElement image,
</span><span class="cx"> optional unrestricted float sx = 0, optional unrestricted float sy = 0, optional unrestricted float sw = 0, optional unrestricted float sh = 0,
</span><span class="cx"> optional unrestricted float dx = 0, optional unrestricted float dy = 0, optional unrestricted float dw = 0, optional unrestricted float dh = 0,
</span><span class="lines">@@ -162,14 +163,14 @@
</span><span class="cx"> void webkitPutImageDataHD(ImageData imagedata, float dx, float dy);
</span><span class="cx"> void webkitPutImageDataHD(ImageData imagedata, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight);
</span><span class="cx">
</span><del>- [MayThrowException] CanvasPattern createPattern(HTMLCanvasElement canvas, [TreatNullAs=EmptyString] DOMString repetitionType);
- [MayThrowException] CanvasPattern createPattern(HTMLImageElement image, [TreatNullAs=EmptyString] DOMString repetitionType);
- [Conditional=VIDEO, MayThrowException] CanvasPattern? createPattern(HTMLVideoElement video, [TreatNullAs=EmptyString] DOMString repetitionType);
</del><span class="cx"> [MayThrowException] ImageData createImageData(ImageData? imagedata);
</span><span class="cx"> [MayThrowException] ImageData createImageData(float sw, float sh);
</span><span class="cx">
</span><span class="cx"> [Custom] attribute custom strokeStyle;
</span><span class="cx"> [Custom] attribute custom fillStyle;
</span><ins>+ [MayThrowException] CanvasGradient createLinearGradient(float x0, float y0, float x1, float y1);
+ [MayThrowException] CanvasGradient createRadialGradient(float x0, float y0, float r0, float x1, float y1, float r1);
+ [MayThrowException] CanvasPattern? createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
</ins><span class="cx">
</span><span class="cx"> // pixel manipulation
</span><span class="cx"> [MayThrowException] ImageData getImageData(float sx, float sy, float sw, float sh);
</span></span></pre>
</div>
</div>
</body>
</html>