mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Remove helper traits
Now that JSRef<T> is gone, there is no need to have helper traits. On components/script/*.rs: # Remove imports. /^ *use dom::[a-z]+::\{.*Helpers/ { s/\{(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers, /\{/ s/, (Raw[^L]|[^L][^a])[a-zA-Z]+Helpers([,}])/\2/g s/\{([a-zA-Z]+)\}/\1/ /\{\}/d s/::self;$/;/ } /^ *use dom::[a-z]+::\{?(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers\}?;$/d On components/script/dom/*.rs: # Ignore layout things. /^(pub )?(impl|trait).*Layout.* \{/,/^}$/ { P; D; } # Delete helpers traits. /^(pub )?trait ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? \{$/,/^\}$/D # Patch private helpers. /^impl.*Private.*Helpers/,/^\}$/ { s/^impl<'a> Private([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for &'a ([^ ]+) \{$/impl \3 {/ /^ *(unsafe )?fn .*\(self.*[<&]'a/ { s/&'a /\&/g s/<'a, /</g } /^ *(unsafe )?fn /s/\(self([,)])/\(\&self\1/ } # Patch public helpers. /^impl.*Helpers/,/^\}$/ { s/^impl(<'a>)? ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for (&'a )?([^ ]+) \{$/impl \5 {/ /^ *(unsafe )?fn .*\(self.*[<&]'a/ { s/&'a /\&/g s/<'a, /</g } /^ *(unsafe )?fn .*\(&?self[,)]/s/(unsafe )?fn/pub &/ /^ *pub (unsafe )?fn /s/\(self([,)])/\(\&self\1/ } The few error cases were then fixed by hand.
This commit is contained in:
parent
1384ff5e9f
commit
c831c2c0a5
90 changed files with 597 additions and 1284 deletions
|
@ -55,23 +55,14 @@ impl WebGLTexture {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait WebGLTextureHelpers {
|
||||
fn id(self) -> u32;
|
||||
fn bind(self, target: u32) -> WebGLResult<()>;
|
||||
fn delete(self);
|
||||
fn tex_parameter(self,
|
||||
target: u32,
|
||||
name: u32,
|
||||
value: TexParameterValue) -> WebGLResult<()>;
|
||||
}
|
||||
|
||||
impl<'a> WebGLTextureHelpers for &'a WebGLTexture {
|
||||
fn id(self) -> u32 {
|
||||
impl WebGLTexture {
|
||||
pub fn id(&self) -> u32 {
|
||||
self.id
|
||||
}
|
||||
|
||||
// NB: Only valid texture targets come here
|
||||
fn bind(self, target: u32) -> WebGLResult<()> {
|
||||
pub fn bind(&self, target: u32) -> WebGLResult<()> {
|
||||
if let Some(previous_target) = self.target.get() {
|
||||
if target != previous_target {
|
||||
return Err(WebGLError::InvalidOperation);
|
||||
|
@ -85,7 +76,7 @@ impl<'a> WebGLTextureHelpers for &'a WebGLTexture {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn delete(self) {
|
||||
pub fn delete(&self) {
|
||||
if !self.is_deleted.get() {
|
||||
self.is_deleted.set(true);
|
||||
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::DeleteTexture(self.id))).unwrap();
|
||||
|
@ -95,7 +86,7 @@ impl<'a> WebGLTextureHelpers for &'a WebGLTexture {
|
|||
/// We have to follow the conversion rules for GLES 2.0. See:
|
||||
/// https://www.khronos.org/webgl/public-mailing-list/archives/1008/msg00014.html
|
||||
///
|
||||
fn tex_parameter(self,
|
||||
pub fn tex_parameter(&self,
|
||||
target: u32,
|
||||
name: u32,
|
||||
value: TexParameterValue) -> WebGLResult<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue