mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #10155 - bholley:generalize_style_structs, r=SimonSapin
Generalize the style structs This allows geckolib to pass gecko style structs and have the style system write to them directly, provided we implement all the traits. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10155) <!-- Reviewable:end -->
This commit is contained in:
commit
605842f193
47 changed files with 995 additions and 433 deletions
|
@ -60,7 +60,7 @@ use style::computed_values::{border_collapse, box_sizing, display, float, overfl
|
|||
use style::computed_values::{position, text_align, transform_style};
|
||||
use style::context::StyleContext;
|
||||
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone};
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use util::geometry::MAX_RECT;
|
||||
|
|
|
@ -45,7 +45,7 @@ use std::sync::atomic::Ordering;
|
|||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::{caption_side, display, empty_cells, float, list_style_position};
|
||||
use style::computed_values::{position};
|
||||
use style::properties::{self, ComputedValues};
|
||||
use style::properties::{self, ComputedValues, TComputedValues};
|
||||
use table::TableFlow;
|
||||
use table_caption::TableCaptionFlow;
|
||||
use table_cell::TableCellFlow;
|
||||
|
|
|
@ -26,13 +26,14 @@ use std::rc::Rc;
|
|||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use style::context::{LocalStyleContext, StyleContext};
|
||||
use style::matching::{ApplicableDeclarationsCache, StyleSharingCandidateCache};
|
||||
use style::properties::ComputedValues;
|
||||
use style::selector_impl::ServoSelectorImpl;
|
||||
use style::servo::SharedStyleContext;
|
||||
use url::Url;
|
||||
use util::opts;
|
||||
|
||||
struct LocalLayoutContext {
|
||||
style_context: LocalStyleContext,
|
||||
style_context: LocalStyleContext<ComputedValues>,
|
||||
font_context: RefCell<FontContext>,
|
||||
}
|
||||
|
||||
|
@ -107,12 +108,12 @@ pub struct LayoutContext<'a> {
|
|||
cached_local_layout_context: Rc<LocalLayoutContext>,
|
||||
}
|
||||
|
||||
impl<'a> StyleContext<'a, ServoSelectorImpl> for LayoutContext<'a> {
|
||||
impl<'a> StyleContext<'a, ServoSelectorImpl, ComputedValues> for LayoutContext<'a> {
|
||||
fn shared_context(&self) -> &'a SharedStyleContext {
|
||||
&self.shared.style_context
|
||||
}
|
||||
|
||||
fn local_context(&self) -> &LocalStyleContext {
|
||||
fn local_context(&self) -> &LocalStyleContext<ComputedValues> {
|
||||
&self.cached_local_layout_context.style_context
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ use style::computed_values::{border_style, image_rendering, overflow_x, position
|
|||
use style::computed_values::{transform, transform_style, visibility};
|
||||
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::style_structs::Border;
|
||||
use style::properties::{self, ComputedValues};
|
||||
use style::properties::{self, ComputedValues, TComputedValues};
|
||||
use style::values::RGBA;
|
||||
use style::values::computed;
|
||||
use style::values::computed::{LengthOrNone, LengthOrPercentage, LengthOrPercentageOrAuto, LinearGradient};
|
||||
|
|
|
@ -28,8 +28,8 @@ use std::cmp::max;
|
|||
use std::sync::Arc;
|
||||
use style::computed_values::{flex_direction, float};
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::style_structs;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
|
||||
// A mode describes which logical axis a flex axis is parallel with.
|
||||
|
|
|
@ -50,7 +50,7 @@ use std::{fmt, mem, raw};
|
|||
use style::computed_values::{clear, display, empty_cells, float, position, overflow_x, text_align};
|
||||
use style::dom::TRestyleDamage;
|
||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::{self, ComputedValues};
|
||||
use style::properties::{self, ComputedValues, TComputedValues};
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, TableFlow};
|
||||
use table_caption::TableCaptionFlow;
|
||||
|
|
|
@ -41,7 +41,7 @@ use style::computed_values::{overflow_x, position, text_decoration, transform_st
|
|||
use style::computed_values::{white_space, word_break, z_index};
|
||||
use style::dom::TRestyleDamage;
|
||||
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use style::values::computed::{LengthOrPercentageOrNone};
|
||||
use text;
|
||||
|
|
|
@ -20,7 +20,7 @@ use std::sync::Arc;
|
|||
use style::computed_values::content::ContentItem;
|
||||
use style::computed_values::{display, list_style_type};
|
||||
use style::dom::TRestyleDamage;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use text::TextRunScanner;
|
||||
use wrapper::PseudoElementType;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::fmt;
|
|||
use std::sync::Arc;
|
||||
use style::computed_values::float;
|
||||
use style::dom::TRestyleDamage;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
|
||||
bitflags! {
|
||||
#[doc = "Individual layout actions that may be necessary after restyling."]
|
||||
|
@ -53,6 +53,7 @@ bitflags! {
|
|||
}
|
||||
|
||||
impl TRestyleDamage for RestyleDamage {
|
||||
type ConcreteComputedValues = ComputedValues;
|
||||
fn compute(old: Option<&Arc<ComputedValues>>, new: &ComputedValues) -> RestyleDamage { compute_damage(old, new) }
|
||||
|
||||
/// Returns a bitmask that represents a flow that needs to be rebuilt and reflowed.
|
||||
|
|
|
@ -30,7 +30,7 @@ use std::{fmt, isize, mem};
|
|||
use style::computed_values::{display, overflow_x, position, text_align, text_justify};
|
||||
use style::computed_values::{text_overflow, vertical_align, white_space};
|
||||
use style::logical_geometry::{LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::computed::LengthOrPercentage;
|
||||
use text;
|
||||
use unicode_bidi;
|
||||
|
|
|
@ -72,6 +72,7 @@ use style::error_reporting::ParseErrorReporter;
|
|||
use style::logical_geometry::LogicalPoint;
|
||||
use style::media_queries::{Device, MediaType};
|
||||
use style::parallel::WorkQueueData;
|
||||
use style::properties::TComputedValues;
|
||||
use style::selector_impl::ServoSelectorImpl;
|
||||
use style::selector_matching::USER_OR_USER_AGENT_STYLESHEETS;
|
||||
use style::servo::{SharedStyleContext, Stylesheet, Stylist};
|
||||
|
|
|
@ -23,7 +23,7 @@ use inline::InlineMetrics;
|
|||
use std::sync::Arc;
|
||||
use style::computed_values::{list_style_type, position};
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use text;
|
||||
|
||||
/// A block with the CSS `display` property equal to `list-item`.
|
||||
|
|
|
@ -13,7 +13,7 @@ use std::cmp::{max, min};
|
|||
use std::fmt;
|
||||
use style::computed_values::transform::ComputedMatrix;
|
||||
use style::logical_geometry::LogicalMargin;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::computed::{BorderRadiusSize, LengthOrPercentageOrAuto};
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrNone};
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ use std::fmt;
|
|||
use std::sync::Arc;
|
||||
use style::context::StyleContext;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::computed::{LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use util::print_tree::PrintTree;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ use std::sync::{Arc, Mutex};
|
|||
use string_cache::Atom;
|
||||
use style::computed_values;
|
||||
use style::logical_geometry::{WritingMode, BlockFlowDirection, InlineBaseDirection};
|
||||
use style::properties::TComputedValues;
|
||||
use style::properties::longhands::{display, position};
|
||||
use style::properties::style_structs;
|
||||
use style::selector_impl::PseudoElement;
|
||||
|
|
|
@ -25,7 +25,7 @@ use std::fmt;
|
|||
use std::sync::Arc;
|
||||
use style::computed_values::{border_collapse, border_spacing, table_layout};
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::CSSFloat;
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use table_row::{TableRowFlow};
|
||||
|
|
|
@ -17,7 +17,7 @@ use gfx::display_list::{StackingContext, StackingContextId};
|
|||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use util::print_tree::PrintTree;
|
||||
|
||||
/// A table formatting context.
|
||||
|
|
|
@ -21,7 +21,7 @@ use std::fmt;
|
|||
use std::sync::Arc;
|
||||
use style::computed_values::{border_collapse, border_top_style};
|
||||
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use table::InternalTable;
|
||||
use table_row::{CollapsedBorder, CollapsedBorderProvenance};
|
||||
use util::print_tree::PrintTree;
|
||||
|
|
|
@ -18,7 +18,7 @@ use std::cmp::max;
|
|||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
|
||||
/// A table formatting context.
|
||||
|
|
|
@ -25,7 +25,7 @@ use std::iter::{Enumerate, IntoIterator, Peekable};
|
|||
use std::sync::Arc;
|
||||
use style::computed_values::{border_collapse, border_spacing, border_top_style};
|
||||
use style::logical_geometry::{LogicalSize, PhysicalSide, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt};
|
||||
use table_cell::{CollapsedBordersForCell, TableCellFlow};
|
||||
|
|
|
@ -21,7 +21,7 @@ use std::iter::{IntoIterator, Iterator, Peekable};
|
|||
use std::sync::Arc;
|
||||
use style::computed_values::{border_collapse, border_spacing};
|
||||
use style::logical_geometry::{LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow};
|
||||
use table_row;
|
||||
use util::print_tree::PrintTree;
|
||||
|
|
|
@ -31,7 +31,7 @@ use std::ops::Add;
|
|||
use std::sync::Arc;
|
||||
use style::computed_values::{border_collapse, table_layout};
|
||||
use style::logical_geometry::LogicalSize;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::values::CSSFloat;
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize};
|
||||
|
|
|
@ -23,8 +23,8 @@ use std::sync::Arc;
|
|||
use style::computed_values::{line_height, text_orientation, text_rendering, text_transform};
|
||||
use style::computed_values::{white_space};
|
||||
use style::logical_geometry::{LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::style_structs::Font as FontStyle;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use unicode_bidi::{is_rtl, process_text};
|
||||
use unicode_script::{get_script, Script};
|
||||
use util::linked_list::split_off_head;
|
||||
|
|
|
@ -66,7 +66,7 @@ use style::computed_values::content::ContentItem;
|
|||
use style::computed_values::{content, display};
|
||||
use style::dom::{TDocument, TElement, TNode, UnsafeNode};
|
||||
use style::element_state::*;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{ComputedValues, TComputedValues};
|
||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use style::restyle_hints::ElementSnapshot;
|
||||
use style::selector_impl::{NonTSPseudoClass, PseudoElement, ServoSelectorImpl};
|
||||
|
@ -131,6 +131,7 @@ impl<'ln> ServoLayoutNode<'ln> {
|
|||
}
|
||||
|
||||
impl<'ln> TNode for ServoLayoutNode<'ln> {
|
||||
type ConcreteComputedValues = ComputedValues;
|
||||
type ConcreteElement = ServoLayoutElement<'ln>;
|
||||
type ConcreteDocument = ServoLayoutDocument<'ln>;
|
||||
type ConcreteRestyleDamage = RestyleDamage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue