Commit e58064d
committed
LocalFrame::setPrinting doesn't set printing state on remote frame children.
https://bugs.webkit.org/show_bug.cgi?id=299049
<rdar://problem/160808134>
Reviewed by Alex Christensen.
Makes the recursive setPrinting frame walk work correctly across local/remote
frame boundaries, and also synchronizes the boolean printing state to all
processes such that LocalFrame::shouldUsePrintingLayout can correctly detect if
it's the root printing frame.
The latter of these would be a good candidate for being moved to
FrameTreeSyncData, once that supports broadcasting mutations from a web process.
Adds a new test that checks that the print bool state is propagated recursively
into remote descendants by using an @media print rule in a cross origin iframe.
It also checks that LocalFrame::shouldUsePrintingLayout correctly reads the bool
printing state from remote ancestors by using a percentage width in the iframe.
If remote ancestor state isn't available, the frame contents will layout to the
page size instead of the viewport created by the iframe element (since it will
think it is the print root).
Test: http/tests/site-isolation/print-with-iframe.html
* LayoutTests/http/tests/site-isolation/print-with-iframe-expected.txt: Added.
* LayoutTests/http/tests/site-isolation/print-with-iframe.html: Added.
* LayoutTests/http/tests/site-isolation/resources/green-square-if-printed.html: Added.
* Source/WebCore/loader/EmptyClients.cpp:
(WebCore::EmptyFrameLoaderClient::setPrinting):
* Source/WebCore/loader/EmptyFrameLoaderClient.h:
* Source/WebCore/loader/FrameLoaderClient.h:
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::isPrinting const):
(WebCore::Frame::setPrinting):
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::setPrinting):
(WebCore::LocalFrame::shouldUsePrintingLayout const):
* Source/WebCore/page/LocalFrame.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setFramePrinting):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::setPrinting):
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::setPrinting):
* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp:
(WebKit::WebRemoteFrameClient::setPrinting):
* Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateOpener):
(WebKit::WebPage::setFramePrinting):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h:
(WebFrameLoaderClient::setPrinting):
Canonical link: https://commits.webkit.org/300374@main1 parent 7bf168f commit e58064d
File tree
25 files changed
+171
-16
lines changed- LayoutTests
- http/tests/site-isolation
- resources
- platform/ios/http/tests/site-isolation
- Source
- WebCore
- loader
- page
- WebKitLegacy/mac/WebCoreSupport
- WebKit
- UIProcess
- WebProcess
- WebCoreSupport
- WebPage
25 files changed
+171
-16
lines changedLines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
677 | 681 | | |
678 | 682 | | |
679 | 683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
348 | 360 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| |||
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
154 | 160 | | |
155 | 161 | | |
156 | 162 | | |
| |||
173 | 179 | | |
174 | 180 | | |
175 | 181 | | |
| 182 | + | |
176 | 183 | | |
177 | 184 | | |
178 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
671 | 671 | | |
672 | 672 | | |
673 | 673 | | |
674 | | - | |
| 674 | + | |
675 | 675 | | |
676 | 676 | | |
677 | 677 | | |
678 | 678 | | |
| 679 | + | |
| 680 | + | |
679 | 681 | | |
680 | 682 | | |
681 | 683 | | |
| |||
700 | 702 | | |
701 | 703 | | |
702 | 704 | | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
| 705 | + | |
| 706 | + | |
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
714 | | - | |
| 713 | + | |
715 | 714 | | |
716 | 715 | | |
717 | 716 | | |
| |||
0 commit comments