mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Auto merge of #11179 - asajeffrey:webdriver-resize-window, r=jgraham
Implemented webdriver SetWindowSize. 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 #10467 (github issue number if applicable). Either: - [ ] There are tests for these changes OR - [X] These changes do not require tests because the new tests are in https://github.com/w3c/web-platform-tests/pull/3024 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11179) <!-- Reviewable:end -->
This commit is contained in:
commit
2063bde0a4
9 changed files with 61 additions and 26 deletions
|
@ -292,13 +292,15 @@ impl<'a> Iterator for FrameTreeIterator<'a> {
|
|||
}
|
||||
|
||||
struct WebDriverData {
|
||||
load_channel: Option<(PipelineId, IpcSender<webdriver_msg::LoadStatus>)>
|
||||
load_channel: Option<(PipelineId, IpcSender<webdriver_msg::LoadStatus>)>,
|
||||
resize_channel: Option<IpcSender<WindowSizeData>>,
|
||||
}
|
||||
|
||||
impl WebDriverData {
|
||||
fn new() -> WebDriverData {
|
||||
WebDriverData {
|
||||
load_channel: None
|
||||
load_channel: None,
|
||||
resize_channel: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1484,6 +1486,13 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
// Find the script channel for the given parent pipeline,
|
||||
// and pass the event to that script thread.
|
||||
match msg {
|
||||
WebDriverCommandMsg::GetWindowSize(_, reply) => {
|
||||
let _ = reply.send(self.window_size);
|
||||
},
|
||||
WebDriverCommandMsg::SetWindowSize(_, size, reply) => {
|
||||
self.webdriver.resize_channel = Some(reply);
|
||||
self.compositor_proxy.send(ToCompositorMsg::ResizeTo(size));
|
||||
},
|
||||
WebDriverCommandMsg::LoadUrl(pipeline_id, load_data, reply) => {
|
||||
self.load_url_for_webdriver(pipeline_id, load_data, reply);
|
||||
},
|
||||
|
@ -1703,6 +1712,10 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF>
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(resize_channel) = self.webdriver.resize_channel.take() {
|
||||
let _ = resize_channel.send(new_size);
|
||||
}
|
||||
|
||||
self.window_size = new_size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue