aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/servo/media_queries.rs
diff options
context:
space:
mode:
authorbors-servo <infra@servo.org>2023-05-11 21:04:45 +0200
committerGitHub <noreply@github.com>2023-05-11 21:04:45 +0200
commit9bec0d0f8e92e90b5d8c99ba691a9d9a6bb41bcc (patch)
treefbfaa73aa4702fdb2a32fe6838388189ab1d41db /components/style/servo/media_queries.rs
parentfeaa66b5972c3e31d77c2acce7d626c455320535 (diff)
parentab2ba273e342c6f1a0c1f29cca3f551fd8926e94 (diff)
downloadservo-9bec0d0f8e92e90b5d8c99ba691a9d9a6bb41bcc.tar.gz
servo-9bec0d0f8e92e90b5d8c99ba691a9d9a6bb41bcc.zip
Auto merge of #29728 - Loirooriol:sync-fontprovider-D157589, r=mrobinson
Simplify our setup for font metric queries from style This is a backport of https://phabricator.services.mozilla.com/D157589, by Emilio Cobos Álvarez, plus some additions so that Servo compiles, and some parts from https://phabricator.services.mozilla.com/D144455. Should have no change in behavior. <!-- Please describe your changes on the following line: --> --- <!-- 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: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because there should be no change in behavior <!-- 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. -->
Diffstat (limited to 'components/style/servo/media_queries.rs')
-rw-r--r--components/style/servo/media_queries.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/components/style/servo/media_queries.rs b/components/style/servo/media_queries.rs
index 17949c723d0..4b535a9b875 100644
--- a/components/style/servo/media_queries.rs
+++ b/components/style/servo/media_queries.rs
@@ -6,6 +6,7 @@
use crate::context::QuirksMode;
use crate::custom_properties::CssEnvironment;
+use crate::font_metrics::FontMetrics;
use crate::media_queries::media_feature::{AllowsRanges, ParsingRequirements};
use crate::media_queries::media_feature::{Evaluator, MediaFeatureDescription};
use crate::media_queries::media_feature_expression::RangeOrOperator;
@@ -156,6 +157,22 @@ impl Device {
self.device_pixel_ratio
}
+ /// Queries dummy font metrics for Servo. Knows nothing about fonts and does not provide
+ /// any metrics.
+ /// TODO: Servo's font metrics provider will probably not live in this crate, so this will
+ /// have to be replaced with something else (perhaps a trait method on TElement)
+ /// when we get there
+ pub fn query_font_metrics(
+ &self,
+ _vertical: bool,
+ _font: &crate::properties::style_structs::Font,
+ _base_size: CSSPixelLength,
+ _in_media_query: bool,
+ _retrieve_math_scales: bool,
+ ) -> FontMetrics {
+ Default::default()
+ }
+
/// Take into account a viewport rule taken from the stylesheets.
pub fn account_for_viewport_rule(&mut self, constraints: &ViewportConstraints) {
self.viewport_size = constraints.size;