[webkit-reviews] review requested: [Bug 36444] [Qt] LayoutTests/fast/canvas/fillrect_gradient.html failed : [Attachment 51312] fix platformGradient

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 22 11:09:14 PDT 2010


qi <qi.2.zhang at nokia.com> has asked  for review:
Bug 36444: [Qt] LayoutTests/fast/canvas/fillrect_gradient.html failed
https://bugs.webkit.org/show_bug.cgi?id=36444

Attachment 51312: fix platformGradient
https://bugs.webkit.org/attachment.cgi?id=51312&action=review

------- Additional Comments from qi <qi.2.zhang at nokia.com>
Based on HTML5.0 (4.8.10.1.4 Colors and styles)

The addColorStop(offset, color) method on the CanvasGradient interface adds a
new stop to a gradient.
If the offset is less than 0, greater than 1, infinite, or NaN, then an
INDEX_SIZE_ERR exception must be raised. If
the color cannot be parsed as a CSS color, then a SYNTAX_ERR exception must be
raised. Otherwise, the
gradient must have a new stop placed, at offset offset relative to the whole
gradient, and with the color obtained
by parsing color as a CSS <color> value. If multiple stops are added at the
same offset on a gradient, they must
be placed in the order added, with the first one closest to the start of the
gradient, and each subsequent one
infinitesimally further along towards the end point (in effect causing all but
the first and last stop added at each
point to be ignored).

1. Currently, the algorithm of the platformGradient depends on a sorted
colorStop array, otherwise when the duplicated colorStop are not continually,
it will failed, because it can't find the duplicated colorStop anymore.
2. When we have duplicated colorStop, suppose only the first and last works,
the other shall be ignored based on the spec.
for example, in this test case, we have case like:
colorStop      current		 should be
0,  '#00f'     --> 0		 -->0
0.5,'#fff'     -->0.5		 -->0.5
0.5,'#aaa'     -->0.5+0.00...1	 -->0.5+0.00...1		 -->finally, it
is ignored
0.5,'#abc'     -->0.5+0.00...2	 -->0.5+0.00...1(overwrite pre)  --> finally,
it ignored
0.5,'#f00'     -->0.5+0.00...3	 -->0.5+0.00...1(overwrite pre)
1,  '#ff0'     -->1		 -->1
another case is:
colorStop		 current					       
  should be
0.5,   '#fff'		 0.5,  '#fff'	 -->finally, it is ignored	       
  0, '#00f'
0.5,   '#aaa'		 0.5+0.00...1, '#aaa'  -->finally, it is ignored       
  0.5,	'#fff'
1,     '#ff0'		 1, '#ff0'					       
  0.5+0.00...1,'#aaa'	      -->finally, it is ignored
0.5,   '#abc'		 0.5, '#abc'  (overwrite the 1th)		       
  0.5+0.00...1,'#abc'(overwrite pre) -->finally, it is ignored
0.5,   '#f00'		 0.5+0.00...1, '#f00' (overwrite the 2nd)	       
  0.5+0.00...1,'#f00'(overwrite pre)
0,     '#00f'		 0, '#00f'					       
  1, '#ff0'


More information about the webkit-reviews mailing list