mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #10871 - daoshengmu:canvasWithoutContexts, r=jdm
Fix issue #10755 Canvas without contexts While canvas without contexts, we just need to return the function without drawing any pixel. Fixes #10755. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10871) <!-- Reviewable:end -->
This commit is contained in:
commit
14de06aef0
4 changed files with 56 additions and 9 deletions
|
@ -13,7 +13,7 @@
|
||||||
use app_units::{Au, AU_PER_PX};
|
use app_units::{Au, AU_PER_PX};
|
||||||
use azure::azure_hl::Color;
|
use azure::azure_hl::Color;
|
||||||
use block::{BlockFlow, BlockStackingContextType};
|
use block::{BlockFlow, BlockStackingContextType};
|
||||||
use canvas_traits::{CanvasMsg, CanvasPixelData, CanvasData, FromLayoutMsg};
|
use canvas_traits::{CanvasMsg, CanvasData, FromLayoutMsg};
|
||||||
use context::LayoutContext;
|
use context::LayoutContext;
|
||||||
use euclid::num::Zero;
|
use euclid::num::Zero;
|
||||||
use euclid::{Matrix4D, Point2D, Point3D, Rect, SideOffsets2D, Size2D};
|
use euclid::{Matrix4D, Point2D, Point3D, Rect, SideOffsets2D, Size2D};
|
||||||
|
@ -34,7 +34,7 @@ use gfx::paint_thread::THREAD_TINT_COLORS;
|
||||||
use gfx::text::glyph::CharIndex;
|
use gfx::text::glyph::CharIndex;
|
||||||
use gfx_traits::{color, ScrollPolicy};
|
use gfx_traits::{color, ScrollPolicy};
|
||||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
|
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, LAST_FRAGMENT_OF_ELEMENT};
|
||||||
use ipc_channel::ipc::{self, IpcSharedMemory};
|
use ipc_channel::ipc::{self};
|
||||||
use list_item::ListItemFlow;
|
use list_item::ListItemFlow;
|
||||||
use model::{self, MaybeAuto, ToGfxMatrix};
|
use model::{self, MaybeAuto, ToGfxMatrix};
|
||||||
use net_traits::image::base::PixelFormat;
|
use net_traits::image::base::PixelFormat;
|
||||||
|
@ -1259,13 +1259,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
FromLayoutMsg::SendData(sender))).unwrap();
|
FromLayoutMsg::SendData(sender))).unwrap();
|
||||||
receiver.recv().unwrap()
|
receiver.recv().unwrap()
|
||||||
},
|
},
|
||||||
None => CanvasData::Pixels(CanvasPixelData {
|
None => return,
|
||||||
image_data: IpcSharedMemory::from_byte(0xFFu8,
|
|
||||||
(computed_width *
|
|
||||||
computed_height * 4)
|
|
||||||
as usize),
|
|
||||||
image_key: None,
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let base = state.create_base_display_item(
|
let base = state.create_base_display_item(
|
||||||
|
|
|
@ -1212,6 +1212,18 @@
|
||||||
"url": "/_mozilla/css/canvas_radial_gradient_a.html"
|
"url": "/_mozilla/css/canvas_radial_gradient_a.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"css/canvas_without_context_a.html": [
|
||||||
|
{
|
||||||
|
"path": "css/canvas_without_context_a.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/_mozilla/css/canvas_without_context_ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/_mozilla/css/canvas_without_context_a.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"css/case-insensitive-font-family.html": [
|
"css/case-insensitive-font-family.html": [
|
||||||
{
|
{
|
||||||
"path": "css/case-insensitive-font-family.html",
|
"path": "css/case-insensitive-font-family.html",
|
||||||
|
@ -7940,6 +7952,18 @@
|
||||||
"url": "/_mozilla/css/canvas_radial_gradient_a.html"
|
"url": "/_mozilla/css/canvas_radial_gradient_a.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"css/canvas_without_context_a.html": [
|
||||||
|
{
|
||||||
|
"path": "css/canvas_without_context_a.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/_mozilla/css/canvas_without_context_ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/_mozilla/css/canvas_without_context_a.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"css/case-insensitive-font-family.html": [
|
"css/case-insensitive-font-family.html": [
|
||||||
{
|
{
|
||||||
"path": "css/case-insensitive-font-family.html",
|
"path": "css/case-insensitive-font-family.html",
|
||||||
|
|
15
tests/wpt/mozilla/tests/css/canvas_without_context_a.html
Normal file
15
tests/wpt/mozilla/tests/css/canvas_without_context_a.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="match" href="canvas_without_context_ref.html">
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
background-color: green;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div><canvas width="20" height="20"></canvas></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
14
tests/wpt/mozilla/tests/css/canvas_without_context_ref.html
Normal file
14
tests/wpt/mozilla/tests/css/canvas_without_context_ref.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
background-color: green;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue