mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
Add flows if requested to the display list info.
This will be used for hit testing.
This commit is contained in:
parent
e2bcd3648e
commit
2e4cecc718
8 changed files with 112 additions and 72 deletions
|
@ -26,20 +26,20 @@ use std::arc::ARC;
|
||||||
use std::arc;
|
use std::arc;
|
||||||
|
|
||||||
/// A list of rendering operations to be performed.
|
/// A list of rendering operations to be performed.
|
||||||
pub struct DisplayList {
|
pub struct DisplayList<E> {
|
||||||
priv list: ~[DisplayItem]
|
priv list: ~[DisplayItem<E>]
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DisplayList {
|
impl<E> DisplayList<E> {
|
||||||
/// Creates a new display list.
|
/// Creates a new display list.
|
||||||
pub fn new() -> DisplayList {
|
pub fn new() -> DisplayList<E> {
|
||||||
DisplayList {
|
DisplayList {
|
||||||
list: ~[]
|
list: ~[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Appends the given item to the display list.
|
/// Appends the given item to the display list.
|
||||||
pub fn append_item(&mut self, item: DisplayItem) {
|
pub fn append_item(&mut self, item: DisplayItem<E>) {
|
||||||
// FIXME(Issue #150): crashes
|
// FIXME(Issue #150): crashes
|
||||||
//debug!("Adding display item %u: %?", self.len(), item);
|
//debug!("Adding display item %u: %?", self.len(), item);
|
||||||
self.list.push(item)
|
self.list.push(item)
|
||||||
|
@ -58,51 +58,54 @@ impl DisplayList {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// One drawing command in the list.
|
/// One drawing command in the list.
|
||||||
pub enum DisplayItem {
|
pub enum DisplayItem<E> {
|
||||||
SolidColorDisplayItemClass(~SolidColorDisplayItem),
|
SolidColorDisplayItemClass(~SolidColorDisplayItem<E>),
|
||||||
TextDisplayItemClass(~TextDisplayItem),
|
TextDisplayItemClass(~TextDisplayItem<E>),
|
||||||
ImageDisplayItemClass(~ImageDisplayItem),
|
ImageDisplayItemClass(~ImageDisplayItem<E>),
|
||||||
BorderDisplayItemClass(~BorderDisplayItem),
|
BorderDisplayItemClass(~BorderDisplayItem<E>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Information common to all display items.
|
/// Information common to all display items.
|
||||||
pub struct BaseDisplayItem {
|
pub struct BaseDisplayItem<E> {
|
||||||
/// The boundaries of the display item.
|
/// The boundaries of the display item.
|
||||||
///
|
///
|
||||||
/// TODO: Which coordinate system should this use?
|
/// TODO: Which coordinate system should this use?
|
||||||
bounds: Rect<Au>,
|
bounds: Rect<Au>,
|
||||||
|
|
||||||
|
/// Extra data: either the originating flow (for hit testing) or nothing (for rendering).
|
||||||
|
extra: E,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Renders a solid color.
|
/// Renders a solid color.
|
||||||
pub struct SolidColorDisplayItem {
|
pub struct SolidColorDisplayItem<E> {
|
||||||
base: BaseDisplayItem,
|
base: BaseDisplayItem<E>,
|
||||||
color: Color,
|
color: Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Renders text.
|
/// Renders text.
|
||||||
pub struct TextDisplayItem {
|
pub struct TextDisplayItem<E> {
|
||||||
base: BaseDisplayItem,
|
base: BaseDisplayItem<E>,
|
||||||
text_run: ~SendableTextRun,
|
text_run: ~SendableTextRun,
|
||||||
range: Range,
|
range: Range,
|
||||||
color: Color,
|
color: Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Renders an image.
|
/// Renders an image.
|
||||||
pub struct ImageDisplayItem {
|
pub struct ImageDisplayItem<E> {
|
||||||
base: BaseDisplayItem,
|
base: BaseDisplayItem<E>,
|
||||||
image: ARC<~Image>,
|
image: ARC<~Image>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Renders a border.
|
/// Renders a border.
|
||||||
pub struct BorderDisplayItem {
|
pub struct BorderDisplayItem<E> {
|
||||||
base: BaseDisplayItem,
|
base: BaseDisplayItem<E>,
|
||||||
/// The width of the border.
|
/// The width of the border.
|
||||||
width: Au,
|
width: Au,
|
||||||
/// The color of the border.
|
/// The color of the border.
|
||||||
color: Color,
|
color: Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DisplayItem {
|
impl<E> DisplayItem<E> {
|
||||||
/// Renders this display item into the given render context.
|
/// Renders this display item into the given render context.
|
||||||
fn draw_into_context(&self, render_context: &RenderContext) {
|
fn draw_into_context(&self, render_context: &RenderContext) {
|
||||||
match *self {
|
match *self {
|
||||||
|
|
|
@ -14,8 +14,12 @@ use geom::point::Point2D;
|
||||||
use geom::rect::Rect;
|
use geom::rect::Rect;
|
||||||
use geom::size::Size2D;
|
use geom::size::Size2D;
|
||||||
|
|
||||||
|
/// The type representing the lack of extra display list data. This is used when sending display
|
||||||
|
/// list data off to be rendered.
|
||||||
|
pub type Nothing = ();
|
||||||
|
|
||||||
pub struct RenderLayer {
|
pub struct RenderLayer {
|
||||||
display_list: DisplayList,
|
display_list: DisplayList<Nothing>,
|
||||||
size: Size2D<uint>
|
size: Size2D<uint>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
use layout::box::{RenderBox};
|
use layout::box::{RenderBox};
|
||||||
use layout::context::LayoutContext;
|
use layout::context::LayoutContext;
|
||||||
use layout::display_list_builder::{DisplayListBuilder, FlowDisplayListBuilderMethods};
|
use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData};
|
||||||
|
use layout::display_list_builder::{FlowDisplayListBuilderMethods};
|
||||||
use layout::flow::{BlockFlow, FlowContext, FlowData, InlineBlockFlow};
|
use layout::flow::{BlockFlow, FlowContext, FlowData, InlineBlockFlow};
|
||||||
use layout::inline::InlineLayout;
|
use layout::inline::InlineLayout;
|
||||||
|
|
||||||
|
@ -175,11 +176,11 @@ impl BlockFlowData {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_display_list_block(@mut self,
|
pub fn build_display_list_block<E:ExtraDisplayListData>(@mut self,
|
||||||
builder: &DisplayListBuilder,
|
builder: &DisplayListBuilder,
|
||||||
dirty: &Rect<Au>,
|
dirty: &Rect<Au>,
|
||||||
offset: &Point2D<Au>,
|
offset: &Point2D<Au>,
|
||||||
list: &Cell<DisplayList>) {
|
list: &Cell<DisplayList<E>>) {
|
||||||
// add box that starts block context
|
// add box that starts block context
|
||||||
self.box.map(|&box| {
|
self.box.map(|&box| {
|
||||||
box.build_display_list(builder, dirty, offset, list)
|
box.build_display_list(builder, dirty, offset, list)
|
||||||
|
@ -195,3 +196,4 @@ impl BlockFlowData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
use css::node_style::StyledNode;
|
use css::node_style::StyledNode;
|
||||||
use layout::context::LayoutContext;
|
use layout::context::LayoutContext;
|
||||||
use layout::display_list_builder::{DisplayListBuilder, ToGfxColor};
|
use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData, ToGfxColor};
|
||||||
use layout::flow::FlowContext;
|
use layout::flow::FlowContext;
|
||||||
use layout::model::BoxModel;
|
use layout::model::BoxModel;
|
||||||
use layout::text;
|
use layout::text;
|
||||||
|
@ -550,11 +550,11 @@ pub impl RenderBox {
|
||||||
/// representing the box's stacking context. When asked to construct its constituent display
|
/// representing the box's stacking context. When asked to construct its constituent display
|
||||||
/// items, each box puts its display items into the correct stack layer according to CSS 2.1
|
/// items, each box puts its display items into the correct stack layer according to CSS 2.1
|
||||||
/// Appendix E. Finally, the builder flattens the list.
|
/// Appendix E. Finally, the builder flattens the list.
|
||||||
fn build_display_list(&self,
|
fn build_display_list<E:ExtraDisplayListData>(&self,
|
||||||
_: &DisplayListBuilder,
|
_: &DisplayListBuilder,
|
||||||
dirty: &Rect<Au>,
|
dirty: &Rect<Au>,
|
||||||
offset: &Point2D<Au>,
|
offset: &Point2D<Au>,
|
||||||
list: &Cell<DisplayList>) {
|
list: &Cell<DisplayList<E>>) {
|
||||||
let box_bounds = self.position();
|
let box_bounds = self.position();
|
||||||
let absolute_box_bounds = box_bounds.translate(offset);
|
let absolute_box_bounds = box_bounds.translate(offset);
|
||||||
debug!("RenderBox::build_display_list at rel=%?, abs=%?: %s",
|
debug!("RenderBox::build_display_list at rel=%?, abs=%?: %s",
|
||||||
|
@ -582,6 +582,7 @@ pub impl RenderBox {
|
||||||
let text_display_item = ~TextDisplayItem {
|
let text_display_item = ~TextDisplayItem {
|
||||||
base: BaseDisplayItem {
|
base: BaseDisplayItem {
|
||||||
bounds: absolute_box_bounds,
|
bounds: absolute_box_bounds,
|
||||||
|
extra: ExtraDisplayListData::new(*self),
|
||||||
},
|
},
|
||||||
// FIXME(pcwalton): Allocation? Why?!
|
// FIXME(pcwalton): Allocation? Why?!
|
||||||
text_run: ~text_box.run.serialize(),
|
text_run: ~text_box.run.serialize(),
|
||||||
|
@ -602,6 +603,7 @@ pub impl RenderBox {
|
||||||
let border_display_item = ~BorderDisplayItem {
|
let border_display_item = ~BorderDisplayItem {
|
||||||
base: BaseDisplayItem {
|
base: BaseDisplayItem {
|
||||||
bounds: absolute_box_bounds,
|
bounds: absolute_box_bounds,
|
||||||
|
extra: ExtraDisplayListData::new(*self),
|
||||||
},
|
},
|
||||||
width: Au::from_px(1),
|
width: Au::from_px(1),
|
||||||
color: rgb(0, 0, 200).to_gfx_color(),
|
color: rgb(0, 0, 200).to_gfx_color(),
|
||||||
|
@ -621,6 +623,7 @@ pub impl RenderBox {
|
||||||
let border_display_item = ~BorderDisplayItem {
|
let border_display_item = ~BorderDisplayItem {
|
||||||
base: BaseDisplayItem {
|
base: BaseDisplayItem {
|
||||||
bounds: baseline,
|
bounds: baseline,
|
||||||
|
extra: ExtraDisplayListData::new(*self),
|
||||||
},
|
},
|
||||||
width: Au::from_px(1),
|
width: Au::from_px(1),
|
||||||
color: rgb(0, 200, 0).to_gfx_color(),
|
color: rgb(0, 200, 0).to_gfx_color(),
|
||||||
|
@ -644,6 +647,7 @@ pub impl RenderBox {
|
||||||
let image_display_item = ~ImageDisplayItem {
|
let image_display_item = ~ImageDisplayItem {
|
||||||
base: BaseDisplayItem {
|
base: BaseDisplayItem {
|
||||||
bounds: absolute_box_bounds,
|
bounds: absolute_box_bounds,
|
||||||
|
extra: ExtraDisplayListData::new(*self),
|
||||||
},
|
},
|
||||||
image: image.clone(),
|
image: image.clone(),
|
||||||
};
|
};
|
||||||
|
@ -668,9 +672,9 @@ pub impl RenderBox {
|
||||||
|
|
||||||
/// Adds the display items necessary to paint the background of this render box to the display
|
/// Adds the display items necessary to paint the background of this render box to the display
|
||||||
/// list if necessary.
|
/// list if necessary.
|
||||||
fn paint_background_if_applicable(&self,
|
fn paint_background_if_applicable<E:ExtraDisplayListData>(&self,
|
||||||
list: &Cell<DisplayList>,
|
list: &Cell<DisplayList<E>>,
|
||||||
absolute_bounds: &Rect<Au>) {
|
absolute_bounds: &Rect<Au>) {
|
||||||
// FIXME: This causes a lot of background colors to be displayed when they are clearly not
|
// FIXME: This causes a lot of background colors to be displayed when they are clearly not
|
||||||
// needed. We could use display list optimization to clean this up, but it still seems
|
// needed. We could use display list optimization to clean this up, but it still seems
|
||||||
// inefficient. What we really want is something like "nearest ancestor element that
|
// inefficient. What we really want is something like "nearest ancestor element that
|
||||||
|
@ -683,6 +687,7 @@ pub impl RenderBox {
|
||||||
let solid_color_display_item = ~SolidColorDisplayItem {
|
let solid_color_display_item = ~SolidColorDisplayItem {
|
||||||
base: BaseDisplayItem {
|
base: BaseDisplayItem {
|
||||||
bounds: *absolute_bounds,
|
bounds: *absolute_bounds,
|
||||||
|
extra: ExtraDisplayListData::new(*self),
|
||||||
},
|
},
|
||||||
color: background_color.to_gfx_color(),
|
color: background_color.to_gfx_color(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,15 +2,13 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
///
|
//! Constructs display lists from render boxes.
|
||||||
/// Constructs display lists from render boxes.
|
|
||||||
///
|
|
||||||
|
|
||||||
use core::cell::Cell;
|
|
||||||
|
|
||||||
|
use layout::box::RenderBox;
|
||||||
use layout::context::LayoutContext;
|
use layout::context::LayoutContext;
|
||||||
use layout::flow::FlowContext;
|
use layout::flow::FlowContext;
|
||||||
|
|
||||||
|
use core::cell::Cell;
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use geom::rect::Rect;
|
use geom::rect::Rect;
|
||||||
use gfx::display_list::DisplayList;
|
use gfx::display_list::DisplayList;
|
||||||
|
@ -19,6 +17,28 @@ use gfx;
|
||||||
use newcss;
|
use newcss;
|
||||||
use servo_util::tree::TreeNodeRef;
|
use servo_util::tree::TreeNodeRef;
|
||||||
|
|
||||||
|
/// Extra display list data is either nothing (if the display list is to be rendered) or the
|
||||||
|
/// originating render box (if the display list is generated for hit testing).
|
||||||
|
pub trait ExtraDisplayListData {
|
||||||
|
fn new(box: RenderBox) -> Self;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The type representing the lack of extra display list data. This is used when sending display
|
||||||
|
/// list data off to be rendered.
|
||||||
|
pub type Nothing = ();
|
||||||
|
|
||||||
|
impl ExtraDisplayListData for Nothing {
|
||||||
|
fn new(_: RenderBox) -> Nothing {
|
||||||
|
()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ExtraDisplayListData for RenderBox {
|
||||||
|
fn new(box: RenderBox) -> RenderBox {
|
||||||
|
box
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A builder object that manages display list builder should mainly hold information about the
|
/// A builder object that manages display list builder should mainly hold information about the
|
||||||
/// initial request and desired result--for example, whether the `DisplayList` is to be used for
|
/// initial request and desired result--for example, whether the `DisplayList` is to be used for
|
||||||
/// painting or hit testing. This can affect which boxes are created.
|
/// painting or hit testing. This can affect which boxes are created.
|
||||||
|
@ -30,30 +50,33 @@ pub struct DisplayListBuilder<'self> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait FlowDisplayListBuilderMethods {
|
pub trait FlowDisplayListBuilderMethods {
|
||||||
fn build_display_list(&self, a: &DisplayListBuilder, b: &Rect<Au>, c: &Cell<DisplayList>);
|
fn build_display_list<E:ExtraDisplayListData>(&self,
|
||||||
fn build_display_list_for_child(&self,
|
a: &DisplayListBuilder,
|
||||||
a: &DisplayListBuilder,
|
b: &Rect<Au>,
|
||||||
b: FlowContext,
|
c: &Cell<DisplayList<E>>);
|
||||||
c: &Rect<Au>,
|
fn build_display_list_for_child<E:ExtraDisplayListData>(&self,
|
||||||
d: &Point2D<Au>,
|
a: &DisplayListBuilder,
|
||||||
e: &Cell<DisplayList>);
|
b: FlowContext,
|
||||||
|
c: &Rect<Au>,
|
||||||
|
d: &Point2D<Au>,
|
||||||
|
e: &Cell<DisplayList<E>>);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlowDisplayListBuilderMethods for FlowContext {
|
impl FlowDisplayListBuilderMethods for FlowContext {
|
||||||
fn build_display_list(&self,
|
fn build_display_list<E:ExtraDisplayListData>(&self,
|
||||||
builder: &DisplayListBuilder,
|
builder: &DisplayListBuilder,
|
||||||
dirty: &Rect<Au>,
|
dirty: &Rect<Au>,
|
||||||
list: &Cell<DisplayList>) {
|
list: &Cell<DisplayList<E>>) {
|
||||||
let zero = gfx::geometry::zero_point();
|
let zero = gfx::geometry::zero_point();
|
||||||
self.build_display_list_recurse(builder, dirty, &zero, list);
|
self.build_display_list_recurse(builder, dirty, &zero, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_display_list_for_child(&self,
|
fn build_display_list_for_child<E:ExtraDisplayListData>(&self,
|
||||||
builder: &DisplayListBuilder,
|
builder: &DisplayListBuilder,
|
||||||
child_flow: FlowContext,
|
child_flow: FlowContext,
|
||||||
dirty: &Rect<Au>,
|
dirty: &Rect<Au>,
|
||||||
offset: &Point2D<Au>,
|
offset: &Point2D<Au>,
|
||||||
list: &Cell<DisplayList>) {
|
list: &Cell<DisplayList<E>>) {
|
||||||
// Adjust the dirty rect to child flow context coordinates.
|
// Adjust the dirty rect to child flow context coordinates.
|
||||||
do child_flow.with_base |child_node| {
|
do child_flow.with_base |child_node| {
|
||||||
let abs_flow_bounds = child_node.position.translate(offset);
|
let abs_flow_bounds = child_node.position.translate(offset);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
use layout::block::BlockFlowData;
|
use layout::block::BlockFlowData;
|
||||||
use layout::box::RenderBox;
|
use layout::box::RenderBox;
|
||||||
use layout::context::LayoutContext;
|
use layout::context::LayoutContext;
|
||||||
use layout::display_list_builder::DisplayListBuilder;
|
use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData};
|
||||||
use layout::inline::{InlineFlowData};
|
use layout::inline::{InlineFlowData};
|
||||||
|
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
|
@ -284,11 +284,11 @@ impl<'self> FlowContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_display_list_recurse(&self,
|
pub fn build_display_list_recurse<E:ExtraDisplayListData>(&self,
|
||||||
builder: &DisplayListBuilder,
|
builder: &DisplayListBuilder,
|
||||||
dirty: &Rect<Au>,
|
dirty: &Rect<Au>,
|
||||||
offset: &Point2D<Au>,
|
offset: &Point2D<Au>,
|
||||||
list: &Cell<DisplayList>) {
|
list: &Cell<DisplayList<E>>) {
|
||||||
do self.with_base |info| {
|
do self.with_base |info| {
|
||||||
debug!("FlowContext::build_display_list at %?: %s", info.position, self.debug_str());
|
debug!("FlowContext::build_display_list at %?: %s", info.position, self.debug_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use core;
|
||||||
use layout::box::{CannotSplit, GenericRenderBoxClass, ImageRenderBoxClass, RenderBox};
|
use layout::box::{CannotSplit, GenericRenderBoxClass, ImageRenderBoxClass, RenderBox};
|
||||||
use layout::box::{SplitDidFit, SplitDidNotFit, TextRenderBoxClass, UnscannedTextRenderBoxClass};
|
use layout::box::{SplitDidFit, SplitDidNotFit, TextRenderBoxClass, UnscannedTextRenderBoxClass};
|
||||||
use layout::context::LayoutContext;
|
use layout::context::LayoutContext;
|
||||||
use layout::display_list_builder::DisplayListBuilder;
|
use layout::display_list_builder::{DisplayListBuilder, ExtraDisplayListData};
|
||||||
use layout::flow::{FlowContext, FlowData, InlineFlow};
|
use layout::flow::{FlowContext, FlowData, InlineFlow};
|
||||||
use layout::text::{UnscannedMethods, adapt_textbox_with_range};
|
use layout::text::{UnscannedMethods, adapt_textbox_with_range};
|
||||||
|
|
||||||
|
@ -864,11 +864,11 @@ impl InlineFlowData {
|
||||||
self.common.position.size.height = cur_y;
|
self.common.position.size.height = cur_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_display_list_inline(&self,
|
pub fn build_display_list_inline<E:ExtraDisplayListData>(&self,
|
||||||
builder: &DisplayListBuilder,
|
builder: &DisplayListBuilder,
|
||||||
dirty: &Rect<Au>,
|
dirty: &Rect<Au>,
|
||||||
offset: &Point2D<Au>,
|
offset: &Point2D<Au>,
|
||||||
list: &Cell<DisplayList>) {
|
list: &Cell<DisplayList<E>>) {
|
||||||
// TODO(#228): Once we form line boxes and have their cached bounds, we can be smarter and
|
// TODO(#228): Once we form line boxes and have their cached bounds, we can be smarter and
|
||||||
// not recurse on a line if nothing in it can intersect the dirty region.
|
// not recurse on a line if nothing in it can intersect the dirty region.
|
||||||
debug!("FlowContext[%d]: building display list for %u inline boxes",
|
debug!("FlowContext[%d]: building display list for %u inline boxes",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
//! Borders, padding, and margins.
|
//! Borders, padding, and margins.
|
||||||
|
|
||||||
use layout::display_list_builder::ToGfxColor;
|
use layout::display_list_builder::{ExtraDisplayListData, ToGfxColor};
|
||||||
use layout::box::RenderBox;
|
use layout::box::RenderBox;
|
||||||
|
|
||||||
use core::cell::Cell;
|
use core::cell::Cell;
|
||||||
|
@ -76,7 +76,9 @@ impl BoxModel {
|
||||||
impl RenderBox {
|
impl RenderBox {
|
||||||
/// Adds the display items necessary to paint the borders of this render box to a display list
|
/// Adds the display items necessary to paint the borders of this render box to a display list
|
||||||
/// if necessary.
|
/// if necessary.
|
||||||
pub fn paint_borders_if_applicable(&self, list: &Cell<DisplayList>, abs_bounds: &Rect<Au>) {
|
pub fn paint_borders_if_applicable<E:ExtraDisplayListData>(&self,
|
||||||
|
list: &Cell<DisplayList<E>>,
|
||||||
|
abs_bounds: &Rect<Au>) {
|
||||||
// Fast path.
|
// Fast path.
|
||||||
let border = do self.with_imm_base |base| {
|
let border = do self.with_imm_base |base| {
|
||||||
base.model.border
|
base.model.border
|
||||||
|
@ -109,6 +111,7 @@ impl RenderBox {
|
||||||
let border_display_item = ~BorderDisplayItem {
|
let border_display_item = ~BorderDisplayItem {
|
||||||
base: BaseDisplayItem {
|
base: BaseDisplayItem {
|
||||||
bounds: bounds,
|
bounds: bounds,
|
||||||
|
extra: ExtraDisplayListData::new(*self),
|
||||||
},
|
},
|
||||||
width: border_width,
|
width: border_width,
|
||||||
color: color,
|
color: color,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue