Changeset 192788 in webkit
- Timestamp:
- Nov 29, 2015 2:03:18 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r192772 r192788 1 2015-11-29 Antoine Quint <graouts@apple.com> 2 3 Browser does not fall back to SVG attribute value when CSS style value is invalid or not supported 4 https://bugs.webkit.org/show_bug.cgi?id=147932 5 6 Reviewed by Dean Jackson. 7 8 Testing that we correctly fall back to the presentation attribute for SVGPaint and SVGColor values 9 specified with an invalid keyword in a `style` attribute. We also update the expected output for 10 svg/css/svg-attribute-parser-mode.html which is now in line with values returned by Firefox and 11 Chrome, where we correctly use the default value instead of null objects, which was definitely 12 an error. 13 14 * svg/css/invalid-color-cascade-expected.svg: Added. 15 * svg/css/invalid-color-cascade.svg: Added. 16 * svg/css/invalid-paint-cascade-expected.svg: Added. 17 * svg/css/invalid-paint-cascade.svg: Added. 18 * svg/css/script-tests/svg-attribute-parser-mode.js: 19 * svg/css/svg-attribute-parser-mode-expected.txt: 20 1 21 2015-11-18 Andy Estes <aestes@apple.com> 2 22 -
trunk/LayoutTests/svg/css/script-tests/svg-attribute-parser-mode.js
r189646 r192788 22 22 // Set following colors should be invalid. 23 23 rect.setAttribute("fill", "f00"); 24 shouldBe Null("document.defaultView.getComputedStyle(rect, null).fill");24 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill", "rgb(0, 0, 0)"); 25 25 // Reset to green. 26 26 rect.setAttribute("fill", "green"); … … 28 28 29 29 rect.setAttribute("fill", "ff00"); 30 shouldBe Null("document.defaultView.getComputedStyle(rect, null).fill");30 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill", "rgb(0, 0, 0)"); 31 31 // Reset to green. 32 32 rect.setAttribute("fill", "green"); … … 34 34 35 35 rect.setAttribute("fill", "ff0000"); 36 shouldBe Null("document.defaultView.getComputedStyle(rect, null).fill");36 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill", "rgb(0, 0, 0)"); 37 37 // Reset to green. 38 38 rect.setAttribute("fill", "green"); … … 40 40 41 41 rect.setAttribute("fill", "ff00"); 42 shouldBe Null("document.defaultView.getComputedStyle(rect, null).fill");42 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).fill", "rgb(0, 0, 0)"); 43 43 // Reset to green. 44 44 rect.setAttribute("fill", "green"); … … 74 74 // Set following colors should be invalid. 75 75 rect.setAttribute("stroke", "f00"); 76 shouldBe Null("document.defaultView.getComputedStyle(rect, null).stroke");76 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke", "none"); 77 77 // Reset to green. 78 78 rect.setAttribute("stroke", "green"); … … 80 80 81 81 rect.setAttribute("stroke", "ff00"); 82 shouldBe Null("document.defaultView.getComputedStyle(rect, null).stroke");82 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke", "none"); 83 83 // Reset to green. 84 84 rect.setAttribute("stroke", "green"); … … 86 86 87 87 rect.setAttribute("stroke", "ff0000"); 88 shouldBe Null("document.defaultView.getComputedStyle(rect, null).stroke");88 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke", "none"); 89 89 // Reset to green. 90 90 rect.setAttribute("stroke", "green"); … … 92 92 93 93 rect.setAttribute("stroke", "ff00"); 94 shouldBe Null("document.defaultView.getComputedStyle(rect, null).stroke");94 shouldBeEqualToString("document.defaultView.getComputedStyle(rect, null).stroke", "none"); 95 95 // Reset to green. 96 96 rect.setAttribute("stroke", "green"); -
trunk/LayoutTests/svg/css/svg-attribute-parser-mode-expected.txt
r189646 r192788 6 6 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 0, 0)" 7 7 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 128, 0)" 8 PASS document.defaultView.getComputedStyle(rect, null).fill is null8 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 0, 0)" 9 9 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 128, 0)" 10 PASS document.defaultView.getComputedStyle(rect, null).fill is null10 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 0, 0)" 11 11 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 128, 0)" 12 PASS document.defaultView.getComputedStyle(rect, null).fill is null12 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 0, 0)" 13 13 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 128, 0)" 14 PASS document.defaultView.getComputedStyle(rect, null).fill is null14 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 0, 0)" 15 15 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 128, 0)" 16 16 PASS document.defaultView.getComputedStyle(rect, null).fill is "rgb(0, 0, 0)" … … 22 22 PASS document.defaultView.getComputedStyle(rect, null).stroke is "none" 23 23 PASS document.defaultView.getComputedStyle(rect, null).stroke is "rgb(0, 128, 0)" 24 PASS document.defaultView.getComputedStyle(rect, null).stroke is null24 PASS document.defaultView.getComputedStyle(rect, null).stroke is "none" 25 25 PASS document.defaultView.getComputedStyle(rect, null).stroke is "rgb(0, 128, 0)" 26 PASS document.defaultView.getComputedStyle(rect, null).stroke is null26 PASS document.defaultView.getComputedStyle(rect, null).stroke is "none" 27 27 PASS document.defaultView.getComputedStyle(rect, null).stroke is "rgb(0, 128, 0)" 28 PASS document.defaultView.getComputedStyle(rect, null).stroke is null28 PASS document.defaultView.getComputedStyle(rect, null).stroke is "none" 29 29 PASS document.defaultView.getComputedStyle(rect, null).stroke is "rgb(0, 128, 0)" 30 PASS document.defaultView.getComputedStyle(rect, null).stroke is null30 PASS document.defaultView.getComputedStyle(rect, null).stroke is "none" 31 31 PASS document.defaultView.getComputedStyle(rect, null).stroke is "rgb(0, 128, 0)" 32 32 PASS document.defaultView.getComputedStyle(rect, null).stroke is "none" -
trunk/Source/WebCore/ChangeLog
r192787 r192788 1 2015-11-29 Antoine Quint <graouts@apple.com> 2 3 Browser does not fall back to SVG attribute value when CSS style value is invalid or not supported 4 https://bugs.webkit.org/show_bug.cgi?id=147932 5 6 Reviewed by Dean Jackson. 7 8 Instead of returning an SVGPaint object of type SVG_PAINTTYPE_UNKNOWN when we encounter an SVG paint 9 value that cannot be parsed, we now return `nullptr` which will cause that value to be ignored and 10 let another paint value in the cascade be used instead. This is the same approach used for SVGColor. 11 Since we're removing the only call site for `SVGPaint::createUnknown()`, we remove that function entirely. 12 13 Tests: svg/css/invalid-color-cascade.svg 14 svg/css/invalid-paint-cascade.svg 15 16 * css/SVGCSSParser.cpp: 17 (WebCore::CSSParser::parseSVGPaint): 18 * svg/SVGPaint.h: 19 (WebCore::SVGPaint::createUnknown): Deleted. 20 1 21 2015-11-29 Simon Fraser <simon.fraser@apple.com> 2 22 -
trunk/Source/WebCore/css/SVGCSSParser.cpp
r188315 r192788 369 369 RGBA32 c = Color::transparent; 370 370 if (!parseColorFromValue(*m_valueList->current(), c)) 371 return SVGPaint::createUnknown();371 return nullptr; 372 372 return SVGPaint::createColor(Color(c)); 373 373 } -
trunk/Source/WebCore/svg/SVGPaint.h
r183536 r192788 43 43 SVG_PAINTTYPE_URI = 107 44 44 }; 45 46 static Ref<SVGPaint> createUnknown()47 {48 return adoptRef(*new SVGPaint(SVG_PAINTTYPE_UNKNOWN));49 }50 45 51 46 static Ref<SVGPaint> createNone()
Note: See TracChangeset
for help on using the changeset viewer.