Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement attribute restyle hints #8381

Merged
merged 7 commits into from Nov 10, 2015

Tests.

  • Loading branch information
bholley committed Nov 10, 2015
commit a79f6e43a05be3401ace0ec816b8b2f6499246f4
@@ -3119,6 +3119,18 @@
"url": "/_mozilla/css/quotes_simple_a.html"
}
],
"css/restyle_hints_attr.html": [
{
"path": "css/restyle_hints_attr.html",
"references": [
[
"/_mozilla/css/restyle_hints_attr_ref.html",
"=="
]
],
"url": "/_mozilla/css/restyle_hints_attr.html"
}
],
"css/restyle_hints_state.html": [
{
"path": "css/restyle_hints_state.html",
@@ -8052,6 +8064,18 @@
"url": "/_mozilla/css/quotes_simple_a.html"
}
],
"css/restyle_hints_attr.html": [
{
"path": "css/restyle_hints_attr.html",
"references": [
[
"/_mozilla/css/restyle_hints_attr_ref.html",
"=="
]
],
"url": "/_mozilla/css/restyle_hints_attr.html"
}
],
"css/restyle_hints_state.html": [
{
"path": "css/restyle_hints_state.html",
@@ -0,0 +1,44 @@
div {
background-color: black;
padding: 10px;
width: 50px;
height: 50px;
color: gray;
}

div[foo=kokosnuss] {
background: black;
}

div[foo][bar] {
background: red;
}

div[foo=kokosnuss][bar~=fett] {
background: green;
}

div[bar] > div[baz] div {
color: cyan;
}

div[foo][bar~=butter] div {
background: purple;
color: white;
}

div[foo][bar~=butter] > div {
background: yellow;
}

div[bar~=butter][foo=kokosnuss] + div {
background: pink;
}

div[foo=kokosnuss] ~ div {
background: green;
}

div + div[foo=keine][bar=ahnung] {
background: lavender;
}
@@ -0,0 +1,35 @@
<!doctype html>
<meta charset="utf-8">
<title></title>
<link rel="match" href="restyle_hints_attr_ref.html">
<link rel="stylesheet" href="restyle_hints_attr.css">
<body>
<div id="d1">
<div id="d2">
<div>some text</div>
</div>
</div>
<div id="d3" foo="keine" bar="ahnung"></div>
<div id="d4"></div>
<div></div>
<script>
window.dummy = 0;
var $ = document.getElementById.bind(document);
function syncRestyle() { window.dummy += document.body.lastElementChild.offsetTop; }
$('d1').setAttribute("foo", "kokosnuss");
syncRestyle();
$('d1').setAttribute("bar", "butter");
syncRestyle();
$('d4').setAttribute("foo", true);
syncRestyle();
$('d4').setAttribute("bar", true);
syncRestyle();
$('d2').setAttribute("baz", "lecker");
syncRestyle();
$('d1').setAttribute("bar", "fett butter");
syncRestyle();
$('d3').removeAttribute("bar");
syncRestyle();
</script>
</body>
</html>
@@ -0,0 +1,16 @@
<!doctype html>
<meta charset="utf-8">
<link rel="stylesheet" href="restyle_hints_attr.css">
<title></title>
<body>
<div foo="kokosnuss" bar="butter fett">
<div baz="lecker">
<div>some text</div>
</div>
</div>
<div></div>
<div bar foo></div>
<div></div>
</body>
</html>

@@ -30,8 +30,9 @@
* implement attribute-based restyle hints, we can stop dirtying the subtree
* on attribute modifications, and these tests will start to be more useful.
*/
window.dummy = 0;
var $ = document.getElementById.bind(document);
function syncRestyle() { window.dummy != $("fs2").offsetTop; }
function syncRestyle() { window.dummy += $("fs2").offsetTop; }
syncRestyle();
$('fs1').disabled = true;
syncRestyle();
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.