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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-whitespace-parsing.html

Issue 2560993003: Fix the parsing of colors used as canvas styles to ignore whitespace (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/CanvasStyle.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-whitespace-parsing.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-whitespace-parsing.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-whitespace-parsing.html
new file mode 100644
index 0000000000000000000000000000000000000000..85bbab35d7626a441e40dbb15a4e99da2c7299a9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-whitespace-parsing.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<title>Test whitespace parsing on canvas attributes that invoke the CSS parser</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+
+var ctx;
+function whiteSpaceTest(attribute, input, output) {
+ var canvas = document.createElement('canvas');
+ ctx = canvas.getContext('2d');
+ eval('ctx.' + attribute + ' = "' + input + '"');
+ assert_equals(eval('ctx.' + attribute), output);
+}
+
+generate_tests(whiteSpaceTest, [
+ ['', 'fillStyle', ' red', '#ff0000'],
+ ['', 'fillStyle', 'red ', '#ff0000'],
+ ['', 'fillStyle', '\tred', '#ff0000'],
+ ['', 'fillStyle', 'red\t', '#ff0000'],
+ ['', 'fillStyle', ' #f00', '#ff0000'],
+ ['', 'fillStyle', '#f00 ', '#ff0000'],
+ ['', 'fillStyle', '\t#f00', '#ff0000'],
+ ['', 'fillStyle', '#f00\t', '#ff0000'],
+ ['', 'fillStyle', ' rgb(255, 0, 0)', '#ff0000'],
+ ['', 'fillStyle', 'rgb(255,0,0) ', '#ff0000'],
+ ['', 'fillStyle', 'invalid', '#000000'], // Sanity check
+ ['', 'strokeStyle', ' red', '#ff0000'],
+ ['', 'strokeStyle', 'red ', '#ff0000'],
+ ['', 'strokeStyle', '\tred', '#ff0000'],
+ ['', 'strokeStyle', 'red\t', '#ff0000'],
+ ['', 'strokeStyle', 'invalid', '#000000'], // Sanity check
+// The filter attribute is different: it does not get re-serialized
+ ['', 'filter', ' blur(5px)', ' blur(5px)'],
+ ['', 'filter', 'blur(5px) ', 'blur(5px) '],
+ ['', 'filter', 'blur( 5px)', 'blur( 5px)'],
+ ['', 'filter', '\tblur(5px)', '\tblur(5px)'],
+ ['', 'filter', 'blur(5px)\t', 'blur(5px)\t'],
+ ['', 'filter', 'invalid', 'none'], // Sanity check
+ ]);
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/CanvasStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698