-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Store CSS color name in CSSRGB
When serializing an sRGB color value that originated from a named color, it should return the color name converted to ASCII lowercase. This requires storing the color name (if it has one). This change also requires explicitly removing the color names when computing style, because computed color values do not retain their name. This fixes at least 2 WPT subtests.
- Loading branch information
Showing
8 changed files
with
93 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Tests/LibWeb/Text/expected/wpt-import/domparsing/style_attribute_html.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Summary | ||
|
||
Harness status: OK | ||
|
||
Rerun | ||
|
||
Found 4 tests | ||
|
||
2 Pass | ||
2 Fail | ||
Details | ||
Result Test Name MessagePass Parsing of initial style attribute | ||
Fail Parsing of invalid style attribute | ||
Fail Parsing of style attribute | ||
Pass Update style.backgroundColor |
52 changes: 52 additions & 0 deletions
52
Tests/LibWeb/Text/input/wpt-import/domparsing/style_attribute_html.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Style attribute in HTML</title> | ||
<script src=../resources/testharness.js></script> | ||
<script src=../resources/testharnessreport.js></script> | ||
<script> | ||
|
||
var div; | ||
setup(function() { | ||
var input = '<div style="color: red">Foo</div>'; | ||
var doc = (new DOMParser()).parseFromString(input, 'text/html'); | ||
div = doc.querySelector('div'); | ||
}); | ||
|
||
test(function() { | ||
var style = div.style; | ||
assert_equals(style.cssText, 'color: red;'); | ||
assert_equals(style.color, 'red'); | ||
assert_equals(div.getAttribute("style"), 'color: red', | ||
'Value of style attribute should match the string value that was set'); | ||
}, 'Parsing of initial style attribute'); | ||
|
||
test(function() { | ||
var style = div.style; | ||
div.setAttribute('style', 'color:: invalid'); | ||
assert_equals(style.cssText, ''); | ||
assert_equals(style.color, ''); | ||
assert_equals(div.getAttribute('style'), 'color:: invalid', | ||
'Value of style attribute should match the string value that was set'); | ||
}, 'Parsing of invalid style attribute'); | ||
|
||
test(function() { | ||
var style = div.style; | ||
div.setAttribute('style', 'color: green'); | ||
assert_equals(style.cssText, 'color: green;'); | ||
assert_equals(style.color, 'green'); | ||
assert_equals(div.getAttribute('style'), 'color: green', | ||
'Value of style attribute should match the string value that was set'); | ||
}, 'Parsing of style attribute'); | ||
|
||
test(function() { | ||
var style = div.style; | ||
style.backgroundColor = 'blue'; | ||
assert_equals(style.cssText, 'color: green; background-color: blue;', | ||
'Should not drop the existing style'); | ||
assert_equals(style.color, 'green', | ||
'Should not drop the existing style'); | ||
assert_equals(div.getAttribute('style'), 'color: green; background-color: blue;', | ||
'Should update style attribute'); | ||
}, 'Update style.backgroundColor'); | ||
|
||
</script> |