summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/canvas/CanvasGradient.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/canvas/CanvasGradient.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/html/canvas/CanvasGradient.cpp')
-rw-r--r--Source/WebCore/html/canvas/CanvasGradient.cpp38
1 files changed, 14 insertions, 24 deletions
diff --git a/Source/WebCore/html/canvas/CanvasGradient.cpp b/Source/WebCore/html/canvas/CanvasGradient.cpp
index 8a7ace0cf..a5efa3296 100644
--- a/Source/WebCore/html/canvas/CanvasGradient.cpp
+++ b/Source/WebCore/html/canvas/CanvasGradient.cpp
@@ -11,10 +11,10 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
@@ -27,48 +27,38 @@
#include "config.h"
#include "CanvasGradient.h"
-#include "CanvasPattern.h"
#include "CanvasStyle.h"
-#include "CSSParser.h"
#include "ExceptionCode.h"
namespace WebCore {
CanvasGradient::CanvasGradient(const FloatPoint& p0, const FloatPoint& p1)
: m_gradient(Gradient::create(p0, p1))
-#if ENABLE(DASHBOARD_SUPPORT)
- , m_dashbardCompatibilityMode(false)
-#endif
{
}
CanvasGradient::CanvasGradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1)
: m_gradient(Gradient::create(p0, r0, p1, r1))
-#if ENABLE(DASHBOARD_SUPPORT)
- , m_dashbardCompatibilityMode(false)
-#endif
{
}
-void CanvasGradient::addColorStop(float value, const String& color, ExceptionCode& ec)
+ExceptionOr<void> CanvasGradient::addColorStop(float value, const String& colorString)
{
- if (!(value >= 0 && value <= 1.0f)) {
- ec = INDEX_SIZE_ERR;
- return;
- }
+ if (!(value >= 0 && value <= 1))
+ return Exception { INDEX_SIZE_ERR };
- RGBA32 rgba = 0;
- if (!parseColorOrCurrentColor(rgba, color, 0 /*canvas*/)) {
+ // FIXME: Passing null for canvas means this won't work for current color. Is that OK?
+ Color color = parseColorOrCurrentColor(colorString, nullptr /*canvas*/);
+ if (!color.isValid()) {
#if ENABLE(DASHBOARD_SUPPORT)
- if (!m_dashbardCompatibilityMode)
- ec = SYNTAX_ERR;
-#else
- ec = SYNTAX_ERR;
+ if (m_dashboardCompatibilityMode)
+ return { };
#endif
- return;
+ return Exception { SYNTAX_ERR };
}
- m_gradient->addColorStop(value, Color(rgba));
+ m_gradient->addColorStop(value, color);
+ return { };
}
-} // namespace
+}