mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #17773 - emilio:removing-the-ugly, r=manishearth
style: Cleanup post #17767 Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1381764 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17773) <!-- Reviewable:end -->
This commit is contained in:
commit
66e06578ee
27 changed files with 3431 additions and 2695 deletions
|
@ -416,7 +416,7 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
&style_pseudo,
|
||||
Some(data.styles.primary()),
|
||||
CascadeFlags::empty(),
|
||||
&ServoMetricsProvider, (), ())
|
||||
&ServoMetricsProvider)
|
||||
.clone()
|
||||
}
|
||||
PseudoElementCascadeType::Lazy => {
|
||||
|
@ -428,7 +428,7 @@ pub trait ThreadSafeLayoutElement: Clone + Copy + Sized + Debug +
|
|||
RuleInclusion::All,
|
||||
data.styles.primary(),
|
||||
/* is_probe = */ false,
|
||||
&ServoMetricsProvider, (), ())
|
||||
&ServoMetricsProvider)
|
||||
.unwrap()
|
||||
.clone()
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use context::SharedStyleContext;
|
|||
use dom::OpaqueNode;
|
||||
use euclid::Point2D;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use properties::{self, CascadeFlags, ComputedValues, ComputedValuesInner, Importance};
|
||||
use properties::{self, CascadeFlags, ComputedValues, Importance};
|
||||
use properties::animated_properties::{AnimatableLonghand, AnimatedProperty, TransitionProperty};
|
||||
use properties::longhands::animation_direction::computed_value::single_value::T as AnimationDirection;
|
||||
use properties::longhands::animation_iteration_count::single_value::computed_value::T as AnimationIterationCount;
|
||||
|
@ -347,8 +347,8 @@ impl PropertyAnimation {
|
|||
fn from_animatable_longhand(animatable_longhand: &AnimatableLonghand,
|
||||
timing_function: TimingFunction,
|
||||
duration: Time,
|
||||
old_style: &ComputedValuesInner,
|
||||
new_style: &ComputedValuesInner)
|
||||
old_style: &ComputedValues,
|
||||
new_style: &ComputedValues)
|
||||
-> Option<PropertyAnimation> {
|
||||
let animated_property = AnimatedProperty::from_animatable_longhand(animatable_longhand,
|
||||
old_style,
|
||||
|
@ -480,10 +480,10 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Sender<Animation>
|
|||
|
||||
fn compute_style_for_animation_step(context: &SharedStyleContext,
|
||||
step: &KeyframesStep,
|
||||
previous_style: &ComputedValuesInner,
|
||||
style_from_cascade: &ComputedValuesInner,
|
||||
previous_style: &ComputedValues,
|
||||
style_from_cascade: &Arc<ComputedValues>,
|
||||
font_metrics_provider: &FontMetricsProvider)
|
||||
-> ComputedValuesInner {
|
||||
-> Arc<ComputedValues> {
|
||||
match step.value {
|
||||
KeyframesStepValue::ComputedValues => style_from_cascade.clone(),
|
||||
KeyframesStepValue::Declarations { block: ref declarations } => {
|
||||
|
@ -502,10 +502,11 @@ fn compute_style_for_animation_step(context: &SharedStyleContext,
|
|||
// as existing browsers don't appear to animate visited styles.
|
||||
let computed =
|
||||
properties::apply_declarations(context.stylist.device(),
|
||||
/* pseudo = */ None,
|
||||
previous_style.rules(),
|
||||
iter,
|
||||
previous_style,
|
||||
previous_style,
|
||||
Some(previous_style),
|
||||
Some(previous_style),
|
||||
/* cascade_info = */ None,
|
||||
/* visited_style = */ None,
|
||||
font_metrics_provider,
|
||||
|
|
|
@ -15,7 +15,7 @@ use data::ElementData;
|
|||
use element_state::ElementState;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use media_queries::Device;
|
||||
use properties::{AnimationRules, ComputedValues, ComputedValuesInner, PropertyDeclarationBlock};
|
||||
use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock};
|
||||
#[cfg(feature = "gecko")] use properties::animated_properties::AnimationValue;
|
||||
#[cfg(feature = "gecko")] use properties::animated_properties::TransitionProperty;
|
||||
use rule_tree::CascadeLevel;
|
||||
|
@ -437,7 +437,7 @@ pub trait TElement : Eq + PartialEq + Debug + Hash + Sized + Copy + Clone +
|
|||
fn may_generate_pseudo(
|
||||
&self,
|
||||
pseudo: &PseudoElement,
|
||||
_primary_style: &ComputedValuesInner,
|
||||
_primary_style: &ComputedValues,
|
||||
) -> bool {
|
||||
// ::before/::after are always supported for now, though we could try to
|
||||
// optimize out leaf elements.
|
||||
|
|
|
@ -16,7 +16,7 @@ use gecko_bindings::structs::nsIDocument;
|
|||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||
use media_queries::{Device, MediaList};
|
||||
use properties::ComputedValuesInner;
|
||||
use properties::ComputedValues;
|
||||
use shared_lock::{Locked, StylesheetGuards, SharedRwLockReadGuard};
|
||||
use stylearc::Arc;
|
||||
use stylesheet_set::StylesheetSet;
|
||||
|
@ -188,8 +188,8 @@ impl PerDocumentStyleDataImpl {
|
|||
}
|
||||
|
||||
/// Get the default computed values for this document.
|
||||
pub fn default_computed_values(&self) -> &ComputedValuesInner {
|
||||
self.stylist.device().default_computed_values()
|
||||
pub fn default_computed_values(&self) -> &Arc<ComputedValues> {
|
||||
self.stylist.device().default_computed_values_arc()
|
||||
}
|
||||
|
||||
/// Clear the stylist. This will be a no-op if the stylist is
|
||||
|
|
|
@ -1971,6 +1971,12 @@ extern "C" {
|
|||
RawServoDeclarationBlockBorrowed)
|
||||
-> ServoStyleContextStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleContext_AddRef(ctx: ServoStyleContextBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleContext_Release(ctx: ServoStyleContextBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_MightHaveAttributeDependency(set:
|
||||
RawServoStyleSetBorrowed,
|
||||
|
@ -2289,14 +2295,14 @@ extern "C" {
|
|||
pub fn Servo_GetComputedKeyframeValues(keyframes:
|
||||
RawGeckoKeyframeListBorrowed,
|
||||
element: RawGeckoElementBorrowed,
|
||||
style: ServoComputedValuesBorrowed,
|
||||
style: ServoStyleContextBorrowed,
|
||||
set: RawServoStyleSetBorrowed,
|
||||
result:
|
||||
RawGeckoComputedKeyframeValuesListBorrowedMut);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_ExtractAnimationValue(computed_values:
|
||||
ServoComputedValuesBorrowed,
|
||||
ServoStyleContextBorrowed,
|
||||
property:
|
||||
nsCSSPropertyID)
|
||||
-> RawServoAnimationValueStrong;
|
||||
|
@ -2336,7 +2342,7 @@ extern "C" {
|
|||
pub fn Servo_GetAnimationValues(declarations:
|
||||
RawServoDeclarationBlockBorrowed,
|
||||
element: RawGeckoElementBorrowed,
|
||||
style: ServoComputedValuesBorrowed,
|
||||
style: ServoStyleContextBorrowed,
|
||||
style_set: RawServoStyleSetBorrowed,
|
||||
animation_values:
|
||||
RawGeckoServoAnimationValueListBorrowedMut);
|
||||
|
@ -2419,7 +2425,7 @@ extern "C" {
|
|||
pub fn Servo_AnimationValue_Compute(element: RawGeckoElementBorrowed,
|
||||
declarations:
|
||||
RawServoDeclarationBlockBorrowed,
|
||||
style: ServoComputedValuesBorrowed,
|
||||
style: ServoStyleContextBorrowed,
|
||||
raw_data: RawServoStyleSetBorrowed)
|
||||
-> RawServoAnimationValueStrong;
|
||||
}
|
||||
|
@ -2671,8 +2677,6 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
||||
ServoStyleContextBorrowedOrNull,
|
||||
pseudo_type:
|
||||
CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom,
|
||||
set:
|
||||
RawServoStyleSetBorrowed)
|
||||
|
@ -2680,7 +2684,6 @@ extern "C" {
|
|||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_Inherit(set: RawServoStyleSetBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom,
|
||||
parent_style:
|
||||
ServoStyleContextBorrowedOrNull,
|
||||
|
@ -2705,16 +2708,6 @@ extern "C" {
|
|||
rules:
|
||||
RawGeckoServoStyleRuleListBorrowedMut);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleContext_NewContext(values: ServoComputedValuesBorrowed,
|
||||
parent:
|
||||
ServoStyleContextBorrowedOrNull,
|
||||
pres_context:
|
||||
RawGeckoPresContextBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom)
|
||||
-> ServoStyleContextStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_Initialize(dummy_url_data: *mut RawGeckoURLExtraData);
|
||||
}
|
||||
|
@ -2740,10 +2733,8 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Servo_ResolvePseudoStyle(element: RawGeckoElementBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom, is_probe: bool,
|
||||
is_probe: bool,
|
||||
inherited_style:
|
||||
ServoComputedValuesBorrowedOrNull,
|
||||
parent_style_context:
|
||||
ServoStyleContextBorrowedOrNull,
|
||||
set: RawServoStyleSetBorrowed)
|
||||
-> ServoStyleContextStrong;
|
||||
|
@ -2760,9 +2751,6 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom,
|
||||
parent_style_context:
|
||||
ServoStyleContextBorrowedOrNull,
|
||||
rule_inclusion: StyleRuleInclusion,
|
||||
snapshots:
|
||||
*const ServoElementSnapshotTable,
|
||||
|
|
|
@ -689,10 +689,11 @@ impl PseudoElement {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// Construct a `CSSPseudoElementType` from a pseudo-element
|
||||
#[inline]
|
||||
pub fn pseudo_type(&self) -> CSSPseudoElementType {
|
||||
use gecko_bindings::structs::CSSPseudoElementType_InheritingAnonBox;
|
||||
|
||||
match *self {
|
||||
PseudoElement::After => CSSPseudoElementType::after,
|
||||
PseudoElement::Before => CSSPseudoElementType::before,
|
||||
|
@ -719,7 +720,64 @@ impl PseudoElement {
|
|||
PseudoElement::MozPlaceholder => CSSPseudoElementType::mozPlaceholder,
|
||||
PseudoElement::Placeholder => CSSPseudoElementType::placeholder,
|
||||
PseudoElement::MozColorSwatch => CSSPseudoElementType::mozColorSwatch,
|
||||
_ => CSSPseudoElementType::NotPseudo
|
||||
PseudoElement::MozText => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::OofPlaceholder => CSSPseudoElementType::NonInheritingAnonBox,
|
||||
PseudoElement::FirstLetterContinuation => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozBlockInsideInlineWrapper => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozMathMLAnonymousBlock => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozXULAnonymousBlock => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::HorizontalFramesetBorder => CSSPseudoElementType::NonInheritingAnonBox,
|
||||
PseudoElement::VerticalFramesetBorder => CSSPseudoElementType::NonInheritingAnonBox,
|
||||
PseudoElement::MozLineFrame => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::ButtonContent => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::CellContent => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::DropDownList => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::FieldsetContent => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::FramesetBlank => CSSPseudoElementType::NonInheritingAnonBox,
|
||||
PseudoElement::MozDisplayComboboxControlFrame => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::HtmlCanvasContent => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::InlineTable => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::Table => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::TableCell => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::TableColGroup => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::TableCol => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::TableWrapper => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::TableRowGroup => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::TableRow => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::Canvas => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::PageBreak => CSSPseudoElementType::NonInheritingAnonBox,
|
||||
PseudoElement::Page => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::PageContent => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::PageSequence => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::ScrolledContent => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::ScrolledCanvas => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::ScrolledPageSequence => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::ColumnContent => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::Viewport => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::ViewportScroll => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::AnonymousFlexItem => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::AnonymousGridItem => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::Ruby => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::RubyBase => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::RubyBaseContainer => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::RubyText => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::RubyTextContainer => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeColumn(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeRow(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeSeparator(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeCell(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeIndentation(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeLine(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeTwisty(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeImage(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeCellText(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeCheckbox(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeProgressmeter(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozTreeDropFeedback(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozSVGMarkerAnonChild => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozSVGOuterSVGAnonChild => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozSVGForeignContent => CSSPseudoElementType_InheritingAnonBox,
|
||||
PseudoElement::MozSVGText => CSSPseudoElementType_InheritingAnonBox,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,6 +786,237 @@ impl PseudoElement {
|
|||
(self.atom().as_ptr(), self.pseudo_type())
|
||||
}
|
||||
|
||||
/// Construct a pseudo-element from an `Atom`.
|
||||
#[inline]
|
||||
pub fn from_atom(atom: &Atom) -> Option<Self> {
|
||||
if atom == &atom!(":after") {
|
||||
return Some(PseudoElement::After);
|
||||
}
|
||||
if atom == &atom!(":before") {
|
||||
return Some(PseudoElement::Before);
|
||||
}
|
||||
if atom == &atom!(":backdrop") {
|
||||
return Some(PseudoElement::Backdrop);
|
||||
}
|
||||
if atom == &atom!(":cue") {
|
||||
return Some(PseudoElement::Cue);
|
||||
}
|
||||
if atom == &atom!(":first-letter") {
|
||||
return Some(PseudoElement::FirstLetter);
|
||||
}
|
||||
if atom == &atom!(":first-line") {
|
||||
return Some(PseudoElement::FirstLine);
|
||||
}
|
||||
if atom == &atom!(":-moz-selection") {
|
||||
return Some(PseudoElement::MozSelection);
|
||||
}
|
||||
if atom == &atom!(":-moz-focus-inner") {
|
||||
return Some(PseudoElement::MozFocusInner);
|
||||
}
|
||||
if atom == &atom!(":-moz-focus-outer") {
|
||||
return Some(PseudoElement::MozFocusOuter);
|
||||
}
|
||||
if atom == &atom!(":-moz-list-bullet") {
|
||||
return Some(PseudoElement::MozListBullet);
|
||||
}
|
||||
if atom == &atom!(":-moz-list-number") {
|
||||
return Some(PseudoElement::MozListNumber);
|
||||
}
|
||||
if atom == &atom!(":-moz-math-anonymous") {
|
||||
return Some(PseudoElement::MozMathAnonymous);
|
||||
}
|
||||
if atom == &atom!(":-moz-number-wrapper") {
|
||||
return Some(PseudoElement::MozNumberWrapper);
|
||||
}
|
||||
if atom == &atom!(":-moz-number-text") {
|
||||
return Some(PseudoElement::MozNumberText);
|
||||
}
|
||||
if atom == &atom!(":-moz-number-spin-box") {
|
||||
return Some(PseudoElement::MozNumberSpinBox);
|
||||
}
|
||||
if atom == &atom!(":-moz-number-spin-up") {
|
||||
return Some(PseudoElement::MozNumberSpinUp);
|
||||
}
|
||||
if atom == &atom!(":-moz-number-spin-down") {
|
||||
return Some(PseudoElement::MozNumberSpinDown);
|
||||
}
|
||||
if atom == &atom!(":-moz-progress-bar") {
|
||||
return Some(PseudoElement::MozProgressBar);
|
||||
}
|
||||
if atom == &atom!(":-moz-range-track") {
|
||||
return Some(PseudoElement::MozRangeTrack);
|
||||
}
|
||||
if atom == &atom!(":-moz-range-progress") {
|
||||
return Some(PseudoElement::MozRangeProgress);
|
||||
}
|
||||
if atom == &atom!(":-moz-range-thumb") {
|
||||
return Some(PseudoElement::MozRangeThumb);
|
||||
}
|
||||
if atom == &atom!(":-moz-meter-bar") {
|
||||
return Some(PseudoElement::MozMeterBar);
|
||||
}
|
||||
if atom == &atom!(":-moz-placeholder") {
|
||||
return Some(PseudoElement::MozPlaceholder);
|
||||
}
|
||||
if atom == &atom!(":placeholder") {
|
||||
return Some(PseudoElement::Placeholder);
|
||||
}
|
||||
if atom == &atom!(":-moz-color-swatch") {
|
||||
return Some(PseudoElement::MozColorSwatch);
|
||||
}
|
||||
if atom == &atom!(":-moz-text") {
|
||||
return Some(PseudoElement::MozText);
|
||||
}
|
||||
if atom == &atom!(":-moz-oof-placeholder") {
|
||||
return Some(PseudoElement::OofPlaceholder);
|
||||
}
|
||||
if atom == &atom!(":-moz-first-letter-continuation") {
|
||||
return Some(PseudoElement::FirstLetterContinuation);
|
||||
}
|
||||
if atom == &atom!(":-moz-block-inside-inline-wrapper") {
|
||||
return Some(PseudoElement::MozBlockInsideInlineWrapper);
|
||||
}
|
||||
if atom == &atom!(":-moz-mathml-anonymous-block") {
|
||||
return Some(PseudoElement::MozMathMLAnonymousBlock);
|
||||
}
|
||||
if atom == &atom!(":-moz-xul-anonymous-block") {
|
||||
return Some(PseudoElement::MozXULAnonymousBlock);
|
||||
}
|
||||
if atom == &atom!(":-moz-hframeset-border") {
|
||||
return Some(PseudoElement::HorizontalFramesetBorder);
|
||||
}
|
||||
if atom == &atom!(":-moz-vframeset-border") {
|
||||
return Some(PseudoElement::VerticalFramesetBorder);
|
||||
}
|
||||
if atom == &atom!(":-moz-line-frame") {
|
||||
return Some(PseudoElement::MozLineFrame);
|
||||
}
|
||||
if atom == &atom!(":-moz-button-content") {
|
||||
return Some(PseudoElement::ButtonContent);
|
||||
}
|
||||
if atom == &atom!(":-moz-cell-content") {
|
||||
return Some(PseudoElement::CellContent);
|
||||
}
|
||||
if atom == &atom!(":-moz-dropdown-list") {
|
||||
return Some(PseudoElement::DropDownList);
|
||||
}
|
||||
if atom == &atom!(":-moz-fieldset-content") {
|
||||
return Some(PseudoElement::FieldsetContent);
|
||||
}
|
||||
if atom == &atom!(":-moz-frameset-blank") {
|
||||
return Some(PseudoElement::FramesetBlank);
|
||||
}
|
||||
if atom == &atom!(":-moz-display-comboboxcontrol-frame") {
|
||||
return Some(PseudoElement::MozDisplayComboboxControlFrame);
|
||||
}
|
||||
if atom == &atom!(":-moz-html-canvas-content") {
|
||||
return Some(PseudoElement::HtmlCanvasContent);
|
||||
}
|
||||
if atom == &atom!(":-moz-inline-table") {
|
||||
return Some(PseudoElement::InlineTable);
|
||||
}
|
||||
if atom == &atom!(":-moz-table") {
|
||||
return Some(PseudoElement::Table);
|
||||
}
|
||||
if atom == &atom!(":-moz-table-cell") {
|
||||
return Some(PseudoElement::TableCell);
|
||||
}
|
||||
if atom == &atom!(":-moz-table-column-group") {
|
||||
return Some(PseudoElement::TableColGroup);
|
||||
}
|
||||
if atom == &atom!(":-moz-table-column") {
|
||||
return Some(PseudoElement::TableCol);
|
||||
}
|
||||
if atom == &atom!(":-moz-table-wrapper") {
|
||||
return Some(PseudoElement::TableWrapper);
|
||||
}
|
||||
if atom == &atom!(":-moz-table-row-group") {
|
||||
return Some(PseudoElement::TableRowGroup);
|
||||
}
|
||||
if atom == &atom!(":-moz-table-row") {
|
||||
return Some(PseudoElement::TableRow);
|
||||
}
|
||||
if atom == &atom!(":-moz-canvas") {
|
||||
return Some(PseudoElement::Canvas);
|
||||
}
|
||||
if atom == &atom!(":-moz-pagebreak") {
|
||||
return Some(PseudoElement::PageBreak);
|
||||
}
|
||||
if atom == &atom!(":-moz-page") {
|
||||
return Some(PseudoElement::Page);
|
||||
}
|
||||
if atom == &atom!(":-moz-pagecontent") {
|
||||
return Some(PseudoElement::PageContent);
|
||||
}
|
||||
if atom == &atom!(":-moz-page-sequence") {
|
||||
return Some(PseudoElement::PageSequence);
|
||||
}
|
||||
if atom == &atom!(":-moz-scrolled-content") {
|
||||
return Some(PseudoElement::ScrolledContent);
|
||||
}
|
||||
if atom == &atom!(":-moz-scrolled-canvas") {
|
||||
return Some(PseudoElement::ScrolledCanvas);
|
||||
}
|
||||
if atom == &atom!(":-moz-scrolled-page-sequence") {
|
||||
return Some(PseudoElement::ScrolledPageSequence);
|
||||
}
|
||||
if atom == &atom!(":-moz-column-content") {
|
||||
return Some(PseudoElement::ColumnContent);
|
||||
}
|
||||
if atom == &atom!(":-moz-viewport") {
|
||||
return Some(PseudoElement::Viewport);
|
||||
}
|
||||
if atom == &atom!(":-moz-viewport-scroll") {
|
||||
return Some(PseudoElement::ViewportScroll);
|
||||
}
|
||||
if atom == &atom!(":-moz-anonymous-flex-item") {
|
||||
return Some(PseudoElement::AnonymousFlexItem);
|
||||
}
|
||||
if atom == &atom!(":-moz-anonymous-grid-item") {
|
||||
return Some(PseudoElement::AnonymousGridItem);
|
||||
}
|
||||
if atom == &atom!(":-moz-ruby") {
|
||||
return Some(PseudoElement::Ruby);
|
||||
}
|
||||
if atom == &atom!(":-moz-ruby-base") {
|
||||
return Some(PseudoElement::RubyBase);
|
||||
}
|
||||
if atom == &atom!(":-moz-ruby-base-container") {
|
||||
return Some(PseudoElement::RubyBaseContainer);
|
||||
}
|
||||
if atom == &atom!(":-moz-ruby-text") {
|
||||
return Some(PseudoElement::RubyText);
|
||||
}
|
||||
if atom == &atom!(":-moz-ruby-text-container") {
|
||||
return Some(PseudoElement::RubyTextContainer);
|
||||
}
|
||||
// We cannot generate PseudoElement::MozTreeColumn(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeRow(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeSeparator(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeCell(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeIndentation(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeLine(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeTwisty(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeImage(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeCellText(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeCheckbox(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeProgressmeter(..) from just an atom.
|
||||
// We cannot generate PseudoElement::MozTreeDropFeedback(..) from just an atom.
|
||||
if atom == &atom!(":-moz-svg-marker-anon-child") {
|
||||
return Some(PseudoElement::MozSVGMarkerAnonChild);
|
||||
}
|
||||
if atom == &atom!(":-moz-svg-outer-svg-anon-child") {
|
||||
return Some(PseudoElement::MozSVGOuterSVGAnonChild);
|
||||
}
|
||||
if atom == &atom!(":-moz-svg-foreign-content") {
|
||||
return Some(PseudoElement::MozSVGForeignContent);
|
||||
}
|
||||
if atom == &atom!(":-moz-svg-text") {
|
||||
return Some(PseudoElement::MozSVGText);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Construct a pseudo-element from an anonymous box `Atom`.
|
||||
#[inline]
|
||||
pub fn from_anon_box_atom(atom: &Atom) -> Option<Self> {
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -17,9 +17,10 @@ use gecko_bindings::structs::{nsMediaFeature_ValueType, nsMediaFeature_RangeType
|
|||
use gecko_bindings::structs::{nsPresContext, RawGeckoPresContextOwned};
|
||||
use media_queries::MediaType;
|
||||
use parser::ParserContext;
|
||||
use properties::{ComputedValuesInner, StyleBuilder};
|
||||
use properties::{ComputedValues, StyleBuilder};
|
||||
use properties::longhands::font_size;
|
||||
use selectors::parser::SelectorParseError;
|
||||
use servo_arc::Arc;
|
||||
use std::fmt::{self, Write};
|
||||
use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
|
||||
use str::starts_with_ignore_ascii_case;
|
||||
|
@ -36,7 +37,7 @@ pub struct Device {
|
|||
/// stylist, and thus the `Device`, so having a raw pres context pointer
|
||||
/// here is fine.
|
||||
pres_context: RawGeckoPresContextOwned,
|
||||
default_values: ComputedValuesInner,
|
||||
default_values: Arc<ComputedValues>,
|
||||
viewport_override: Option<ViewportConstraints>,
|
||||
/// The font size of the root element
|
||||
/// This is set when computing the style of the root
|
||||
|
@ -61,7 +62,7 @@ impl Device {
|
|||
assert!(!pres_context.is_null());
|
||||
Device {
|
||||
pres_context: pres_context,
|
||||
default_values: ComputedValuesInner::default_values(unsafe { &*pres_context }),
|
||||
default_values: ComputedValues::default_values(unsafe { &*pres_context }),
|
||||
viewport_override: None,
|
||||
root_font_size: AtomicIsize::new(font_size::get_initial_value().0 as isize), // FIXME(bz): Seems dubious?
|
||||
used_root_font_size: AtomicBool::new(false),
|
||||
|
@ -77,7 +78,12 @@ impl Device {
|
|||
|
||||
/// Returns the default computed values as a reference, in order to match
|
||||
/// Servo.
|
||||
pub fn default_computed_values(&self) -> &ComputedValuesInner {
|
||||
pub fn default_computed_values(&self) -> &ComputedValues {
|
||||
&self.default_values
|
||||
}
|
||||
|
||||
/// Returns the default computed values as an `Arc`.
|
||||
pub fn default_computed_values_arc(&self) -> &Arc<ComputedValues> {
|
||||
&self.default_values
|
||||
}
|
||||
|
||||
|
@ -101,7 +107,7 @@ impl Device {
|
|||
pub fn reset_computed_values(&mut self) {
|
||||
// NB: A following stylesheet flush will populate this if appropriate.
|
||||
self.viewport_override = None;
|
||||
self.default_values = ComputedValuesInner::default_values(self.pres_context());
|
||||
self.default_values = ComputedValues::default_values(self.pres_context());
|
||||
self.used_root_font_size.store(false, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
|
@ -620,8 +626,7 @@ impl Expression {
|
|||
is_root_element: false,
|
||||
device: device,
|
||||
inherited_style: default_values,
|
||||
layout_parent_style: default_values,
|
||||
style: StyleBuilder::for_derived_style(default_values),
|
||||
style: StyleBuilder::for_derived_style(device, default_values, None),
|
||||
font_metrics_provider: &provider,
|
||||
cached_system_font: None,
|
||||
in_media_query: true,
|
||||
|
|
|
@ -107,17 +107,23 @@ impl PseudoElement {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// Construct a `CSSPseudoElementType` from a pseudo-element
|
||||
#[inline]
|
||||
pub fn pseudo_type(&self) -> CSSPseudoElementType {
|
||||
use gecko_bindings::structs::CSSPseudoElementType_InheritingAnonBox;
|
||||
|
||||
match *self {
|
||||
% for pseudo in PSEUDOS:
|
||||
% if not pseudo.is_anon_box():
|
||||
PseudoElement::${pseudo.capitalized()} => CSSPseudoElementType::${pseudo.original_ident},
|
||||
% elif pseudo.is_tree_pseudo_element():
|
||||
PseudoElement::${pseudo.capitalized()}(..) => CSSPseudoElementType_InheritingAnonBox,
|
||||
% elif pseudo.is_inheriting_anon_box():
|
||||
PseudoElement::${pseudo.capitalized()} => CSSPseudoElementType_InheritingAnonBox,
|
||||
% else:
|
||||
PseudoElement::${pseudo.capitalized()} => CSSPseudoElementType::NonInheritingAnonBox,
|
||||
% endif
|
||||
% endfor
|
||||
_ => CSSPseudoElementType::NotPseudo
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,6 +132,21 @@ impl PseudoElement {
|
|||
(self.atom().as_ptr(), self.pseudo_type())
|
||||
}
|
||||
|
||||
/// Construct a pseudo-element from an `Atom`.
|
||||
#[inline]
|
||||
pub fn from_atom(atom: &Atom) -> Option<Self> {
|
||||
% for pseudo in PSEUDOS:
|
||||
% if pseudo.is_tree_pseudo_element():
|
||||
// We cannot generate ${pseudo_element_variant(pseudo)} from just an atom.
|
||||
% else:
|
||||
if atom == &atom!("${pseudo.value}") {
|
||||
return Some(${pseudo_element_variant(pseudo)});
|
||||
}
|
||||
% endif
|
||||
% endfor
|
||||
None
|
||||
}
|
||||
|
||||
/// Construct a pseudo-element from an anonymous box `Atom`.
|
||||
#[inline]
|
||||
pub fn from_anon_box_atom(atom: &Atom) -> Option<Self> {
|
||||
|
|
|
@ -39,14 +39,14 @@ def msvc32_symbolify(source, ident):
|
|||
|
||||
|
||||
class GkAtomSource:
|
||||
PATTERN = re.compile('^GK_ATOM\((.+),\s*"(.*)"\)')
|
||||
PATTERN = re.compile('^(GK_ATOM)\((.+),\s*"(.*)"\)')
|
||||
FILE = "include/nsGkAtomList.h"
|
||||
CLASS = "nsGkAtoms"
|
||||
TYPE = "nsIAtom"
|
||||
|
||||
|
||||
class CSSPseudoElementsAtomSource:
|
||||
PATTERN = re.compile('^CSS_PSEUDO_ELEMENT\((.+),\s*"(.*)",')
|
||||
PATTERN = re.compile('^(CSS_PSEUDO_ELEMENT)\((.+),\s*"(.*)",')
|
||||
FILE = "include/nsCSSPseudoElementList.h"
|
||||
CLASS = "nsCSSPseudoElements"
|
||||
# NB: nsICSSPseudoElement is effectively the same as a nsIAtom, but we need
|
||||
|
@ -55,7 +55,7 @@ class CSSPseudoElementsAtomSource:
|
|||
|
||||
|
||||
class CSSAnonBoxesAtomSource:
|
||||
PATTERN = re.compile('^(?:CSS_ANON_BOX|CSS_NON_INHERITING_ANON_BOX)\((.+),\s*"(.*)"\)')
|
||||
PATTERN = re.compile('^(CSS_ANON_BOX|CSS_NON_INHERITING_ANON_BOX)\((.+),\s*"(.*)"\)')
|
||||
FILE = "include/nsCSSAnonBoxList.h"
|
||||
CLASS = "nsCSSAnonBoxes"
|
||||
TYPE = "nsICSSAnonBoxPseudo"
|
||||
|
@ -76,11 +76,14 @@ def map_atom(ident):
|
|||
|
||||
|
||||
class Atom:
|
||||
def __init__(self, source, ident, value):
|
||||
def __init__(self, source, macro_name, ident, value):
|
||||
self.ident = "{}_{}".format(source.CLASS, ident)
|
||||
self.original_ident = ident
|
||||
self.value = value
|
||||
self.source = source
|
||||
self.macro = macro_name
|
||||
if self.is_anon_box():
|
||||
assert self.is_inheriting_anon_box() or self.is_non_inheriting_anon_box()
|
||||
|
||||
def cpp_class(self):
|
||||
return self.source.CLASS
|
||||
|
@ -103,6 +106,12 @@ class Atom:
|
|||
def is_anon_box(self):
|
||||
return self.type() == "nsICSSAnonBoxPseudo"
|
||||
|
||||
def is_non_inheriting_anon_box(self):
|
||||
return self.macro == "CSS_NON_INHERITING_ANON_BOX"
|
||||
|
||||
def is_inheriting_anon_box(self):
|
||||
return self.macro == "CSS_ANON_BOX"
|
||||
|
||||
def is_tree_pseudo_element(self):
|
||||
return self.value.startswith(":-moz-tree-")
|
||||
|
||||
|
@ -116,7 +125,7 @@ def collect_atoms(objdir):
|
|||
for line in f.readlines():
|
||||
result = re.match(source.PATTERN, line)
|
||||
if result:
|
||||
atoms.append(Atom(source, result.group(1), result.group(2)))
|
||||
atoms.append(Atom(source, result.group(1), result.group(2), result.group(3)))
|
||||
return atoms
|
||||
|
||||
|
||||
|
|
|
@ -110,13 +110,13 @@ impl<'a> Iterator for PropertyDeclarationIterator<'a> {
|
|||
pub struct AnimationValueIterator<'a, 'cx, 'cx_a:'cx> {
|
||||
iter: Iter<'a, (PropertyDeclaration, Importance)>,
|
||||
context: &'cx mut Context<'cx_a>,
|
||||
default_values: &'a ComputedValuesInner,
|
||||
default_values: &'a ComputedValues,
|
||||
}
|
||||
|
||||
impl<'a, 'cx, 'cx_a:'cx> AnimationValueIterator<'a, 'cx, 'cx_a> {
|
||||
fn new(declarations: &'a PropertyDeclarationBlock,
|
||||
context: &'cx mut Context<'cx_a>,
|
||||
default_values: &'a ComputedValuesInner) -> AnimationValueIterator<'a, 'cx, 'cx_a> {
|
||||
default_values: &'a ComputedValues) -> AnimationValueIterator<'a, 'cx, 'cx_a> {
|
||||
AnimationValueIterator {
|
||||
iter: declarations.declarations().iter(),
|
||||
context: context,
|
||||
|
@ -204,7 +204,7 @@ impl PropertyDeclarationBlock {
|
|||
/// Return an iterator of (AnimatableLonghand, AnimationValue).
|
||||
pub fn to_animation_value_iter<'a, 'cx, 'cx_a:'cx>(&'a self,
|
||||
context: &'cx mut Context<'cx_a>,
|
||||
default_values: &'a ComputedValuesInner)
|
||||
default_values: &'a ComputedValues)
|
||||
-> AnimationValueIterator<'a, 'cx, 'cx_a> {
|
||||
AnimationValueIterator::new(self, context, default_values)
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ use properties::computed_value_flags::ComputedValueFlags;
|
|||
use properties::{longhands, FontComputationData, Importance, LonghandId};
|
||||
use properties::{PropertyDeclaration, PropertyDeclarationBlock, PropertyDeclarationId};
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::PseudoElement;
|
||||
use std::mem::{forget, uninitialized, transmute, zeroed};
|
||||
use std::{cmp, ops, ptr};
|
||||
use stylearc::{Arc, RawOffsetArc};
|
||||
|
@ -72,13 +73,72 @@ pub mod style_structs {
|
|||
% endfor
|
||||
}
|
||||
|
||||
|
||||
/// FIXME(emilio): This is completely duplicated with the other properties code.
|
||||
pub type ComputedValuesInner = ::gecko_bindings::structs::ServoComputedValues;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[repr(C)]
|
||||
pub struct ComputedValues(::gecko_bindings::structs::mozilla::ServoStyleContext);
|
||||
|
||||
impl ComputedValues {
|
||||
pub fn new(
|
||||
device: &Device,
|
||||
parent: Option<<&ComputedValues>,
|
||||
pseudo: Option<<&PseudoElement>,
|
||||
custom_properties: Option<Arc<CustomPropertiesMap>>,
|
||||
writing_mode: WritingMode,
|
||||
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
|
||||
flags: ComputedValueFlags,
|
||||
rules: Option<StrongRuleNode>,
|
||||
visited_style: Option<Arc<ComputedValues>>,
|
||||
% for style_struct in data.style_structs:
|
||||
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
|
||||
% endfor
|
||||
) -> Arc<Self> {
|
||||
ComputedValuesInner::new(
|
||||
custom_properties,
|
||||
writing_mode,
|
||||
font_size_keyword,
|
||||
flags,
|
||||
rules,
|
||||
visited_style,
|
||||
% for style_struct in data.style_structs:
|
||||
${style_struct.ident},
|
||||
% endfor
|
||||
).to_outer(
|
||||
device.pres_context(),
|
||||
parent,
|
||||
pseudo.map(|p| p.pseudo_info())
|
||||
)
|
||||
}
|
||||
|
||||
pub fn default_values(pres_context: RawGeckoPresContextBorrowed) -> Arc<Self> {
|
||||
ComputedValuesInner::new(
|
||||
/* custom_properties = */ None,
|
||||
/* writing_mode = */ WritingMode::empty(), // FIXME(bz): This seems dubious
|
||||
FontComputationData::default_font_size_keyword(),
|
||||
ComputedValueFlags::empty(),
|
||||
/* rules = */ None,
|
||||
/* visited_style = */ None,
|
||||
% for style_struct in data.style_structs:
|
||||
style_structs::${style_struct.name}::default(pres_context),
|
||||
% endfor
|
||||
).to_outer(pres_context, None, None)
|
||||
}
|
||||
|
||||
pub fn pseudo(&self) -> Option<PseudoElement> {
|
||||
use string_cache::Atom;
|
||||
|
||||
let atom = (self.0)._base.mPseudoTag.raw::<structs::nsIAtom>();
|
||||
if atom.is_null() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let atom = Atom::from(atom);
|
||||
PseudoElement::from_atom(&atom)
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for ComputedValues {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
|
@ -112,8 +172,8 @@ impl Clone for ComputedValuesInner {
|
|||
}
|
||||
}
|
||||
|
||||
pub type PseudoInfo = (*mut structs::nsIAtom, structs::CSSPseudoElementType);
|
||||
pub type ParentStyleContextInfo<'a> = Option< &'a ComputedValues>;
|
||||
type PseudoInfo = (*mut structs::nsIAtom, structs::CSSPseudoElementType);
|
||||
type ParentStyleContextInfo<'a> = Option< &'a ComputedValues>;
|
||||
|
||||
impl ComputedValuesInner {
|
||||
pub fn new(custom_properties: Option<Arc<CustomPropertiesMap>>,
|
||||
|
@ -139,36 +199,28 @@ impl ComputedValuesInner {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn default_values(pres_context: RawGeckoPresContextBorrowed) -> Self {
|
||||
ComputedValuesInner {
|
||||
custom_properties: None,
|
||||
writing_mode: WritingMode::empty(), // FIXME(bz): This seems dubious
|
||||
font_computation_data: FontComputationData::default_values(),
|
||||
rules: None,
|
||||
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)
|
||||
),
|
||||
% endfor
|
||||
}
|
||||
}
|
||||
pub fn to_outer(self, device: &Device, parent: ParentStyleContextInfo,
|
||||
info: Option<PseudoInfo>) -> Arc<ComputedValues> {
|
||||
fn to_outer(
|
||||
self,
|
||||
pres_context: RawGeckoPresContextBorrowed,
|
||||
parent: ParentStyleContextInfo,
|
||||
info: Option<PseudoInfo>
|
||||
) -> Arc<ComputedValues> {
|
||||
let (tag, ty) = if let Some(info) = info {
|
||||
info
|
||||
} else {
|
||||
(ptr::null_mut(), structs::CSSPseudoElementType::NotPseudo)
|
||||
};
|
||||
|
||||
unsafe { self.to_outer_helper(device.pres_context(), parent, ty, tag) }
|
||||
unsafe { self.to_outer_helper(pres_context, parent, ty, tag) }
|
||||
}
|
||||
|
||||
pub unsafe fn to_outer_helper(self, pres_context: bindings::RawGeckoPresContextBorrowed,
|
||||
parent: ParentStyleContextInfo,
|
||||
pseudo_ty: structs::CSSPseudoElementType,
|
||||
pseudo_tag: *mut structs::nsIAtom) -> Arc<ComputedValues> {
|
||||
unsafe fn to_outer_helper(
|
||||
self,
|
||||
pres_context: bindings::RawGeckoPresContextBorrowed,
|
||||
parent: ParentStyleContextInfo,
|
||||
pseudo_ty: structs::CSSPseudoElementType,
|
||||
pseudo_tag: *mut structs::nsIAtom
|
||||
) -> Arc<ComputedValues> {
|
||||
let arc = unsafe {
|
||||
let arc: Arc<ComputedValues> = Arc::new(uninitialized());
|
||||
bindings::Gecko_ServoStyleContext_Init(&arc.0 as *const _ as *mut _, parent, pres_context,
|
||||
|
|
|
@ -292,7 +292,7 @@
|
|||
#[allow(unused_imports)]
|
||||
use properties::{DeclaredValue, LonghandId, LonghandIdSet};
|
||||
#[allow(unused_imports)]
|
||||
use properties::{CSSWideKeyword, ComputedValuesInner, PropertyDeclaration};
|
||||
use properties::{CSSWideKeyword, ComputedValues, PropertyDeclaration};
|
||||
#[allow(unused_imports)]
|
||||
use properties::style_structs;
|
||||
#[allow(unused_imports)]
|
||||
|
@ -310,8 +310,8 @@
|
|||
${caller.body()}
|
||||
#[allow(unused_variables)]
|
||||
pub fn cascade_property(declaration: &PropertyDeclaration,
|
||||
inherited_style: &ComputedValuesInner,
|
||||
default_style: &ComputedValuesInner,
|
||||
inherited_style: &ComputedValues,
|
||||
default_style: &ComputedValues,
|
||||
context: &mut computed::Context,
|
||||
cacheable: &mut bool,
|
||||
cascade_info: &mut Option<<&mut CascadeInfo>) {
|
||||
|
|
|
@ -29,7 +29,7 @@ use smallvec::SmallVec;
|
|||
use std::cmp;
|
||||
#[cfg(feature = "gecko")] use fnv::FnvHashMap;
|
||||
use style_traits::ParseError;
|
||||
use super::ComputedValuesInner;
|
||||
use super::ComputedValues;
|
||||
#[cfg(any(feature = "gecko", feature = "testing"))]
|
||||
use values::Auto;
|
||||
use values::{CSSFloat, CustomIdent, Either};
|
||||
|
@ -394,7 +394,7 @@ impl AnimatedProperty {
|
|||
|
||||
/// Update `style` with the proper computed style corresponding to this
|
||||
/// animation at `progress`.
|
||||
pub fn update(&self, style: &mut ComputedValuesInner, progress: f64) {
|
||||
pub fn update(&self, style: &mut ComputedValues, progress: f64) {
|
||||
match *self {
|
||||
% for prop in data.longhands:
|
||||
% if prop.animatable:
|
||||
|
@ -427,8 +427,8 @@ impl AnimatedProperty {
|
|||
/// Get an animatable value from a transition-property, an old style, and a
|
||||
/// new style.
|
||||
pub fn from_animatable_longhand(property: &AnimatableLonghand,
|
||||
old_style: &ComputedValuesInner,
|
||||
new_style: &ComputedValuesInner)
|
||||
old_style: &ComputedValues,
|
||||
new_style: &ComputedValues)
|
||||
-> AnimatedProperty {
|
||||
match *property {
|
||||
% for prop in data.longhands:
|
||||
|
@ -521,7 +521,7 @@ impl AnimationValue {
|
|||
|
||||
/// Construct an AnimationValue from a property declaration
|
||||
pub fn from_declaration(decl: &PropertyDeclaration, context: &mut Context,
|
||||
initial: &ComputedValuesInner) -> Option<Self> {
|
||||
initial: &ComputedValues) -> Option<Self> {
|
||||
use properties::LonghandId;
|
||||
|
||||
match *decl {
|
||||
|
@ -593,7 +593,7 @@ impl AnimationValue {
|
|||
|
||||
/// Get an AnimationValue for an AnimatableLonghand from a given computed values.
|
||||
pub fn from_computed_values(property: &AnimatableLonghand,
|
||||
computed_values: &ComputedValuesInner)
|
||||
computed_values: &ComputedValues)
|
||||
-> Self {
|
||||
match *property {
|
||||
% for prop in data.longhands:
|
||||
|
|
|
@ -181,7 +181,7 @@
|
|||
|
||||
% if product == "servo":
|
||||
fn cascade_property_custom(_declaration: &PropertyDeclaration,
|
||||
_inherited_style: &ComputedValuesInner,
|
||||
_inherited_style: &ComputedValues,
|
||||
context: &mut computed::Context,
|
||||
_cacheable: &mut bool) {
|
||||
longhands::_servo_display_for_hypothetical_box::derive_from_display(context);
|
||||
|
|
|
@ -249,7 +249,7 @@ ${helpers.single_keyword("unicode-bidi",
|
|||
|
||||
% if product == "servo":
|
||||
fn cascade_property_custom(_declaration: &PropertyDeclaration,
|
||||
_inherited_style: &ComputedValuesInner,
|
||||
_inherited_style: &ComputedValues,
|
||||
context: &mut computed::Context,
|
||||
_cacheable: &mut bool) {
|
||||
longhands::_servo_text_decorations_in_effect::derive_from_text_decoration(context);
|
||||
|
|
|
@ -32,6 +32,7 @@ use media_queries::Device;
|
|||
use parser::{Parse, ParserContext};
|
||||
use properties::animated_properties::AnimatableLonghand;
|
||||
#[cfg(feature = "gecko")] use properties::longhands::system_font::SystemFont;
|
||||
use selector_parser::PseudoElement;
|
||||
use selectors::parser::SelectorParseError;
|
||||
#[cfg(feature = "servo")] use servo_config::prefs::PREFS;
|
||||
use shared_lock::StylesheetGuards;
|
||||
|
@ -107,22 +108,26 @@ pub struct FontComputationData {
|
|||
///
|
||||
/// When this is Some, we compute font sizes by computing the keyword against
|
||||
/// the generic font, and then multiplying it by the ratio.
|
||||
pub font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>
|
||||
pub font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>
|
||||
}
|
||||
|
||||
|
||||
impl FontComputationData {
|
||||
/// Assigns values for variables in struct FontComputationData
|
||||
/// Assigns values for variables in struct FontComputationData
|
||||
pub fn new(font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>) -> Self {
|
||||
FontComputationData {
|
||||
font_size_keyword: font_size_keyword
|
||||
}
|
||||
}
|
||||
/// Assigns default values for variables in struct FontComputationData
|
||||
pub fn default_values() -> Self {
|
||||
FontComputationData{
|
||||
font_size_keyword: Some((Default::default(), 1.))
|
||||
}
|
||||
|
||||
/// Assigns default values for variables in struct FontComputationData
|
||||
pub fn default_font_size_keyword() -> Option<(longhands::font_size::KeywordSize, f32)> {
|
||||
Some((Default::default(), 1.))
|
||||
}
|
||||
|
||||
/// Gets a FontComputationData with the default values.
|
||||
pub fn default_values() -> Self {
|
||||
Self::new(Self::default_font_size_keyword())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1871,15 +1876,7 @@ pub mod style_structs {
|
|||
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_properties::{ComputedValues, ComputedValuesInner, ParentStyleContextInfo, PseudoInfo};
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
/// Servo doesn't have style contexts so this is extraneous info
|
||||
pub type PseudoInfo = ();
|
||||
#[cfg(feature = "servo")]
|
||||
/// Servo doesn't have style contexts so this is extraneous info
|
||||
pub type ParentStyleContextInfo = ();
|
||||
|
||||
pub use gecko_properties::{ComputedValues, ComputedValuesInner};
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
#[cfg_attr(feature = "servo", derive(Clone, Debug))]
|
||||
|
@ -1891,6 +1888,7 @@ pub struct ComputedValuesInner {
|
|||
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
||||
/// The writing mode of this computed values struct.
|
||||
pub writing_mode: WritingMode,
|
||||
|
||||
/// The keyword behind the current font-size property, if any
|
||||
pub font_computation_data: FontComputationData,
|
||||
|
||||
|
@ -1923,12 +1921,48 @@ pub struct ComputedValues {
|
|||
/// whereas ComputedValuesInner is the core set of computed values.
|
||||
///
|
||||
/// We maintain this distinction in servo to reduce the amount of special casing.
|
||||
pub inner: ComputedValuesInner,
|
||||
inner: ComputedValuesInner,
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
impl ComputedValues {
|
||||
/// Create a new refcounted `ComputedValues`
|
||||
pub fn new(
|
||||
_: &Device,
|
||||
_: Option<<&ComputedValues>,
|
||||
_: Option<<&PseudoElement>,
|
||||
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
||||
writing_mode: WritingMode,
|
||||
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
|
||||
flags: ComputedValueFlags,
|
||||
rules: Option<StrongRuleNode>,
|
||||
visited_style: Option<Arc<ComputedValues>>,
|
||||
% for style_struct in data.active_style_structs():
|
||||
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
|
||||
% endfor
|
||||
) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
inner: ComputedValuesInner::new(
|
||||
custom_properties,
|
||||
writing_mode,
|
||||
font_size_keyword,
|
||||
flags,
|
||||
rules,
|
||||
visited_style,
|
||||
% for style_struct in data.active_style_structs():
|
||||
${style_struct.ident},
|
||||
% endfor
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the initial computed values.
|
||||
pub fn initial_values() -> &'static Self { &*INITIAL_SERVO_VALUES }
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
impl ComputedValuesInner {
|
||||
/// Construct a `ComputedValues` instance.
|
||||
/// Construct a `ComputedValuesInner` instance.
|
||||
pub fn new(
|
||||
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
||||
writing_mode: WritingMode,
|
||||
|
@ -1952,9 +1986,6 @@ impl ComputedValuesInner {
|
|||
% endfor
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the initial computed values.
|
||||
pub fn initial_values() -> &'static Self { &*INITIAL_SERVO_VALUES }
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
|
@ -1974,12 +2005,6 @@ impl ops::DerefMut for ComputedValues {
|
|||
|
||||
#[cfg(feature = "servo")]
|
||||
impl ComputedValuesInner {
|
||||
/// Convert to an Arc<ComputedValues>
|
||||
pub fn to_outer(self, _: &Device, _: ParentStyleContextInfo,
|
||||
_: Option<PseudoInfo>) -> Arc<ComputedValues> {
|
||||
Arc::new(ComputedValues {inner: self})
|
||||
}
|
||||
|
||||
% for style_struct in data.active_style_structs():
|
||||
/// Clone the ${style_struct.name} struct.
|
||||
#[inline]
|
||||
|
@ -2428,6 +2453,9 @@ impl<'a, T: 'a> ops::Deref for StyleStructRef<'a, T> {
|
|||
/// actually cloning them, until we either build the style, or mutate the
|
||||
/// inherited value.
|
||||
pub struct StyleBuilder<'a> {
|
||||
device: &'a Device,
|
||||
parent_style: Option<<&'a ComputedValues>,
|
||||
pseudo: Option<<&'a PseudoElement>,
|
||||
/// The rule node representing the ordered list of rules matched for this
|
||||
/// node.
|
||||
rules: Option<StrongRuleNode>,
|
||||
|
@ -2452,8 +2480,11 @@ pub struct StyleBuilder<'a> {
|
|||
impl<'a> StyleBuilder<'a> {
|
||||
/// Trivially construct a `StyleBuilder`.
|
||||
fn new(
|
||||
inherited_style: &'a ComputedValuesInner,
|
||||
reset_style: &'a ComputedValuesInner,
|
||||
device: &'a Device,
|
||||
parent_style: Option<<&'a ComputedValues>,
|
||||
reset_style: &'a ComputedValues,
|
||||
pseudo: Option<<&'a PseudoElement>,
|
||||
cascade_flags: CascadeFlags,
|
||||
rules: Option<StrongRuleNode>,
|
||||
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
|
||||
writing_mode: WritingMode,
|
||||
|
@ -2461,7 +2492,17 @@ impl<'a> StyleBuilder<'a> {
|
|||
flags: ComputedValueFlags,
|
||||
visited_style: Option<Arc<ComputedValues>>,
|
||||
) -> Self {
|
||||
let inherited_style = parent_style.unwrap_or(reset_style);
|
||||
let reset_style = if cascade_flags.contains(INHERIT_ALL) {
|
||||
inherited_style
|
||||
} else {
|
||||
reset_style
|
||||
};
|
||||
|
||||
StyleBuilder {
|
||||
device,
|
||||
parent_style,
|
||||
pseudo,
|
||||
rules,
|
||||
custom_properties,
|
||||
writing_mode,
|
||||
|
@ -2480,19 +2521,31 @@ impl<'a> StyleBuilder<'a> {
|
|||
|
||||
/// Creates a StyleBuilder holding only references to the structs of `s`, in
|
||||
/// order to create a derived style.
|
||||
pub fn for_derived_style(s: &'a ComputedValuesInner) -> Self {
|
||||
Self::for_inheritance(s, s)
|
||||
pub fn for_derived_style(
|
||||
device: &'a Device,
|
||||
s: &'a ComputedValues,
|
||||
pseudo: Option<<&'a PseudoElement>,
|
||||
) -> Self {
|
||||
Self::for_inheritance(device, s, s, pseudo)
|
||||
}
|
||||
|
||||
/// Inherits style from the parent element, accounting for the default
|
||||
/// computed values that need to be provided as well.
|
||||
pub fn for_inheritance(
|
||||
parent: &'a ComputedValuesInner,
|
||||
default: &'a ComputedValuesInner
|
||||
device: &'a Device,
|
||||
parent: &'a ComputedValues,
|
||||
reset: &'a ComputedValues,
|
||||
pseudo: Option<<&'a PseudoElement>,
|
||||
) -> Self {
|
||||
// FIXME(emilio): This Some(parent) here is inconsistent with what we
|
||||
// usually do if `parent` is the default computed values, but that's
|
||||
// fine, and we want to eventually get rid of it.
|
||||
Self::new(
|
||||
parent,
|
||||
default,
|
||||
device,
|
||||
Some(parent),
|
||||
reset,
|
||||
pseudo,
|
||||
CascadeFlags::empty(),
|
||||
/* rules = */ None,
|
||||
parent.custom_properties(),
|
||||
parent.writing_mode,
|
||||
|
@ -2566,16 +2619,20 @@ impl<'a> StyleBuilder<'a> {
|
|||
|
||||
|
||||
/// Turns this `StyleBuilder` into a proper `ComputedValues` instance.
|
||||
pub fn build(self) -> ComputedValuesInner {
|
||||
ComputedValuesInner::new(self.custom_properties,
|
||||
self.writing_mode,
|
||||
self.font_size_keyword,
|
||||
self.flags,
|
||||
self.rules,
|
||||
self.visited_style,
|
||||
% for style_struct in data.active_style_structs():
|
||||
self.${style_struct.ident}.build(),
|
||||
% endfor
|
||||
pub fn build(self) -> Arc<ComputedValues> {
|
||||
ComputedValues::new(
|
||||
self.device,
|
||||
self.parent_style,
|
||||
self.pseudo,
|
||||
self.custom_properties,
|
||||
self.writing_mode,
|
||||
self.font_size_keyword,
|
||||
self.flags,
|
||||
self.rules,
|
||||
self.visited_style,
|
||||
% for style_struct in data.active_style_structs():
|
||||
self.${style_struct.ident}.build(),
|
||||
% endfor
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -2597,28 +2654,30 @@ pub use self::lazy_static_module::INITIAL_SERVO_VALUES;
|
|||
mod lazy_static_module {
|
||||
use logical_geometry::WritingMode;
|
||||
use stylearc::Arc;
|
||||
use super::{ComputedValuesInner, longhands, style_structs, FontComputationData};
|
||||
use super::{ComputedValues, ComputedValuesInner, longhands, style_structs, FontComputationData};
|
||||
use super::computed_value_flags::ComputedValueFlags;
|
||||
|
||||
/// The initial values for all style structs as defined by the specification.
|
||||
lazy_static! {
|
||||
pub static ref INITIAL_SERVO_VALUES: ComputedValuesInner = ComputedValuesInner {
|
||||
% for style_struct in data.active_style_structs():
|
||||
${style_struct.ident}: Arc::new(style_structs::${style_struct.name} {
|
||||
% for longhand in style_struct.longhands:
|
||||
${longhand.ident}: longhands::${longhand.ident}::get_initial_value(),
|
||||
% endfor
|
||||
% if style_struct.name == "Font":
|
||||
hash: 0,
|
||||
% endif
|
||||
}),
|
||||
% endfor
|
||||
custom_properties: None,
|
||||
writing_mode: WritingMode::empty(),
|
||||
font_computation_data: FontComputationData::default_values(),
|
||||
rules: None,
|
||||
visited_style: None,
|
||||
flags: ComputedValueFlags::empty(),
|
||||
pub static ref INITIAL_SERVO_VALUES: ComputedValues = ComputedValues {
|
||||
inner: ComputedValuesInner {
|
||||
% for style_struct in data.active_style_structs():
|
||||
${style_struct.ident}: Arc::new(style_structs::${style_struct.name} {
|
||||
% for longhand in style_struct.longhands:
|
||||
${longhand.ident}: longhands::${longhand.ident}::get_initial_value(),
|
||||
% endfor
|
||||
% if style_struct.name == "Font":
|
||||
hash: 0,
|
||||
% endif
|
||||
}),
|
||||
% endfor
|
||||
custom_properties: None,
|
||||
writing_mode: WritingMode::empty(),
|
||||
font_computation_data: FontComputationData::default_values(),
|
||||
rules: None,
|
||||
visited_style: None,
|
||||
flags: ComputedValueFlags::empty(),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -2626,8 +2685,8 @@ mod lazy_static_module {
|
|||
/// A per-longhand function that performs the CSS cascade for that longhand.
|
||||
pub type CascadePropertyFn =
|
||||
extern "Rust" fn(declaration: &PropertyDeclaration,
|
||||
inherited_style: &ComputedValuesInner,
|
||||
default_style: &ComputedValuesInner,
|
||||
inherited_style: &ComputedValues,
|
||||
default_style: &ComputedValues,
|
||||
context: &mut computed::Context,
|
||||
cacheable: &mut bool,
|
||||
cascade_info: &mut Option<<&mut CascadeInfo>);
|
||||
|
@ -2688,29 +2747,19 @@ bitflags! {
|
|||
/// Returns the computed values.
|
||||
/// * `flags`: Various flags.
|
||||
///
|
||||
pub fn cascade(device: &Device,
|
||||
rule_node: &StrongRuleNode,
|
||||
guards: &StylesheetGuards,
|
||||
parent_style: Option<<&ComputedValuesInner>,
|
||||
layout_parent_style: Option<<&ComputedValuesInner>,
|
||||
visited_style: Option<Arc<ComputedValues>>,
|
||||
cascade_info: Option<<&mut CascadeInfo>,
|
||||
font_metrics_provider: &FontMetricsProvider,
|
||||
flags: CascadeFlags,
|
||||
quirks_mode: QuirksMode)
|
||||
-> ComputedValuesInner {
|
||||
debug_assert!(layout_parent_style.is_none() || parent_style.is_some());
|
||||
let (inherited_style, layout_parent_style) = match parent_style {
|
||||
Some(parent_style) => {
|
||||
(parent_style,
|
||||
layout_parent_style.unwrap_or(parent_style))
|
||||
},
|
||||
None => {
|
||||
(device.default_computed_values(),
|
||||
device.default_computed_values())
|
||||
}
|
||||
};
|
||||
|
||||
pub fn cascade(
|
||||
device: &Device,
|
||||
pseudo: Option<<&PseudoElement>,
|
||||
rule_node: &StrongRuleNode,
|
||||
guards: &StylesheetGuards,
|
||||
parent_style: Option<<&ComputedValues>,
|
||||
layout_parent_style: Option<<&ComputedValues>,
|
||||
visited_style: Option<Arc<ComputedValues>>,
|
||||
cascade_info: Option<<&mut CascadeInfo>,
|
||||
font_metrics_provider: &FontMetricsProvider,
|
||||
flags: CascadeFlags,
|
||||
quirks_mode: QuirksMode
|
||||
) -> Arc<ComputedValues> {
|
||||
let iter_declarations = || {
|
||||
rule_node.self_and_ancestors().flat_map(|node| {
|
||||
let cascade_level = node.cascade_level();
|
||||
|
@ -2735,35 +2784,53 @@ pub fn cascade(device: &Device,
|
|||
})
|
||||
})
|
||||
};
|
||||
apply_declarations(device,
|
||||
rule_node,
|
||||
iter_declarations,
|
||||
inherited_style,
|
||||
layout_parent_style,
|
||||
visited_style,
|
||||
cascade_info,
|
||||
font_metrics_provider,
|
||||
flags,
|
||||
quirks_mode)
|
||||
apply_declarations(
|
||||
device,
|
||||
pseudo,
|
||||
rule_node,
|
||||
iter_declarations,
|
||||
parent_style,
|
||||
layout_parent_style,
|
||||
visited_style,
|
||||
cascade_info,
|
||||
font_metrics_provider,
|
||||
flags,
|
||||
quirks_mode,
|
||||
)
|
||||
}
|
||||
|
||||
/// NOTE: This function expects the declaration with more priority to appear
|
||||
/// first.
|
||||
#[allow(unused_mut)] // conditionally compiled code for "position"
|
||||
pub fn apply_declarations<'a, F, I>(device: &Device,
|
||||
rules: &StrongRuleNode,
|
||||
iter_declarations: F,
|
||||
inherited_style: &ComputedValuesInner,
|
||||
layout_parent_style: &ComputedValuesInner,
|
||||
visited_style: Option<Arc<ComputedValues>>,
|
||||
mut cascade_info: Option<<&mut CascadeInfo>,
|
||||
font_metrics_provider: &FontMetricsProvider,
|
||||
flags: CascadeFlags,
|
||||
quirks_mode: QuirksMode)
|
||||
-> ComputedValuesInner
|
||||
where F: Fn() -> I,
|
||||
I: Iterator<Item = (&'a PropertyDeclaration, CascadeLevel)>,
|
||||
pub fn apply_declarations<'a, F, I>(
|
||||
device: &Device,
|
||||
pseudo: Option<<&PseudoElement>,
|
||||
rules: &StrongRuleNode,
|
||||
iter_declarations: F,
|
||||
parent_style: Option<<&ComputedValues>,
|
||||
layout_parent_style: Option<<&ComputedValues>,
|
||||
visited_style: Option<Arc<ComputedValues>>,
|
||||
mut cascade_info: Option<<&mut CascadeInfo>,
|
||||
font_metrics_provider: &FontMetricsProvider,
|
||||
flags: CascadeFlags,
|
||||
quirks_mode: QuirksMode,
|
||||
) -> Arc<ComputedValues>
|
||||
where
|
||||
F: Fn() -> I,
|
||||
I: Iterator<Item = (&'a PropertyDeclaration, CascadeLevel)>,
|
||||
{
|
||||
debug_assert!(layout_parent_style.is_none() || parent_style.is_some());
|
||||
let (inherited_style, layout_parent_style) = match parent_style {
|
||||
Some(parent_style) => {
|
||||
(parent_style,
|
||||
layout_parent_style.unwrap_or(parent_style))
|
||||
},
|
||||
None => {
|
||||
(device.default_computed_values(),
|
||||
device.default_computed_values())
|
||||
}
|
||||
};
|
||||
|
||||
let default_style = device.default_computed_values();
|
||||
let inherited_custom_properties = inherited_style.custom_properties();
|
||||
let mut custom_properties = None;
|
||||
|
@ -2780,23 +2847,19 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
|
|||
::custom_properties::finish_cascade(
|
||||
custom_properties, &inherited_custom_properties);
|
||||
|
||||
let reset_style = if flags.contains(INHERIT_ALL) {
|
||||
inherited_style
|
||||
} else {
|
||||
default_style
|
||||
};
|
||||
|
||||
let mut context = computed::Context {
|
||||
is_root_element: flags.contains(IS_ROOT_ELEMENT),
|
||||
device: device,
|
||||
inherited_style: inherited_style,
|
||||
layout_parent_style: layout_parent_style,
|
||||
// We'd really like to own the rules here to avoid refcount traffic, but
|
||||
// animation's usage of `apply_declarations` make this tricky. See bug
|
||||
// 1375525.
|
||||
style: StyleBuilder::new(
|
||||
inherited_style,
|
||||
reset_style,
|
||||
device,
|
||||
parent_style,
|
||||
device.default_computed_values(),
|
||||
pseudo,
|
||||
flags,
|
||||
Some(rules.clone()),
|
||||
custom_properties,
|
||||
WritingMode::empty(),
|
||||
|
@ -3038,8 +3101,11 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
|
|||
|
||||
{
|
||||
StyleAdjuster::new(&mut style)
|
||||
.adjust(context.layout_parent_style,
|
||||
context.device.default_computed_values(), flags);
|
||||
.adjust(
|
||||
layout_parent_style,
|
||||
context.device.default_computed_values(),
|
||||
flags
|
||||
);
|
||||
}
|
||||
|
||||
% if product == "gecko":
|
||||
|
|
|
@ -11,7 +11,7 @@ use euclid::{Size2D, TypedSize2D};
|
|||
use font_metrics::ServoMetricsProvider;
|
||||
use media_queries::MediaType;
|
||||
use parser::ParserContext;
|
||||
use properties::{ComputedValuesInner, StyleBuilder};
|
||||
use properties::{ComputedValues, StyleBuilder};
|
||||
use properties::longhands::font_size;
|
||||
use selectors::parser::SelectorParseError;
|
||||
use std::fmt;
|
||||
|
@ -62,11 +62,11 @@ impl Device {
|
|||
}
|
||||
|
||||
/// Return the default computed values for this device.
|
||||
pub fn default_computed_values(&self) -> &ComputedValuesInner {
|
||||
pub fn default_computed_values(&self) -> &ComputedValues {
|
||||
// FIXME(bz): This isn't really right, but it's no more wrong
|
||||
// than what we used to do. See
|
||||
// https://github.com/servo/servo/issues/14773 for fixing it properly.
|
||||
ComputedValuesInner::initial_values()
|
||||
ComputedValues::initial_values()
|
||||
}
|
||||
|
||||
/// Get the font size of the root element (for rem)
|
||||
|
@ -231,8 +231,7 @@ impl Range<specified::Length> {
|
|||
is_root_element: false,
|
||||
device: device,
|
||||
inherited_style: default_values,
|
||||
layout_parent_style: default_values,
|
||||
style: StyleBuilder::for_derived_style(default_values),
|
||||
style: StyleBuilder::for_derived_style(device, default_values, None),
|
||||
// Servo doesn't support font metrics
|
||||
// A real provider will be needed here once we do; since
|
||||
// ch units can exist in media queries.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
//! a computed style needs in order for it to adhere to the CSS spec.
|
||||
|
||||
use app_units::Au;
|
||||
use properties::{self, CascadeFlags, ComputedValuesInner};
|
||||
use properties::{self, CascadeFlags, ComputedValues};
|
||||
use properties::{IS_ROOT_ELEMENT, SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP, StyleBuilder};
|
||||
use properties::longhands::display::computed_value::T as display;
|
||||
use properties::longhands::float::computed_value::T as float;
|
||||
|
@ -54,7 +54,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// Apply the blockification rules based on the table in CSS 2.2 section 9.7.
|
||||
/// https://drafts.csswg.org/css2/visuren.html#dis-pos-flo
|
||||
fn blockify_if_necessary(&mut self,
|
||||
layout_parent_style: &ComputedValuesInner,
|
||||
layout_parent_style: &ComputedValues,
|
||||
flags: CascadeFlags) {
|
||||
let mut blockify = false;
|
||||
macro_rules! blockify_if {
|
||||
|
@ -136,7 +136,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// https://lists.w3.org/Archives/Public/www-style/2017Mar/0045.html
|
||||
/// https://github.com/servo/servo/issues/15754
|
||||
fn adjust_for_writing_mode(&mut self,
|
||||
layout_parent_style: &ComputedValuesInner) {
|
||||
layout_parent_style: &ComputedValues) {
|
||||
let our_writing_mode = self.style.get_inheritedbox().clone_writing_mode();
|
||||
let parent_writing_mode = layout_parent_style.get_inheritedbox().clone_writing_mode();
|
||||
|
||||
|
@ -196,7 +196,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
///
|
||||
/// See https://github.com/servo/servo/issues/15229
|
||||
#[cfg(feature = "servo")]
|
||||
fn adjust_for_alignment(&mut self, layout_parent_style: &ComputedValuesInner) {
|
||||
fn adjust_for_alignment(&mut self, layout_parent_style: &ComputedValues) {
|
||||
use computed_values::align_items::T as align_items;
|
||||
use computed_values::align_self::T as align_self;
|
||||
|
||||
|
@ -295,7 +295,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// this type into its ::-moz-fieldset-content anonymous box.
|
||||
#[cfg(feature = "gecko")]
|
||||
fn adjust_for_fieldset_content(&mut self,
|
||||
layout_parent_style: &ComputedValuesInner,
|
||||
layout_parent_style: &ComputedValues,
|
||||
flags: CascadeFlags) {
|
||||
use properties::IS_FIELDSET_CONTENT;
|
||||
if !flags.contains(IS_FIELDSET_CONTENT) {
|
||||
|
@ -340,7 +340,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
}
|
||||
|
||||
/// Set the HAS_TEXT_DECORATION_LINES flag based on parent style.
|
||||
fn adjust_for_text_decoration_lines(&mut self, layout_parent_style: &ComputedValuesInner) {
|
||||
fn adjust_for_text_decoration_lines(&mut self, layout_parent_style: &ComputedValues) {
|
||||
use properties::computed_value_flags::HAS_TEXT_DECORATION_LINES;
|
||||
if layout_parent_style.flags.contains(HAS_TEXT_DECORATION_LINES) ||
|
||||
!self.style.get_text().clone_text_decoration_line().is_empty() {
|
||||
|
@ -349,7 +349,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
fn should_suppress_linebreak(&self, layout_parent_style: &ComputedValuesInner) -> bool {
|
||||
fn should_suppress_linebreak(&self, layout_parent_style: &ComputedValues) -> bool {
|
||||
use properties::computed_value_flags::SHOULD_SUPPRESS_LINEBREAK;
|
||||
// Line break suppression should only be propagated to in-flow children.
|
||||
if self.style.floated() || self.style.out_of_flow_positioned() {
|
||||
|
@ -386,8 +386,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// * correct unicode-bidi.
|
||||
#[cfg(feature = "gecko")]
|
||||
fn adjust_for_ruby(&mut self,
|
||||
layout_parent_style: &ComputedValuesInner,
|
||||
default_computed_values: &'b ComputedValuesInner,
|
||||
layout_parent_style: &ComputedValues,
|
||||
default_computed_values: &'b ComputedValues,
|
||||
flags: CascadeFlags) {
|
||||
use properties::SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP;
|
||||
use properties::computed_value_flags::SHOULD_SUPPRESS_LINEBREAK;
|
||||
|
@ -431,8 +431,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// When comparing to Gecko, this is similar to the work done by
|
||||
/// `nsStyleContext::ApplyStyleFixups`.
|
||||
pub fn adjust(&mut self,
|
||||
layout_parent_style: &ComputedValuesInner,
|
||||
_default_computed_values: &'b ComputedValuesInner,
|
||||
layout_parent_style: &ComputedValues,
|
||||
_default_computed_values: &'b ComputedValues,
|
||||
flags: CascadeFlags) {
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ use data::{ElementStyles, EagerPseudoStyles};
|
|||
use dom::TElement;
|
||||
use log::LogLevel::Trace;
|
||||
use matching::{CascadeVisitedMode, MatchMethods};
|
||||
use properties::{AnimationRules, CascadeFlags, ComputedValues, ComputedValuesInner};
|
||||
use properties::{AnimationRules, CascadeFlags, ComputedValues};
|
||||
use properties::{IS_ROOT_ELEMENT, PROHIBIT_DISPLAY_CONTENTS, SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP};
|
||||
use properties::{VISITED_DEPENDENT_ONLY, cascade};
|
||||
use rule_tree::StrongRuleNode;
|
||||
|
@ -47,7 +47,7 @@ pub struct PrimaryStyle {
|
|||
fn with_default_parent_styles<E, F, R>(element: E, f: F) -> R
|
||||
where
|
||||
E: TElement,
|
||||
F: FnOnce(Option<&ComputedValues>, Option<&ComputedValuesInner>) -> R,
|
||||
F: FnOnce(Option<&ComputedValues>, Option<&ComputedValues>) -> R,
|
||||
{
|
||||
let parent_el = element.inheritance_parent();
|
||||
let parent_data = parent_el.as_ref().and_then(|e| e.borrow_data());
|
||||
|
@ -72,7 +72,7 @@ where
|
|||
layout_parent_style = Some(layout_parent_data.styles.primary());
|
||||
}
|
||||
|
||||
f(parent_style.map(|x| &**x), layout_parent_style.map(|s| &***s))
|
||||
f(parent_style.map(|x| &**x), layout_parent_style.map(|s| &**s))
|
||||
}
|
||||
|
||||
impl<'a, 'ctx, 'le, E> StyleResolverForElement<'a, 'ctx, 'le, E>
|
||||
|
@ -99,7 +99,7 @@ where
|
|||
pub fn resolve_primary_style(
|
||||
&mut self,
|
||||
parent_style: Option<&ComputedValues>,
|
||||
layout_parent_style: Option<&ComputedValuesInner>,
|
||||
layout_parent_style: Option<&ComputedValues>,
|
||||
) -> PrimaryStyle {
|
||||
let primary_results =
|
||||
self.match_primary(VisitedHandlingMode::AllLinksUnvisited);
|
||||
|
@ -147,7 +147,7 @@ where
|
|||
pub fn resolve_style(
|
||||
&mut self,
|
||||
parent_style: Option<&ComputedValues>,
|
||||
layout_parent_style: Option<&ComputedValuesInner>,
|
||||
layout_parent_style: Option<&ComputedValues>,
|
||||
) -> ElementStyles {
|
||||
use properties::longhands::display::computed_value::T as display;
|
||||
|
||||
|
@ -168,7 +168,7 @@ where
|
|||
if primary_style.style.is_display_contents() {
|
||||
layout_parent_style
|
||||
} else {
|
||||
Some(&**primary_style.style)
|
||||
Some(&*primary_style.style)
|
||||
};
|
||||
SelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
|
||||
let pseudo_style = self.resolve_pseudo_style(
|
||||
|
@ -216,7 +216,7 @@ where
|
|||
&mut self,
|
||||
inputs: CascadeInputs,
|
||||
parent_style: Option<&ComputedValues>,
|
||||
layout_parent_style: Option<&ComputedValuesInner>,
|
||||
layout_parent_style: Option<&ComputedValues>,
|
||||
pseudo: Option<&PseudoElement>,
|
||||
) -> Arc<ComputedValues> {
|
||||
let mut style_if_visited = None;
|
||||
|
@ -272,7 +272,7 @@ where
|
|||
if primary_style.style.is_display_contents() {
|
||||
layout_parent_style
|
||||
} else {
|
||||
Some(&**primary_style.style)
|
||||
Some(&*primary_style.style)
|
||||
};
|
||||
|
||||
for (i, mut inputs) in pseudo_array.unwrap().iter_mut().enumerate() {
|
||||
|
@ -302,7 +302,7 @@ where
|
|||
&mut self,
|
||||
pseudo: &PseudoElement,
|
||||
originating_element_style: &PrimaryStyle,
|
||||
layout_parent_style: Option<&ComputedValuesInner>,
|
||||
layout_parent_style: Option<&ComputedValues>,
|
||||
) -> Option<Arc<ComputedValues>> {
|
||||
let rules = self.match_pseudo(
|
||||
&originating_element_style.style,
|
||||
|
@ -398,7 +398,7 @@ where
|
|||
|
||||
fn match_pseudo(
|
||||
&mut self,
|
||||
originating_element_style: &ComputedValuesInner,
|
||||
originating_element_style: &ComputedValues,
|
||||
pseudo_element: &PseudoElement,
|
||||
visited_handling: VisitedHandlingMode,
|
||||
) -> Option<StrongRuleNode> {
|
||||
|
@ -463,7 +463,7 @@ where
|
|||
rules: Option<&StrongRuleNode>,
|
||||
style_if_visited: Option<Arc<ComputedValues>>,
|
||||
mut parent_style: Option<&ComputedValues>,
|
||||
layout_parent_style: Option<&ComputedValuesInner>,
|
||||
layout_parent_style: Option<&ComputedValues>,
|
||||
cascade_visited: CascadeVisitedMode,
|
||||
pseudo: Option<&PseudoElement>,
|
||||
) -> Arc<ComputedValues> {
|
||||
|
@ -485,17 +485,14 @@ where
|
|||
cascade_flags.insert(IS_ROOT_ELEMENT);
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
let parent_style_context = parent_style;
|
||||
#[cfg(feature = "servo")]
|
||||
let parent_style_context = ();
|
||||
|
||||
let implemented_pseudo = self.element.implemented_pseudo_element();
|
||||
let values =
|
||||
cascade(
|
||||
self.context.shared.stylist.device(),
|
||||
pseudo.or(implemented_pseudo.as_ref()),
|
||||
rules.unwrap_or(self.context.shared.stylist.rule_tree().root()),
|
||||
&self.context.shared.guards,
|
||||
parent_style.map(|x| &**x),
|
||||
parent_style,
|
||||
layout_parent_style,
|
||||
style_if_visited,
|
||||
Some(&mut cascade_info),
|
||||
|
@ -506,17 +503,6 @@ where
|
|||
|
||||
cascade_info.finish(&self.element.as_node());
|
||||
|
||||
// In case of NAC like ::placeholder we style it via
|
||||
// cascade_primary without a PseudoElement, but
|
||||
// the element itself is a pseudo, so try to use that
|
||||
// when `pseudo` is unset
|
||||
let pseudo_info = if let Some(pseudo) = pseudo {
|
||||
Some(pseudo.pseudo_info())
|
||||
} else {
|
||||
self.element.implemented_pseudo_element().map(|x| x.pseudo_info())
|
||||
};
|
||||
values.to_outer(self.context.shared.stylist.device(),
|
||||
parent_style_context,
|
||||
pseudo_info)
|
||||
values
|
||||
}
|
||||
}
|
||||
|
|
|
@ -702,13 +702,11 @@ impl MaybeNew for ViewportConstraints {
|
|||
|
||||
let default_values = device.default_computed_values();
|
||||
|
||||
// TODO(emilio): Stop cloning `ComputedValues` around!
|
||||
let context = Context {
|
||||
is_root_element: false,
|
||||
device: device,
|
||||
inherited_style: default_values,
|
||||
layout_parent_style: default_values,
|
||||
style: StyleBuilder::for_derived_style(default_values),
|
||||
style: StyleBuilder::for_derived_style(device, default_values, None),
|
||||
font_metrics_provider: &provider,
|
||||
cached_system_font: None,
|
||||
in_media_query: false,
|
||||
|
|
|
@ -16,8 +16,8 @@ use gecko_bindings::structs::{nsIAtom, StyleRuleInclusion};
|
|||
use invalidation::element::invalidation_map::InvalidationMap;
|
||||
use invalidation::media_queries::{EffectiveMediaQueryResults, ToMediaListKey};
|
||||
use media_queries::Device;
|
||||
use properties::{self, CascadeFlags, ComputedValues, ComputedValuesInner};
|
||||
use properties::{AnimationRules, PropertyDeclarationBlock, PseudoInfo, ParentStyleContextInfo};
|
||||
use properties::{self, CascadeFlags, ComputedValues};
|
||||
use properties::{AnimationRules, PropertyDeclarationBlock};
|
||||
#[cfg(feature = "servo")]
|
||||
use properties::INHERIT_ALL;
|
||||
use rule_tree::{CascadeLevel, RuleTree, StyleSource};
|
||||
|
@ -599,11 +599,9 @@ impl Stylist {
|
|||
pub fn precomputed_values_for_pseudo(&self,
|
||||
guards: &StylesheetGuards,
|
||||
pseudo: &PseudoElement,
|
||||
parent: Option<&ComputedValuesInner>,
|
||||
parent: Option<&ComputedValues>,
|
||||
cascade_flags: CascadeFlags,
|
||||
font_metrics: &FontMetricsProvider,
|
||||
pseudo_info: PseudoInfo,
|
||||
parent_style_context: ParentStyleContextInfo)
|
||||
font_metrics: &FontMetricsProvider)
|
||||
-> Arc<ComputedValues> {
|
||||
debug_assert!(pseudo.is_precomputed());
|
||||
|
||||
|
@ -632,6 +630,7 @@ impl Stylist {
|
|||
// the actual used value, and the computed value of it would need
|
||||
// blockification.
|
||||
properties::cascade(&self.device,
|
||||
Some(pseudo),
|
||||
&rule_node,
|
||||
guards,
|
||||
parent,
|
||||
|
@ -640,8 +639,7 @@ impl Stylist {
|
|||
None,
|
||||
font_metrics,
|
||||
cascade_flags,
|
||||
self.quirks_mode).to_outer(self.device(), parent_style_context,
|
||||
Some(pseudo_info))
|
||||
self.quirks_mode)
|
||||
}
|
||||
|
||||
/// Returns the style for an anonymous box of the given type.
|
||||
|
@ -649,7 +647,7 @@ impl Stylist {
|
|||
pub fn style_for_anonymous(&self,
|
||||
guards: &StylesheetGuards,
|
||||
pseudo: &PseudoElement,
|
||||
parent_style: &ComputedValuesInner)
|
||||
parent_style: &ComputedValues)
|
||||
-> Arc<ComputedValues> {
|
||||
use font_metrics::ServoMetricsProvider;
|
||||
|
||||
|
@ -678,7 +676,7 @@ impl Stylist {
|
|||
cascade_flags.insert(INHERIT_ALL);
|
||||
}
|
||||
self.precomputed_values_for_pseudo(guards, &pseudo, Some(parent_style), cascade_flags,
|
||||
&ServoMetricsProvider, (), ())
|
||||
&ServoMetricsProvider)
|
||||
}
|
||||
|
||||
/// Computes a pseudo-element style lazily during layout.
|
||||
|
@ -693,22 +691,19 @@ impl Stylist {
|
|||
element: &E,
|
||||
pseudo: &PseudoElement,
|
||||
rule_inclusion: RuleInclusion,
|
||||
parent_style: &ComputedValuesInner,
|
||||
parent_style: &ComputedValues,
|
||||
is_probe: bool,
|
||||
font_metrics: &FontMetricsProvider,
|
||||
pseudo_info: PseudoInfo,
|
||||
parent_style_context: ParentStyleContextInfo)
|
||||
font_metrics: &FontMetricsProvider)
|
||||
-> Option<Arc<ComputedValues>>
|
||||
where E: TElement,
|
||||
{
|
||||
let cascade_inputs =
|
||||
self.lazy_pseudo_rules(guards, element, pseudo, is_probe, rule_inclusion);
|
||||
self.compute_pseudo_element_style_with_inputs(&cascade_inputs,
|
||||
pseudo,
|
||||
guards,
|
||||
parent_style,
|
||||
font_metrics,
|
||||
pseudo_info,
|
||||
parent_style_context)
|
||||
font_metrics)
|
||||
}
|
||||
|
||||
/// Computes a pseudo-element style lazily using the given CascadeInputs.
|
||||
|
@ -717,11 +712,10 @@ impl Stylist {
|
|||
/// their style with a new parent style.
|
||||
pub fn compute_pseudo_element_style_with_inputs(&self,
|
||||
inputs: &CascadeInputs,
|
||||
pseudo: &PseudoElement,
|
||||
guards: &StylesheetGuards,
|
||||
parent_style: &ComputedValuesInner,
|
||||
font_metrics: &FontMetricsProvider,
|
||||
pseudo_info: PseudoInfo,
|
||||
parent_style_context: ParentStyleContextInfo)
|
||||
parent_style: &ComputedValues,
|
||||
font_metrics: &FontMetricsProvider)
|
||||
-> Option<Arc<ComputedValues>>
|
||||
{
|
||||
// We may have only visited rules in cases when we are actually
|
||||
|
@ -743,7 +737,7 @@ impl Stylist {
|
|||
// We want to use the visited bits (if any) from our parent style as
|
||||
// our parent.
|
||||
let inherited_style =
|
||||
parent_style.get_visited_style().map(|x| &**x).unwrap_or(parent_style);
|
||||
parent_style.get_visited_style().unwrap_or(parent_style);
|
||||
|
||||
// FIXME(emilio): The lack of layout_parent_style here could be
|
||||
// worrying, but we're probably dropping the display fixup for
|
||||
|
@ -752,6 +746,7 @@ impl Stylist {
|
|||
// (Though the flags don't indicate so!)
|
||||
let computed =
|
||||
properties::cascade(&self.device,
|
||||
Some(pseudo),
|
||||
rule_node,
|
||||
guards,
|
||||
Some(inherited_style),
|
||||
|
@ -760,8 +755,7 @@ impl Stylist {
|
|||
None,
|
||||
font_metrics,
|
||||
CascadeFlags::empty(),
|
||||
self.quirks_mode).to_outer(self.device(), parent_style_context,
|
||||
Some(pseudo_info.clone()));
|
||||
self.quirks_mode);
|
||||
|
||||
Some(computed)
|
||||
} else {
|
||||
|
@ -777,17 +771,16 @@ impl Stylist {
|
|||
// (tl;dr: It doesn't apply for replaced elements and such, but the
|
||||
// computed value is still "contents").
|
||||
Some(properties::cascade(&self.device,
|
||||
rules,
|
||||
guards,
|
||||
Some(parent_style),
|
||||
Some(parent_style),
|
||||
visited_values,
|
||||
None,
|
||||
font_metrics,
|
||||
CascadeFlags::empty(),
|
||||
self.quirks_mode).to_outer(self.device(),
|
||||
parent_style_context,
|
||||
Some(pseudo_info)))
|
||||
Some(pseudo),
|
||||
rules,
|
||||
guards,
|
||||
Some(parent_style),
|
||||
Some(parent_style),
|
||||
visited_values,
|
||||
None,
|
||||
font_metrics,
|
||||
CascadeFlags::empty(),
|
||||
self.quirks_mode))
|
||||
}
|
||||
|
||||
/// Computes the cascade inputs for a lazily-cascaded pseudo-element.
|
||||
|
@ -1324,9 +1317,8 @@ impl Stylist {
|
|||
/// Computes styles for a given declaration with parent_style.
|
||||
pub fn compute_for_declarations(&self,
|
||||
guards: &StylesheetGuards,
|
||||
parent_style: &ComputedValuesInner,
|
||||
declarations: Arc<Locked<PropertyDeclarationBlock>>,
|
||||
parent_style_context: ParentStyleContextInfo)
|
||||
parent_style: &ComputedValues,
|
||||
declarations: Arc<Locked<PropertyDeclarationBlock>>)
|
||||
-> Arc<ComputedValues> {
|
||||
use font_metrics::get_metrics_provider_for_product;
|
||||
|
||||
|
@ -1341,7 +1333,9 @@ impl Stylist {
|
|||
// font styles in <canvas> via Servo_StyleSet_ResolveForDeclarations.
|
||||
// It is unclear if visited styles are meaningful for this case.
|
||||
let metrics = get_metrics_provider_for_product();
|
||||
// FIXME(emilio): the pseudo bit looks quite dubious!
|
||||
properties::cascade(&self.device,
|
||||
/* pseudo = */ None,
|
||||
&rule_node,
|
||||
guards,
|
||||
Some(parent_style),
|
||||
|
@ -1350,7 +1344,7 @@ impl Stylist {
|
|||
None,
|
||||
&metrics,
|
||||
CascadeFlags::empty(),
|
||||
self.quirks_mode).to_outer(self.device(), parent_style_context, None)
|
||||
self.quirks_mode)
|
||||
}
|
||||
|
||||
/// Accessor for a shared reference to the device.
|
||||
|
|
|
@ -486,7 +486,7 @@ where
|
|||
StyleResolverForElement::new(*ancestor, context, rule_inclusion)
|
||||
.resolve_primary_style(
|
||||
style.as_ref().map(|s| &**s),
|
||||
layout_parent_style.as_ref().map(|s| &***s)
|
||||
layout_parent_style.as_ref().map(|s| &**s)
|
||||
);
|
||||
|
||||
let is_display_contents = primary_style.style.is_display_contents();
|
||||
|
@ -503,7 +503,7 @@ where
|
|||
StyleResolverForElement::new(element, context, rule_inclusion)
|
||||
.resolve_style(
|
||||
style.as_ref().map(|s| &**s),
|
||||
layout_parent_style.as_ref().map(|s| &***s)
|
||||
layout_parent_style.as_ref().map(|s| &**s)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ use font_metrics::FontMetricsProvider;
|
|||
use media_queries::Device;
|
||||
#[cfg(feature = "gecko")]
|
||||
use properties;
|
||||
use properties::{ComputedValuesInner, StyleBuilder};
|
||||
use properties::{ComputedValues, StyleBuilder};
|
||||
use std::f32;
|
||||
use std::f64;
|
||||
use std::f64::consts::PI;
|
||||
|
@ -72,13 +72,7 @@ pub struct Context<'a> {
|
|||
pub device: &'a Device,
|
||||
|
||||
/// The style we're inheriting from.
|
||||
pub inherited_style: &'a ComputedValuesInner,
|
||||
|
||||
/// The style of the layout parent node. This will almost always be
|
||||
/// `inherited_style`, except when `display: contents` is at play, in which
|
||||
/// case it's the style of the last ancestor with a `display` value that
|
||||
/// isn't `contents`.
|
||||
pub layout_parent_style: &'a ComputedValuesInner,
|
||||
pub inherited_style: &'a ComputedValues,
|
||||
|
||||
/// Values accessed through this need to be in the properties "computed
|
||||
/// early": color, text-decoration, font-size, display, position, float,
|
||||
|
@ -115,7 +109,7 @@ impl<'a> Context<'a> {
|
|||
/// The current viewport size.
|
||||
pub fn viewport_size(&self) -> Size2D<Au> { self.device.au_viewport_size() }
|
||||
/// The style we're inheriting from.
|
||||
pub fn inherited_style(&self) -> &ComputedValuesInner { &self.inherited_style }
|
||||
pub fn inherited_style(&self) -> &ComputedValues { &self.inherited_style }
|
||||
/// The current style. Note that only "eager" properties should be accessed
|
||||
/// from here, see the comment in the member.
|
||||
pub fn style(&self) -> &StyleBuilder { &self.style }
|
||||
|
|
|
@ -60,7 +60,6 @@ use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed;
|
|||
use style::gecko_bindings::bindings::RawServoAnimationValueMapBorrowedMut;
|
||||
use style::gecko_bindings::bindings::RawServoAnimationValueStrong;
|
||||
use style::gecko_bindings::bindings::RawServoStyleRuleBorrowed;
|
||||
use style::gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull;
|
||||
use style::gecko_bindings::bindings::ServoStyleContextBorrowedOrNull;
|
||||
use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
|
||||
use style::gecko_bindings::bindings::nsTimingFunctionBorrowed;
|
||||
|
@ -91,9 +90,8 @@ use style::invalidation::element::restyle_hints::{self, RestyleHint};
|
|||
use style::media_queries::{MediaList, parse_media_query_list};
|
||||
use style::parallel;
|
||||
use style::parser::ParserContext;
|
||||
use style::properties::{ComputedValues, ComputedValuesInner, Importance};
|
||||
use style::properties::{ComputedValues, Importance};
|
||||
use style::properties::{IS_FIELDSET_CONTENT, LonghandIdSet};
|
||||
use style::properties::{ParentStyleContextInfo, PseudoInfo};
|
||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, PropertyId};
|
||||
use style::properties::{SKIP_ROOT_AND_ITEM_BASED_DISPLAY_FIXUP, SourcePropertyDeclaration, StyleBuilder};
|
||||
use style::properties::animated_properties::{Animatable, AnimatableLonghand, AnimationValue};
|
||||
|
@ -725,15 +723,16 @@ pub extern "C" fn Servo_StyleSet_GetBaseComputedValuesForElement(raw_data: RawSe
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ComputedValues_ExtractAnimationValue(computed_values: ServoComputedValuesBorrowed,
|
||||
pub extern "C" fn Servo_ComputedValues_ExtractAnimationValue(computed_values: ServoStyleContextBorrowed,
|
||||
property_id: nsCSSPropertyID)
|
||||
-> RawServoAnimationValueStrong
|
||||
{
|
||||
let property = match AnimatableLonghand::from_nscsspropertyid(property_id) {
|
||||
Some(longhand) => longhand,
|
||||
None => { return Strong::null(); }
|
||||
None => return Strong::null(),
|
||||
};
|
||||
|
||||
let computed_values = ComputedValues::as_arc(&computed_values);
|
||||
Arc::new(AnimationValue::from_computed_values(&property, computed_values)).into_strong()
|
||||
}
|
||||
|
||||
|
@ -1504,7 +1503,6 @@ pub extern "C" fn Servo_DocumentRule_GetConditionText(rule: RawServoDocumentRule
|
|||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null: ServoStyleContextBorrowedOrNull,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom,
|
||||
raw_data: RawServoStyleSetBorrowed)
|
||||
-> ServoStyleContextStrong {
|
||||
|
@ -1521,20 +1519,19 @@ pub extern "C" fn Servo_ComputedValues_GetForAnonymousBox(parent_style_or_null:
|
|||
cascade_flags.insert(IS_FIELDSET_CONTENT);
|
||||
}
|
||||
let metrics = get_metrics_provider_for_product();
|
||||
data.stylist.precomputed_values_for_pseudo(&guards, &pseudo, parent_style_or_null.map(|x| &**x),
|
||||
cascade_flags, &metrics,
|
||||
(pseudo_tag, pseudo_type),
|
||||
parent_style_or_null)
|
||||
.into_strong()
|
||||
data.stylist.precomputed_values_for_pseudo(
|
||||
&guards,
|
||||
&pseudo,
|
||||
parent_style_or_null.map(|x| &*x),
|
||||
cascade_flags, &metrics
|
||||
).into_strong()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ResolvePseudoStyle(element: RawGeckoElementBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom,
|
||||
is_probe: bool,
|
||||
inherited_style: ServoComputedValuesBorrowedOrNull,
|
||||
parent_style_context: ServoStyleContextBorrowedOrNull,
|
||||
inherited_style: ServoStyleContextBorrowedOrNull,
|
||||
raw_data: RawServoStyleSetBorrowed)
|
||||
-> ServoStyleContextStrong
|
||||
{
|
||||
|
@ -1551,9 +1548,7 @@ pub extern "C" fn Servo_ResolvePseudoStyle(element: RawGeckoElementBorrowed,
|
|||
return if is_probe {
|
||||
Strong::null()
|
||||
} else {
|
||||
doc_data.default_computed_values()
|
||||
.clone().to_outer(doc_data.stylist.device(), parent_style_context,
|
||||
Some((pseudo_tag, pseudo_type))).into_strong()
|
||||
doc_data.default_computed_values().clone().into_strong()
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1571,8 +1566,6 @@ pub extern "C" fn Servo_ResolvePseudoStyle(element: RawGeckoElementBorrowed,
|
|||
inherited_style,
|
||||
&*doc_data,
|
||||
is_probe,
|
||||
(pseudo_tag, pseudo_type),
|
||||
parent_style_context
|
||||
);
|
||||
|
||||
match style {
|
||||
|
@ -1624,11 +1617,9 @@ fn get_pseudo_style(
|
|||
pseudo: &PseudoElement,
|
||||
rule_inclusion: RuleInclusion,
|
||||
styles: &ElementStyles,
|
||||
inherited_styles: Option<&ComputedValuesInner>,
|
||||
inherited_styles: Option<&ComputedValues>,
|
||||
doc_data: &PerDocumentStyleDataImpl,
|
||||
is_probe: bool,
|
||||
pseudo_info: PseudoInfo,
|
||||
parent_style_context: ParentStyleContextInfo,
|
||||
) -> Option<Arc<ComputedValues>> {
|
||||
let style = match pseudo.cascade_type() {
|
||||
PseudoElementCascadeType::Eager => {
|
||||
|
@ -1648,17 +1639,17 @@ fn get_pseudo_style(
|
|||
doc_data.stylist
|
||||
.compute_pseudo_element_style_with_inputs(
|
||||
&inputs,
|
||||
pseudo,
|
||||
&guards,
|
||||
inherited_styles,
|
||||
&metrics,
|
||||
pseudo_info.clone(),
|
||||
parent_style_context)
|
||||
&metrics
|
||||
)
|
||||
})
|
||||
},
|
||||
_ => {
|
||||
debug_assert!(inherited_styles.is_none() ||
|
||||
ptr::eq(&*inherited_styles.unwrap(),
|
||||
&***styles.primary()));
|
||||
ptr::eq(inherited_styles.unwrap(),
|
||||
&**styles.primary()));
|
||||
styles.pseudos.get(&pseudo).cloned()
|
||||
},
|
||||
}
|
||||
|
@ -1666,8 +1657,8 @@ fn get_pseudo_style(
|
|||
PseudoElementCascadeType::Precomputed => unreachable!("No anonymous boxes"),
|
||||
PseudoElementCascadeType::Lazy => {
|
||||
debug_assert!(inherited_styles.is_none() ||
|
||||
ptr::eq(&*inherited_styles.unwrap(),
|
||||
&***styles.primary()));
|
||||
ptr::eq(inherited_styles.unwrap(),
|
||||
&**styles.primary()));
|
||||
let base = if pseudo.inherits_from_default_values() {
|
||||
doc_data.default_computed_values()
|
||||
} else {
|
||||
|
@ -1684,8 +1675,7 @@ fn get_pseudo_style(
|
|||
base,
|
||||
is_probe,
|
||||
&metrics,
|
||||
pseudo_info.clone(),
|
||||
parent_style_context)
|
||||
)
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -1695,17 +1685,17 @@ fn get_pseudo_style(
|
|||
|
||||
Some(style.unwrap_or_else(|| {
|
||||
StyleBuilder::for_inheritance(
|
||||
doc_data.stylist.device(),
|
||||
styles.primary(),
|
||||
doc_data.default_computed_values(),
|
||||
).build().to_outer(doc_data.stylist.device(), parent_style_context,
|
||||
Some(pseudo_info))
|
||||
Some(pseudo),
|
||||
).build()
|
||||
}))
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ComputedValues_Inherit(
|
||||
raw_data: RawServoStyleSetBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom,
|
||||
parent_style_context: ServoStyleContextBorrowedOrNull,
|
||||
target: structs::InheritTarget
|
||||
|
@ -1713,10 +1703,17 @@ pub extern "C" fn Servo_ComputedValues_Inherit(
|
|||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||
|
||||
let for_text = target == structs::InheritTarget::Text;
|
||||
let atom = Atom::from(pseudo_tag);
|
||||
let pseudo = PseudoElement::from_anon_box_atom(&atom)
|
||||
.expect("Not an anon-box? Gah!");
|
||||
let style = if let Some(reference) = parent_style_context {
|
||||
let mut style =
|
||||
StyleBuilder::for_inheritance(reference,
|
||||
&data.default_computed_values());
|
||||
let mut style = StyleBuilder::for_inheritance(
|
||||
data.stylist.device(),
|
||||
reference,
|
||||
data.default_computed_values(),
|
||||
Some(&pseudo)
|
||||
);
|
||||
|
||||
if for_text {
|
||||
StyleAdjuster::new(&mut style)
|
||||
.adjust_for_text();
|
||||
|
@ -1725,29 +1722,14 @@ pub extern "C" fn Servo_ComputedValues_Inherit(
|
|||
style.build()
|
||||
} else {
|
||||
debug_assert!(!for_text);
|
||||
data.default_computed_values().clone()
|
||||
StyleBuilder::for_derived_style(
|
||||
data.stylist.device(),
|
||||
data.default_computed_values(),
|
||||
Some(&pseudo),
|
||||
).build()
|
||||
};
|
||||
|
||||
let pseudo_info = if pseudo_tag.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some((pseudo_tag, pseudo_type))
|
||||
};
|
||||
|
||||
style.to_outer(data.stylist.device(), parent_style_context, pseudo_info).into_strong()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleContext_NewContext(values: ServoComputedValuesBorrowed,
|
||||
parent: ServoStyleContextBorrowedOrNull,
|
||||
pres_context: bindings::RawGeckoPresContextBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom)
|
||||
-> ServoStyleContextStrong {
|
||||
unsafe {
|
||||
(*values).clone().to_outer_helper(pres_context, parent,
|
||||
pseudo_type, pseudo_tag).into_strong()
|
||||
}
|
||||
style.into_strong()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -2827,8 +2809,6 @@ pub extern "C" fn Servo_ResolveStyle(element: RawGeckoElementBorrowed,
|
|||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
pseudo_tag: *mut nsIAtom,
|
||||
parent_style_context: ServoStyleContextBorrowedOrNull,
|
||||
rule_inclusion: StyleRuleInclusion,
|
||||
snapshots: *const ServoElementSnapshotTable,
|
||||
raw_data: RawServoStyleSetBorrowed)
|
||||
|
@ -2853,8 +2833,6 @@ pub extern "C" fn Servo_ResolveStyleLazily(element: RawGeckoElementBorrowed,
|
|||
/* inherited_styles = */ None,
|
||||
&*data,
|
||||
/* is_probe = */ false,
|
||||
(pseudo_tag, pseudo_type),
|
||||
parent_style_context
|
||||
).expect("We're not probing, so we should always get a style \
|
||||
back")
|
||||
}
|
||||
|
@ -2908,8 +2886,9 @@ fn simulate_compute_values_failure(_: &PropertyValuePair) -> bool {
|
|||
|
||||
fn create_context<'a>(per_doc_data: &'a PerDocumentStyleDataImpl,
|
||||
font_metrics_provider: &'a FontMetricsProvider,
|
||||
style: &'a ComputedValuesInner,
|
||||
parent_style: &'a Option<&ComputedValuesInner>)
|
||||
style: &'a ComputedValues,
|
||||
parent_style: Option<&'a ComputedValues>,
|
||||
pseudo: Option<&'a PseudoElement>)
|
||||
-> Context<'a> {
|
||||
let default_values = per_doc_data.default_computed_values();
|
||||
let inherited_style = parent_style.unwrap_or(default_values);
|
||||
|
@ -2918,8 +2897,7 @@ fn create_context<'a>(per_doc_data: &'a PerDocumentStyleDataImpl,
|
|||
is_root_element: false,
|
||||
device: per_doc_data.stylist.device(),
|
||||
inherited_style: inherited_style,
|
||||
layout_parent_style: inherited_style,
|
||||
style: StyleBuilder::for_derived_style(&style),
|
||||
style: StyleBuilder::for_derived_style(per_doc_data.stylist.device(), style, pseudo),
|
||||
font_metrics_provider: font_metrics_provider,
|
||||
cached_system_font: None,
|
||||
in_media_query: false,
|
||||
|
@ -2930,7 +2908,7 @@ fn create_context<'a>(per_doc_data: &'a PerDocumentStyleDataImpl,
|
|||
#[no_mangle]
|
||||
pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeListBorrowed,
|
||||
element: RawGeckoElementBorrowed,
|
||||
style: ServoComputedValuesBorrowed,
|
||||
style: ServoStyleContextBorrowed,
|
||||
raw_data: RawServoStyleSetBorrowed,
|
||||
computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut)
|
||||
{
|
||||
|
@ -2939,13 +2917,15 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis
|
|||
|
||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||
let metrics = get_metrics_provider_for_product();
|
||||
let style = ComputedValues::as_arc(&style);
|
||||
|
||||
let element = GeckoElement(element);
|
||||
let parent_element = element.inheritance_parent();
|
||||
let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
|
||||
let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &***x);
|
||||
let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &**x);
|
||||
|
||||
let mut context = create_context(&data, &metrics, style, &parent_style);
|
||||
let pseudo = style.pseudo();
|
||||
let mut context = create_context(&data, &metrics, style, parent_style, pseudo.as_ref());
|
||||
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
|
@ -3014,18 +2994,20 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis
|
|||
#[no_mangle]
|
||||
pub extern "C" fn Servo_GetAnimationValues(declarations: RawServoDeclarationBlockBorrowed,
|
||||
element: RawGeckoElementBorrowed,
|
||||
style: ServoComputedValuesBorrowed,
|
||||
style: ServoStyleContextBorrowed,
|
||||
raw_data: RawServoStyleSetBorrowed,
|
||||
animation_values: RawGeckoServoAnimationValueListBorrowedMut) {
|
||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||
let metrics = get_metrics_provider_for_product();
|
||||
let style = ComputedValues::as_arc(&style);
|
||||
|
||||
let element = GeckoElement(element);
|
||||
let parent_element = element.inheritance_parent();
|
||||
let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
|
||||
let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &***x);
|
||||
let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &**x);
|
||||
|
||||
let mut context = create_context(&data, &metrics, style, &parent_style);
|
||||
let pseudo = style.pseudo();
|
||||
let mut context = create_context(&data, &metrics, style, parent_style, pseudo.as_ref());
|
||||
|
||||
let default_values = data.default_computed_values();
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
|
@ -3042,18 +3024,20 @@ pub extern "C" fn Servo_GetAnimationValues(declarations: RawServoDeclarationBloc
|
|||
#[no_mangle]
|
||||
pub extern "C" fn Servo_AnimationValue_Compute(element: RawGeckoElementBorrowed,
|
||||
declarations: RawServoDeclarationBlockBorrowed,
|
||||
style: ServoComputedValuesBorrowed,
|
||||
style: ServoStyleContextBorrowed,
|
||||
raw_data: RawServoStyleSetBorrowed)
|
||||
-> RawServoAnimationValueStrong {
|
||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||
let metrics = get_metrics_provider_for_product();
|
||||
let style = ComputedValues::as_arc(&style);
|
||||
|
||||
let element = GeckoElement(element);
|
||||
let parent_element = element.inheritance_parent();
|
||||
let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
|
||||
let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &***x);
|
||||
let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &**x);
|
||||
|
||||
let mut context = create_context(&data, &metrics, style, &parent_style);
|
||||
let pseudo = style.pseudo();
|
||||
let mut context = create_context(&data, &metrics, style, parent_style, pseudo.as_ref());
|
||||
|
||||
let default_values = data.default_computed_values();
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
|
@ -3304,16 +3288,17 @@ pub extern "C" fn Servo_StyleSet_ResolveForDeclarations(
|
|||
let guards = StylesheetGuards::same(&guard);
|
||||
|
||||
let parent_style = match parent_style_context {
|
||||
Some(parent) => &**parent,
|
||||
Some(parent) => &*parent,
|
||||
None => doc_data.default_computed_values(),
|
||||
};
|
||||
|
||||
let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
|
||||
|
||||
doc_data.stylist.compute_for_declarations(&guards,
|
||||
parent_style,
|
||||
declarations.clone_arc(),
|
||||
parent_style_context).into_strong()
|
||||
doc_data.stylist.compute_for_declarations(
|
||||
&guards,
|
||||
parent_style,
|
||||
declarations.clone_arc(),
|
||||
).into_strong()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
|
@ -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, ComputedValuesInner, StyleBuilder};
|
||||
use style::properties::{ComputedValues, StyleBuilder};
|
||||
use style::stylesheets::{CssRuleType, Origin};
|
||||
use style::values::computed::{Context, ToComputedValue};
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError};
|
||||
|
@ -49,15 +49,14 @@ 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 = ComputedValuesInner::initial_values();
|
||||
let initial_style = ComputedValues::initial_values();
|
||||
let device = Device::new(MediaType::Screen, viewport_size);
|
||||
|
||||
let context = Context {
|
||||
is_root_element: true,
|
||||
device: &device,
|
||||
inherited_style: initial_style,
|
||||
layout_parent_style: initial_style,
|
||||
style: StyleBuilder::for_derived_style(&initial_style),
|
||||
style: StyleBuilder::for_derived_style(&device, initial_style, None),
|
||||
cached_system_font: None,
|
||||
font_metrics_provider: &ServoMetricsProvider,
|
||||
in_media_query: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue