Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

stylo: Fuse ServoStyleContext and ServoComputedValues #17767

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

Always

Just for now

stylo: Use ComputedValuesInner instead of ComputedValues when we don'…

…t need it
  • Loading branch information
Manishearth committed Jul 18, 2017
commit 808b1f509b7e1524cfc49f7cc1fc89fd5f8e5737
@@ -56,7 +56,7 @@ use style::computed_values::{border_collapse, box_sizing, display, float, overfl
use style::computed_values::{position, text_align};
use style::context::SharedStyleContext;
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use style::properties::ServoComputedValues;
use style::properties::ComputedValues;
use style::servo::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPOSITION};
use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage};
use style::values::computed::LengthOrPercentageOrAuto;
@@ -2139,7 +2139,7 @@ impl Flow for BlockFlow {
self.build_display_list_for_block(state, BorderPaintingMode::Separate);
}

fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
fn repair_style(&mut self, new_style: &::StyleArc<ComputedValues>) {
self.fragment.repair_style(new_style)
}

@@ -52,7 +52,7 @@ use style::computed_values::content::ContentItem;
use style::computed_values::position;
use style::context::SharedStyleContext;
use style::logical_geometry::Direction;
use style::properties::ServoComputedValues;
use style::properties::ComputedValues;
use style::properties::longhands::list_style_image;
use style::selector_parser::{PseudoElement, RestyleDamage};
use style::servo::restyle_damage::{BUBBLE_ISIZES, RECONSTRUCT_FLOW};
@@ -109,7 +109,7 @@ pub enum ConstructionItem {
/// Inline fragments and associated {ib} splits that have not yet found flows.
InlineFragments(InlineFragmentsConstructionResult),
/// Potentially ignorable whitespace.
Whitespace(OpaqueNode, PseudoElementType<()>, StyleArc<ServoComputedValues>, RestyleDamage),
Whitespace(OpaqueNode, PseudoElementType<()>, StyleArc<ComputedValues>, RestyleDamage),
/// TableColumn Fragment
TableColumnFragment(Fragment),
}
@@ -677,7 +677,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
fn create_fragments_for_node_text_content(&self,
fragments: &mut IntermediateInlineFragments,
node: &ConcreteThreadSafeLayoutNode,
style: &StyleArc<ServoComputedValues>) {
style: &StyleArc<ComputedValues>) {
// Fast path: If there is no text content, return immediately.
let text_content = node.text_content();
if text_content.is_empty() {
@@ -1806,7 +1806,7 @@ pub fn strip_ignorable_whitespace_from_end(this: &mut LinkedList<Fragment>) {

/// If the 'unicode-bidi' property has a value other than 'normal', return the bidi control codes
/// to inject before and after the text content of the element.
fn bidi_control_chars(style: &StyleArc<ServoComputedValues>) -> Option<(&'static str, &'static str)> {
fn bidi_control_chars(style: &StyleArc<ComputedValues>) -> Option<(&'static str, &'static str)> {
use style::computed_values::direction::T::*;
use style::computed_values::unicode_bidi::T::*;

@@ -1851,7 +1851,7 @@ trait ComputedValueUtils {
fn has_padding_or_border(&self) -> bool;
}

impl ComputedValueUtils for ServoComputedValues {
impl ComputedValueUtils for ComputedValues {
fn has_padding_or_border(&self) -> bool {
let padding = self.get_padding();
let border = self.get_border();
@@ -51,7 +51,7 @@ use style::computed_values::{background_attachment, background_clip, background_
use style::computed_values::{background_repeat, border_style, cursor};
use style::computed_values::{image_rendering, overflow_x, pointer_events, position, visibility};
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
use style::properties::{self, ServoComputedValues};
use style::properties::{self, ComputedValues};
use style::properties::longhands::border_image_repeat::computed_value::RepeatKeyword;
use style::properties::style_structs;
use style::servo::restyle_damage::REPAINT;
@@ -375,14 +375,14 @@ pub trait FragmentDisplayListBuilding {
/// list if necessary.
fn build_display_list_for_background_if_applicable(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>);

/// Computes the background size for an image with the given background area according to the
/// rules in CSS-BACKGROUNDS § 3.9.
fn compute_background_image_size(&self,
style: &ServoComputedValues,
style: &ComputedValues,
bounds: &Rect<Au>,
image: &WebRenderImageInfo, index: usize)
-> Size2D<Au>;
@@ -391,7 +391,7 @@ pub trait FragmentDisplayListBuilding {
/// appropriate section of the display list.
fn build_display_list_for_background_image(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip: &LocalClip,
@@ -402,7 +402,7 @@ pub trait FragmentDisplayListBuilding {
/// appropriate section of the display list.
fn build_display_list_for_webrender_image(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip: &LocalClip,
@@ -413,7 +413,7 @@ pub trait FragmentDisplayListBuilding {
/// worklet to the appropriate section of the display list.
fn build_display_list_for_background_paint_worklet(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip: &LocalClip,
@@ -443,14 +443,14 @@ pub trait FragmentDisplayListBuilding {
absolute_bounds: &Rect<Au>,
clip: &LocalClip,
gradient: &Gradient,
style: &ServoComputedValues);
style: &ComputedValues);

/// Adds the display items necessary to paint the borders of this fragment to a display list if
/// necessary.
fn build_display_list_for_borders_if_applicable(
&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
border_painting_mode: BorderPaintingMode,
bounds: &Rect<Au>,
display_list_section: DisplayListSection,
@@ -460,23 +460,23 @@ pub trait FragmentDisplayListBuilding {
/// if necessary.
fn build_display_list_for_outline_if_applicable(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
bounds: &Rect<Au>,
clip: &Rect<Au>);

/// Adds the display items necessary to paint the box shadow of this fragment to the display
/// list if necessary.
fn build_display_list_for_box_shadow_if_applicable(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip: &Rect<Au>);

/// Adds display items necessary to draw debug boxes around a scanned text fragment.
fn build_debug_borders_around_text_fragments(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
stacking_relative_border_box: &Rect<Au>,
stacking_relative_content_box: &Rect<Au>,
text_fragment: &ScannedTextFragmentInfo,
@@ -607,7 +607,7 @@ fn build_border_radius(abs_bounds: &Rect<Au>,
/// Get the border radius for the rectangle inside of a rounded border. This is useful
/// for building the clip for the content inside the border.
fn build_border_radius_for_inner_rect(outer_rect: &Rect<Au>,
style: &ServoComputedValues)
style: &ComputedValues)
-> BorderRadii<Au> {
let mut radii = build_border_radius(&outer_rect, style.get_border());
if radii.is_square() {
@@ -633,7 +633,7 @@ fn build_border_radius_for_inner_rect(outer_rect: &Rect<Au>,
}

fn build_inner_border_box_for_border_rect(border_box: &Rect<Au>,
style: &ServoComputedValues)
style: &ComputedValues)
-> Rect<Au> {
let border_widths = style.logical_border_width().to_physical(style.writing_mode);
let mut inner_border_box = *border_box;
@@ -845,7 +845,7 @@ fn convert_ellipse_size_keyword(keyword: ShapeExtent,
impl FragmentDisplayListBuilding for Fragment {
fn build_display_list_for_background_if_applicable(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>) {
// FIXME: This causes a lot of background colors to be displayed when they are clearly not
@@ -950,7 +950,7 @@ impl FragmentDisplayListBuilding for Fragment {
}

fn compute_background_image_size(&self,
style: &ServoComputedValues,
style: &ComputedValues,
bounds: &Rect<Au>,
image: &WebRenderImageInfo,
index: usize)
@@ -996,7 +996,7 @@ impl FragmentDisplayListBuilding for Fragment {

fn build_display_list_for_background_image(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip: &LocalClip,
@@ -1020,7 +1020,7 @@ impl FragmentDisplayListBuilding for Fragment {

fn build_display_list_for_webrender_image(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip: &LocalClip,
@@ -1157,7 +1157,7 @@ impl FragmentDisplayListBuilding for Fragment {

fn build_display_list_for_background_paint_worklet(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip: &LocalClip,
@@ -1338,7 +1338,7 @@ impl FragmentDisplayListBuilding for Fragment {
absolute_bounds: &Rect<Au>,
clip: &LocalClip,
gradient: &Gradient,
style: &ServoComputedValues) {
style: &ComputedValues) {
let border = self.border_width().to_physical(style.writing_mode);
let mut bounds = *absolute_bounds;
bounds.origin.x = bounds.origin.x + border.left;
@@ -1380,7 +1380,7 @@ impl FragmentDisplayListBuilding for Fragment {

fn build_display_list_for_box_shadow_if_applicable(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
display_list_section: DisplayListSection,
absolute_bounds: &Rect<Au>,
clip: &Rect<Au>) {
@@ -1423,7 +1423,7 @@ impl FragmentDisplayListBuilding for Fragment {
fn build_display_list_for_borders_if_applicable(
&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
border_painting_mode: BorderPaintingMode,
bounds: &Rect<Au>,
display_list_section: DisplayListSection,
@@ -1570,7 +1570,7 @@ impl FragmentDisplayListBuilding for Fragment {

fn build_display_list_for_outline_if_applicable(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
bounds: &Rect<Au>,
clip: &Rect<Au>) {
use style::values::Either;
@@ -1615,7 +1615,7 @@ impl FragmentDisplayListBuilding for Fragment {

fn build_debug_borders_around_text_fragments(&self,
state: &mut DisplayListBuildState,
style: &ServoComputedValues,
style: &ComputedValues,
stacking_relative_border_box: &Rect<Au>,
stacking_relative_content_box: &Rect<Au>,
text_fragment: &ScannedTextFragmentInfo,
@@ -2886,12 +2886,12 @@ impl BaseFlowDisplayListBuilding for BaseFlow {
}
}

trait ServoComputedValuesCursorUtility {
trait ComputedValuesCursorUtility {
fn get_cursor(&self, default_cursor: Cursor) -> Option<Cursor>;
}

impl ServoComputedValuesCursorUtility for ServoComputedValues {
/// Gets the cursor to use given the specific ServoComputedValues. `default_cursor` specifies
impl ComputedValuesCursorUtility for ComputedValues {
/// Gets the cursor to use given the specific ComputedValues. `default_cursor` specifies
/// the cursor to use if `cursor` is `auto`. Typically, this will be `PointerCursor`, but for
/// text display items it may be `TextCursor` or `VerticalTextCursor`.
#[inline]
@@ -23,7 +23,7 @@ use std::ops::Range;
use style::computed_values::{align_content, align_self, flex_direction, flex_wrap, justify_content};
use style::computed_values::border_collapse;
use style::logical_geometry::{Direction, LogicalSize};
use style::properties::ServoComputedValues;
use style::properties::ComputedValues;
use style::servo::restyle_damage::{REFLOW, REFLOW_OUT_OF_FLOW};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use style::values::computed::flex::FlexBasis;
@@ -973,7 +973,7 @@ impl Flow for FlexFlow {
self.block_flow.collect_stacking_contexts(state);
}

fn repair_style(&mut self, new_style: &::StyleArc<ServoComputedValues>) {
fn repair_style(&mut self, new_style: &::StyleArc<ComputedValues>) {
self.block_flow.repair_style(new_style)
}

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