stylo: Use ComputedValuesInner instead of ComputedValues when we don't need it

This commit is contained in:
Manish Goregaokar 2017-07-17 11:41:52 -07:00 committed by Manish Goregaokar
parent 04b0ae64f2
commit 808b1f509b
38 changed files with 302 additions and 316 deletions

View file

@ -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,7 +460,7 @@ 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>);
@ -468,7 +468,7 @@ pub trait FragmentDisplayListBuilding {
/// 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>);
@ -476,7 +476,7 @@ pub trait FragmentDisplayListBuilding {
/// 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]