Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upEnable screen.width/height/availWidth/availHeight #18183
Conversation
highfive
commented
Aug 22, 2017
|
Heads up! This PR modifies the following files:
|
| fn AvailHeight(&self) -> Finite<f64> { | ||
| // FIXME: Not spec complient because glutin don't have corresponding API | ||
| // Fallback to window.screen.height behavior | ||
| self.Height() |
This comment has been minimized.
This comment has been minimized.
paulrouget
Aug 22, 2017
Contributor
The FIXME should be in /ports/, not in servo. Code in /components/ are backend independent.
Here you should call self.avail_screen_size().height, and implement the associated message (GetAvailScreenSize).
In ports/glutin/window.rs, implement fn avail_screen_size(), and there, add the FIXME and use glutin::get_primary_monitor().get_dimensions();.
|
Move fallback to |
|
The throwing tests no longer exist upstream, so that's fine. |
|
@paulrouget I create a separate path for availWidth/availHeight all the way down to |
| ShutdownState::NotShuttingDown) => { | ||
| let screen_size = self.window.screen_size(top_level_browsing_context_id); | ||
| if let Err(e) = send.send(screen_size) { | ||
| warn!("Sending response to get client window failed ({}).", e); |
This comment has been minimized.
This comment has been minimized.
| ShutdownState::NotShuttingDown) => { | ||
| let screen_size = self.window.screen_avail_size(top_level_browsing_context_id); | ||
| if let Err(e) = send.send(screen_size) { | ||
| warn!("Sending response to get client window failed ({}).", e); |
This comment has been minimized.
This comment has been minimized.
| let (width, height) = glutin::get_primary_monitor().get_dimensions(); | ||
| Size2D::new(width, height) | ||
| } | ||
|
|
This comment has been minimized.
This comment has been minimized.
paulrouget
Aug 24, 2017
Contributor
In the headless case, you probably want to return context.width/height for both screen_size and screen_avail_size.
|
You also need to fix CEF (try |
24e76b3
to
3558b9c
|
Looks good to me. Can someone review this? |
|
Maybe @jdm, who suggested this solution? |
|
Looks good, some minor nits. |
| browser.get_host() | ||
| .get_client() | ||
| .get_render_handler() | ||
| .get_screen_info((*browser).clone(), &mut screen_info); |
This comment has been minimized.
This comment has been minimized.
| is_monochrome: 0 as i32, | ||
| rect: cef_rect_t::zero(), | ||
| available_rect: cef_rect_t::zero(), | ||
| }; |
This comment has been minimized.
This comment has been minimized.
asajeffrey
Aug 24, 2017
Member
Not very nice having to do this. Is there an implementation of Default::default() we could use to make this slightly better?
|
|
||
| [window.screen.availHeight >= 0 && window.screen.availHeight <= window.screen.height] | ||
| expected: FAIL | ||
|
|
This comment has been minimized.
This comment has been minimized.
| /// Get the screen size | ||
| GetScreenSize(TopLevelBrowsingContextId, IpcSender<(Size2D<u32>)>), | ||
| /// Get the available screen size | ||
| GetScreenAvailSize(TopLevelBrowsingContextId, IpcSender<(Size2D<u32>)>), |
This comment has been minimized.
This comment has been minimized.
asajeffrey
Aug 24, 2017
Member
This isn't really an issue with this PR, but it would be nice if we could give these typed units, since I'm not sure what the unit is (device pixels?). A comment with the unit at least would be nice.
This comment has been minimized.
This comment has been minimized.
shinglyu
Aug 25, 2017
Author
Member
Are you suggesting we use Typed* for all compositor message? Will that mean more bytes passing through IPC? or is it just a type system thing and has no runtime impact?
This comment has been minimized.
This comment has been minimized.
|
@asajeffrey Changing to Typed units seems like a good first bug for contributors. I'm going to create a followup bug for that and hand it to a new volunteer I'm mentoring here in Taiwan. So I only added a comment about the units. |
|
Sorry, new job, new team, new house, so didn't have time to check github for a while :'( Just pushed a fix and I'm testing it locally now. |
|
@bors-servo: try |
Enable screen.width/height/availWidth/availHeight <!-- Please describe your changes on the following line: --> Support screen.width/height/availWidth/availHeight using information from glutin. r?@paulrouget Since glutin don't have `availWidth` and `availHeight` information, I let them fallback to `width` and `height`. If that's not acceptable in terms of webcompat, I can remove that part. There are some test failures on wpt css about mutating screen.width/height should throw exception, but I can't reproduce that behavior on other major browser, so I keep them disabled. Also there are some media query issues, but I believe that's due to some test harness problem on my test machine. --- <!-- 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 - [x] These changes fix #18062 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes in wpt cssom-view - [ ] These changes do not require tests because _____ <!-- 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/18183) <!-- Reviewable:end -->
|
|
|
@shinglyu tests/wpt/metadata-css/ doesn't exist any more, and the merge algorithm apparently decided that that wasn't important. |
|
The merge commit seems to have the relevant test expectation removals: https://github.com/servo/servo/tree/db311974f63a2dc17c821f2c318c2e5379a275cd/tests/wpt/metadata (diffs on merge commits aren't very clear) |
|
Ah OK, let me do another rebase. |
|
Removed the test expectations that was moved to @bors-servo: try |
Enable screen.width/height/availWidth/availHeight <!-- Please describe your changes on the following line: --> Support screen.width/height/availWidth/availHeight using information from glutin. r?@paulrouget Since glutin don't have `availWidth` and `availHeight` information, I let them fallback to `width` and `height`. If that's not acceptable in terms of webcompat, I can remove that part. There are some test failures on wpt css about mutating screen.width/height should throw exception, but I can't reproduce that behavior on other major browser, so I keep them disabled. Also there are some media query issues, but I believe that's due to some test harness problem on my test machine. --- <!-- 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 - [x] These changes fix #18062 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes in wpt cssom-view - [ ] These changes do not require tests because _____ <!-- 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/18183) <!-- Reviewable:end -->
|
|
|
Yay, it landed! |
|
@bors-servo: r=asajeffrey |
|
|
Enable screen.width/height/availWidth/availHeight <!-- Please describe your changes on the following line: --> Support screen.width/height/availWidth/availHeight using information from glutin. r?@paulrouget Since glutin don't have `availWidth` and `availHeight` information, I let them fallback to `width` and `height`. If that's not acceptable in terms of webcompat, I can remove that part. There are some test failures on wpt css about mutating screen.width/height should throw exception, but I can't reproduce that behavior on other major browser, so I keep them disabled. Also there are some media query issues, but I believe that's due to some test harness problem on my test machine. --- <!-- 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 - [x] These changes fix #18062 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes in wpt cssom-view - [ ] These changes do not require tests because _____ <!-- 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/18183) <!-- Reviewable:end -->
|
|
shinglyu commentedAug 22, 2017
•
edited by SimonSapin
Support screen.width/height/availWidth/availHeight using information from glutin. r?@paulrouget
Since glutin don't have
availWidthandavailHeightinformation, I let them fallback towidthandheight. If that's not acceptable in terms of webcompat, I can remove that part.There are some test failures on wpt css about mutating screen.width/height should throw exception, but I can't reproduce that behavior on other major browser, so I keep them disabled. Also there are some media query issues, but I believe that's due to some test harness problem on my test machine.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is