2020: paint background-color

This commit is contained in:
Simon Sapin 2019-10-15 17:52:51 +02:00
parent 4e8eeda976
commit cfc3ffcd54
8 changed files with 143 additions and 24 deletions

View file

@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::display_list::IsContentful;
use crate::dom_traversal::{Contents, NodeExt};
use crate::flow::construct::ContainsFloats;
use crate::flow::float::FloatBox;
use crate::flow::{BlockContainer, BlockFormattingContext, BlockLevelBox};
use crate::fragments::{Fragment, IsContentful};
use crate::fragments::Fragment;
use crate::geom;
use crate::geom::flow_relative::Vec2;
use crate::positioned::AbsolutelyPositionedBox;
@ -20,8 +21,8 @@ use servo_arc::Arc;
use style::context::SharedStyleContext;
use style::properties::ComputedValues;
use style::values::computed::{Length, LengthOrAuto};
use style::Zero;
use style_traits::CSSPixel;
use webrender_api::DisplayListBuilder;
pub struct BoxTreeRoot(BlockFormattingContext);
pub struct FragmentTreeRoot(Vec<Fragment>);
@ -132,10 +133,25 @@ impl BoxTreeRoot {
}
impl FragmentTreeRoot {
pub fn build_display_list(&self, builder: &mut DisplayListBuilder) -> IsContentful {
pub fn build_display_list(
&self,
builder: &mut crate::display_list::DisplayListBuilder,
pipeline_id: msg::constellation_msg::PipelineId,
viewport_size: webrender_api::units::LayoutSize,
) -> IsContentful {
let containing_block = geom::physical::Rect {
top_left: geom::physical::Vec2 {
x: Length::zero(),
y: Length::zero(),
},
size: geom::physical::Vec2 {
x: Length::new(viewport_size.width),
y: Length::new(viewport_size.height),
},
};
let mut is_contentful = IsContentful(false);
for fragment in &self.0 {
fragment.build_display_list(builder, &mut is_contentful)
fragment.build_display_list(builder, &mut is_contentful, &containing_block)
}
is_contentful
}