-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[css-typed-om] Rejig CSSResourceValue hierarchy.
We implement the new CSSImageValue, which is an opaque object with no constructor. We also had to change the testsuite.js a bit to test it. Bug: 545318 Change-Id: I0ae719c5380e01ff9423e0ff0684afe547de1bb0
- Loading branch information
1 parent
99ea9dc
commit 20a6d28
Showing
10 changed files
with
74 additions
and
231 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
30 changes: 30 additions & 0 deletions
30
css/css-typed-om/stylevalue-normalization/normalize-image.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,30 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>CSSImageValue normalization tests</title> | ||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#resourcevalue-normalization"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../resources/testhelper.js"></script> | ||
<body> | ||
<script> | ||
'use strict'; | ||
|
||
const gTestUrl = '/media/1x1-green.png'; | ||
const gBadTestUrl = document.location.href; | ||
|
||
test(t => { | ||
const result = CSSStyleValue.parse('background-image', 'url("' + gTestUrl + '")'); | ||
assert_class_string(result, 'CSSImageValue'); | ||
}, 'Normalizing a valid <url> returns a CSSImageValue'); | ||
|
||
test(t => { | ||
const result = CSSStyleValue.parse('background-image', 'url("' + gBadTestUrl + '")'); | ||
assert_class_string(result, 'CSSImageValue'); | ||
}, 'Normalizing a bad <url> returns a CSSImageValue'); | ||
|
||
test(t => { | ||
const result = CSSStyleValue.parse('background-image', 'linear-gradient(red, orange)'); | ||
assert_equals(result.constructor.name, 'CSSImageValue'); | ||
}, 'Normalizing a <gradient> returns a CSSImageValue'); | ||
|
||
</script> |
56 changes: 0 additions & 56 deletions
56
css/css-typed-om/stylevalue-normalization/normalize-resource.tentative.html
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
css/css-typed-om/stylevalue-serialization/cssImageValue.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,19 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>CSSURLImageValue serialization tests</title> | ||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#urlimagevalue-serialization"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../resources/testhelper.js"></script> | ||
<body> | ||
<div id="log"></div> | ||
<div id="testUrl" style="background-image: url('/media/1x1-green.png')"></div> | ||
<script> | ||
'use strict'; | ||
|
||
test(() => { | ||
const result = document.getElementById('testUrl').attributeStyleMap.get('background-image'); | ||
assert_equals(result.toString(), 'url("/media/1x1-green.png")'); | ||
}, 'CSSUrlImageValue serializes correctly'); | ||
|
||
</script> |
15 changes: 0 additions & 15 deletions
15
css/css-typed-om/stylevalue-serialization/cssUrlImageValue.tentative.html
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
css/css-typed-om/stylevalue-subclasses/cssUrlImageValue-interface.html
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
css/css-typed-om/stylevalue-subclasses/cssUrlImageValue-invalid.html
This file was deleted.
Oops, something went wrong.
81 changes: 0 additions & 81 deletions
81
css/css-typed-om/stylevalue-subclasses/cssUrlImageValue.html
This file was deleted.
Oops, something went wrong.
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