diff options
Diffstat (limited to 'components/script/dom/gpusampler.rs')
-rw-r--r-- | components/script/dom/gpusampler.rs | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/components/script/dom/gpusampler.rs b/components/script/dom/gpusampler.rs index 97e6c1dc37f..cba3ec3b018 100644 --- a/components/script/dom/gpusampler.rs +++ b/components/script/dom/gpusampler.rs @@ -6,33 +6,25 @@ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::GPUSamplerBinding::GPUSamplerMethods; use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; -use crate::dom::bindings::str::DOMString; +use crate::dom::bindings::str::USVString; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; -use std::cell::Cell; use webgpu::{WebGPUDevice, WebGPUSampler}; #[dom_struct] pub struct GPUSampler { reflector_: Reflector, - label: DomRefCell<Option<DOMString>>, + label: DomRefCell<Option<USVString>>, device: WebGPUDevice, compare_enable: bool, sampler: WebGPUSampler, - valid: Cell<bool>, } impl GPUSampler { - fn new_inherited( - device: WebGPUDevice, - compare_enable: bool, - sampler: WebGPUSampler, - valid: bool, - ) -> Self { + fn new_inherited(device: WebGPUDevice, compare_enable: bool, sampler: WebGPUSampler) -> Self { Self { reflector_: Reflector::new(), label: DomRefCell::new(None), - valid: Cell::new(valid), device, sampler, compare_enable, @@ -44,15 +36,9 @@ impl GPUSampler { device: WebGPUDevice, compare_enable: bool, sampler: WebGPUSampler, - valid: bool, ) -> DomRoot<Self> { reflect_dom_object( - Box::new(GPUSampler::new_inherited( - device, - compare_enable, - sampler, - valid, - )), + Box::new(GPUSampler::new_inherited(device, compare_enable, sampler)), global, ) } @@ -62,20 +48,16 @@ impl GPUSampler { pub fn id(&self) -> WebGPUSampler { self.sampler } - - pub fn is_valid(&self) -> bool { - self.valid.get() - } } impl GPUSamplerMethods for GPUSampler { /// 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; } } |