Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stylo: Fuse ServoStyleContext and ServoComputedValues #17767

Merged
merged 16 commits into from Jul 18, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Fix tidy

  • Loading branch information
Manishearth committed Jul 18, 2017
commit 8eafe6a3b7a5a4170857a968176b643a22d2ff48
@@ -10,8 +10,7 @@

use gecko_bindings::bindings::{RawServoImportRule, RawServoSupportsRule};
use gecko_bindings::bindings::{RawServoKeyframe, RawServoKeyframesRule};
use gecko_bindings::bindings::RawServoMediaRule;
use gecko_bindings::bindings::{RawServoNamespaceRule, RawServoPageRule};
use gecko_bindings::bindings::{RawServoMediaRule, RawServoNamespaceRule, RawServoPageRule};
use gecko_bindings::bindings::{RawServoRuleNode, RawServoRuleNodeStrong, RawServoDocumentRule};
use gecko_bindings::bindings::ServoCssRules;
use gecko_bindings::structs::{RawServoAnimationValue, RawServoDeclarationBlock, RawServoStyleRule, RawServoMediaList};
@@ -866,8 +866,8 @@ impl<'le> TElement for GeckoElement<'le> {
}

let declarations = unsafe { Gecko_GetStyleAttrDeclarationBlock(self.0) };
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>>
= declarations.and_then(|s| s.as_arc_opt());
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
declarations.and_then(|s| s.as_arc_opt());
declarations.map(|s| s.borrow_arc())
}

@@ -881,8 +881,8 @@ impl<'le> TElement for GeckoElement<'le> {

fn get_smil_override(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
let declarations = unsafe { Gecko_GetSMILOverrideDeclarationBlock(self.0) };
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>>
= declarations.and_then(|s| s.as_arc_opt());
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
declarations.and_then(|s| s.as_arc_opt());
declarations.map(|s| s.borrow_arc())
}

@@ -1431,16 +1431,16 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
}
}
let declarations = unsafe { Gecko_GetHTMLPresentationAttrDeclarationBlock(self.0) };
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>>
= declarations.and_then(|s| s.as_arc_opt());
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
declarations.and_then(|s| s.as_arc_opt());
if let Some(decl) = declarations {
hints.push(
ApplicableDeclarationBlock::from_declarations(decl.clone_arc(), ServoCascadeLevel::PresHints)
);
}
let declarations = unsafe { Gecko_GetExtraContentStyleDeclarations(self.0) };
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>>
= declarations.and_then(|s| s.as_arc_opt());
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
declarations.and_then(|s| s.as_arc_opt());
if let Some(decl) = declarations {
hints.push(
ApplicableDeclarationBlock::from_declarations(decl.clone_arc(), ServoCascadeLevel::PresHints)
@@ -1474,8 +1474,8 @@ impl<'le> PresentationalHintsSynthesizer for GeckoElement<'le> {
let active = self.get_state().intersects(NonTSPseudoClass::Active.state_flag());
if active {
let declarations = unsafe { Gecko_GetActiveLinkAttrDeclarationBlock(self.0) };
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>>
= declarations.and_then(|s| s.as_arc_opt());
let declarations: Option<&RawOffsetArc<Locked<PropertyDeclarationBlock>>> =
declarations.and_then(|s| s.as_arc_opt());
if let Some(decl) = declarations {
hints.push(
ApplicableDeclarationBlock::from_declarations(decl.clone_arc(), ServoCascadeLevel::PresHints)
@@ -148,7 +148,9 @@ impl ComputedValuesInner {
visited_style: None,
flags: ComputedValueFlags::empty(),
% for style_struct in data.style_structs:
${style_struct.gecko_name}: Arc::into_raw_offset(style_structs::${style_struct.name}::default(pres_context)),
${style_struct.gecko_name}: Arc::into_raw_offset(
style_structs::${style_struct.name}::default(pres_context)
),
% endfor
}
}
@@ -168,7 +168,7 @@ impl PseudoElement {
}

/// Stub, only Gecko needs this
pub fn pseudo_info(&self) -> () { () }
pub fn pseudo_info(&self) { () }
}

/// The type used for storing pseudo-class string arguments.
@@ -3358,7 +3358,6 @@ pub extern "C" fn Servo_StyleSet_HasStateDependency(
pub extern "C" fn Servo_GetCustomPropertyValue(computed_values: ServoComputedValuesBorrowed,
name: *const nsAString,
value: *mut nsAString) -> bool {

let custom_properties = match computed_values.custom_properties() {
Some(p) => p,
None => return false,
@@ -11,7 +11,7 @@ use style::context::QuirksMode;
use style::font_metrics::ServoMetricsProvider;
use style::media_queries::{Device, MediaType};
use style::parser::ParserContext;
use style::properties::{ComputedValues, StyleBuilder};
use style::properties::{ComputedValues, ComputedValuesInner, StyleBuilder};
use style::stylesheets::{CssRuleType, Origin};
use style::values::computed::{Context, ToComputedValue};
use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError};
@@ -49,7 +49,7 @@ fn assert_computed_serialization<C, F, T>(f: F, input: &'static str, output: &st
T: ToComputedValue<ComputedValue=C>, C: ToCss
{
let viewport_size = TypedSize2D::new(0., 0.);
let initial_style = ComputedValues::initial_values();
let initial_style = ComputedValuesInner::initial_values();
let device = Device::new(MediaType::Screen, viewport_size);

let context = Context {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.