mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
style: Introduce a generic way of gathering information from the cascade, and use it for viewport units.
This commit is contained in:
parent
40c04b4c6b
commit
9e88a495c8
12 changed files with 205 additions and 23 deletions
|
@ -394,6 +394,7 @@ fn compute_style_for_animation_step(context: &SharedStyleContext,
|
||||||
false,
|
false,
|
||||||
Some(previous_style),
|
Some(previous_style),
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
context.error_reporter.clone());
|
context.error_reporter.clone());
|
||||||
computed
|
computed
|
||||||
}
|
}
|
||||||
|
|
78
components/style/cascade_info.rs
Normal file
78
components/style/cascade_info.rs
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* 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/. */
|
||||||
|
use dom::TNode;
|
||||||
|
use properties::{DeclaredValue, PropertyDeclaration};
|
||||||
|
use values::HasViewportPercentage;
|
||||||
|
|
||||||
|
/// A structure to collect information about the cascade.
|
||||||
|
///
|
||||||
|
/// This is useful to gather information about what an element is affected by,
|
||||||
|
/// and can be used in the future to track optimisations like when a
|
||||||
|
/// non-inherited property is explicitly inherited, in order to cut-off the
|
||||||
|
/// traversal.
|
||||||
|
pub struct CascadeInfo {
|
||||||
|
pub saw_viewport_units: bool,
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
finished: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CascadeInfo {
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
pub fn new() -> Self {
|
||||||
|
CascadeInfo {
|
||||||
|
saw_viewport_units: false,
|
||||||
|
finished: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
pub fn new() -> Self {
|
||||||
|
CascadeInfo {
|
||||||
|
saw_viewport_units: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Called when a property is cascaded.
|
||||||
|
///
|
||||||
|
/// NOTE: We can add a vast amount of information here.
|
||||||
|
#[inline]
|
||||||
|
pub fn on_cascade_property<T>(&mut self,
|
||||||
|
_property_declaration: &PropertyDeclaration,
|
||||||
|
value: &DeclaredValue<T>)
|
||||||
|
where T: HasViewportPercentage
|
||||||
|
{
|
||||||
|
// TODO: we can be smarter and keep a property bitfield to keep track of
|
||||||
|
// the last applying rule.
|
||||||
|
if value.has_viewport_percentage() {
|
||||||
|
self.saw_viewport_units = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
fn mark_as_finished_if_appropriate(&mut self) {
|
||||||
|
self.finished = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
fn mark_as_finished_if_appropriate(&mut self) {}
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
pub fn finish<N: TNode>(mut self, node: &N) {
|
||||||
|
self.mark_as_finished_if_appropriate();
|
||||||
|
|
||||||
|
if self.saw_viewport_units {
|
||||||
|
unsafe {
|
||||||
|
node.set_dirty_on_viewport_size_changed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
impl Drop for CascadeInfo {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
debug_assert!(self.finished,
|
||||||
|
"Didn't use the result of CascadeInfo, if you don't need it, consider passing None");
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,6 +39,12 @@ pub struct SpecifiedValue {
|
||||||
references: HashSet<Name>,
|
references: HashSet<Name>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ::values::HasViewportPercentage for SpecifiedValue {
|
||||||
|
fn has_viewport_percentage(&self) -> bool {
|
||||||
|
panic!("has_viewport_percentage called before resolving!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct BorrowedSpecifiedValue<'a> {
|
pub struct BorrowedSpecifiedValue<'a> {
|
||||||
css: &'a str,
|
css: &'a str,
|
||||||
first_token_type: TokenSerializationType,
|
first_token_type: TokenSerializationType,
|
||||||
|
|
|
@ -74,6 +74,7 @@ pub mod animation;
|
||||||
pub mod attr;
|
pub mod attr;
|
||||||
pub mod bezier;
|
pub mod bezier;
|
||||||
pub mod cache;
|
pub mod cache;
|
||||||
|
pub mod cascade_info;
|
||||||
pub mod context;
|
pub mod context;
|
||||||
pub mod custom_properties;
|
pub mod custom_properties;
|
||||||
pub mod data;
|
pub mod data;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
use animation;
|
use animation;
|
||||||
use arc_ptr_eq;
|
use arc_ptr_eq;
|
||||||
use cache::{LRUCache, SimpleHashCache};
|
use cache::{LRUCache, SimpleHashCache};
|
||||||
|
use cascade_info::CascadeInfo;
|
||||||
use context::{StyleContext, SharedStyleContext};
|
use context::{StyleContext, SharedStyleContext};
|
||||||
use data::PrivateStyleData;
|
use data::PrivateStyleData;
|
||||||
use dom::{TElement, TNode, TRestyleDamage};
|
use dom::{TElement, TNode, TRestyleDamage};
|
||||||
|
@ -443,6 +444,7 @@ trait PrivateMatchMethods: TNode {
|
||||||
&mut old_style) && cacheable;
|
&mut old_style) && cacheable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut cascade_info = CascadeInfo::new();
|
||||||
let (this_style, is_cacheable) = match parent_style {
|
let (this_style, is_cacheable) = match parent_style {
|
||||||
Some(ref parent_style) => {
|
Some(ref parent_style) => {
|
||||||
let cache_entry = applicable_declarations_cache.find(applicable_declarations);
|
let cache_entry = applicable_declarations_cache.find(applicable_declarations);
|
||||||
|
@ -456,6 +458,7 @@ trait PrivateMatchMethods: TNode {
|
||||||
shareable,
|
shareable,
|
||||||
Some(&***parent_style),
|
Some(&***parent_style),
|
||||||
cached_computed_values,
|
cached_computed_values,
|
||||||
|
Some(&mut cascade_info),
|
||||||
shared_context.error_reporter.clone())
|
shared_context.error_reporter.clone())
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
@ -464,9 +467,11 @@ trait PrivateMatchMethods: TNode {
|
||||||
shareable,
|
shareable,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
Some(&mut cascade_info),
|
||||||
shared_context.error_reporter.clone())
|
shared_context.error_reporter.clone())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
cascade_info.finish(self);
|
||||||
|
|
||||||
cacheable = cacheable && is_cacheable;
|
cacheable = cacheable && is_cacheable;
|
||||||
|
|
||||||
|
@ -497,7 +502,6 @@ trait PrivateMatchMethods: TNode {
|
||||||
cacheable = cacheable && !animations_started
|
cacheable = cacheable && !animations_started
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Cache the resolved style if it was cacheable.
|
// Cache the resolved style if it was cacheable.
|
||||||
if cacheable {
|
if cacheable {
|
||||||
applicable_declarations_cache.insert(applicable_declarations.to_vec(),
|
applicable_declarations_cache.insert(applicable_declarations.to_vec(),
|
||||||
|
|
|
@ -167,6 +167,7 @@
|
||||||
use parser::{ParserContext, ParserContextExtraData};
|
use parser::{ParserContext, ParserContextExtraData};
|
||||||
use properties::{CSSWideKeyword, DeclaredValue, Shorthand};
|
use properties::{CSSWideKeyword, DeclaredValue, Shorthand};
|
||||||
% endif
|
% endif
|
||||||
|
use cascade_info::CascadeInfo;
|
||||||
use error_reporting::ParseErrorReporter;
|
use error_reporting::ParseErrorReporter;
|
||||||
use properties::longhands;
|
use properties::longhands;
|
||||||
use properties::property_bit_field::PropertyBitField;
|
use properties::property_bit_field::PropertyBitField;
|
||||||
|
@ -185,6 +186,7 @@
|
||||||
context: &mut computed::Context,
|
context: &mut computed::Context,
|
||||||
seen: &mut PropertyBitField,
|
seen: &mut PropertyBitField,
|
||||||
cacheable: &mut bool,
|
cacheable: &mut bool,
|
||||||
|
cascade_info: &mut Option<<&mut CascadeInfo>,
|
||||||
error_reporter: &mut StdBox<ParseErrorReporter + Send>) {
|
error_reporter: &mut StdBox<ParseErrorReporter + Send>) {
|
||||||
let declared_value = match *declaration {
|
let declared_value = match *declaration {
|
||||||
PropertyDeclaration::${property.camel_case}(ref declared_value) => {
|
PropertyDeclaration::${property.camel_case}(ref declared_value) => {
|
||||||
|
@ -200,7 +202,13 @@
|
||||||
{
|
{
|
||||||
let custom_props = context.style().custom_properties();
|
let custom_props = context.style().custom_properties();
|
||||||
::properties::substitute_variables_${property.ident}(
|
::properties::substitute_variables_${property.ident}(
|
||||||
declared_value, &custom_props, |value| match *value {
|
declared_value, &custom_props,
|
||||||
|
|value| {
|
||||||
|
if let Some(ref mut cascade_info) = *cascade_info {
|
||||||
|
cascade_info.on_cascade_property(&declaration,
|
||||||
|
&value);
|
||||||
|
}
|
||||||
|
match *value {
|
||||||
DeclaredValue::Value(ref specified_value) => {
|
DeclaredValue::Value(ref specified_value) => {
|
||||||
let computed = specified_value.to_computed_value(context);
|
let computed = specified_value.to_computed_value(context);
|
||||||
context.mutate_style().mutate_${data.current_style_struct.name_lower}()
|
context.mutate_style().mutate_${data.current_style_struct.name_lower}()
|
||||||
|
@ -226,8 +234,8 @@
|
||||||
context.mutate_style().mutate_${data.current_style_struct.name_lower}()
|
context.mutate_style().mutate_${data.current_style_struct.name_lower}()
|
||||||
.copy_${property.ident}_from(inherited_struct);
|
.copy_${property.ident}_from(inherited_struct);
|
||||||
}
|
}
|
||||||
}, error_reporter
|
}
|
||||||
);
|
}, error_reporter);
|
||||||
}
|
}
|
||||||
|
|
||||||
% if property.custom_cascade:
|
% if property.custom_cascade:
|
||||||
|
|
|
@ -34,6 +34,7 @@ use stylesheets::Origin;
|
||||||
use values::LocalToCss;
|
use values::LocalToCss;
|
||||||
use values::HasViewportPercentage;
|
use values::HasViewportPercentage;
|
||||||
use values::computed::{self, ToComputedValue};
|
use values::computed::{self, ToComputedValue};
|
||||||
|
use cascade_info::CascadeInfo;
|
||||||
#[cfg(feature = "servo")] use values::specified::BorderStyle;
|
#[cfg(feature = "servo")] use values::specified::BorderStyle;
|
||||||
|
|
||||||
use self::property_bit_field::PropertyBitField;
|
use self::property_bit_field::PropertyBitField;
|
||||||
|
@ -773,6 +774,19 @@ pub enum DeclaredValue<T> {
|
||||||
// depending on whether the property is inherited.
|
// depending on whether the property is inherited.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: HasViewportPercentage> HasViewportPercentage for DeclaredValue<T> {
|
||||||
|
fn has_viewport_percentage(&self) -> bool {
|
||||||
|
match *self {
|
||||||
|
DeclaredValue::Value(ref v)
|
||||||
|
=> v.has_viewport_percentage(),
|
||||||
|
DeclaredValue::WithVariables { .. }
|
||||||
|
=> panic!("DeclaredValue::has_viewport_percentage without resolving variables!"),
|
||||||
|
DeclaredValue::Initial |
|
||||||
|
DeclaredValue::Inherit => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: ToCss> ToCss for DeclaredValue<T> {
|
impl<T: ToCss> ToCss for DeclaredValue<T> {
|
||||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -797,6 +811,20 @@ pub enum PropertyDeclaration {
|
||||||
Custom(::custom_properties::Name, DeclaredValue<::custom_properties::SpecifiedValue>),
|
Custom(::custom_properties::Name, DeclaredValue<::custom_properties::SpecifiedValue>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl HasViewportPercentage for PropertyDeclaration {
|
||||||
|
fn has_viewport_percentage(&self) -> bool {
|
||||||
|
match *self {
|
||||||
|
% for property in data.longhands:
|
||||||
|
PropertyDeclaration::${property.camel_case}(ref val) => {
|
||||||
|
val.has_viewport_percentage()
|
||||||
|
},
|
||||||
|
% endfor
|
||||||
|
PropertyDeclaration::Custom(_, ref val) => {
|
||||||
|
val.has_viewport_percentage()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Copy, Clone)]
|
#[derive(Eq, PartialEq, Copy, Clone)]
|
||||||
pub enum PropertyDeclarationParseResult {
|
pub enum PropertyDeclarationParseResult {
|
||||||
|
@ -854,19 +882,6 @@ impl ToCss for PropertyDeclaration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasViewportPercentage for PropertyDeclaration {
|
|
||||||
fn has_viewport_percentage(&self) -> bool {
|
|
||||||
match *self {
|
|
||||||
% for property in data.longhands:
|
|
||||||
PropertyDeclaration::${property.camel_case}(DeclaredValue::Value(ref val)) => {
|
|
||||||
val.has_viewport_percentage()
|
|
||||||
},
|
|
||||||
% endfor
|
|
||||||
_ => false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PropertyDeclaration {
|
impl PropertyDeclaration {
|
||||||
pub fn name(&self) -> PropertyDeclarationName {
|
pub fn name(&self) -> PropertyDeclarationName {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -1622,6 +1637,7 @@ fn cascade_with_cached_declarations(
|
||||||
parent_style: &ComputedValues,
|
parent_style: &ComputedValues,
|
||||||
cached_style: &ComputedValues,
|
cached_style: &ComputedValues,
|
||||||
custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
|
custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
|
||||||
|
mut cascade_info: Option<<&mut CascadeInfo>,
|
||||||
mut error_reporter: StdBox<ParseErrorReporter + Send>)
|
mut error_reporter: StdBox<ParseErrorReporter + Send>)
|
||||||
-> ComputedValues {
|
-> ComputedValues {
|
||||||
let mut context = computed::Context {
|
let mut context = computed::Context {
|
||||||
|
@ -1664,7 +1680,12 @@ fn cascade_with_cached_declarations(
|
||||||
let custom_props = context.style().custom_properties();
|
let custom_props = context.style().custom_properties();
|
||||||
substitute_variables_${property.ident}(
|
substitute_variables_${property.ident}(
|
||||||
declared_value, &custom_props,
|
declared_value, &custom_props,
|
||||||
|value| match *value {
|
|value| {
|
||||||
|
if let Some(ref mut cascade_info) = cascade_info {
|
||||||
|
cascade_info.on_cascade_property(&declaration,
|
||||||
|
&value);
|
||||||
|
}
|
||||||
|
match *value {
|
||||||
DeclaredValue::Value(ref specified_value)
|
DeclaredValue::Value(ref specified_value)
|
||||||
=> {
|
=> {
|
||||||
let computed = specified_value.to_computed_value(&context);
|
let computed = specified_value.to_computed_value(&context);
|
||||||
|
@ -1688,8 +1709,8 @@ fn cascade_with_cached_declarations(
|
||||||
.copy_${property.ident}_from(inherited_struct);
|
.copy_${property.ident}_from(inherited_struct);
|
||||||
}
|
}
|
||||||
DeclaredValue::WithVariables { .. } => unreachable!()
|
DeclaredValue::WithVariables { .. } => unreachable!()
|
||||||
}, &mut error_reporter
|
}
|
||||||
);
|
}, &mut error_reporter);
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
% if property.name in data.derived_longhands:
|
% if property.name in data.derived_longhands:
|
||||||
|
@ -1728,6 +1749,7 @@ pub type CascadePropertyFn =
|
||||||
context: &mut computed::Context,
|
context: &mut computed::Context,
|
||||||
seen: &mut PropertyBitField,
|
seen: &mut PropertyBitField,
|
||||||
cacheable: &mut bool,
|
cacheable: &mut bool,
|
||||||
|
cascade_info: &mut Option<<&mut CascadeInfo>,
|
||||||
error_reporter: &mut StdBox<ParseErrorReporter + Send>);
|
error_reporter: &mut StdBox<ParseErrorReporter + Send>);
|
||||||
|
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
|
@ -1760,6 +1782,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
|
||||||
shareable: bool,
|
shareable: bool,
|
||||||
parent_style: Option<<&ComputedValues>,
|
parent_style: Option<<&ComputedValues>,
|
||||||
cached_style: Option<<&ComputedValues>,
|
cached_style: Option<<&ComputedValues>,
|
||||||
|
mut cascade_info: Option<<&mut CascadeInfo>,
|
||||||
mut error_reporter: StdBox<ParseErrorReporter + Send>)
|
mut error_reporter: StdBox<ParseErrorReporter + Send>)
|
||||||
-> (ComputedValues, bool) {
|
-> (ComputedValues, bool) {
|
||||||
let initial_values = ComputedValues::initial_values();
|
let initial_values = ComputedValues::initial_values();
|
||||||
|
@ -1794,6 +1817,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
|
||||||
parent_style,
|
parent_style,
|
||||||
cached_style,
|
cached_style,
|
||||||
custom_properties,
|
custom_properties,
|
||||||
|
cascade_info,
|
||||||
error_reporter);
|
error_reporter);
|
||||||
return (style, false)
|
return (style, false)
|
||||||
}
|
}
|
||||||
|
@ -1863,6 +1887,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
|
||||||
&mut context,
|
&mut context,
|
||||||
&mut seen,
|
&mut seen,
|
||||||
&mut cacheable,
|
&mut cacheable,
|
||||||
|
&mut cascade_info,
|
||||||
&mut error_reporter);
|
&mut error_reporter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,6 +230,7 @@ impl Stylist {
|
||||||
&declarations, false,
|
&declarations, false,
|
||||||
parent.map(|p| &**p),
|
parent.map(|p| &**p),
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
Box::new(StdoutErrorReporter));
|
Box::new(StdoutErrorReporter));
|
||||||
Some(Arc::new(computed))
|
Some(Arc::new(computed))
|
||||||
} else {
|
} else {
|
||||||
|
@ -242,8 +243,9 @@ impl Stylist {
|
||||||
pseudo: &PseudoElement,
|
pseudo: &PseudoElement,
|
||||||
parent: &Arc<ComputedValues>)
|
parent: &Arc<ComputedValues>)
|
||||||
-> Option<Arc<ComputedValues>>
|
-> Option<Arc<ComputedValues>>
|
||||||
where E: Element<Impl=TheSelectorImpl> +
|
where E: Element<Impl=TheSelectorImpl> +
|
||||||
PresentationalHintsSynthetizer {
|
PresentationalHintsSynthetizer
|
||||||
|
{
|
||||||
debug_assert!(TheSelectorImpl::pseudo_element_cascade_type(pseudo).is_lazy());
|
debug_assert!(TheSelectorImpl::pseudo_element_cascade_type(pseudo).is_lazy());
|
||||||
if self.pseudos_map.get(pseudo).is_none() {
|
if self.pseudos_map.get(pseudo).is_none() {
|
||||||
return None;
|
return None;
|
||||||
|
@ -262,8 +264,10 @@ impl Stylist {
|
||||||
let (computed, _) =
|
let (computed, _) =
|
||||||
properties::cascade(self.device.au_viewport_size(),
|
properties::cascade(self.device.au_viewport_size(),
|
||||||
&declarations, false,
|
&declarations, false,
|
||||||
Some(&**parent), None,
|
Some(&**parent), None, None,
|
||||||
Box::new(StdoutErrorReporter));
|
Box::new(StdoutErrorReporter));
|
||||||
|
|
||||||
|
|
||||||
Some(Arc::new(computed))
|
Some(Arc::new(computed))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1356,6 +1356,18 @@
|
||||||
"url": "/_mozilla/css/direction_style_caching.html"
|
"url": "/_mozilla/css/direction_style_caching.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"css/dirty_viewport.html": [
|
||||||
|
{
|
||||||
|
"path": "css/dirty_viewport.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/_mozilla/css/dirty_viewport_ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/_mozilla/css/dirty_viewport.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"css/empty_cells_a.html": [
|
"css/empty_cells_a.html": [
|
||||||
{
|
{
|
||||||
"path": "css/empty_cells_a.html",
|
"path": "css/empty_cells_a.html",
|
||||||
|
@ -10576,6 +10588,18 @@
|
||||||
"url": "/_mozilla/css/direction_style_caching.html"
|
"url": "/_mozilla/css/direction_style_caching.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"css/dirty_viewport.html": [
|
||||||
|
{
|
||||||
|
"path": "css/dirty_viewport.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/_mozilla/css/dirty_viewport_ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/_mozilla/css/dirty_viewport.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"css/empty_cells_a.html": [
|
"css/empty_cells_a.html": [
|
||||||
{
|
{
|
||||||
"path": "css/empty_cells_a.html",
|
"path": "css/empty_cells_a.html",
|
||||||
|
|
11
tests/wpt/mozilla/tests/css/dirty_viewport.html
Normal file
11
tests/wpt/mozilla/tests/css/dirty_viewport.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Test elements subject to viewport units are restyled correctly</title>
|
||||||
|
<link rel="match" href="dirty_viewport_ref.html">
|
||||||
|
<iframe seamless src="dirty_viewport_inner.html" width="500" height="500"></iframe>
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
var iframe = document.querySelector('iframe');
|
||||||
|
iframe.width = iframe.height = 100;
|
||||||
|
}
|
||||||
|
</script>
|
11
tests/wpt/mozilla/tests/css/dirty_viewport_inner.html
Normal file
11
tests/wpt/mozilla/tests/css/dirty_viewport_inner.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<!doctype html>
|
||||||
|
<title>Dirty viewport test (inner)</title>
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
background: green;
|
||||||
|
width: 50vw;
|
||||||
|
height: 50vh;
|
||||||
|
}
|
||||||
|
html, body { margin: 0; padding: 0; }
|
||||||
|
</style>
|
||||||
|
<div></div>
|
9
tests/wpt/mozilla/tests/css/dirty_viewport_ref.html
Normal file
9
tests/wpt/mozilla/tests/css/dirty_viewport_ref.html
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<!doctype html>
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
background: green;
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div></div>
|
Loading…
Add table
Add a link
Reference in a new issue