mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update GPUObjectBase webidl and cleanup valid flags
This commit is contained in:
parent
3216209506
commit
cdc0a75fe4
20 changed files with 229 additions and 251 deletions
|
@ -6,34 +6,27 @@ use crate::dom::bindings::cell::DomRefCell;
|
|||
use crate::dom::bindings::codegen::Bindings::GPUTextureViewBinding::GPUTextureViewMethods;
|
||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::bindings::str::USVString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::gputexture::GPUTexture;
|
||||
use dom_struct::dom_struct;
|
||||
use std::cell::Cell;
|
||||
use webgpu::WebGPUTextureView;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GPUTextureView {
|
||||
reflector_: Reflector,
|
||||
label: DomRefCell<Option<DOMString>>,
|
||||
label: DomRefCell<Option<USVString>>,
|
||||
texture_view: WebGPUTextureView,
|
||||
texture: Dom<GPUTexture>,
|
||||
valid: Cell<bool>,
|
||||
}
|
||||
|
||||
impl GPUTextureView {
|
||||
fn new_inherited(
|
||||
texture_view: WebGPUTextureView,
|
||||
texture: &GPUTexture,
|
||||
valid: bool,
|
||||
) -> GPUTextureView {
|
||||
fn new_inherited(texture_view: WebGPUTextureView, texture: &GPUTexture) -> GPUTextureView {
|
||||
Self {
|
||||
reflector_: Reflector::new(),
|
||||
texture: Dom::from_ref(texture),
|
||||
label: DomRefCell::new(None),
|
||||
texture_view,
|
||||
valid: Cell::new(valid),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,10 +34,9 @@ impl GPUTextureView {
|
|||
global: &GlobalScope,
|
||||
texture_view: WebGPUTextureView,
|
||||
texture: &GPUTexture,
|
||||
valid: bool,
|
||||
) -> DomRoot<GPUTextureView> {
|
||||
reflect_dom_object(
|
||||
Box::new(GPUTextureView::new_inherited(texture_view, texture, valid)),
|
||||
Box::new(GPUTextureView::new_inherited(texture_view, texture)),
|
||||
global,
|
||||
)
|
||||
}
|
||||
|
@ -54,20 +46,16 @@ impl GPUTextureView {
|
|||
pub fn id(&self) -> WebGPUTextureView {
|
||||
self.texture_view
|
||||
}
|
||||
|
||||
pub fn is_valid(&self) -> bool {
|
||||
self.valid.get()
|
||||
}
|
||||
}
|
||||
|
||||
impl GPUTextureViewMethods for GPUTextureView {
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
fn GetLabel(&self) -> Option<DOMString> {
|
||||
fn GetLabel(&self) -> Option<USVString> {
|
||||
self.label.borrow().clone()
|
||||
}
|
||||
|
||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuobjectbase-label
|
||||
fn SetLabel(&self, value: Option<DOMString>) {
|
||||
fn SetLabel(&self, value: Option<USVString>) {
|
||||
*self.label.borrow_mut() = value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue