servo: Merge #18764 - Change MediaExpressionValue::from_css_value to only accept pixels (from bradwerth:onlyDPPX); r=heycam
authorBrad Werth <bwerth@mozilla.com>
Fri, 06 Oct 2017 03:39:42 -0500
changeset 384869 edce9959c364b57b8b77fa2047d3a6be1337138e
parent 384868 97fcd35b0d3792e7305bcb46b303ce409b30d23e
child 384870 3549d9c469cfc5c3a014884dd7216377a85482ab
push id95880
push userarchaeopteryx@coole-files.de
push dateSat, 07 Oct 2017 08:58:44 +0000
treeherdermozilla-inbound@156942799371 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #18764 - Change MediaExpressionValue::from_css_value to only accept pixels (from bradwerth:onlyDPPX); r=heycam MozReview-Commit-ID: Hn3twVa8xLo <!-- Please describe your changes on the following line: --> https://bugzilla.mozilla.org/show_bug.cgi?id=1404097 https://reviewboard.mozilla.org/r/184746/ --- <!-- 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 existing tests provide coverage. <!-- 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. --> Source-Repo: https://github.com/servo/servo Source-Revision: 6421332fb3f13205553ec3d9f911e7577b2638fd
servo/components/style/gecko/media_queries.rs
--- a/servo/components/style/gecko/media_queries.rs
+++ b/servo/components/style/gecko/media_queries.rs
@@ -369,28 +369,18 @@ impl MediaExpressionValue {
             }
             nsMediaFeature_ValueType::eBoolInteger => {
                 debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Integer);
                 let i = css_value.integer_unchecked();
                 debug_assert!(i == 0 || i == 1);
                 Some(MediaExpressionValue::BoolInteger(i == 1))
             }
             nsMediaFeature_ValueType::eResolution => {
-                // 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))
+                debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Pixel);
+                Some(MediaExpressionValue::Resolution(Resolution::Dppx(css_value.float_unchecked())))
             }
             nsMediaFeature_ValueType::eEnumerated => {
                 let value = css_value.integer_unchecked() as i16;
                 Some(MediaExpressionValue::Enumerated(value))
             }
             nsMediaFeature_ValueType::eIdent => {
                 debug_assert!(css_value.mUnit == nsCSSUnit::eCSSUnit_Ident);
                 let string = unsafe {