diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-06-14 03:07:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-14 03:07:27 -0700 |
commit | 63a5ab154eabf72595477f8136e371127bcd8486 (patch) | |
tree | 6a7f794c10484b2011d8857f64d4303cc819de57 | |
parent | f26726cfdd5d5cd3780638eefc54393805cba952 (diff) | |
parent | 08c12062c7e94096c8d31703afb86309c5abc6da (diff) | |
download | servo-63a5ab154eabf72595477f8136e371127bcd8486.tar.gz servo-63a5ab154eabf72595477f8136e371127bcd8486.zip |
Auto merge of #17316 - upsuper:bug1371976, r=heycam
Resolve counter style during parallel traversal when possible
This is the Servo side change of [bug 1371976](https://bugzilla.mozilla.org/show_bug.cgi?id=1371976).
-rw-r--r-- | components/style/gecko/generated/bindings.rs | 4 | ||||
-rw-r--r-- | components/style/gecko/values.rs | 8 | ||||
-rw-r--r-- | components/style/properties/gecko.mako.rs | 15 | ||||
-rw-r--r-- | components/style/properties/helpers.mako.rs | 5 |
4 files changed, 20 insertions, 12 deletions
diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index c6e85dff304..38b86d87c3b 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -906,7 +906,9 @@ extern "C" { } extern "C" { pub fn Gecko_SetCounterStyleToName(ptr: *mut CounterStylePtr, - name: *mut nsIAtom); + name: *mut nsIAtom, + pres_context: + RawGeckoPresContextBorrowed); } extern "C" { pub fn Gecko_SetCounterStyleToSymbols(ptr: *mut CounterStylePtr, diff --git a/components/style/gecko/values.rs b/components/style/gecko/values.rs index 041387dd54c..aacf5373077 100644 --- a/components/style/gecko/values.rs +++ b/components/style/gecko/values.rs @@ -12,6 +12,7 @@ use cssparser::RGBA; use gecko_bindings::structs::{CounterStylePtr, nsStyleCoord}; use gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius}; use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue}; +use media_queries::Device; use nsstring::{nsACString, nsCString}; use std::cmp::max; use values::{Auto, Either, ExtremumLength, None_, Normal}; @@ -397,15 +398,16 @@ pub fn round_border_to_device_pixels(width: Au, au_per_device_px: Au) -> Au { impl CounterStyleOrNone { /// Convert this counter style to a Gecko CounterStylePtr. - pub fn to_gecko_value(self, gecko_value: &mut CounterStylePtr) { + pub fn to_gecko_value(self, gecko_value: &mut CounterStylePtr, device: &Device) { use gecko_bindings::bindings::Gecko_SetCounterStyleToName as set_name; use gecko_bindings::bindings::Gecko_SetCounterStyleToSymbols as set_symbols; + let pres_context = unsafe { &*device.pres_context }; match self { CounterStyleOrNone::None => unsafe { - set_name(gecko_value, atom!("none").into_addrefed()); + set_name(gecko_value, atom!("none").into_addrefed(), pres_context); }, CounterStyleOrNone::Name(name) => unsafe { - set_name(gecko_value, name.0.into_addrefed()); + set_name(gecko_value, name.0.into_addrefed(), pres_context); }, CounterStyleOrNone::Symbols(symbols_type, symbols) => { let symbols: Vec<_> = symbols.0.iter().map(|symbol| match *symbol { diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 847b189bf25..8c4cdb4a063 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -3202,12 +3202,12 @@ fn static_assert() { unsafe { Gecko_CopyListStyleImageFrom(&mut self.gecko, &other.gecko); } } - pub fn set_list_style_type(&mut self, v: longhands::list_style_type::computed_value::T) { + pub fn set_list_style_type(&mut self, v: longhands::list_style_type::computed_value::T, device: &Device) { use gecko_bindings::bindings::Gecko_SetCounterStyleToString; use nsstring::{nsACString, nsCString}; use self::longhands::list_style_type::computed_value::T; match v { - T::CounterStyle(s) => s.to_gecko_value(&mut self.gecko.mCounterStyle), + T::CounterStyle(s) => s.to_gecko_value(&mut self.gecko.mCounterStyle, device), T::String(s) => unsafe { Gecko_SetCounterStyleToString(&mut self.gecko.mCounterStyle, &nsCString::from(s) as &nsACString) @@ -4254,7 +4254,7 @@ clip-path self.gecko.mContents.is_empty() } - pub fn set_content(&mut self, v: longhands::content::computed_value::T) { + pub fn set_content(&mut self, v: longhands::content::computed_value::T, device: &Device) { use properties::longhands::content::computed_value::T; use properties::longhands::content::computed_value::ContentItem; use values::generics::CounterStyleOrNone; @@ -4275,7 +4275,8 @@ clip-path fn set_counter_function(data: &mut nsStyleContentData, content_type: nsStyleContentType, - name: &str, sep: &str, style: CounterStyleOrNone) { + name: &str, sep: &str, + style: CounterStyleOrNone, device: &Device) { debug_assert!(content_type == eStyleContentType_Counter || content_type == eStyleContentType_Counters); let counter_func = unsafe { @@ -4285,7 +4286,7 @@ clip-path if content_type == eStyleContentType_Counters { counter_func.mSeparator.assign_utf8(sep); } - style.to_gecko_value(&mut counter_func.mCounterStyle); + style.to_gecko_value(&mut counter_func.mCounterStyle, device); } match v { @@ -4349,11 +4350,11 @@ clip-path => self.gecko.mContents[i].mType = eStyleContentType_NoCloseQuote, ContentItem::Counter(name, style) => { set_counter_function(&mut self.gecko.mContents[i], - eStyleContentType_Counter, &name, "", style); + eStyleContentType_Counter, &name, "", style, device); } ContentItem::Counters(name, sep, style) => { set_counter_function(&mut self.gecko.mContents[i], - eStyleContentType_Counters, &name, &sep, style); + eStyleContentType_Counters, &name, &sep, style, device); } ContentItem::Url(ref url) => { unsafe { diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index c8502551a0e..f2c0e818b37 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -344,6 +344,8 @@ <% maybe_wm = ", wm" if property.logical else "" maybe_cacheable = ", cacheable" if property.has_uncacheable_values == "True" else "" + props_need_device = "content list_style_type".split() if product == "gecko" else [] + maybe_device = ", context.device" if property.ident in props_need_device else "" %> match *value { DeclaredValue::Value(ref specified_value) => { @@ -375,7 +377,8 @@ inherited_style.get_font()); % else: context.mutate_style().mutate_${data.current_style_struct.name_lower}() - .set_${property.ident}(computed ${maybe_cacheable} ${maybe_wm}); + .set_${property.ident}(computed ${maybe_device} + ${maybe_cacheable} ${maybe_wm}); % endif % endif } |