зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1626570 - Improve handling of copying arrays in layout/style/ and servo/. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D72351
This commit is contained in:
Родитель
ce0c1f66e6
Коммит
e59bae7061
|
@ -23,7 +23,7 @@ class nsStyleAutoArray {
|
|||
nsStyleAutoArray(const nsStyleAutoArray& aOther) { *this = aOther; }
|
||||
nsStyleAutoArray& operator=(const nsStyleAutoArray& aOther) {
|
||||
mFirstElement = aOther.mFirstElement;
|
||||
mOtherElements = aOther.mOtherElements;
|
||||
mOtherElements = aOther.mOtherElements.Clone();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -1981,6 +1981,7 @@ STATIC_ASSERT_TYPE_LAYOUTS_MATCH(mozilla::UniquePtr<int>,
|
|||
*/
|
||||
template <typename T>
|
||||
class nsTArray_Simple {
|
||||
protected:
|
||||
T* mBuffer;
|
||||
|
||||
public:
|
||||
|
@ -1991,6 +1992,12 @@ class nsTArray_Simple {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* <div rustbindgen replaces="CopyableTArray"></div>
|
||||
*/
|
||||
template <typename T>
|
||||
class CopyableTArray_Simple : public nsTArray_Simple<T> {};
|
||||
|
||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsTArray<nsStyleImageLayers::Layer>,
|
||||
nsTArray_Simple<nsStyleImageLayers::Layer>);
|
||||
STATIC_ASSERT_TYPE_LAYOUTS_MATCH(nsTArray<mozilla::StyleTransition>,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! Rust helpers for Gecko's nsTArray.
|
||||
|
||||
use crate::gecko_bindings::bindings;
|
||||
use crate::gecko_bindings::structs::{nsTArray, nsTArrayHeader};
|
||||
use crate::gecko_bindings::structs::{nsTArray, nsTArrayHeader, CopyableTArray};
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::slice;
|
||||
|
@ -128,3 +128,16 @@ impl<T> nsTArray<T> {
|
|||
self.iter_mut().zip(iter).for_each(|(r, v)| *r = v);
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Deref for CopyableTArray<T> {
|
||||
type Target = nsTArray<T>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self._base
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> DerefMut for CopyableTArray<T> {
|
||||
fn deref_mut(&mut self) -> &mut nsTArray<T> {
|
||||
&mut self._base
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,6 +233,7 @@ renaming_overrides_prefixing = true
|
|||
"nsACString" = "nsACString"
|
||||
"nsAString" = "nsAString"
|
||||
"nsString" = "nsString"
|
||||
"CopyableTArray" = "CopyableTArray"
|
||||
"nsTArray" = "nsTArray"
|
||||
"nsPresContext" = "nsPresContext"
|
||||
"ComputedTiming" = "ComputedTiming"
|
||||
|
|
|
@ -5791,7 +5791,7 @@ fn fill_in_missing_keyframe_values(
|
|||
if !longhands_at_offset.contains(property) {
|
||||
unsafe {
|
||||
Gecko_AppendPropertyValuePair(
|
||||
&mut (*keyframe).mPropertyValues,
|
||||
&mut *(*keyframe).mPropertyValues,
|
||||
property.to_nscsspropertyid(),
|
||||
);
|
||||
}
|
||||
|
@ -5873,7 +5873,7 @@ pub unsafe extern "C" fn Servo_StyleSet_GetKeyframesForName(
|
|||
seen.insert(property);
|
||||
|
||||
Gecko_AppendPropertyValuePair(
|
||||
&mut (*keyframe).mPropertyValues,
|
||||
&mut *(*keyframe).mPropertyValues,
|
||||
property.to_nscsspropertyid(),
|
||||
);
|
||||
}
|
||||
|
@ -5922,7 +5922,7 @@ pub unsafe extern "C" fn Servo_StyleSet_GetKeyframesForName(
|
|||
}
|
||||
|
||||
let pair = Gecko_AppendPropertyValuePair(
|
||||
&mut (*keyframe).mPropertyValues,
|
||||
&mut *(*keyframe).mPropertyValues,
|
||||
id.to_nscsspropertyid(),
|
||||
);
|
||||
|
||||
|
@ -5945,7 +5945,7 @@ pub unsafe extern "C" fn Servo_StyleSet_GetKeyframesForName(
|
|||
|
||||
if custom_properties.any_normal() {
|
||||
let pair = Gecko_AppendPropertyValuePair(
|
||||
&mut (*keyframe).mPropertyValues,
|
||||
&mut *(*keyframe).mPropertyValues,
|
||||
nsCSSPropertyID::eCSSPropertyExtra_variable,
|
||||
);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче