mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1496486 - Remove some more leftover code. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D7755
This commit is contained in:
parent
046243a12e
commit
8a3d09ee15
@ -2280,13 +2280,6 @@ Gecko_CSSValue_SetArray(nsCSSValueBorrowedMut aCSSValue, int32_t aLength)
|
||||
aCSSValue->SetArrayValue(array, eCSSUnit_Array);
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CSSValue_SetURL(nsCSSValueBorrowedMut aCSSValue, URLValue* aURL)
|
||||
{
|
||||
MOZ_ASSERT(aCSSValue->GetUnit() == eCSSUnit_Null);
|
||||
aCSSValue->SetURLValue(aURL);
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CSSValue_SetInt(nsCSSValueBorrowedMut aCSSValue,
|
||||
int32_t aInteger, nsCSSUnit aUnit)
|
||||
|
@ -590,7 +590,6 @@ void Gecko_CSSValue_SetStringFromAtom(nsCSSValueBorrowedMut css_value,
|
||||
// Take an addrefed nsAtom and set it to the nsCSSValue
|
||||
void Gecko_CSSValue_SetAtomIdent(nsCSSValueBorrowedMut css_value, nsAtom* atom);
|
||||
void Gecko_CSSValue_SetArray(nsCSSValueBorrowedMut css_value, int32_t len);
|
||||
void Gecko_CSSValue_SetURL(nsCSSValueBorrowedMut css_value, mozilla::css::URLValue* uri);
|
||||
void Gecko_CSSValue_SetInt(nsCSSValueBorrowedMut css_value, int32_t integer, nsCSSUnit unit);
|
||||
void Gecko_CSSValue_SetFloat(nsCSSValueBorrowedMut css_value, float value, nsCSSUnit unit);
|
||||
void Gecko_CSSValue_SetPair(nsCSSValueBorrowedMut css_value,
|
||||
|
@ -81,13 +81,6 @@ nsCSSValue::nsCSSValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit)
|
||||
mValue.mArray->AddRef();
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(mozilla::css::URLValue* aValue)
|
||||
: mUnit(eCSSUnit_URL)
|
||||
{
|
||||
mValue.mURL = aValue;
|
||||
mValue.mURL->AddRef();
|
||||
}
|
||||
|
||||
nsCSSValue::nsCSSValue(SharedFontList* aValue)
|
||||
: mUnit(eCSSUnit_FontFamilyList)
|
||||
{
|
||||
@ -116,10 +109,6 @@ nsCSSValue::nsCSSValue(const nsCSSValue& aCopy)
|
||||
mValue.mArray = aCopy.mValue.mArray;
|
||||
mValue.mArray->AddRef();
|
||||
}
|
||||
else if (eCSSUnit_URL == mUnit) {
|
||||
mValue.mURL = aCopy.mValue.mURL;
|
||||
mValue.mURL->AddRef();
|
||||
}
|
||||
else if (eCSSUnit_Pair == mUnit) {
|
||||
mValue.mPair = aCopy.mValue.mPair;
|
||||
mValue.mPair->AddRef();
|
||||
@ -199,9 +188,6 @@ bool nsCSSValue::operator==(const nsCSSValue& aOther) const
|
||||
else if (UnitHasArrayValue()) {
|
||||
return *mValue.mArray == *aOther.mValue.mArray;
|
||||
}
|
||||
else if (eCSSUnit_URL == mUnit) {
|
||||
return mValue.mURL->Equals(*aOther.mValue.mURL);
|
||||
}
|
||||
else if (eCSSUnit_Pair == mUnit) {
|
||||
return *mValue.mPair == *aOther.mValue.mPair;
|
||||
}
|
||||
@ -300,8 +286,6 @@ void nsCSSValue::DoReset()
|
||||
mValue.mString->Release();
|
||||
} else if (UnitHasArrayValue()) {
|
||||
DO_RELEASE(mArray);
|
||||
} else if (eCSSUnit_URL == mUnit) {
|
||||
DO_RELEASE(mURL);
|
||||
} else if (eCSSUnit_Pair == mUnit) {
|
||||
DO_RELEASE(mPair);
|
||||
} else if (eCSSUnit_List == mUnit) {
|
||||
@ -385,14 +369,6 @@ void nsCSSValue::SetArrayValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit)
|
||||
mValue.mArray->AddRef();
|
||||
}
|
||||
|
||||
void nsCSSValue::SetURLValue(mozilla::css::URLValue* aValue)
|
||||
{
|
||||
Reset();
|
||||
mUnit = eCSSUnit_URL;
|
||||
mValue.mURL = aValue;
|
||||
mValue.mURL->AddRef();
|
||||
}
|
||||
|
||||
void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue)
|
||||
{
|
||||
// pairs should not be used for null/inherit/initial values
|
||||
@ -602,8 +578,6 @@ nsCSSValue::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
case eCSSUnit_String:
|
||||
case eCSSUnit_Ident:
|
||||
case eCSSUnit_Attr:
|
||||
case eCSSUnit_Local_Font:
|
||||
case eCSSUnit_Font_Format:
|
||||
case eCSSUnit_Element:
|
||||
n += mValue.mString->SizeOfIncludingThisIfUnshared(aMallocSizeOf);
|
||||
break;
|
||||
@ -624,11 +598,6 @@ nsCSSValue::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
case eCSSUnit_Calc_Divided:
|
||||
break;
|
||||
|
||||
// URL
|
||||
case eCSSUnit_URL:
|
||||
n += mValue.mURL->SizeOfIncludingThis(aMallocSizeOf);
|
||||
break;
|
||||
|
||||
// Pair
|
||||
case eCSSUnit_Pair:
|
||||
n += mValue.mPair->SizeOfIncludingThis(aMallocSizeOf);
|
||||
|
@ -336,9 +336,7 @@ enum nsCSSUnit {
|
||||
eCSSUnit_String = 11, // (char16_t*) a string value
|
||||
eCSSUnit_Ident = 12, // (char16_t*) a string value
|
||||
eCSSUnit_Attr = 14, // (char16_t*) a attr(string) value
|
||||
eCSSUnit_Local_Font = 15, // (char16_t*) a local font name
|
||||
eCSSUnit_Font_Format = 16, // (char16_t*) a font format name
|
||||
eCSSUnit_Element = 17, // (char16_t*) an element id
|
||||
eCSSUnit_Element = 15, // (char16_t*) an element id
|
||||
|
||||
eCSSUnit_Array = 20, // (nsCSSValue::Array*) a list of values
|
||||
eCSSUnit_Counter = 21, // (nsCSSValue::Array*) a counter(string,[string]) value
|
||||
@ -368,8 +366,6 @@ enum nsCSSUnit {
|
||||
eCSSUnit_Calc_Times_R = 34, // (nsCSSValue::Array*) val * num within calc
|
||||
eCSSUnit_Calc_Divided = 35, // (nsCSSValue::Array*) / within calc
|
||||
|
||||
eCSSUnit_URL = 40, // (nsCSSValue::URL*) value
|
||||
|
||||
eCSSUnit_Pair = 50, // (nsCSSValuePair*) pair of values
|
||||
eCSSUnit_List = 53, // (nsCSSValueList*) list of values
|
||||
eCSSUnit_ListDep = 54, // (nsCSSValueList*) same as List
|
||||
@ -444,8 +440,6 @@ public:
|
||||
struct Array;
|
||||
friend struct Array;
|
||||
|
||||
friend struct mozilla::css::URLValueData;
|
||||
|
||||
friend struct mozilla::css::ImageValue;
|
||||
|
||||
// for valueless units only (null, auto, inherit, none, all, normal)
|
||||
@ -459,8 +453,6 @@ public:
|
||||
nsCSSValue(float aValue, nsCSSUnit aUnit);
|
||||
nsCSSValue(const nsString& aValue, nsCSSUnit aUnit);
|
||||
nsCSSValue(Array* aArray, nsCSSUnit aUnit);
|
||||
explicit nsCSSValue(mozilla::css::URLValue* aValue);
|
||||
explicit nsCSSValue(mozilla::css::ImageValue* aValue);
|
||||
explicit nsCSSValue(mozilla::SharedFontList* aValue);
|
||||
nsCSSValue(const nsCSSValue& aCopy);
|
||||
nsCSSValue(nsCSSValue&& aOther)
|
||||
@ -594,12 +586,6 @@ public:
|
||||
return mValue.mArray;
|
||||
}
|
||||
|
||||
nsIURI* GetURLValue() const
|
||||
{
|
||||
MOZ_ASSERT(mUnit == eCSSUnit_URL, "not a URL value");
|
||||
return mValue.mURL->GetURI();
|
||||
}
|
||||
|
||||
nsCSSValueSharedList* GetSharedListValue() const
|
||||
{
|
||||
MOZ_ASSERT(mUnit == eCSSUnit_SharedList, "not a shared list value");
|
||||
@ -625,14 +611,6 @@ public:
|
||||
inline nsCSSValuePairList* GetPairListValue();
|
||||
inline const nsCSSValuePairList* GetPairListValue() const;
|
||||
|
||||
mozilla::css::URLValue* GetURLStructValue() const
|
||||
{
|
||||
// Not allowing this for Image values, because if the caller takes
|
||||
// a ref to them they won't be able to delete them properly.
|
||||
MOZ_ASSERT(mUnit == eCSSUnit_URL, "not a URL value");
|
||||
return mValue.mURL;
|
||||
}
|
||||
|
||||
// Not making this inline because that would force us to include
|
||||
// imgIRequest.h, which leads to REQUIRES hell, since this header is included
|
||||
// all over.
|
||||
@ -675,7 +653,6 @@ public:
|
||||
// converts the nscoord to pixels
|
||||
void SetIntegerCoordValue(nscoord aCoord);
|
||||
void SetArrayValue(nsCSSValue::Array* aArray, nsCSSUnit aUnit);
|
||||
void SetURLValue(mozilla::css::URLValue* aURI);
|
||||
void SetFontFamilyListValue(already_AddRefed<mozilla::SharedFontList> aFontListValue);
|
||||
void SetPairValue(const nsCSSValuePair* aPair);
|
||||
void SetPairValue(const nsCSSValue& xValue, const nsCSSValue& yValue);
|
||||
@ -718,7 +695,6 @@ protected:
|
||||
nsStringBuffer* MOZ_OWNING_REF mString;
|
||||
nsAtom* MOZ_OWNING_REF mAtom;
|
||||
Array* MOZ_OWNING_REF mArray;
|
||||
mozilla::css::URLValue* MOZ_OWNING_REF mURL;
|
||||
nsCSSValuePair_heap* MOZ_OWNING_REF mPair;
|
||||
nsCSSValueList_heap* MOZ_OWNING_REF mList;
|
||||
nsCSSValueList* mListDependent;
|
||||
|
@ -5,47 +5,9 @@
|
||||
//! Bindings for CSS Rule objects
|
||||
|
||||
use counter_style::{self, CounterBound};
|
||||
use font_face::Source;
|
||||
use gecko_bindings::structs::{self, nsCSSValue};
|
||||
use gecko_bindings::sugar::ns_css_value::ToNsCssValue;
|
||||
|
||||
impl<'a> ToNsCssValue for &'a Vec<Source> {
|
||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
let src_len = self.iter().fold(0, |acc, src| {
|
||||
acc + match *src {
|
||||
// Each format hint takes one position in the array of mSrc.
|
||||
Source::Url(ref url) => url.format_hints.len() + 1,
|
||||
Source::Local(_) => 1,
|
||||
}
|
||||
});
|
||||
let mut target_srcs = nscssvalue
|
||||
.set_array(src_len as i32)
|
||||
.as_mut_slice()
|
||||
.iter_mut();
|
||||
macro_rules! next {
|
||||
() => {
|
||||
target_srcs
|
||||
.next()
|
||||
.expect("Length of target_srcs should be enough")
|
||||
};
|
||||
}
|
||||
for src in self.iter() {
|
||||
match *src {
|
||||
Source::Url(ref url) => {
|
||||
next!().set_url(&url.url);
|
||||
for hint in url.format_hints.iter() {
|
||||
next!().set_font_format(&hint);
|
||||
}
|
||||
},
|
||||
Source::Local(ref family) => {
|
||||
next!().set_local_font(&family.name);
|
||||
},
|
||||
}
|
||||
}
|
||||
debug_assert!(target_srcs.next().is_none(), "Should have filled all slots");
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ToNsCssValue for &'a counter_style::System {
|
||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
use counter_style::System::*;
|
||||
|
@ -14,7 +14,6 @@ use std::mem;
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::slice;
|
||||
use values::computed::{Angle, Length, LengthOrPercentage, Percentage};
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
|
||||
impl nsCSSValue {
|
||||
/// Create a CSSValue with null unit, useful to be used as a return value.
|
||||
@ -167,16 +166,6 @@ impl nsCSSValue {
|
||||
unsafe { bindings::Gecko_CSSValue_SetAtomIdent(self, s.into_addrefed()) }
|
||||
}
|
||||
|
||||
/// Set to a font format.
|
||||
pub fn set_font_format(&mut self, s: &str) {
|
||||
self.set_string_internal(s, nsCSSUnit::eCSSUnit_Font_Format);
|
||||
}
|
||||
|
||||
/// Set to a local font value.
|
||||
pub fn set_local_font(&mut self, s: &Atom) {
|
||||
self.set_string_from_atom_internal(s, nsCSSUnit::eCSSUnit_Local_Font);
|
||||
}
|
||||
|
||||
fn set_int_internal(&mut self, value: i32, unit: nsCSSUnit) {
|
||||
unsafe { bindings::Gecko_CSSValue_SetInt(self, value, unit) }
|
||||
}
|
||||
@ -196,11 +185,6 @@ impl nsCSSValue {
|
||||
unsafe { bindings::Gecko_CSSValue_SetFloat(self, number, nsCSSUnit::eCSSUnit_Number) }
|
||||
}
|
||||
|
||||
/// Set to a url value
|
||||
pub fn set_url(&mut self, url: &SpecifiedUrl) {
|
||||
unsafe { bindings::Gecko_CSSValue_SetURL(self, url.url_value.get()) }
|
||||
}
|
||||
|
||||
/// Set to an array of given length
|
||||
pub fn set_array(&mut self, len: i32) -> &mut nsCSSValue_Array {
|
||||
unsafe { bindings::Gecko_CSSValue_SetArray(self, len) }
|
||||
|
Loading…
Reference in New Issue
Block a user