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 upFigure out if Servo can just communicate iframe resizes to itself instead of relying on WebRender #14682
Comments
|
I do not see any reason it needs to be structured this way. The layout thread creates display items for each iframe that get passed directly to WR, and WR stores the LayerSize values in a hashmap unmodified. These values are passed unmodified by WR to the pipeline_size_changed notification in the compositor, which sends them unmodified to the constellation. Finally in the constellation they are sent to the script thread, which uses them to resize things. Since the constellation already has a hashmap of pipelines that contains a size, we could theoretically send them from layout to the constellation and do the checking there. This should let us remove all the related code from WR. |
|
Right, I'm taking this one! |
|
Since this will introduce changes in both servo's and webrender's repos, how will the bot build/test these changes? |
|
The bot can't test it unless you publish a fork of webrender with your changes (or they get merged into the original) and the PR includes an update to the WR revision. |
|
My suggestion would be to change Servo to work without using the WR APIs at all first. Then we could actually land this without any changes to WR. Once that work is done, we could remove the deprecated WR APIs as a follow up, which will then have no effect on Servo since they are unused. |
|
I'm sending a resize message from layout to constellation in Later, I compare the size I sent in the message to constellation to the old size here. But when I check the debug logs, I notice that the two sizes are always equal. Am I correct in assuming that |
|
I believe the problem is that sending the viewport size from layout to the constellation is self-fulfilling - the viewport is provided to layout by the script thread, and was provided to the script thread by the constellation. Instead, when layout encounters an iframe element and determines its size, it should inform the constellation of the iframe's dimensions for the pipeline contained inside of the iframe. |
|
@jdm What do you mean by pipelines contained inside the iframe? |
|
An iframe embeds one document inside of another. Each document has a corresponding pipeline, therefore there is a pipeline associated with the child document embedded in the iframe. |
|
I don't know if I understood this right, but we were checking whether there was a mismatch in the old and new sizes and updating the frame size itself. Why do we want to update the children's sizes in this refactor? |
|
For a document A that contains an iframe embedding document B, there are two layout threads. The viewport size of document B depends on the size of the iframe calculated by the layout thread for document A. In Servo master, the layout thread for document A sends a display list to the compositor that includes the iframe size, and at some point WebRender sees this and checks whether that iframe changed sizes. It then notifies the compositor, which notifies the constellation, which sends a resize message to the script thread for document B. Next time layout happens for document B, the layout thread is informed of the updated viewport size. In the new model that excludes WebRender, the layout thread for document A still has the information about the iframe size. The layout thread for document B will not receive an updated viewport size unless the constellation finds out about document A's iframe size, so it can propagate that information to document B's script thread. Does that make sense? |
|
Doesn't layout thread send the display list to WR instead of the compositor? |
|
That may be the case, yes. |
|
Ah, it makes sense now. Thanks! |
|
If you want debug logs, it's better to select the modules that will actually be useful (eg. |
|
I've changed the code so that the display list is checked in |
|
The debug messages show that the existing pipeline size in the constellation is always None. This means that cynicaldevil@fd427ea#diff-55c92a6a5ba7654ce45fe6fc6c63740fR1336 skips the code that updates the current size and the resize message is never sent. |
Refactor to send iframe resize messages directly from layout thread to constellation <!-- 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 - [X] These changes fix #14682. <!-- Either: --> r? @jdm passing tests: tests/wpt/mozilla/tests/css/matchMedia.html, tests/wpt/mozilla/tests/mozilla/window_resize_not_triggered_on_load.html, tests/wpt/mozilla/tests/mozilla/iframe/resize_after_load.html, tests/wpt/mozilla/tests/css/meta_viewport_resize.html <!-- 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/15129) <!-- Reviewable:end -->
Refactor to send iframe resize messages directly from layout thread to constellation <!-- 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 - [X] These changes fix #14682. <!-- Either: --> r? @jdm passing tests: tests/wpt/mozilla/tests/css/matchMedia.html, tests/wpt/mozilla/tests/mozilla/window_resize_not_triggered_on_load.html, tests/wpt/mozilla/tests/mozilla/iframe/resize_after_load.html, tests/wpt/mozilla/tests/css/meta_viewport_resize.html <!-- 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/15129) <!-- Reviewable:end -->
|
Trying to reland them in #15186 |
|
Relanded |
Currently WebRender sends a FrameSize message to the constellation when it detects an Iframe resize. It seems like any consumers of this should be getting the information directly from layout instead of indirectly via WebRender.
@jdm