mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #16891 - kvark:preserve3d, r=glennw,emilio
Using TransformStyle::Preserve3D <!-- Please describe your changes on the following line: --> The changes were reviewed previously as a part of WR update PRs, but then we decided to move them out. r? @emilio --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16891) <!-- Reviewable:end -->
This commit is contained in:
commit
a5ff57b20f
9 changed files with 79 additions and 57 deletions
|
@ -68,7 +68,8 @@ use style::values::specified::position::{X, Y};
|
|||
use style_traits::CSSPixel;
|
||||
use style_traits::cursor::Cursor;
|
||||
use table_cell::CollapsedBordersForCell;
|
||||
use webrender_traits::{ColorF, ClipId, GradientStop, RepeatMode, ScrollPolicy};
|
||||
use webrender_helpers::{ToMixBlendMode, ToTransformStyle};
|
||||
use webrender_traits::{ColorF, ClipId, GradientStop, RepeatMode, ScrollPolicy, TransformStyle};
|
||||
|
||||
trait ResolvePercentage {
|
||||
fn resolve(&self, length: u32) -> u32;
|
||||
|
@ -184,6 +185,9 @@ pub struct DisplayListBuildState<'a> {
|
|||
/// A stack of clips used to cull display list entries that are outside the
|
||||
/// rendered region, but only collected at containing block boundaries.
|
||||
pub containing_block_clip_stack: Vec<Rect<Au>>,
|
||||
|
||||
/// The current transform style of the stacking context.
|
||||
current_transform_style: TransformStyle,
|
||||
}
|
||||
|
||||
impl<'a> DisplayListBuildState<'a> {
|
||||
|
@ -201,6 +205,7 @@ impl<'a> DisplayListBuildState<'a> {
|
|||
iframe_sizes: Vec::new(),
|
||||
clip_stack: Vec::new(),
|
||||
containing_block_clip_stack: Vec::new(),
|
||||
current_transform_style: TransformStyle::Flat,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,6 +217,7 @@ impl<'a> DisplayListBuildState<'a> {
|
|||
fn add_stacking_context(&mut self,
|
||||
parent_id: StackingContextId,
|
||||
stacking_context: StackingContext) {
|
||||
self.current_transform_style = stacking_context.transform_style;
|
||||
let info = self.stacking_context_info
|
||||
.entry(parent_id)
|
||||
.or_insert(StackingContextInfo::new());
|
||||
|
@ -1947,8 +1953,9 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
&overflow,
|
||||
self.effective_z_index(),
|
||||
filters,
|
||||
self.style().get_effects().mix_blend_mode,
|
||||
self.style().get_effects().mix_blend_mode.to_mix_blend_mode(),
|
||||
self.transform_matrix(&border_box),
|
||||
self.style().get_used_transform_style().to_transform_style(),
|
||||
self.perspective_matrix(&border_box),
|
||||
scroll_policy,
|
||||
parent_scroll_id)
|
||||
|
@ -2153,6 +2160,7 @@ pub struct PreservedDisplayListState {
|
|||
containing_block_scroll_root_id: ClipId,
|
||||
clips_pushed: usize,
|
||||
containing_block_clips_pushed: usize,
|
||||
transform_style: TransformStyle,
|
||||
}
|
||||
|
||||
impl PreservedDisplayListState {
|
||||
|
@ -2163,6 +2171,7 @@ impl PreservedDisplayListState {
|
|||
containing_block_scroll_root_id: state.containing_block_scroll_root_id,
|
||||
clips_pushed: 0,
|
||||
containing_block_clips_pushed: 0,
|
||||
transform_style: state.current_transform_style,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2183,6 +2192,8 @@ impl PreservedDisplayListState {
|
|||
let truncate_length = state.containing_block_clip_stack.len() -
|
||||
self.containing_block_clips_pushed;
|
||||
state.containing_block_clip_stack.truncate(truncate_length);
|
||||
|
||||
state.current_transform_style = self.transform_style;
|
||||
}
|
||||
|
||||
fn push_clip(&mut self,
|
||||
|
@ -2622,14 +2633,14 @@ impl InlineFlowDisplayListBuilding for InlineFlow {
|
|||
fragment.stacking_context_id = fragment.stacking_context_id();
|
||||
|
||||
let current_stacking_context_id = state.current_stacking_context_id;
|
||||
let current_scroll_root_id = state.current_scroll_root_id;
|
||||
let stacking_context = fragment.create_stacking_context(fragment.stacking_context_id,
|
||||
&self.base,
|
||||
ScrollPolicy::Scrollable,
|
||||
StackingContextCreationMode::Normal,
|
||||
state.current_scroll_root_id);
|
||||
|
||||
state.add_stacking_context(current_stacking_context_id,
|
||||
fragment.create_stacking_context(
|
||||
fragment.stacking_context_id,
|
||||
&self.base,
|
||||
ScrollPolicy::Scrollable,
|
||||
StackingContextCreationMode::Normal,
|
||||
current_scroll_root_id));
|
||||
stacking_context);
|
||||
}
|
||||
_ => fragment.stacking_context_id = state.current_stacking_context_id,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue