aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-10-04 15:31:17 -0500
committerGitHub <noreply@github.com>2017-10-04 15:31:17 -0500
commit3f07cfec7c6e1b0398229cf308b752a060031ac3 (patch)
treef628f67c79202d25490607fe47b3b717aa875444
parentd8c7066464d1c621621473b630bc125929e15622 (diff)
parentb8e78d20bf2530261c8a8fa834df310d575f5e51 (diff)
downloadservo-3f07cfec7c6e1b0398229cf308b752a060031ac3.tar.gz
servo-3f07cfec7c6e1b0398229cf308b752a060031ac3.zip
Auto merge of #18733 - bradwerth:nativeDPPX, r=heycam
Change resolution queries to compare in unconverted dppx units. MozReview-Commit-ID: 7wYlixTQTIC <!-- Please describe your changes on the following line: --> https://bugzilla.mozilla.org/show_bug.cgi?id=1376931 https://reviewboard.mozilla.org/r/182424/ --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./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 the tests are in Gecko <!-- 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/18733) <!-- Reviewable:end -->
-rw-r--r--components/style/gecko/media_queries.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs
index 394cd5c1833..00e2d0887ae 100644
--- a/components/style/gecko/media_queries.rs
+++ b/components/style/gecko/media_queries.rs
@@ -373,8 +373,18 @@ impl MediaExpressionValue {
Some(MediaExpressionValue::BoolInteger(i == 1))
}
nsMediaFeature_ValueType::eResolution => {
- debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Inch);
- Some(MediaExpressionValue::Resolution(Resolution::Dpi(css_value.float_unchecked())))
+ // This is temporarily more complicated to allow Gecko Bug
+ // 1376931 to land. Parts of that bug will supply pixel values
+ // and expect them to be passed through without conversion.
+ // After all parts of that bug have landed, Bug 1404097 will
+ // return this function to once again only allow one type of
+ // value to be accepted: this time, only pixel values.
+ let res = match css_value.mUnit {
+ nsCSSUnit::eCSSUnit_Pixel => Resolution::Dppx(css_value.float_unchecked()),
+ nsCSSUnit::eCSSUnit_Inch => Resolution::Dpi(css_value.float_unchecked()),
+ _ => unreachable!(),
+ };
+ Some(MediaExpressionValue::Resolution(res))
}
nsMediaFeature_ValueType::eEnumerated => {
let value = css_value.integer_unchecked() as i16;