mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Create a solid rectangle display list entry for the page background.
This commit is contained in:
parent
e57e2121b2
commit
10ab466e5d
4 changed files with 37 additions and 11 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -5405,7 +5405,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webrender"
|
name = "webrender"
|
||||||
version = "0.60.0"
|
version = "0.60.0"
|
||||||
source = "git+https://github.com/servo/webrender#fb1c0cf5ee16724820d004ad77e9f72beeeb7181"
|
source = "git+https://github.com/servo/webrender#81703c1274cd4935f82412d4e5819942934d0c96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -5446,7 +5446,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webrender_api"
|
name = "webrender_api"
|
||||||
version = "0.60.0"
|
version = "0.60.0"
|
||||||
source = "git+https://github.com/servo/webrender#fb1c0cf5ee16724820d004ad77e9f72beeeb7181"
|
source = "git+https://github.com/servo/webrender#81703c1274cd4935f82412d4e5819942934d0c96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -5468,7 +5468,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webrender_build"
|
name = "webrender_build"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/webrender#fb1c0cf5ee16724820d004ad77e9f72beeeb7181"
|
source = "git+https://github.com/servo/webrender#81703c1274cd4935f82412d4e5819942934d0c96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
@ -5620,7 +5620,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wr_malloc_size_of"
|
name = "wr_malloc_size_of"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/webrender#fb1c0cf5ee16724820d004ad77e9f72beeeb7181"
|
source = "git+https://github.com/servo/webrender#81703c1274cd4935f82412d4e5819942934d0c96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -345,7 +345,7 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_display_item(&mut self, display_item: DisplayItem) {
|
pub fn add_display_item(&mut self, display_item: DisplayItem) {
|
||||||
let items = self
|
let items = self
|
||||||
.items
|
.items
|
||||||
.entry(display_item.stacking_context_id())
|
.entry(display_item.stacking_context_id())
|
||||||
|
@ -374,7 +374,7 @@ impl<'a> DisplayListBuildState<'a> {
|
||||||
self.processing_scrolling_overflow_element
|
self.processing_scrolling_overflow_element
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_base_display_item(
|
pub fn create_base_display_item(
|
||||||
&self,
|
&self,
|
||||||
bounds: Rect<Au>,
|
bounds: Rect<Au>,
|
||||||
clip_rect: Rect<Au>,
|
clip_rect: Rect<Au>,
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
use crate::context::LayoutContext;
|
use crate::context::LayoutContext;
|
||||||
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
use crate::display_list::{DisplayListBuildState, StackingContextCollectionState};
|
||||||
|
use crate::display_list::items::{self, CommonDisplayItem, DisplayItem, DisplayListSection};
|
||||||
use crate::floats::SpeculatedFloatPlacement;
|
use crate::floats::SpeculatedFloatPlacement;
|
||||||
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
use crate::flow::{Flow, FlowFlags, GetBaseFlow, ImmutableFlowUtils};
|
||||||
use crate::fragment::{CoordinateSystem, FragmentBorderBoxIterator};
|
use crate::fragment::{CoordinateSystem, FragmentBorderBoxIterator};
|
||||||
|
@ -14,7 +15,7 @@ use crate::incremental::RelayoutMode;
|
||||||
use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
|
use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList};
|
||||||
use crate::traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal};
|
use crate::traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal};
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use euclid::{Point2D, Vector2D};
|
use euclid::{Point2D, Rect, Size2D, Vector2D};
|
||||||
use servo_config::opts;
|
use servo_config::opts;
|
||||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||||
use webrender_api::units::LayoutPoint;
|
use webrender_api::units::LayoutPoint;
|
||||||
|
@ -72,11 +73,31 @@ pub fn reflow(root: &mut dyn Flow, layout_context: &LayoutContext, relayout_mode
|
||||||
pub fn build_display_list_for_subtree<'a>(
|
pub fn build_display_list_for_subtree<'a>(
|
||||||
flow_root: &mut dyn Flow,
|
flow_root: &mut dyn Flow,
|
||||||
layout_context: &'a LayoutContext,
|
layout_context: &'a LayoutContext,
|
||||||
|
background_color: webrender_api::ColorF,
|
||||||
|
client_size: Size2D<Au>,
|
||||||
) -> DisplayListBuildState<'a> {
|
) -> DisplayListBuildState<'a> {
|
||||||
let mut state = StackingContextCollectionState::new(layout_context.id);
|
let mut state = StackingContextCollectionState::new(layout_context.id);
|
||||||
flow_root.collect_stacking_contexts(&mut state);
|
flow_root.collect_stacking_contexts(&mut state);
|
||||||
|
|
||||||
let state = DisplayListBuildState::new(layout_context, state);
|
let mut state = DisplayListBuildState::new(layout_context, state);
|
||||||
|
|
||||||
|
// Create a base rectangle for the page background based on the root
|
||||||
|
// background color.
|
||||||
|
let base = state.create_base_display_item(
|
||||||
|
Rect::new(Point2D::new(Au::new(0), Au::new(0)), client_size),
|
||||||
|
Rect::new(Point2D::new(Au::new(0), Au::new(0)), client_size),
|
||||||
|
flow_root.as_block().fragment.node,
|
||||||
|
None,
|
||||||
|
DisplayListSection::BackgroundAndBorders,
|
||||||
|
);
|
||||||
|
state.add_display_item(DisplayItem::Rectangle(CommonDisplayItem::new(
|
||||||
|
base,
|
||||||
|
webrender_api::RectangleDisplayItem {
|
||||||
|
color: background_color,
|
||||||
|
common: items::empty_common_item_properties(),
|
||||||
|
},
|
||||||
|
)));
|
||||||
|
|
||||||
let mut build_display_list = BuildDisplayList { state: state };
|
let mut build_display_list = BuildDisplayList { state: state };
|
||||||
build_display_list.traverse(flow_root);
|
build_display_list.traverse(flow_root);
|
||||||
build_display_list.state
|
build_display_list.state
|
||||||
|
|
|
@ -1138,8 +1138,13 @@ impl LayoutThread {
|
||||||
rw_data.display_list.is_none()
|
rw_data.display_list.is_none()
|
||||||
{
|
{
|
||||||
if reflow_goal.needs_display_list() {
|
if reflow_goal.needs_display_list() {
|
||||||
let mut build_state =
|
let background_color = get_root_flow_background_color(layout_root);
|
||||||
sequential::build_display_list_for_subtree(layout_root, layout_context);
|
let mut build_state = sequential::build_display_list_for_subtree(
|
||||||
|
layout_root,
|
||||||
|
layout_context,
|
||||||
|
background_color,
|
||||||
|
data.page_clip_rect.size,
|
||||||
|
);
|
||||||
|
|
||||||
debug!("Done building display list.");
|
debug!("Done building display list.");
|
||||||
|
|
||||||
|
@ -1255,7 +1260,7 @@ impl LayoutThread {
|
||||||
let mut txn = webrender_api::Transaction::new();
|
let mut txn = webrender_api::Transaction::new();
|
||||||
txn.set_display_list(
|
txn.set_display_list(
|
||||||
webrender_api::Epoch(epoch.0),
|
webrender_api::Epoch(epoch.0),
|
||||||
Some(get_root_flow_background_color(layout_root)),
|
None,
|
||||||
viewport_size,
|
viewport_size,
|
||||||
builder.finalize(),
|
builder.finalize(),
|
||||||
true,
|
true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue