Auto merge of #20482 - brainlessdeveloper:list-style-image-computed, r=emilio

Implement a URL-generic type for ListStyleImage

<!-- Please describe your changes on the following line: -->

This should fix the following two "expected to fail" tests described in https://github.com/servo/servo/issues/18015:

- getComputedStyle(elem) for url() listStyleImage uses the resolved URL
  and elem.style uses the original URL

- getComputedStyle(elem) for url() listStyle uses the resolved URL
  and elem.style uses the original URL

I updated the test failure expectations by removing the corresponding `.ini` file.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #18015 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20482)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-04-03 18:12:13 -04:00 committed by GitHub
commit d744e35d38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 157 additions and 124 deletions

View file

@ -493,10 +493,9 @@ mod shorthand_serialization {
}
mod list_style {
use style::properties::longhands::list_style_image::SpecifiedValue as ListStyleImage;
use style::properties::longhands::list_style_position::SpecifiedValue as ListStylePosition;
use style::properties::longhands::list_style_type::SpecifiedValue as ListStyleType;
use style::values::Either;
use style::values::generics::url::UrlOrNone as ImageUrlOrNone;
use super::*;
#[test]
@ -504,8 +503,7 @@ mod shorthand_serialization {
let mut properties = Vec::new();
let position = ListStylePosition::Inside;
let image =
ListStyleImage(Either::First(SpecifiedUrl::new_for_testing("http://servo/test.png")));
let image = ImageUrlOrNone::Url(SpecifiedUrl::new_for_testing("http://servo/test.png"));
let style_type = ListStyleType::Disc;
properties.push(PropertyDeclaration::ListStylePosition(position));

View file

@ -1,10 +0,0 @@
[get-computed-style-for-url.html]
type: testharness
[getComputedStyle(elem) for url() listStyle uses the resolved URL and elem.style uses the original URL]
expected: FAIL
bug: https://github.com/servo/servo/issues/18015
[getComputedStyle(elem) for url() listStyleImage uses the resolved URL and elem.style uses the original URL]
expected: FAIL
bug: https://github.com/servo/servo/issues/18015

View file

@ -40,6 +40,29 @@
}, `getComputedStyle(elem) for url() ${property} uses the resolved URL and elem.style uses the original URL`);
}
function testNoneForProperty(property) {
test(function() {
var elem = document.createElement("div");
elem.style[property] = "none";
container.appendChild(elem);
assert_equals(
getComputedStyle(elem)[computedPropertyName[property] || property],
"none"
);
assert_equals(
elem.style[computedPropertyName[property] || property],
"none"
);
}, `getComputedStyle(elem) and elem.style for url() ${property} correctly return "none"`);
}
testNoneForProperty("background");
testNoneForProperty("backgroundImage");
testNoneForProperty("borderImage");
testNoneForProperty("listStyle");
testNoneForProperty("listStyleImage");
testUrlsForProperty("backgroundImage", "test.jpg");
testUrlsForProperty("background", "test.jpg", "no-repeat");
testUrlsForProperty("borderImage", "test.jpg", "30 round");