mirror of
https://github.com/servo/servo.git
synced 2025-07-13 02:13:40 +01:00
Auto merge of #22825 - asajeffrey:layout-fullscreen-top-layer, r=jdm
Layout fullscreen top layer <!-- Please describe your changes on the following line: --> Implement the fullscreen top layer described at https://fullscreen.spec.whatwg.org/#top-layer --- <!-- 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 - [X] There are tests for these changes OR <!-- 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/22825) <!-- Reviewable:end -->
This commit is contained in:
commit
73ff9995fb
6 changed files with 38 additions and 7 deletions
|
@ -1917,6 +1917,7 @@ impl Fragment {
|
|||
border_box.to_layout(),
|
||||
overflow.to_layout(),
|
||||
self.effective_z_index(),
|
||||
self.style().get_box()._servo_top_layer,
|
||||
filters,
|
||||
self.style().get_effects().mix_blend_mode.to_layout(),
|
||||
self.transform_matrix(&border_box),
|
||||
|
|
|
@ -22,6 +22,7 @@ use std::cmp::Ordering;
|
|||
use std::collections::HashMap;
|
||||
use std::f32;
|
||||
use std::fmt;
|
||||
use style::computed_values::_servo_top_layer::T as InTopLayer;
|
||||
use webrender_api as wr;
|
||||
use webrender_api::{BorderRadius, ClipMode};
|
||||
use webrender_api::{ComplexClipRegion, ExternalScrollId, FilterOp};
|
||||
|
@ -189,6 +190,9 @@ pub struct StackingContext {
|
|||
/// The `z-index` for this stacking context.
|
||||
pub z_index: i32,
|
||||
|
||||
/// Whether this is the top layer.
|
||||
pub in_top_layer: InTopLayer,
|
||||
|
||||
/// CSS filters to be applied to this stacking context (including opacity).
|
||||
pub filters: Vec<FilterOp>,
|
||||
|
||||
|
@ -220,6 +224,7 @@ impl StackingContext {
|
|||
bounds: LayoutRect,
|
||||
overflow: LayoutRect,
|
||||
z_index: i32,
|
||||
in_top_layer: InTopLayer,
|
||||
filters: Vec<FilterOp>,
|
||||
mix_blend_mode: MixBlendMode,
|
||||
transform: Option<LayoutTransform>,
|
||||
|
@ -234,6 +239,7 @@ impl StackingContext {
|
|||
bounds,
|
||||
overflow,
|
||||
z_index,
|
||||
in_top_layer,
|
||||
filters,
|
||||
mix_blend_mode,
|
||||
transform,
|
||||
|
@ -252,6 +258,7 @@ impl StackingContext {
|
|||
LayoutRect::zero(),
|
||||
LayoutRect::zero(),
|
||||
0,
|
||||
InTopLayer::None,
|
||||
vec![],
|
||||
MixBlendMode::Normal,
|
||||
None,
|
||||
|
@ -283,6 +290,16 @@ impl StackingContext {
|
|||
|
||||
impl Ord for StackingContext {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
if self.in_top_layer == InTopLayer::Top {
|
||||
if other.in_top_layer == InTopLayer::Top {
|
||||
return Ordering::Equal;
|
||||
} else {
|
||||
return Ordering::Greater;
|
||||
}
|
||||
} else if other.in_top_layer == InTopLayer::Top {
|
||||
return Ordering::Less;
|
||||
}
|
||||
|
||||
if self.z_index != 0 || other.z_index != 0 {
|
||||
return self.z_index.cmp(&other.z_index);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,17 @@ ${helpers.single_keyword(
|
|||
spec="Internal (not web-exposed)",
|
||||
)}
|
||||
|
||||
// An internal-only attribute for elements in a top layer
|
||||
// https://fullscreen.spec.whatwg.org/#top-layer
|
||||
${helpers.single_keyword(
|
||||
"-servo-top-layer",
|
||||
"none top",
|
||||
products="servo",
|
||||
animation_value_type="none",
|
||||
enabled_in="ua",
|
||||
spec="Internal (not web-exposed)",
|
||||
)}
|
||||
|
||||
${helpers.single_keyword(
|
||||
"position",
|
||||
"static absolute relative fixed sticky",
|
||||
|
|
|
@ -3627,11 +3627,12 @@ impl<'a> StyleBuilder<'a> {
|
|||
Position::Absolute | Position::Fixed)
|
||||
}
|
||||
|
||||
/// Whether this style has a top-layer style. That's implemented in Gecko
|
||||
/// via the -moz-top-layer property, but servo doesn't have any concept of a
|
||||
/// top layer (yet, it's needed for fullscreen).
|
||||
/// Whether this style has a top-layer style.
|
||||
#[cfg(feature = "servo")]
|
||||
pub fn in_top_layer(&self) -> bool { false }
|
||||
pub fn in_top_layer(&self) -> bool {
|
||||
matches!(self.get_box().clone__servo_top_layer(),
|
||||
longhands::_servo_top_layer::computed_value::T::Top)
|
||||
}
|
||||
|
||||
/// Whether this style has a top-layer style.
|
||||
#[cfg(feature = "gecko")]
|
||||
|
|
|
@ -302,6 +302,10 @@ textarea { white-space: pre-wrap; }
|
|||
|
||||
/* intentionally not !important */
|
||||
object-fit:contain;
|
||||
|
||||
/* The internal-only -servo-top-layer attribute is used
|
||||
to implement https://fullscreen.spec.whatwg.org/#top-layer */
|
||||
-servo-top-layer: top;
|
||||
}
|
||||
|
||||
iframe:fullscreen {
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[fullscreen-hides-others.html]
|
||||
type: reftest
|
||||
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue