mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Use DOM width/height for canvas display list item.
This commit is contained in:
parent
1eec5d9f72
commit
1623114376
9 changed files with 81 additions and 14 deletions
|
@ -1220,6 +1220,9 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
let height = canvas_fragment_info.replaced_image_fragment_info
|
let height = canvas_fragment_info.replaced_image_fragment_info
|
||||||
.computed_block_size.map_or(0, |h| h.to_px() as usize);
|
.computed_block_size.map_or(0, |h| h.to_px() as usize);
|
||||||
if width > 0 && height > 0 {
|
if width > 0 && height > 0 {
|
||||||
|
let computed_width = canvas_fragment_info.canvas_inline_size().to_px();
|
||||||
|
let computed_height = canvas_fragment_info.canvas_block_size().to_px();
|
||||||
|
|
||||||
let layer_id = self.layer_id();
|
let layer_id = self.layer_id();
|
||||||
let canvas_data = match canvas_fragment_info.ipc_renderer {
|
let canvas_data = match canvas_fragment_info.ipc_renderer {
|
||||||
Some(ref ipc_renderer) => {
|
Some(ref ipc_renderer) => {
|
||||||
|
@ -1230,7 +1233,10 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
receiver.recv().unwrap()
|
receiver.recv().unwrap()
|
||||||
},
|
},
|
||||||
None => CanvasData::Pixels(CanvasPixelData {
|
None => CanvasData::Pixels(CanvasPixelData {
|
||||||
image_data: IpcSharedMemory::from_byte(0xFFu8, width * height * 4),
|
image_data: IpcSharedMemory::from_byte(0xFFu8,
|
||||||
|
(computed_width *
|
||||||
|
computed_height * 4)
|
||||||
|
as usize),
|
||||||
image_key: None,
|
image_key: None,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
@ -1245,8 +1251,8 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
clip),
|
clip),
|
||||||
image_data: Some(Arc::new(canvas_data.image_data)),
|
image_data: Some(Arc::new(canvas_data.image_data)),
|
||||||
webrender_image: WebRenderImageInfo {
|
webrender_image: WebRenderImageInfo {
|
||||||
width: width as u32,
|
width: computed_width as u32,
|
||||||
height: height as u32,
|
height: computed_height as u32,
|
||||||
format: PixelFormat::RGBA8,
|
format: PixelFormat::RGBA8,
|
||||||
key: canvas_data.image_key,
|
key: canvas_data.image_key,
|
||||||
},
|
},
|
||||||
|
|
|
@ -35214,8 +35214,36 @@
|
||||||
"local_changes": {
|
"local_changes": {
|
||||||
"deleted": [],
|
"deleted": [],
|
||||||
"deleted_reftests": {},
|
"deleted_reftests": {},
|
||||||
"items": {},
|
"items": {
|
||||||
"reftest_nodes": {}
|
"reftest": {
|
||||||
|
"html/rendering/replaced-elements/embedded-content-rendering-rules/canvas_scale.html": [
|
||||||
|
{
|
||||||
|
"path": "html/rendering/replaced-elements/embedded-content-rendering-rules/canvas_scale.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/html/rendering/replaced-elements/embedded-content-rendering-rules/canvas_scale_ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/html/rendering/replaced-elements/embedded-content-rendering-rules/canvas_scale.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"reftest_nodes": {
|
||||||
|
"html/rendering/replaced-elements/embedded-content-rendering-rules/canvas_scale.html": [
|
||||||
|
{
|
||||||
|
"path": "html/rendering/replaced-elements/embedded-content-rendering-rules/canvas_scale.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/html/rendering/replaced-elements/embedded-content-rendering-rules/canvas_scale_ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/html/rendering/replaced-elements/embedded-content-rendering-rules/canvas_scale.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"reftest_nodes": {
|
"reftest_nodes": {
|
||||||
"2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [
|
"2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[read-pixels-test.html]
|
[read-pixels-test.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: CRASH
|
expected: TIMEOUT
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[state-uneffected-after-compositing.html]
|
[state-uneffected-after-compositing.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: CRASH
|
expected: TIMEOUT
|
||||||
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
|
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[texture-size-cube-maps.html]
|
[texture-size-cube-maps.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: CRASH
|
expected: TIMEOUT
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
[texture-size-limit.html]
|
[texture-size-limit.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected:
|
expected: TIMEOUT
|
||||||
if os == "linux": CRASH
|
|
||||||
if not debug and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64) and (backend == "cpu"): CRASH
|
|
||||||
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
|
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
[texture-size.html]
|
[texture-size.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected:
|
expected: TIMEOUT
|
||||||
if os == "linux": CRASH
|
|
||||||
if not debug and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64) and (backend == "cpu"): CRASH
|
|
||||||
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
|
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Verify that canvases are scaled up to their computed size</title>
|
||||||
|
<link rel="match" href="canvas_scale_ref.html">
|
||||||
|
<style>
|
||||||
|
canvas {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
line-height: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div><canvas width="16" height="16" data-color="#FF00FF"></canvas><canvas width="16" height="16" data-color="#00FF00"></canvas></div>
|
||||||
|
<div><canvas width="16" height="16" data-color="#0000FF"></canvas><canvas width="16" height="16" data-color="#FF00FF"></canvas></div>
|
||||||
|
<script>
|
||||||
|
var canvases = document.getElementsByTagName('canvas');
|
||||||
|
for (var i = 0; i < canvases.length; i++) {
|
||||||
|
var ctx = canvases[i].getContext('2d');
|
||||||
|
ctx.fillStyle = canvases[i].getAttribute('data-color');
|
||||||
|
ctx.fillRect(0, 0, 16, 16);
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
span {
|
||||||
|
display: inline-block;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
line-height: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div><span style="background-color: #FF00FF"></span><span style="background-color: #00FF00"></span></div>
|
||||||
|
<div><span style="background-color: #0000FF"></span><span style="background-color: #FF00FF"></span></div>
|
Loading…
Add table
Add a link
Reference in a new issue