mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #16609 - nox:quirks, r=Manishearth,emilio
Implement unitless length quirk The Gecko side doesn't propagate its quirks mode yet. <!-- 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/16609) <!-- Reviewable:end -->
This commit is contained in:
commit
d8bcc0db1a
70 changed files with 2321 additions and 194 deletions
|
@ -5,6 +5,7 @@
|
|||
//! Gecko's media-query device and expression representation.
|
||||
|
||||
use app_units::Au;
|
||||
use context::QuirksMode;
|
||||
use cssparser::{CssStringWriter, Parser, Token};
|
||||
use euclid::Size2D;
|
||||
use font_metrics::get_metrics_provider_for_product;
|
||||
|
@ -521,7 +522,7 @@ impl Expression {
|
|||
}
|
||||
|
||||
/// Returns whether this media query evaluates to true for the given device.
|
||||
pub fn matches(&self, device: &Device) -> bool {
|
||||
pub fn matches(&self, device: &Device, quirks_mode: QuirksMode) -> bool {
|
||||
let mut css_value = nsCSSValue::null();
|
||||
unsafe {
|
||||
(self.feature.mGetter.unwrap())(device.pres_context,
|
||||
|
@ -534,12 +535,13 @@ impl Expression {
|
|||
None => return false,
|
||||
};
|
||||
|
||||
self.evaluate_against(device, &value)
|
||||
self.evaluate_against(device, &value, quirks_mode)
|
||||
}
|
||||
|
||||
fn evaluate_against(&self,
|
||||
device: &Device,
|
||||
actual_value: &MediaExpressionValue)
|
||||
actual_value: &MediaExpressionValue,
|
||||
quirks_mode: QuirksMode)
|
||||
-> bool {
|
||||
use self::MediaExpressionValue::*;
|
||||
use std::cmp::Ordering;
|
||||
|
@ -564,6 +566,8 @@ impl Expression {
|
|||
style: default_values.clone(),
|
||||
font_metrics_provider: &provider,
|
||||
in_media_query: true,
|
||||
// TODO: pass the correct value here.
|
||||
quirks_mode: quirks_mode,
|
||||
};
|
||||
|
||||
let required_value = match self.value {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
use app_units::Au;
|
||||
use atomic_refcell::AtomicRefCell;
|
||||
use context::{SharedStyleContext, UpdateAnimationsTasks};
|
||||
use context::{QuirksMode, SharedStyleContext, UpdateAnimationsTasks};
|
||||
use data::ElementData;
|
||||
use dom::{self, AnimationRules, DescendantsBit, LayoutIterator, NodeInfo, TElement, TNode, UnsafeNode};
|
||||
use dom::{OpaqueNode, PresentationalHintsSynthetizer};
|
||||
|
@ -325,7 +325,7 @@ impl<'le> GeckoElement<'le> {
|
|||
/// Parse the style attribute of an element.
|
||||
pub fn parse_style_attribute(value: &str,
|
||||
url_data: &UrlExtraData) -> PropertyDeclarationBlock {
|
||||
parse_style_attribute(value, url_data, &RustLogReporter)
|
||||
parse_style_attribute(value, url_data, &RustLogReporter, QuirksMode::NoQuirks)
|
||||
}
|
||||
|
||||
fn flags(&self) -> u32 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue