Changeset 275055 in webkit
- Timestamp:
- Mar 25, 2021, 1:46:08 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (2 diffs)
-
LayoutTests/platform/win/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSGradientValue.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r275051 r275055 1 2021-03-25 Tim Nguyen <ntim@apple.com> 2 3 Enable normalization-conic-2.html WPT now that underlying bug is fixed. 4 Also skip some conic-gradient tests only on Windows instead of all platforms. 5 https://bugs.webkit.org/show_bug.cgi?id=221294 6 <rdar://problem/74157218> 7 8 Reviewed by Darin Adler. 9 10 * TestExpectations: enabled imported/w3c/web-platform-tests/css/css-images/normalization-conic-2.html. 11 1 12 2021-03-25 Robert Jenner <jenner@apple.com> 2 13 -
trunk/LayoutTests/TestExpectations
r274983 r275055 3011 3011 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html [ Skip ] 3012 3012 3013 http/wpt/css/css-images-4/conic-gradient-parsing.html [ Skip ]3014 fast/gradients/conic-repeating.html [ Skip ]3015 fast/gradients/conic.html [ Skip ]3016 fast/gradients/conic-off-center.html [ Skip ]3017 fast/gradients/conic-center-outside-box.html [ Skip ]3018 fast/gradients/conic-extended-stops.html [ Skip ]3019 fast/gradients/conic-from-angle.html [ Skip ]3020 fast/gradients/conic-repeating-last-stop.html [ Skip ]3021 fast/gradients/conic-gradient-alpha.html [ Skip ]3022 fast/gradients/conic-gradient-extended-stops.html [ Skip ]3023 fast/gradients/conic-gradient.html [ Skip ]3024 fast/gradients/conic-two-hints.html [ Skip ]3025 3013 imported/w3c/web-platform-tests/css/css-images/multiple-position-color-stop-conic.html [ ImageOnlyFailure ] 3026 3014 … … 4450 4438 webkit.org/b/214456 imported/w3c/web-platform-tests/css/css-images/infinite-radial-gradient-refcrash.html [ ImageOnlyFailure ] 4451 4439 webkit.org/b/214456 imported/w3c/web-platform-tests/css/css-images/multiple-position-color-stop-conic-2.html [ ImageOnlyFailure ] 4452 webkit.org/b/214456 imported/w3c/web-platform-tests/css/css-images/normalization-conic-2.html [ ImageOnlyFailure ]4453 4440 webkit.org/b/214456 imported/w3c/web-platform-tests/css/css-images/normalization-linear.html [ ImageOnlyFailure ] 4454 4441 webkit.org/b/214456 imported/w3c/web-platform-tests/css/css-images/normalization-radial.html [ ImageOnlyFailure ] -
trunk/LayoutTests/platform/win/TestExpectations
r274962 r275055 269 269 accessibility/listbox-clear-selection.html [ Skip ] 270 270 accessibility/embedded-image-description.html [ Skip ] 271 272 # TODO Conic gradients 273 http/wpt/css/css-images-4/conic-gradient-parsing.html [ Skip ] 274 fast/gradients/conic-repeating.html [ Skip ] 275 fast/gradients/conic.html [ Skip ] 276 fast/gradients/conic-off-center.html [ Skip ] 277 fast/gradients/conic-center-outside-box.html [ Skip ] 278 fast/gradients/conic-extended-stops.html [ Skip ] 279 fast/gradients/conic-from-angle.html [ Skip ] 280 fast/gradients/conic-repeating-last-stop.html [ Skip ] 281 fast/gradients/conic-gradient-alpha.html [ Skip ] 282 fast/gradients/conic-gradient-extended-stops.html [ Skip ] 283 fast/gradients/conic-gradient.html [ Skip ] 284 fast/gradients/conic-two-hints.html [ Skip ] 271 285 272 286 # TODO Investigate why these mouse scroll tests are failing. -
trunk/Source/WebCore/ChangeLog
r275049 r275055 1 2021-03-25 Tim Nguyen <ntim@apple.com> 2 3 Fix edge cases in normalization of conic-gradient color stops 4 https://bugs.webkit.org/show_bug.cgi?id=221294 5 <rdar://problem/74157218> 6 7 Reviewed by Darin Adler. 8 9 `lastOneOrLessIndex` had an off-by-one error, so it did not go through the 10 branch handling clamping all the stop offsets when they're all above 1. 11 12 Also made `normalizeStopsAndEndpointsOutsideRange` logic easier to follow using 13 `Optional<size_t>` instead of placeholder values. 14 15 Test: web-platform-tests/css/css-images/normalization-conic-2.html 16 17 * css/CSSGradientValue.cpp: 18 (WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange): 19 1 20 2021-03-25 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/Source/WebCore/css/CSSGradientValue.cpp
r272497 r275055 238 238 void normalizeStopsAndEndpointsOutsideRange(Vector<GradientStop>& stops) 239 239 { 240 auto numStops = stops.size(); 241 242 size_t firstZeroOrGreaterIndex = numStops; 240 size_t numStops = stops.size(); 241 size_t lastStopIndex = numStops - 1; 242 243 Optional<size_t> firstZeroOrGreaterIndex; 243 244 for (size_t i = 0; i < numStops; ++i) { 244 245 if (*stops[i].offset >= 0) { … … 248 249 } 249 250 250 if (firstZeroOrGreaterIndex > 0) { 251 if (firstZeroOrGreaterIndex < numStops && *stops[firstZeroOrGreaterIndex].offset > 0) { 252 float prevOffset = *stops[firstZeroOrGreaterIndex - 1].offset; 253 float nextOffset = *stops[firstZeroOrGreaterIndex].offset; 254 255 float interStopProportion = -prevOffset / (nextOffset - prevOffset); 251 if (firstZeroOrGreaterIndex) { 252 size_t index = *firstZeroOrGreaterIndex; 253 if (index > 0) { 254 float previousOffset = *stops[index - 1].offset; 255 float nextOffset = *stops[index].offset; 256 257 float interStopProportion = -previousOffset / (nextOffset - previousOffset); 256 258 // FIXME: when we interpolate gradients using premultiplied colors, this should do premultiplication. 257 Color blendedColor = blend(stops[ firstZeroOrGreaterIndex - 1].color, stops[firstZeroOrGreaterIndex].color, interStopProportion);258 259 Color blendedColor = blend(stops[index - 1].color, stops[index].color, interStopProportion); 260 259 261 // Clamp the positions to 0 and set the color. 260 for (size_t i = 0; i < firstZeroOrGreaterIndex; ++i) {262 for (size_t i = 0; i < index; ++i) { 261 263 stops[i].offset = 0; 262 264 stops[i].color = blendedColor; 263 265 } 264 } else {265 // All stops are below 0; just clamp them.266 for (size_t i = 0; i < firstZeroOrGreaterIndex; ++i)267 stops[i].offset = 0;268 }269 } 270 271 size_t lastOneOrLessIndex = numStops;272 for (int i = numStops - 1; i >= 0; --i) {266 } 267 } else { 268 // All stop offsets below 0, clamp them. 269 for (auto& stop : stops) 270 stop.offset = 0; 271 } 272 273 Optional<size_t> lastOneOrLessIndex; 274 for (int i = lastStopIndex; i >= 0; --i) { 273 275 if (*stops[i].offset <= 1) { 274 276 lastOneOrLessIndex = i; … … 276 278 } 277 279 } 278 279 if (lastOneOrLessIndex < numStops - 1) { 280 if (lastOneOrLessIndex < numStops && *stops[lastOneOrLessIndex].offset < 1) { 281 float prevOffset = *stops[lastOneOrLessIndex].offset; 282 float nextOffset = *stops[lastOneOrLessIndex + 1].offset; 283 284 float interStopProportion = (1 - prevOffset) / (nextOffset - prevOffset); 280 281 if (lastOneOrLessIndex) { 282 size_t index = *lastOneOrLessIndex; 283 if (index < lastStopIndex) { 284 float previousOffset = *stops[index].offset; 285 float nextOffset = *stops[index + 1].offset; 286 287 float interStopProportion = (1 - previousOffset) / (nextOffset - previousOffset); 285 288 // FIXME: when we interpolate gradients using premultiplied colors, this should do premultiplication. 286 Color blendedColor = blend(stops[ lastOneOrLessIndex].color, stops[lastOneOrLessIndex + 1].color, interStopProportion);287 289 Color blendedColor = blend(stops[index].color, stops[index + 1].color, interStopProportion); 290 288 291 // Clamp the positions to 1 and set the color. 289 for (size_t i = lastOneOrLessIndex + 1; i < numStops; ++i) {292 for (size_t i = index + 1; i <= lastStopIndex; ++i) { 290 293 stops[i].offset = 1; 291 294 stops[i].color = blendedColor; 292 295 } 293 } else {294 // All stops are above 1; just clamp them.295 for (size_t i = lastOneOrLessIndex; i < numStops; ++i)296 stops[i].offset = 1;297 }296 } 297 } else { 298 // All stop offsets above 1, clamp them. 299 for (auto& stop : stops) 300 stop.offset = 1; 298 301 } 299 302 }
Note:
See TracChangeset
for help on using the changeset viewer.