Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #8111 - gilles-leblanc:issue-8002, r=SimonSapin
Compute value of float according to position value According to CSS2 Section 9.7, if 'position' has a value of 'absolute' or 'fixed' the computed value of 'float' should be 'none'. This changes the float to a single_keyword_computed which checks the positioned value of the element to compute the float value. Fixes #8002 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8111) <!-- Reviewable:end -->
- Loading branch information
Showing
3 changed files
with
65 additions
and
1 deletion.
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
40 changes: 40 additions & 0 deletions
40
tests/wpt/mozilla/tests/css/float_relative_to_position.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,40 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset=utf-8> | ||
<title>Tests the relationship between float and position</title> | ||
<style> | ||
div { | ||
float: left; | ||
} | ||
</style> | ||
<head> | ||
<body> | ||
<div></div> | ||
|
||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script> | ||
test(function() { | ||
var computed_style = getComputedStyle(document.querySelector("div"))["float"]; | ||
assert_equals(computed_style, "left"); | ||
|
||
document.querySelector("div").setAttribute("style", "position: fixed;"); | ||
|
||
computed_style = getComputedStyle(document.querySelector("div"))["float"]; | ||
assert_equals(computed_style, "none"); | ||
|
||
document.querySelector("div").setAttribute("style", "position: absolute;"); | ||
|
||
computed_style = getComputedStyle(document.querySelector("div"))["float"]; | ||
assert_equals(computed_style, "none"); | ||
|
||
document.querySelector("div").removeAttribute("style"); | ||
|
||
computed_style = getComputedStyle(document.querySelector("div"))["float"]; | ||
assert_equals(computed_style, "left"); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |