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

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 179493002: Add null check to fill, stroke, clip method (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: expected.txt Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index c0ded9f381a1fb7f5838c1167e908c1a00eae83b..9707f9a2e3cc298eee4f138b0cd6b3b0a9e842ff 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -932,8 +932,18 @@ void CanvasRenderingContext2D::fill(const String& windingRuleString)
fillInternal(m_path, windingRuleString);
}
-void CanvasRenderingContext2D::fill(DOMPath* domPath, const String& windingRuleString)
+void CanvasRenderingContext2D::fill(DOMPath* domPath, ExceptionState& exceptionState)
{
+ fill(domPath, "nonzero", exceptionState);
+}
+
+void CanvasRenderingContext2D::fill(DOMPath* domPath, const String& windingRuleString, ExceptionState& exceptionState)
+{
+ if (!domPath) {
+ exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
+ return;
+ }
+
fillInternal(domPath->path(), windingRuleString);
}
@@ -970,8 +980,13 @@ void CanvasRenderingContext2D::stroke()
strokeInternal(m_path);
}
-void CanvasRenderingContext2D::stroke(DOMPath* domPath)
+void CanvasRenderingContext2D::stroke(DOMPath* domPath, ExceptionState& exceptionState)
{
+ if (!domPath) {
+ exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
+ return;
+ }
+
strokeInternal(domPath->path());
}
@@ -999,8 +1014,18 @@ void CanvasRenderingContext2D::clip(const String& windingRuleString)
clipInternal(m_path, windingRuleString);
}
-void CanvasRenderingContext2D::clip(DOMPath* domPath, const String& windingRuleString)
+void CanvasRenderingContext2D::clip(DOMPath* domPath, ExceptionState& exceptionState)
+{
+ clip(domPath, "nonzero", exceptionState);
+}
+
+void CanvasRenderingContext2D::clip(DOMPath* domPath, const String& windingRuleString, ExceptionState& exceptionState)
{
+ if (!domPath) {
+ exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "Path"));
+ return;
+ }
+
clipInternal(domPath->path(), windingRuleString);
}
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698