Merge autoland to mozilla-central. a=merge

This commit is contained in:
Marian-Vasile Laza 2022-04-25 12:40:50 +03:00
Родитель b033b97046 206c96bde0
Коммит a9de726161
17 изменённых файлов: 163 добавлений и 132 удалений

Просмотреть файл

@ -90,6 +90,7 @@ add_task(async function test_default() {
{},
{
SubmittedFrom: "CrashedTab",
Throttleable: "1",
Comments: null,
URL: "",
}
@ -103,6 +104,7 @@ add_task(async function test_just_a_comment() {
await crashTabTestHelper(
{
SubmittedFrom: "CrashedTab",
Throttleable: "1",
comments: COMMENTS,
},
{
@ -119,6 +121,7 @@ add_task(async function test_send_URL() {
await crashTabTestHelper(
{
SubmittedFrom: "CrashedTab",
Throttleable: "1",
includeURL: true,
},
{
@ -135,6 +138,7 @@ add_task(async function test_send_all() {
await crashTabTestHelper(
{
SubmittedFrom: "CrashedTab",
Throttleable: "1",
includeURL: true,
comments: COMMENTS,
},

Просмотреть файл

@ -372,6 +372,7 @@ add_task(async function test_can_submit() {
}
Assert.equal(extra.get("SubmittedFrom"), "Infobar");
Assert.equal(extra.get("Throttleable"), "1");
}
let reportIDs = await createPendingCrashReports(1);
@ -480,6 +481,7 @@ add_task(async function test_can_submit_always() {
Assert.equal(result, null, "The notification should not be shown");
promiseReports = await waitForSubmittedReports(reportIDs, extra => {
Assert.equal(extra.get("SubmittedFrom"), "Auto");
Assert.equal(extra.get("Throttleable"), "1");
});
// And revert back to default now.

Просмотреть файл

@ -13,9 +13,6 @@
#include "VideoUtils.h"
#include "VPXDecoder.h"
#include "mozilla/layers/KnowsCompositor.h"
#if defined(MOZ_AV1) && defined(FFVPX_VERSION) && defined(MOZ_WAYLAND)
# include "AOMDecoder.h"
#endif
#if LIBAVCODEC_VERSION_MAJOR >= 57
# include "mozilla/layers/TextureClient.h"
#endif
@ -27,6 +24,12 @@
# include "va/va.h"
#endif
#if defined(MOZ_AV1) && defined(MOZ_WAYLAND) && \
(defined(FFVPX_VERSION) || LIBAVCODEC_VERSION_MAJOR >= 59)
# define FFMPEG_AV1_DECODE 1
# include "AOMDecoder.h"
#endif
#include "libavutil/pixfmt.h"
#if LIBAVCODEC_VERSION_MAJOR < 54
# define AVPixelFormat PixelFormat
@ -989,7 +992,7 @@ MediaResult FFmpegVideoDecoder<LIBAV_VER>::CreateImage(
#if LIBAVCODEC_VERSION_MAJOR >= 57
|| mCodecContext->pix_fmt == AV_PIX_FMT_YUV444P12LE
#endif
#if defined(MOZ_AV1) && defined(FFVPX_VERSION) && defined(MOZ_WAYLAND)
#if defined(FFMPEG_AV1_DECODE)
|| mCodecContext->pix_fmt == AV_PIX_FMT_GBRP
#endif
) {
@ -1151,7 +1154,7 @@ AVCodecID FFmpegVideoDecoder<LIBAV_VER>::GetCodecId(
}
#endif
#if defined(MOZ_AV1) && defined(FFVPX_VERSION) && defined(MOZ_WAYLAND)
#if defined(FFMPEG_AV1_DECODE)
if (AOMDecoder::IsAV1(aMimeType)) {
return AV_CODEC_ID_AV1;
}

Просмотреть файл

@ -38,16 +38,21 @@ VideoFrameSurface<LIBAV_VER>::VideoFrameSurface(DMABufSurface* aSurface)
void VideoFrameSurface<LIBAV_VER>::LockVAAPIData(
AVCodecContext* aAVCodecContext, AVFrame* aAVFrame,
FFmpegLibWrapper* aLib) {
FFMPEG_LOG("VideoFrameSurface: VAAPI locking dmabuf surface UID = %d",
mSurface->GetUID());
mLib = aLib;
mAVHWDeviceContext = aLib->av_buffer_ref(aAVCodecContext->hw_device_ctx);
mHWAVBuffer = aLib->av_buffer_ref(aAVFrame->buf[0]);
FFMPEG_LOG(
"VideoFrameSurface: VAAPI locking dmabuf surface UID = %d "
"mAVHWDeviceContext %p mHWAVBuffer %p",
mSurface->GetUID(), mAVHWDeviceContext, mHWAVBuffer);
}
void VideoFrameSurface<LIBAV_VER>::ReleaseVAAPIData(bool aForFrameRecycle) {
FFMPEG_LOG("VideoFrameSurface: VAAPI releasing dmabuf surface UID = %d",
mSurface->GetUID());
FFMPEG_LOG(
"VideoFrameSurface: VAAPI releasing dmabuf surface UID = %d "
"aForFrameRecycle %d mLib %p mAVHWDeviceContext %p mHWAVBuffer %p",
mSurface->GetUID(), aForFrameRecycle, mLib, mAVHWDeviceContext,
mHWAVBuffer);
// It's possible to unref GPU data while IsUsed() is still set.
// It can happens when VideoFramePool is deleted while decoder shutdown
@ -58,6 +63,7 @@ void VideoFrameSurface<LIBAV_VER>::ReleaseVAAPIData(bool aForFrameRecycle) {
if (mLib) {
mLib->av_buffer_unref(&mHWAVBuffer);
mLib->av_buffer_unref(&mAVHWDeviceContext);
mLib = nullptr;
}
// If we want to recycle the frame, make sure it's not used

Просмотреть файл

@ -6,8 +6,7 @@
use crate::gecko_bindings::bindings;
use crate::gecko_bindings::structs;
use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements};
use crate::media_queries::media_feature::{Evaluator, MediaFeatureDescription};
use crate::queries::feature::{AllowsRanges, Evaluator, ParsingRequirements, QueryFeatureDescription};
use crate::media_queries::{Device, MediaType};
use crate::values::computed::{Context, CSSPixelLength, Ratio, Resolution};
use app_units::Au;
@ -583,7 +582,7 @@ macro_rules! bool_pref_feature {
/// to support new types in these entries and (2) ensuring that either
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
/// would be returned by the evaluator function could change.
pub static MEDIA_FEATURES: [MediaFeatureDescription; 60] = [
pub static MEDIA_FEATURES: [QueryFeatureDescription; 60] = [
feature!(
atom!("width"),
AllowsRanges::Yes,

Просмотреть файл

@ -103,10 +103,11 @@ pub mod invalidation;
#[allow(missing_docs)] // TODO.
pub mod logical_geometry;
pub mod matching;
#[macro_use]
pub mod media_queries;
pub mod parallel;
pub mod parser;
#[macro_use]
pub mod queries;
pub mod rule_cache;
pub mod rule_collector;
pub mod rule_tree;

Просмотреть файл

@ -6,7 +6,7 @@
//!
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query
use super::media_condition::MediaCondition;
use crate::queries::QueryCondition;
use crate::parser::ParserContext;
use crate::str::string_as_ascii_lowercase;
use crate::values::CustomIdent;
@ -66,7 +66,7 @@ pub struct MediaQuery {
pub media_type: MediaQueryType,
/// The condition that this media query contains. This cannot have `or`
/// in the first level.
pub condition: Option<MediaCondition>,
pub condition: Option<QueryCondition>,
}
impl ToCss for MediaQuery {
@ -134,9 +134,9 @@ impl MediaQuery {
.unwrap_or_default();
let condition = if explicit_media_type.is_none() {
Some(MediaCondition::parse(context, input)?)
Some(QueryCondition::parse(context, input)?)
} else if input.try_parse(|i| i.expect_ident_matching("and")).is_ok() {
Some(MediaCondition::parse_disallow_or(context, input)?)
Some(QueryCondition::parse_disallow_or(context, input)?)
} else {
None
};

Просмотреть файл

@ -6,15 +6,9 @@
//!
//! [mq]: https://drafts.csswg.org/mediaqueries/
mod media_condition;
mod media_list;
mod media_query;
#[macro_use]
pub mod media_feature;
pub mod media_feature_expression;
pub use self::media_condition::MediaCondition;
pub use self::media_feature_expression::MediaFeatureExpression;
pub use self::media_list::MediaList;
pub use self::media_query::{MediaQuery, MediaQueryType, MediaType, Qualifier};

Просмотреть файл

@ -2,11 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! A media query condition:
//! A query condition:
//!
//! https://drafts.csswg.org/mediaqueries-4/#typedef-media-condition
//! https://drafts.csswg.org/css-contain-3/#typedef-container-condition
use super::MediaFeatureExpression;
use super::QueryFeatureExpression;
use crate::parser::ParserContext;
use crate::values::computed;
use cssparser::{Parser, Token};
@ -28,38 +29,38 @@ enum AllowOr {
No,
}
/// Represents a media condition.
/// Represents a condition.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)]
pub enum MediaCondition {
/// A simple media feature expression, implicitly parenthesized.
Feature(MediaFeatureExpression),
pub enum QueryCondition {
/// A simple feature expression, implicitly parenthesized.
Feature(QueryFeatureExpression),
/// A negation of a condition.
Not(Box<MediaCondition>),
Not(Box<QueryCondition>),
/// A set of joint operations.
Operation(Box<[MediaCondition]>, Operator),
Operation(Box<[QueryCondition]>, Operator),
/// A condition wrapped in parenthesis.
InParens(Box<MediaCondition>),
InParens(Box<QueryCondition>),
}
impl ToCss for MediaCondition {
impl ToCss for QueryCondition {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: fmt::Write,
{
match *self {
// NOTE(emilio): MediaFeatureExpression already includes the
// NOTE(emilio): QueryFeatureExpression already includes the
// parenthesis.
MediaCondition::Feature(ref f) => f.to_css(dest),
MediaCondition::Not(ref c) => {
QueryCondition::Feature(ref f) => f.to_css(dest),
QueryCondition::Not(ref c) => {
dest.write_str("not ")?;
c.to_css(dest)
},
MediaCondition::InParens(ref c) => {
QueryCondition::InParens(ref c) => {
dest.write_char('(')?;
c.to_css(dest)?;
dest.write_char(')')
},
MediaCondition::Operation(ref list, op) => {
QueryCondition::Operation(ref list, op) => {
let mut iter = list.iter();
iter.next().unwrap().to_css(dest)?;
for item in iter {
@ -74,8 +75,8 @@ impl ToCss for MediaCondition {
}
}
impl MediaCondition {
/// Parse a single media condition.
impl QueryCondition {
/// Parse a single condition.
pub fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
@ -83,9 +84,9 @@ impl MediaCondition {
Self::parse_internal(context, input, AllowOr::Yes)
}
/// Parse a single media condition, disallowing `or` expressions.
/// Parse a single condition, disallowing `or` expressions.
///
/// To be used from the legacy media query syntax.
/// To be used from the legacy query syntax.
pub fn parse_disallow_or<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
@ -109,7 +110,7 @@ impl MediaCondition {
if is_negation {
let inner_condition = Self::parse_in_parens(context, input)?;
return Ok(MediaCondition::Not(Box::new(inner_condition)));
return Ok(QueryCondition::Not(Box::new(inner_condition)));
}
// ParenthesisBlock.
@ -134,7 +135,7 @@ impl MediaCondition {
loop {
if input.try_parse(|i| i.expect_ident_matching(delim)).is_err() {
return Ok(MediaCondition::Operation(
return Ok(QueryCondition::Operation(
conditions.into_boxed_slice(),
operator,
));
@ -144,7 +145,7 @@ impl MediaCondition {
}
}
/// Parse a media condition in parentheses.
/// Parse a condition in parentheses.
pub fn parse_in_parens<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
@ -160,20 +161,20 @@ impl MediaCondition {
input.parse_nested_block(|input| {
// Base case.
if let Ok(inner) = input.try_parse(|i| Self::parse(context, i)) {
return Ok(MediaCondition::InParens(Box::new(inner)));
return Ok(QueryCondition::InParens(Box::new(inner)));
}
let expr = MediaFeatureExpression::parse_in_parenthesis_block(context, input)?;
Ok(MediaCondition::Feature(expr))
let expr = QueryFeatureExpression::parse_in_parenthesis_block(context, input)?;
Ok(QueryCondition::Feature(expr))
})
}
/// Whether this condition matches the device and quirks mode.
pub fn matches(&self, context: &computed::Context) -> bool {
match *self {
MediaCondition::Feature(ref f) => f.matches(context),
MediaCondition::InParens(ref c) => c.matches(context),
MediaCondition::Not(ref c) => !c.matches(context),
MediaCondition::Operation(ref conditions, op) => {
QueryCondition::Feature(ref f) => f.matches(context),
QueryCondition::InParens(ref c) => c.matches(context),
QueryCondition::Not(ref c) => !c.matches(context),
QueryCondition::Operation(ref conditions, op) => {
let mut iter = conditions.iter();
match op {
Operator::And => iter.all(|c| c.matches(context)),

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Media features.
//! Query features.
use crate::parser::ParserContext;
use crate::values::computed::{self, CSSPixelLength, Resolution, Ratio};
@ -14,7 +14,7 @@ use style_traits::ParseError;
/// A generic discriminant for an enum value.
pub type KeywordDiscriminant = u8;
type MediaFeatureGetter<T> = fn(device: &computed::Context) -> T;
type QueryFeatureGetter<T> = fn(device: &computed::Context) -> T;
/// Serializes a given discriminant.
///
@ -28,19 +28,19 @@ pub type KeywordParser = for<'a, 'i, 't> fn(
input: &'a mut Parser<'i, 't>,
) -> Result<KeywordDiscriminant, ParseError<'i>>;
/// An evaluator for a given media feature.
/// An evaluator for a given feature.
///
/// This determines the kind of values that get parsed, too.
#[allow(missing_docs)]
pub enum Evaluator {
Length(MediaFeatureGetter<CSSPixelLength>),
Integer(MediaFeatureGetter<u32>),
Float(MediaFeatureGetter<f32>),
BoolInteger(MediaFeatureGetter<bool>),
Length(QueryFeatureGetter<CSSPixelLength>),
Integer(QueryFeatureGetter<u32>),
Float(QueryFeatureGetter<f32>),
BoolInteger(QueryFeatureGetter<bool>),
/// A non-negative number ratio, such as the one from device-pixel-ratio.
NumberRatio(MediaFeatureGetter<Ratio>),
NumberRatio(QueryFeatureGetter<Ratio>),
/// A resolution.
Resolution(MediaFeatureGetter<Resolution>),
Resolution(QueryFeatureGetter<Resolution>),
/// A keyword value.
Enumerated {
/// The parser to get a discriminant given a string.
@ -67,14 +67,14 @@ macro_rules! keyword_evaluator {
context: &$crate::parser::ParserContext,
input: &mut $crate::cssparser::Parser<'i, 't>,
) -> Result<
$crate::media_queries::media_feature::KeywordDiscriminant,
$crate::queries::feature::KeywordDiscriminant,
::style_traits::ParseError<'i>,
> {
let kw = <$keyword_type as $crate::parser::Parse>::parse(context, input)?;
Ok(kw as $crate::media_queries::media_feature::KeywordDiscriminant)
Ok(kw as $crate::queries::feature::KeywordDiscriminant)
}
fn __serialize(kw: $crate::media_queries::media_feature::KeywordDiscriminant) -> String {
fn __serialize(kw: $crate::queries::feature::KeywordDiscriminant) -> String {
// This unwrap is ok because the only discriminants that get
// back to us is the ones that `parse` produces.
let value: $keyword_type = ::num_traits::cast::FromPrimitive::from_u8(kw).unwrap();
@ -83,7 +83,7 @@ macro_rules! keyword_evaluator {
fn __evaluate(
context: &$crate::values::computed::Context,
value: Option<$crate::media_queries::media_feature::KeywordDiscriminant>,
value: Option<$crate::queries::feature::KeywordDiscriminant>,
) -> bool {
// This unwrap is ok because the only discriminants that get
// back to us is the ones that `parse` produces.
@ -92,7 +92,7 @@ macro_rules! keyword_evaluator {
$actual_evaluator(context, value)
}
$crate::media_queries::media_feature::Evaluator::Enumerated {
$crate::queries::feature::Evaluator::Enumerated {
parser: __parse,
serializer: __serialize,
evaluator: __evaluate,
@ -111,7 +111,7 @@ bitflags! {
}
}
/// Whether a media feature allows ranges or not.
/// Whether a feature allows ranges or not.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[allow(missing_docs)]
pub enum AllowsRanges {
@ -119,9 +119,9 @@ pub enum AllowsRanges {
No,
}
/// A description of a media feature.
pub struct MediaFeatureDescription {
/// The media feature name, in ascii lowercase.
/// A description of a feature.
pub struct QueryFeatureDescription {
/// The feature name, in ascii lowercase.
pub name: Atom,
/// Whether min- / max- prefixes are allowed or not.
pub allows_ranges: AllowsRanges,
@ -133,18 +133,18 @@ pub struct MediaFeatureDescription {
pub requirements: ParsingRequirements,
}
impl MediaFeatureDescription {
/// Whether this media feature allows ranges.
impl QueryFeatureDescription {
/// Whether this feature allows ranges.
#[inline]
pub fn allows_ranges(&self) -> bool {
self.allows_ranges == AllowsRanges::Yes
}
}
/// A simple helper to construct a `MediaFeatureDescription`.
/// A simple helper to construct a `QueryFeatureDescription`.
macro_rules! feature {
($name:expr, $allows_ranges:expr, $evaluator:expr, $reqs:expr,) => {
$crate::media_queries::media_feature::MediaFeatureDescription {
$crate::queries::feature::QueryFeatureDescription {
name: $name,
allows_ranges: $allows_ranges,
evaluator: $evaluator,
@ -153,9 +153,9 @@ macro_rules! feature {
};
}
impl fmt::Debug for MediaFeatureDescription {
impl fmt::Debug for QueryFeatureDescription {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("MediaFeatureExpression")
f.debug_struct("QueryFeatureDescription")
.field("name", &self.name)
.field("allows_ranges", &self.allows_ranges)
.field("requirements", &self.requirements)

Просмотреть файл

@ -2,11 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! Parsing for media feature expressions, like `(foo: bar)` or
//! Parsing for query feature expressions, like `(foo: bar)` or
//! `(width >= 400px)`.
use super::media_feature::{Evaluator, MediaFeatureDescription};
use super::media_feature::{KeywordDiscriminant, ParsingRequirements};
use super::feature::{Evaluator, QueryFeatureDescription};
use super::feature::{KeywordDiscriminant, ParsingRequirements};
#[cfg(feature = "gecko")]
use crate::gecko::media_features::MEDIA_FEATURES;
use crate::parser::{Parse, ParserContext};
@ -22,7 +22,7 @@ use std::cmp::{Ordering, PartialOrd};
use std::fmt::{self, Write};
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
/// The kind of matching that should be performed on a media feature value.
/// The kind of matching that should be performed on a feature value.
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
pub enum Range {
/// At least the specified value.
@ -31,7 +31,7 @@ pub enum Range {
Max,
}
/// The operator that was specified in this media feature.
/// The operator that was specified in this feature.
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
pub enum Operator {
/// =
@ -63,8 +63,7 @@ impl ToCss for Operator {
/// Either a `Range` or an `Operator`.
///
/// Ranged media features are not allowed with operations (that'd make no
/// sense).
/// Ranged features are not allowed with operations (that'd make no sense).
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
pub enum RangeOrOperator {
/// A `Range`.
@ -121,16 +120,16 @@ impl RangeOrOperator {
}
}
/// A feature expression contains a reference to the media feature, the value
/// the media query contained, and the range to evaluate.
/// A feature expression contains a reference to the feature, the value the
/// query contained, and the range to evaluate.
#[derive(Clone, Debug, MallocSizeOf, ToShmem, PartialEq)]
pub struct MediaFeatureExpression {
pub struct QueryFeatureExpression {
feature_index: usize,
value: Option<MediaExpressionValue>,
value: Option<QueryExpressionValue>,
range_or_operator: Option<RangeOrOperator>,
}
impl ToCss for MediaFeatureExpression {
impl ToCss for QueryFeatureExpression {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
where
W: fmt::Write,
@ -243,10 +242,10 @@ fn disabled_by_pref(feature: &Atom, context: &ParserContext) -> bool {
false
}
impl MediaFeatureExpression {
impl QueryFeatureExpression {
fn new(
feature_index: usize,
value: Option<MediaExpressionValue>,
value: Option<QueryExpressionValue>,
range_or_operator: Option<RangeOrOperator>,
) -> Self {
debug_assert!(feature_index < MEDIA_FEATURES.len());
@ -257,11 +256,11 @@ impl MediaFeatureExpression {
}
}
fn feature(&self) -> &'static MediaFeatureDescription {
fn feature(&self) -> &'static QueryFeatureDescription {
&MEDIA_FEATURES[self.feature_index]
}
/// Parse a media expression of the form:
/// Parse a feature expression of the form:
///
/// ```
/// (media-feature: media-value)
@ -274,8 +273,7 @@ impl MediaFeatureExpression {
input.parse_nested_block(|input| Self::parse_in_parenthesis_block(context, input))
}
/// Parse a media feature expression where we've already consumed the
/// parenthesis.
/// Parse a feature expression where we've already consumed the parenthesis.
pub fn parse_in_parenthesis_block<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
@ -332,9 +330,8 @@ impl MediaFeatureExpression {
let operator = input.try_parse(consume_operation_or_colon);
let operator = match operator {
Err(..) => {
// If there's no colon, this is a media query of the
// form '(<feature>)', that is, there's no value
// specified.
// If there's no colon, this is a query of the form
// '(<feature>)', that is, there's no value specified.
//
// Gecko doesn't allow ranged expressions without a
// value, so just reject them here too.
@ -370,7 +367,7 @@ impl MediaFeatureExpression {
},
};
let value = MediaExpressionValue::parse(feature, context, input).map_err(|err| {
let value = QueryExpressionValue::parse(feature, context, input).map_err(|err| {
err.location
.new_custom_error(StyleParseErrorKind::MediaQueryExpectedFeatureValue)
})?;
@ -378,15 +375,15 @@ impl MediaFeatureExpression {
Ok(Self::new(feature_index, Some(value), range_or_operator))
}
/// Returns whether this media query evaluates to true for the given device.
/// Returns whether this query evaluates to true for the given device.
pub fn matches(&self, context: &computed::Context) -> bool {
let value = self.value.as_ref();
macro_rules! expect {
($variant:ident) => {
value.map(|value| match *value {
MediaExpressionValue::$variant(ref v) => v,
_ => unreachable!("Unexpected MediaExpressionValue"),
QueryExpressionValue::$variant(ref v) => v,
_ => unreachable!("Unexpected QueryExpressionValue"),
})
};
}
@ -442,7 +439,7 @@ impl MediaFeatureExpression {
}
}
/// A value found or expected in a media expression.
/// A value found or expected in a expression.
///
/// FIXME(emilio): How should calc() serialize in the Number / Integer /
/// BoolInteger / NumberRatio case, as computed or as specified value?
@ -451,7 +448,7 @@ impl MediaFeatureExpression {
///
/// See: https://github.com/w3c/csswg-drafts/issues/1968
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)]
pub enum MediaExpressionValue {
pub enum QueryExpressionValue {
/// A length.
Length(Length),
/// A (non-negative) integer.
@ -470,19 +467,19 @@ pub enum MediaExpressionValue {
Enumerated(KeywordDiscriminant),
}
impl MediaExpressionValue {
fn to_css<W>(&self, dest: &mut CssWriter<W>, for_expr: &MediaFeatureExpression) -> fmt::Result
impl QueryExpressionValue {
fn to_css<W>(&self, dest: &mut CssWriter<W>, for_expr: &QueryFeatureExpression) -> fmt::Result
where
W: fmt::Write,
{
match *self {
MediaExpressionValue::Length(ref l) => l.to_css(dest),
MediaExpressionValue::Integer(v) => v.to_css(dest),
MediaExpressionValue::Float(v) => v.to_css(dest),
MediaExpressionValue::BoolInteger(v) => dest.write_str(if v { "1" } else { "0" }),
MediaExpressionValue::NumberRatio(ratio) => ratio.to_css(dest),
MediaExpressionValue::Resolution(ref r) => r.to_css(dest),
MediaExpressionValue::Enumerated(value) => match for_expr.feature().evaluator {
QueryExpressionValue::Length(ref l) => l.to_css(dest),
QueryExpressionValue::Integer(v) => v.to_css(dest),
QueryExpressionValue::Float(v) => v.to_css(dest),
QueryExpressionValue::BoolInteger(v) => dest.write_str(if v { "1" } else { "0" }),
QueryExpressionValue::NumberRatio(ratio) => ratio.to_css(dest),
QueryExpressionValue::Resolution(ref r) => r.to_css(dest),
QueryExpressionValue::Enumerated(value) => match for_expr.feature().evaluator {
Evaluator::Enumerated { serializer, .. } => dest.write_str(&*serializer(value)),
_ => unreachable!(),
},
@ -490,18 +487,18 @@ impl MediaExpressionValue {
}
fn parse<'i, 't>(
for_feature: &MediaFeatureDescription,
for_feature: &QueryFeatureDescription,
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<MediaExpressionValue, ParseError<'i>> {
) -> Result<QueryExpressionValue, ParseError<'i>> {
Ok(match for_feature.evaluator {
Evaluator::Length(..) => {
let length = Length::parse_non_negative(context, input)?;
MediaExpressionValue::Length(length)
QueryExpressionValue::Length(length)
},
Evaluator::Integer(..) => {
let integer = Integer::parse_non_negative(context, input)?;
MediaExpressionValue::Integer(integer.value() as u32)
QueryExpressionValue::Integer(integer.value() as u32)
},
Evaluator::BoolInteger(..) => {
let integer = Integer::parse_non_negative(context, input)?;
@ -509,22 +506,22 @@ impl MediaExpressionValue {
if value > 1 {
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
MediaExpressionValue::BoolInteger(value == 1)
QueryExpressionValue::BoolInteger(value == 1)
},
Evaluator::Float(..) => {
let number = Number::parse(context, input)?;
MediaExpressionValue::Float(number.get())
QueryExpressionValue::Float(number.get())
},
Evaluator::NumberRatio(..) => {
use crate::values::specified::Ratio as SpecifiedRatio;
let ratio = SpecifiedRatio::parse(context, input)?;
MediaExpressionValue::NumberRatio(Ratio::new(ratio.0.get(), ratio.1.get()))
QueryExpressionValue::NumberRatio(Ratio::new(ratio.0.get(), ratio.1.get()))
},
Evaluator::Resolution(..) => {
MediaExpressionValue::Resolution(Resolution::parse(context, input)?)
QueryExpressionValue::Resolution(Resolution::parse(context, input)?)
},
Evaluator::Enumerated { parser, .. } => {
MediaExpressionValue::Enumerated(parser(context, input)?)
QueryExpressionValue::Enumerated(parser(context, input)?)
},
})
}

Просмотреть файл

@ -0,0 +1,17 @@
/* 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 https://mozilla.org/MPL/2.0/. */
//! Code shared between [media queries][mq] and [container queries][cq].
//!
//! [mq]: https://drafts.csswg.org/mediaqueries/
//! [cq]: https://drafts.csswg.org/css-contain-3/#container-rule
mod condition;
#[macro_use]
pub mod feature;
pub mod feature_expression;
pub use self::condition::QueryCondition;
pub use self::feature_expression::QueryFeatureExpression;

Просмотреть файл

@ -6,7 +6,7 @@
//!
//! [container]: https://drafts.csswg.org/css-contain-3/#container-rule
use crate::media_queries::MediaCondition;
use crate::queries::QueryCondition;
use crate::shared_lock::{
DeepCloneParams, DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard,
};
@ -76,4 +76,4 @@ impl ToCssWithGuard for ContainerRule {
}
/// TODO: Factor out the media query code to work with containers.
pub type ContainerCondition = MediaCondition;
pub type ContainerCondition = QueryCondition;

Просмотреть файл

@ -6,8 +6,9 @@
#[cfg(feature = "gecko")]
use crate::gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use crate::media_queries::{Device, MediaCondition};
use crate::media_queries::Device;
use crate::parser::{Parse, ParserContext};
use crate::queries::QueryCondition;
use crate::values::computed::{self, ToComputedValue};
use crate::values::specified::{Length, NoCalcLength, ViewportPercentageLength};
use app_units::Au;
@ -20,7 +21,7 @@ use style_traits::ParseError;
/// https://html.spec.whatwg.org/multipage/#source-size
#[derive(Debug)]
pub struct SourceSize {
condition: MediaCondition,
condition: QueryCondition,
value: Length,
}
@ -29,9 +30,8 @@ impl Parse for SourceSize {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
let condition = MediaCondition::parse(context, input)?;
let condition = QueryCondition::parse(context, input)?;
let value = Length::parse_non_negative(context, input)?;
Ok(Self { condition, value })
}
}

Просмотреть файл

Просмотреть файл

@ -895,6 +895,14 @@ TextureUsage:
type: string
ping: true
Throttleable:
description: >
Whether Socorro can selectively discard this crash report or not. If set
to "0" the crash report will always be processed by Socorro. Do not set
this annotation within Gecko code, it's only supposed to be used by the
crash reporting machinery.
type: boolean
TotalPageFile:
description: >
Maximum amount of memory that can be committed without extending the swap/page file.

Просмотреть файл

@ -229,12 +229,11 @@ Submitter.prototype = {
let formData = new FormData();
// tell the server not to throttle this if requested
this.extraKeyVals.Throttleable = this.noThrottle ? "0" : "1";
// add the data
let payload = Object.assign({}, this.extraKeyVals);
if (this.noThrottle) {
// tell the server not to throttle this, since it was manually submitted
payload.Throttleable = "0";
}
let json = new Blob([JSON.stringify(payload)], {
type: "application/json",
});
@ -454,7 +453,7 @@ var CrashSubmit = {
* If true, a submission event is recorded in CrashManager.
* - noThrottle
* If true, this crash report should be submitted with
* an extra parameter of "Throttleable=0" indicating that
* the Throttleable annotation set to "0" indicating that
* it should be processed right away. This should be set
* when the report is being submitted and the user expects
* to see the results immediately. Defaults to false.