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

Paint worklet size should agree with Chrome. #17456

Merged
merged 1 commit into from Jun 22, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Paint worklet size should agree with Chrome.

  • Loading branch information
asajeffrey committed Jun 22, 2017
commit dded87e402707514f4a0627709db95da454912dc
@@ -1154,10 +1154,14 @@ impl FragmentDisplayListBuilding for Fragment {
paint_worklet: &PaintWorklet,
index: usize)
{
// TODO: check that this is the servo equivalent of "concrete object size".
// This should be the "concrete object size" of the fragment.
// https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image
// https://drafts.csswg.org/css-images-3/#concrete-object-size
let size = self.content_box().size.to_physical(style.writing_mode);
// Experimentally, chrome is using the size in px of the box,
// including padding, but not border or margin, so we follow suit.
// https://github.com/w3c/css-houdini-drafts/issues/417
let unbordered_box = self.border_box - style.logical_border_width();
let size = unbordered_box.size.to_physical(style.writing_mode);
let name = paint_worklet.name.clone();

// If the script thread has not added any paint worklet modules, there is nothing to do!
@@ -6772,6 +6772,18 @@
],
{}
]
],
"mozilla/worklets/test_paint_worklet_size.html": [
[
"/_mozilla/mozilla/worklets/test_paint_worklet_size.html",
[
[
"/_mozilla/mozilla/worklets/test_paint_worklet_ref.html",
"=="
]
],
{}
]
]
},
"reftest_node": {
@@ -11264,6 +11276,16 @@
{}
]
],
"mozilla/worklets/test_paint_worklet_size.js": [
[
{}
]
],
"mozilla/worklets/test_paint_worklet_size_ref.html": [
[
{}
]
],
"mozilla/worklets/test_worklet.js": [
[
{}
"e9cfa945824a8ecf07c41a269f82a2c2ca002406",
"support"
],
"mozilla/worklets/test_paint_worklet_size.html": [
"6ddcf8ad81eaf4a5112de39a87cbd3d290fd9ab4",
"reftest"
],
"mozilla/worklets/test_paint_worklet_size.js": [
"07bbe5099c4e721da1ca9cc8cbf5196e7e6e9510",
"support"
],
"mozilla/worklets/test_paint_worklet_size_ref.html": [
"7c92e508e08d7d146354a5be7fa256ccbd465dde",
"support"
],
"mozilla/worklets/test_worklet.html": [
"fe9c93a5307c616f878b6623155e1b04c86dd994",
"testharness"
@@ -0,0 +1,3 @@
[test_paint_worklet_size.html]
type: reftest

This comment has been minimized.

Copy link
@emilio

emilio Jun 21, 2017

Member

Huh? Why expected fail?

This comment has been minimized.

Copy link
@asajeffrey

asajeffrey Jun 22, 2017

Author Member

Paint rendering contexts haven't landed yet, that's #17326.

expected: FAIL
@@ -0,0 +1,17 @@
<!doctype html>
<html class="reftest-wait">
<head>
<meta charset=utf-8>
<title>Test the size parameter of paint worklets</title>
<link rel=match href=/_mozilla/mozilla/worklets/test_paint_worklet_ref.html>
</head>
<body>
<div style="height: 100px; width: 200px; background: paint(test);
margin: 10px; border: 3px solid blue; padding: 5px;"></div>
</body>
<script>
window.paintWorklet
.addModule("test_paint_worklet_size.js")
.then(function() { document.documentElement.classList.remove("reftest-wait"); });
</script>
</html>
@@ -0,0 +1,8 @@
registerPaint("test", class {
paint(ctx, size) {
if ((size.width === 210) && (size.height === 110)) {
ctx.fillStyle = "green";
ctx.fillRect(0, 0, size.width, size.height);
}
}
});
@@ -0,0 +1,7 @@
<!doctype html>
<html>
<body>
<div style="height: 100px; width: 200px; background: green;
margin: 10px; border: 3px solid blue; padding: 5px;"></div>
</body>
</html>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.