mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Merge mozilla-central to autoland. a=merge CLOSED TREE
This commit is contained in:
commit
8235ee12de
@ -49,9 +49,6 @@ enum class CSSPropFlags : uint8_t
|
|||||||
// the DOM. Properties with this flag are defined in an #ifndef
|
// the DOM. Properties with this flag are defined in an #ifndef
|
||||||
// CSS_PROP_LIST_EXCLUDE_INTERNAL section.
|
// CSS_PROP_LIST_EXCLUDE_INTERNAL section.
|
||||||
Internal = 1 << 5,
|
Internal = 1 << 5,
|
||||||
|
|
||||||
// Whether this property should be serialized by Servo in getComputedStyle.
|
|
||||||
SerializedByServo = 1 << 6,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CSSPropFlags)
|
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CSSPropFlags)
|
||||||
|
@ -825,7 +825,7 @@ SERVO_BINDING_FUNC(Servo_SerializeFontValueForCanvas, void,
|
|||||||
RawServoDeclarationBlockBorrowed declarations,
|
RawServoDeclarationBlockBorrowed declarations,
|
||||||
nsAString* buffer)
|
nsAString* buffer)
|
||||||
|
|
||||||
// GetComputedStyle APIs.
|
// Get custom property value.
|
||||||
SERVO_BINDING_FUNC(Servo_GetCustomPropertyValue, bool,
|
SERVO_BINDING_FUNC(Servo_GetCustomPropertyValue, bool,
|
||||||
ComputedStyleBorrowed computed_values,
|
ComputedStyleBorrowed computed_values,
|
||||||
const nsAString* name, nsAString* value)
|
const nsAString* name, nsAString* value)
|
||||||
@ -837,9 +837,6 @@ SERVO_BINDING_FUNC(Servo_GetCustomPropertyNameAt, bool,
|
|||||||
ComputedStyleBorrowed, uint32_t index,
|
ComputedStyleBorrowed, uint32_t index,
|
||||||
nsAString* name)
|
nsAString* name)
|
||||||
|
|
||||||
SERVO_BINDING_FUNC(Servo_GetPropertyValue, void,
|
|
||||||
ComputedStyleBorrowed computed_values,
|
|
||||||
nsCSSPropertyID property, nsAString* value)
|
|
||||||
|
|
||||||
SERVO_BINDING_FUNC(Servo_ProcessInvalidations, void,
|
SERVO_BINDING_FUNC(Servo_ProcessInvalidations, void,
|
||||||
RawServoStyleSetBorrowed set,
|
RawServoStyleSetBorrowed set,
|
||||||
|
@ -68,34 +68,6 @@ def method(prop):
|
|||||||
return prop.camel_case[1:]
|
return prop.camel_case[1:]
|
||||||
return prop.camel_case
|
return prop.camel_case
|
||||||
|
|
||||||
# Colors, integers and lengths are easy as well.
|
|
||||||
#
|
|
||||||
# TODO(emilio): This will go away once the rest of the longhands have been
|
|
||||||
# moved or perhaps using a blacklist for the ones with non-layout-dependence
|
|
||||||
# but other non-trivial dependence like scrollbar colors.
|
|
||||||
SERIALIZED_PREDEFINED_TYPES = [
|
|
||||||
"Color",
|
|
||||||
"Integer",
|
|
||||||
"Length",
|
|
||||||
"Opacity",
|
|
||||||
]
|
|
||||||
|
|
||||||
def serialized_by_servo(prop):
|
|
||||||
# If the property requires layout information, no such luck.
|
|
||||||
if "GETCS_NEEDS_LAYOUT_FLUSH" in prop.flags:
|
|
||||||
return False
|
|
||||||
# No shorthands yet.
|
|
||||||
if prop.type() == "shorthand":
|
|
||||||
return False
|
|
||||||
# Keywords are all fine.
|
|
||||||
if prop.keyword:
|
|
||||||
return True
|
|
||||||
if prop.predefined_type in SERIALIZED_PREDEFINED_TYPES:
|
|
||||||
return True
|
|
||||||
# TODO(emilio): Enable the rest of the longhands.
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def flags(prop):
|
def flags(prop):
|
||||||
result = []
|
result = []
|
||||||
if prop.explicitly_enabled_in_chrome():
|
if prop.explicitly_enabled_in_chrome():
|
||||||
@ -110,8 +82,6 @@ def flags(prop):
|
|||||||
result.append("GetCSNeedsLayoutFlush")
|
result.append("GetCSNeedsLayoutFlush")
|
||||||
if "CAN_ANIMATE_ON_COMPOSITOR" in prop.flags:
|
if "CAN_ANIMATE_ON_COMPOSITOR" in prop.flags:
|
||||||
result.append("CanAnimateOnCompositor")
|
result.append("CanAnimateOnCompositor")
|
||||||
if serialized_by_servo(prop):
|
|
||||||
result.append("SerializedByServo")
|
|
||||||
return ", ".join('"CSSPropFlags::{}"'.format(flag) for flag in result)
|
return ", ".join('"CSSPropFlags::{}"'.format(flag) for flag in result)
|
||||||
|
|
||||||
def pref(prop):
|
def pref(prop):
|
||||||
|
@ -435,47 +435,20 @@ nsComputedDOMStyle::GetPropertyValue(const nsAString& aPropertyName,
|
|||||||
{
|
{
|
||||||
aReturn.Truncate();
|
aReturn.Truncate();
|
||||||
|
|
||||||
nsCSSPropertyID prop =
|
ErrorResult error;
|
||||||
nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);
|
RefPtr<CSSValue> val =
|
||||||
|
GetPropertyCSSValueWithoutWarning(aPropertyName, error);
|
||||||
const ComputedStyleMap::Entry* entry = nullptr;
|
if (error.Failed()) {
|
||||||
if (prop != eCSSPropertyExtra_variable) {
|
return error.StealNSResult();
|
||||||
entry = GetComputedStyleMap()->FindEntryForProperty(prop);
|
|
||||||
if (!entry) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool layoutFlushIsNeeded = entry && entry->IsLayoutFlushNeeded();
|
if (val) {
|
||||||
UpdateCurrentStyleSources(layoutFlushIsNeeded);
|
nsString text;
|
||||||
if (!mComputedStyle) {
|
val->GetCssText(text, error);
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
aReturn.Assign(text);
|
||||||
|
return error.StealNSResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cleanup = mozilla::MakeScopeExit([&] {
|
|
||||||
ClearCurrentStyleSources();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!entry) {
|
|
||||||
MOZ_ASSERT(nsCSSProps::IsCustomPropertyName(aPropertyName));
|
|
||||||
const nsAString& name =
|
|
||||||
Substring(aPropertyName, CSS_CUSTOM_NAME_PREFIX_LENGTH);
|
|
||||||
Servo_GetCustomPropertyValue(mComputedStyle, &name, &aReturn);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!nsCSSProps::PropHasFlags(prop, CSSPropFlags::SerializedByServo)) {
|
|
||||||
if (RefPtr<CSSValue> value = (this->*entry->mGetter)()) {
|
|
||||||
ErrorResult rv;
|
|
||||||
nsString text;
|
|
||||||
value->GetCssText(text, rv);
|
|
||||||
aReturn.Assign(text);
|
|
||||||
return rv.StealNSResult();
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
Servo_GetPropertyValue(mComputedStyle, prop, &aReturn);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1014,6 +987,57 @@ nsComputedDOMStyle::ClearCurrentStyleSources()
|
|||||||
mPresShell = nullptr;
|
mPresShell = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<CSSValue>
|
||||||
|
nsComputedDOMStyle::GetPropertyCSSValueWithoutWarning(
|
||||||
|
const nsAString& aPropertyName,
|
||||||
|
ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
nsCSSPropertyID prop =
|
||||||
|
nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);
|
||||||
|
|
||||||
|
bool needsLayoutFlush;
|
||||||
|
ComputedStyleMap::Entry::ComputeMethod getter;
|
||||||
|
|
||||||
|
if (prop == eCSSPropertyExtra_variable) {
|
||||||
|
needsLayoutFlush = false;
|
||||||
|
getter = nullptr;
|
||||||
|
} else {
|
||||||
|
const ComputedStyleMap::Entry* propEntry =
|
||||||
|
GetComputedStyleMap()->FindEntryForProperty(prop);
|
||||||
|
|
||||||
|
if (!propEntry) {
|
||||||
|
#ifdef DEBUG_ComputedDOMStyle
|
||||||
|
NS_WARNING(PromiseFlatCString(NS_ConvertUTF16toUTF8(aPropertyName) +
|
||||||
|
NS_LITERAL_CSTRING(" is not queryable!")).get());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// NOTE: For branches, we should flush here for compatibility!
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
needsLayoutFlush = propEntry->IsLayoutFlushNeeded();
|
||||||
|
getter = propEntry->mGetter;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateCurrentStyleSources(needsLayoutFlush);
|
||||||
|
if (!mComputedStyle) {
|
||||||
|
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefPtr<CSSValue> val;
|
||||||
|
if (prop == eCSSPropertyExtra_variable) {
|
||||||
|
val = DoGetCustomProperty(aPropertyName);
|
||||||
|
} else {
|
||||||
|
// Call our pointer-to-member-function.
|
||||||
|
val = (this->*getter)();
|
||||||
|
}
|
||||||
|
|
||||||
|
ClearCurrentStyleSources();
|
||||||
|
|
||||||
|
return val.forget();
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsComputedDOMStyle::RemoveProperty(const nsAString& aPropertyName,
|
nsComputedDOMStyle::RemoveProperty(const nsAString& aPropertyName,
|
||||||
nsAString& aReturn)
|
nsAString& aReturn)
|
||||||
@ -7168,6 +7192,26 @@ MarkComputedStyleMapDirty(const char* aPref, void* aData)
|
|||||||
static_cast<ComputedStyleMap*>(aData)->MarkDirty();
|
static_cast<ComputedStyleMap*>(aData)->MarkDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<CSSValue>
|
||||||
|
nsComputedDOMStyle::DoGetCustomProperty(const nsAString& aPropertyName)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(nsCSSProps::IsCustomPropertyName(aPropertyName));
|
||||||
|
|
||||||
|
nsString variableValue;
|
||||||
|
const nsAString& name = Substring(aPropertyName,
|
||||||
|
CSS_CUSTOM_NAME_PREFIX_LENGTH);
|
||||||
|
bool present =
|
||||||
|
Servo_GetCustomPropertyValue(mComputedStyle, &name, &variableValue);
|
||||||
|
if (!present) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||||
|
val->SetString(variableValue);
|
||||||
|
|
||||||
|
return val.forget();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsComputedDOMStyle::ParentChainChanged(nsIContent* aContent)
|
nsComputedDOMStyle::ParentChainChanged(nsIContent* aContent)
|
||||||
{
|
{
|
||||||
|
@ -59,6 +59,10 @@ private:
|
|||||||
typedef mozilla::dom::CSSValue CSSValue;
|
typedef mozilla::dom::CSSValue CSSValue;
|
||||||
typedef mozilla::StyleGeometryBox StyleGeometryBox;
|
typedef mozilla::StyleGeometryBox StyleGeometryBox;
|
||||||
|
|
||||||
|
already_AddRefed<CSSValue>
|
||||||
|
GetPropertyCSSValueWithoutWarning(const nsAString& aProp,
|
||||||
|
mozilla::ErrorResult& aRv);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsComputedDOMStyle,
|
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsComputedDOMStyle,
|
||||||
@ -613,6 +617,9 @@ private:
|
|||||||
|
|
||||||
already_AddRefed<CSSValue> DoGetContextProperties();
|
already_AddRefed<CSSValue> DoGetContextProperties();
|
||||||
|
|
||||||
|
/* Custom properties */
|
||||||
|
already_AddRefed<CSSValue> DoGetCustomProperty(const nsAString& aPropertyName);
|
||||||
|
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
|
void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
|
||||||
void SetValueFromComplexColor(nsROCSSPrimitiveValue* aValue,
|
void SetValueFromComplexColor(nsROCSSPrimitiveValue* aValue,
|
||||||
|
@ -226,10 +226,6 @@ class Longhand(object):
|
|||||||
# See compute_damage for the various values this can take
|
# See compute_damage for the various values this can take
|
||||||
self.servo_restyle_damage = servo_restyle_damage
|
self.servo_restyle_damage = servo_restyle_damage
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def type():
|
|
||||||
return "longhand"
|
|
||||||
|
|
||||||
def experimental(self, product):
|
def experimental(self, product):
|
||||||
if product == "gecko":
|
if product == "gecko":
|
||||||
return bool(self.gecko_pref)
|
return bool(self.gecko_pref)
|
||||||
@ -365,10 +361,6 @@ class Shorthand(object):
|
|||||||
animatable = property(get_animatable)
|
animatable = property(get_animatable)
|
||||||
transitionable = property(get_transitionable)
|
transitionable = property(get_transitionable)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def type():
|
|
||||||
return "shorthand"
|
|
||||||
|
|
||||||
def experimental(self, product):
|
def experimental(self, product):
|
||||||
if product == "gecko":
|
if product == "gecko":
|
||||||
return bool(self.gecko_pref)
|
return bool(self.gecko_pref)
|
||||||
@ -400,10 +392,6 @@ class Alias(object):
|
|||||||
self.allowed_in_page_rule = original.allowed_in_page_rule
|
self.allowed_in_page_rule = original.allowed_in_page_rule
|
||||||
self.allowed_in_keyframe_block = original.allowed_in_keyframe_block
|
self.allowed_in_keyframe_block = original.allowed_in_keyframe_block
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def type():
|
|
||||||
return "alias"
|
|
||||||
|
|
||||||
def experimental(self, product):
|
def experimental(self, product):
|
||||||
if product == "gecko":
|
if product == "gecko":
|
||||||
return bool(self.gecko_pref)
|
return bool(self.gecko_pref)
|
||||||
|
@ -22,7 +22,8 @@ use std::cell::RefCell;
|
|||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
use std::mem::{self, ManuallyDrop};
|
use std::mem::{self, ManuallyDrop};
|
||||||
|
|
||||||
use cssparser::{Parser, RGBA, TokenSerializationType};
|
#[cfg(feature = "servo")] use cssparser::RGBA;
|
||||||
|
use cssparser::{Parser, TokenSerializationType};
|
||||||
use cssparser::ParserInput;
|
use cssparser::ParserInput;
|
||||||
#[cfg(feature = "servo")] use euclid::SideOffsets2D;
|
#[cfg(feature = "servo")] use euclid::SideOffsets2D;
|
||||||
use context::QuirksMode;
|
use context::QuirksMode;
|
||||||
@ -44,6 +45,7 @@ use shared_lock::StylesheetGuards;
|
|||||||
use style_traits::{CssWriter, KeywordsCollectFn, ParseError, ParsingMode};
|
use style_traits::{CssWriter, KeywordsCollectFn, ParseError, ParsingMode};
|
||||||
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
|
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
|
||||||
use stylesheets::{CssRuleType, Origin, UrlExtraData};
|
use stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||||
|
#[cfg(feature = "servo")] use values::Either;
|
||||||
use values::generics::text::LineHeight;
|
use values::generics::text::LineHeight;
|
||||||
use values::computed;
|
use values::computed;
|
||||||
use values::computed::NonNegativeLength;
|
use values::computed::NonNegativeLength;
|
||||||
@ -832,13 +834,13 @@ bitflags! {
|
|||||||
const APPLIES_TO_FIRST_LINE = 1 << 4;
|
const APPLIES_TO_FIRST_LINE = 1 << 4;
|
||||||
/// This longhand property applies to ::placeholder.
|
/// This longhand property applies to ::placeholder.
|
||||||
const APPLIES_TO_PLACEHOLDER = 1 << 5;
|
const APPLIES_TO_PLACEHOLDER = 1 << 5;
|
||||||
/// This property's getComputedStyle implementation requires layout
|
|
||||||
/// to be flushed.
|
|
||||||
const GETCS_NEEDS_LAYOUT_FLUSH = 1 << 6;
|
|
||||||
|
|
||||||
/* The following flags are currently not used in Rust code, they
|
/* The following flags are currently not used in Rust code, they
|
||||||
* only need to be listed in corresponding properties so that
|
* only need to be listed in corresponding properties so that
|
||||||
* they can be checked in the C++ side via ServoCSSPropList.h. */
|
* they can be checked in the C++ side via ServoCSSPropList.h. */
|
||||||
|
/// This property's getComputedStyle implementation requires layout
|
||||||
|
/// to be flushed.
|
||||||
|
const GETCS_NEEDS_LAYOUT_FLUSH = 0;
|
||||||
/// This property can be animated on the compositor.
|
/// This property can be animated on the compositor.
|
||||||
const CAN_ANIMATE_ON_COMPOSITOR = 0;
|
const CAN_ANIMATE_ON_COMPOSITOR = 0;
|
||||||
}
|
}
|
||||||
@ -2612,59 +2614,6 @@ impl ComputedValues {
|
|||||||
pub fn custom_properties(&self) -> Option<<&Arc<::custom_properties::CustomPropertiesMap>> {
|
pub fn custom_properties(&self) -> Option<<&Arc<::custom_properties::CustomPropertiesMap>> {
|
||||||
self.custom_properties.as_ref()
|
self.custom_properties.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes the value of the given longhand as a string in `dest`.
|
|
||||||
///
|
|
||||||
/// Note that the value will usually be the computed value, except for
|
|
||||||
/// colors, where it's resolved.
|
|
||||||
pub fn get_longhand_property_value<W>(
|
|
||||||
&self,
|
|
||||||
property_id: LonghandId,
|
|
||||||
dest: &mut CssWriter<W>
|
|
||||||
) -> fmt::Result
|
|
||||||
where
|
|
||||||
W: Write,
|
|
||||||
{
|
|
||||||
// TODO(emilio): Is it worth to merge branches here just like
|
|
||||||
// PropertyDeclaration::to_css does?
|
|
||||||
//
|
|
||||||
// We'd need to get a concept of ~resolved value, which may not be worth
|
|
||||||
// it.
|
|
||||||
match property_id {
|
|
||||||
% for prop in data.longhands:
|
|
||||||
LonghandId::${prop.camel_case} => {
|
|
||||||
let style_struct =
|
|
||||||
self.get_${prop.style_struct.ident.strip("_")}();
|
|
||||||
let value =
|
|
||||||
style_struct
|
|
||||||
% if prop.logical:
|
|
||||||
.clone_${prop.ident}(self.writing_mode);
|
|
||||||
% else:
|
|
||||||
.clone_${prop.ident}();
|
|
||||||
% endif
|
|
||||||
|
|
||||||
% if prop.predefined_type == "Color":
|
|
||||||
let value = self.resolve_color(value);
|
|
||||||
% endif
|
|
||||||
|
|
||||||
value.to_css(dest)
|
|
||||||
}
|
|
||||||
% endfor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Resolves the currentColor keyword.
|
|
||||||
///
|
|
||||||
/// Any color value from computed values (except for the 'color' property
|
|
||||||
/// itself) should go through this method.
|
|
||||||
///
|
|
||||||
/// Usage example:
|
|
||||||
/// let top_color =
|
|
||||||
/// style.resolve_color(style.get_border().clone_border_top_color());
|
|
||||||
#[inline]
|
|
||||||
pub fn resolve_color(&self, color: computed::Color) -> RGBA {
|
|
||||||
color.to_rgba(self.get_color().clone_color())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
@ -2777,6 +2726,18 @@ impl ComputedValuesInner {
|
|||||||
self.get_column().is_multicol()
|
self.get_column().is_multicol()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Resolves the currentColor keyword.
|
||||||
|
///
|
||||||
|
/// Any color value from computed values (except for the 'color' property
|
||||||
|
/// itself) should go through this method.
|
||||||
|
///
|
||||||
|
/// Usage example:
|
||||||
|
/// let top_color = style.resolve_color(style.Border.border_top_color);
|
||||||
|
#[inline]
|
||||||
|
pub fn resolve_color(&self, color: computed::Color) -> RGBA {
|
||||||
|
color.to_rgba(self.get_color().color)
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the logical computed inline size.
|
/// Get the logical computed inline size.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn content_inline_size(&self) -> computed::LengthOrPercentageOrAuto {
|
pub fn content_inline_size(&self) -> computed::LengthOrPercentageOrAuto {
|
||||||
@ -2941,19 +2902,19 @@ impl ComputedValuesInner {
|
|||||||
/// Serializes the computed value of this property as a string.
|
/// Serializes the computed value of this property as a string.
|
||||||
pub fn computed_value_to_string(&self, property: PropertyDeclarationId) -> String {
|
pub fn computed_value_to_string(&self, property: PropertyDeclarationId) -> String {
|
||||||
match property {
|
match property {
|
||||||
PropertyDeclarationId::Longhand(id) => {
|
% for style_struct in data.active_style_structs():
|
||||||
let mut s = String::new();
|
% for longhand in style_struct.longhands:
|
||||||
self.get_longhand_property_value(
|
PropertyDeclarationId::Longhand(LonghandId::${longhand.camel_case}) => {
|
||||||
property,
|
self.${style_struct.ident}.${longhand.ident}.to_css_string()
|
||||||
&mut CssWriter::new(&mut s)
|
}
|
||||||
).unwrap();
|
% endfor
|
||||||
s
|
% endfor
|
||||||
}
|
|
||||||
PropertyDeclarationId::Custom(name) => {
|
PropertyDeclarationId::Custom(name) => {
|
||||||
self.custom_properties
|
self.custom_properties
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|map| map.get(name))
|
.and_then(|map| map.get(name))
|
||||||
.map_or(String::new(), |value| value.to_css_string())
|
.map(|value| value.to_css_string())
|
||||||
|
.unwrap_or(String::new())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5132,25 +5132,6 @@ pub extern "C" fn Servo_StyleSet_HasDocumentStateDependency(
|
|||||||
data.stylist.has_document_state_dependency(state)
|
data.stylist.has_document_state_dependency(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub unsafe extern "C" fn Servo_GetPropertyValue(
|
|
||||||
computed_values: ComputedStyleBorrowed,
|
|
||||||
prop: nsCSSPropertyID,
|
|
||||||
value: *mut nsAString,
|
|
||||||
) {
|
|
||||||
use style::properties::PropertyFlags;
|
|
||||||
|
|
||||||
let longhand = LonghandId::from_nscsspropertyid(prop).expect("Not a longhand?");
|
|
||||||
debug_assert!(
|
|
||||||
!longhand.flags().contains(PropertyFlags::GETCS_NEEDS_LAYOUT_FLUSH),
|
|
||||||
"We're not supposed to serialize layout-dependent properties"
|
|
||||||
);
|
|
||||||
computed_values.get_longhand_property_value(
|
|
||||||
longhand,
|
|
||||||
&mut CssWriter::new(&mut *value),
|
|
||||||
).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn Servo_GetCustomPropertyValue(
|
pub unsafe extern "C" fn Servo_GetCustomPropertyValue(
|
||||||
computed_values: ComputedStyleBorrowed,
|
computed_values: ComputedStyleBorrowed,
|
||||||
|
Loading…
Reference in New Issue
Block a user