Changeset 200501 in webkit
- Timestamp:
- May 5, 2016 6:26:26 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r200499 r200501 1 2016-05-05 Dean Jackson <dino@apple.com> 2 3 4 and 8 digit color attributes should use the crazypants algorithm, not the CSS one. 4 https://bugs.webkit.org/show_bug.cgi?id=157402 5 <rdar://problem/26131142> 6 7 Reviewed by Simon Fraser. 8 9 Restore the version that was there before I added support for 10 4 and 8 digit hex colors in CSS. 11 12 * fast/dom/attribute-legacy-colors-expected.txt: 13 * fast/dom/script-tests/attribute-legacy-colors.js: 14 1 15 2016-05-05 Joseph Pecoraro <pecoraro@apple.com> 2 16 -
trunk/LayoutTests/fast/dom/attribute-legacy-colors-expected.txt
r192023 r200501 17 17 PASS document.body.bgColor='f00';getComputedStyle(document.body).backgroundColor; is 'rgb(15, 0, 0)' 18 18 PASS document.body.bgColor='ff0000';getComputedStyle(document.body).backgroundColor; is 'rgb(255, 0, 0)' 19 PASS document.body.bgColor='#00000000';getComputedStyle(document.body).backgroundColor; is 'rgb(0, 0, 0)' 19 20 PASS document.body.bgColor='foo';getComputedStyle(document.body).backgroundColor; is 'rgb(15, 0, 0)' 20 21 PASS document.body.bgColor='cheese';getComputedStyle(document.body).backgroundColor; is 'rgb(192, 238, 14)' … … 35 36 PASS document.body.bgColor='#55';getComputedStyle(document.body).backgroundColor; is 'rgb(5, 5, 0)' 36 37 PASS document.body.bgColor='#555';getComputedStyle(document.body).backgroundColor; is 'rgb(85, 85, 85)' 38 PASS document.body.bgColor='#5555';getComputedStyle(document.body).backgroundColor; is 'rgb(85, 85, 0)' 37 39 PASS document.body.bgColor='#55555';getComputedStyle(document.body).backgroundColor; is 'rgb(85, 85, 80)' 38 40 PASS document.body.bgColor='#555555';getComputedStyle(document.body).backgroundColor; is 'rgb(85, 85, 85)' 39 41 PASS document.body.bgColor='#5555555';getComputedStyle(document.body).backgroundColor; is 'rgb(85, 85, 80)' 42 PASS document.body.bgColor='#55555555';getComputedStyle(document.body).backgroundColor; is 'rgb(85, 85, 85)' 40 43 PASS document.body.bgColor='5';getComputedStyle(document.body).backgroundColor; is 'rgb(5, 0, 0)' 41 44 PASS document.body.bgColor='55';getComputedStyle(document.body).backgroundColor; is 'rgb(5, 5, 0)' -
trunk/LayoutTests/fast/dom/script-tests/attribute-legacy-colors.js
r192023 r200501 16 16 {'test':'f00', 'expected':[15, 0, 0]}, 17 17 {'test':'ff0000', 'expected':[255, 0, 0]}, 18 {'test':'#00000000', 'expected':[0, 0, 0]}, 18 19 {'test':'foo', 'expected':[15, 0, 0]}, 19 20 {'test':'cheese', 'expected':[192, 238, 14]}, … … 34 35 {'test':'#55', 'expected':[5, 5, 0]}, 35 36 {'test':'#555', 'expected':[85, 85, 85]}, 37 {'test':'#5555', 'expected':[85, 85, 0]}, 36 38 {'test':'#55555', 'expected':[85, 85, 80]}, 37 39 {'test':'#555555', 'expected':[85, 85, 85]}, 38 40 {'test':'#5555555', 'expected':[85, 85, 80]}, 41 {'test':'#55555555', 'expected':[85, 85, 85]}, 39 42 {'test':'5', 'expected':[5, 0, 0]}, 40 43 {'test':'55', 'expected':[5, 5, 0]}, -
trunk/Source/WebCore/ChangeLog
r200495 r200501 1 2016-05-05 Dean Jackson <dino@apple.com> 2 3 4 and 8 digit color attributes should use the crazypants algorithm, not the CSS one. 4 https://bugs.webkit.org/show_bug.cgi?id=157402 5 <rdar://problem/26131142> 6 7 Reviewed by Simon Fraser. 8 9 Noel and Tab from Google alerted me to the fact I broke some legacy 10 HTML color attributes when I added support for 4 and 8 digit hex colors 11 in CSS. The fix is to favor the "crazy" parsing unless we know it is a 3 or 6 12 digit hex value (in which case we try the CSS algorithm first). 13 14 Covered by reverting an existing test. 15 16 * html/HTMLElement.cpp: 17 (WebCore::HTMLElement::addHTMLColorToStyle): 18 1 19 2016-05-05 Brady Eidson <beidson@apple.com> 2 20 -
trunk/Source/WebCore/html/HTMLElement.cpp
r200041 r200501 1140 1140 1141 1141 // If the string is a named CSS color or a 3/6-digit hex color, use that. 1142 Color parsedColor(colorString); 1143 if (!parsedColor.isValid()) 1144 parsedColor.setRGB(parseColorStringWithCrazyLegacyRules(colorString)); 1145 1146 style.setProperty(propertyID, CSSValuePool::singleton().createColorValue(parsedColor.rgb())); 1142 // We can't use the default Color constructor because it accepts 1143 // 4/8-digit hex, which conflict with some legacy HTML content using attributes. 1144 1145 Color color; 1146 1147 if ((colorString.length() == 4 || colorString.length() == 7) && colorString[0] == '#') 1148 color = Color(colorString); 1149 if (!color.isValid()) 1150 color.setNamedColor(colorString); 1151 if (!color.isValid()) 1152 color.setRGB(parseColorStringWithCrazyLegacyRules(colorString)); 1153 1154 style.setProperty(propertyID, CSSValuePool::singleton().createColorValue(color.rgb())); 1147 1155 } 1148 1156
Note: See TracChangeset
for help on using the changeset viewer.