- Revision
- 281243
- Author
- simon.fra...@apple.com
- Date
- 2021-08-19 09:23:36 -0700 (Thu, 19 Aug 2021)
Log Message
Rename WebPageProxy::headerHeight() and related to make it clear they are for printing
https://bugs.webkit.org/show_bug.cgi?id=229242
Reviewed by Tim Horton.
Disambiguate WebPageProxy::headerHeight(), used for printing, from FrameView::headerHeight()
which is not.
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::headerHeightForPrinting):
(WebKit::WebPageProxy::footerHeightForPrinting):
(WebKit::WebPageProxy::drawHeaderForPrinting):
(WebKit::WebPageProxy::drawFooterForPrinting):
(WebKit::WebPageProxy::headerHeight): Deleted.
(WebKit::WebPageProxy::footerHeight): Deleted.
(WebKit::WebPageProxy::drawHeader): Deleted.
(WebKit::WebPageProxy::drawFooter): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]):
(-[WKPrintingView drawPageBorderWithSize:]):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (281242 => 281243)
--- trunk/Source/WebKit/ChangeLog 2021-08-19 16:10:36 UTC (rev 281242)
+++ trunk/Source/WebKit/ChangeLog 2021-08-19 16:23:36 UTC (rev 281243)
@@ -1,5 +1,30 @@
2021-08-19 Simon Fraser <simon.fra...@apple.com>
+ Rename WebPageProxy::headerHeight() and related to make it clear they are for printing
+ https://bugs.webkit.org/show_bug.cgi?id=229242
+
+ Reviewed by Tim Horton.
+
+ Disambiguate WebPageProxy::headerHeight(), used for printing, from FrameView::headerHeight()
+ which is not.
+
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::headerHeightForPrinting):
+ (WebKit::WebPageProxy::footerHeightForPrinting):
+ (WebKit::WebPageProxy::drawHeaderForPrinting):
+ (WebKit::WebPageProxy::drawFooterForPrinting):
+ (WebKit::WebPageProxy::headerHeight): Deleted.
+ (WebKit::WebPageProxy::footerHeight): Deleted.
+ (WebKit::WebPageProxy::drawHeader): Deleted.
+ (WebKit::WebPageProxy::drawFooter): Deleted.
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/mac/WKPrintingView.mm:
+ (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]):
+ (-[WKPrintingView drawPageBorderWithSize:]):
+
+2021-08-19 Simon Fraser <simon.fra...@apple.com>
+
Use a Ref<> argument to keep WebPage alive in TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition()
https://bugs.webkit.org/show_bug.cgi?id=229239
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (281242 => 281243)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2021-08-19 16:10:36 UTC (rev 281242)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2021-08-19 16:23:36 UTC (rev 281243)
@@ -115,10 +115,13 @@
void setWindowFrame(WebPageProxy&, const WebCore::FloatRect&) final;
void windowFrame(WebPageProxy&, Function<void(WebCore::FloatRect)>&&) final;
void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&) final;
+
+ // Printing.
float headerHeight(WebPageProxy&, WebFrameProxy&) final;
float footerHeight(WebPageProxy&, WebFrameProxy&) final;
void drawHeader(WebPageProxy&, WebFrameProxy&, WebCore::FloatRect&&) final;
void drawFooter(WebPageProxy&, WebFrameProxy&, WebCore::FloatRect&&) final;
+
void decidePolicyForNotificationPermissionRequest(WebPageProxy&, API::SecurityOrigin&, CompletionHandler<void(bool allowed)>&&) final;
void unavailablePluginButtonClicked(WebPageProxy&, WKPluginUnavailabilityReason, API::Dictionary&) final;
void mouseDidMoveOverElement(WebPageProxy&, const WebHitTestResultData&, OptionSet<WebEvent::Modifier>, API::Object*);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (281242 => 281243)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-08-19 16:10:36 UTC (rev 281242)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-08-19 16:23:36 UTC (rev 281243)
@@ -8662,7 +8662,7 @@
m_process->processPool().supplement<WebNotificationManagerProxy>()->didDestroyNotification(this, notificationID);
}
-float WebPageProxy::headerHeight(WebFrameProxy& frame)
+float WebPageProxy::headerHeightForPrinting(WebFrameProxy& frame)
{
if (frame.isDisplayingPDFDocument())
return 0;
@@ -8669,7 +8669,7 @@
return m_uiClient->headerHeight(*this, frame);
}
-float WebPageProxy::footerHeight(WebFrameProxy& frame)
+float WebPageProxy::footerHeightForPrinting(WebFrameProxy& frame)
{
if (frame.isDisplayingPDFDocument())
return 0;
@@ -8676,7 +8676,7 @@
return m_uiClient->footerHeight(*this, frame);
}
-void WebPageProxy::drawHeader(WebFrameProxy& frame, FloatRect&& rect)
+void WebPageProxy::drawHeaderForPrinting(WebFrameProxy& frame, FloatRect&& rect)
{
if (frame.isDisplayingPDFDocument())
return;
@@ -8683,7 +8683,7 @@
m_uiClient->drawHeader(*this, frame, WTFMove(rect));
}
-void WebPageProxy::drawFooter(WebFrameProxy& frame, FloatRect&& rect)
+void WebPageProxy::drawFooterForPrinting(WebFrameProxy& frame, FloatRect&& rect)
{
if (frame.isDisplayingPDFDocument())
return;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (281242 => 281243)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-08-19 16:10:36 UTC (rev 281242)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-08-19 16:23:36 UTC (rev 281243)
@@ -1196,10 +1196,10 @@
void runJavaScriptInFrameInScriptWorld(WebCore::RunJavaScriptParameters&&, std::optional<WebCore::FrameIdentifier>, API::ContentWorld&, CompletionHandler<void(Expected<RefPtr<API::SerializedScriptValue>, WebCore::ExceptionDetails>&&)>&&);
void forceRepaint(CompletionHandler<void()>&&);
- float headerHeight(WebFrameProxy&);
- float footerHeight(WebFrameProxy&);
- void drawHeader(WebFrameProxy&, WebCore::FloatRect&&);
- void drawFooter(WebFrameProxy&, WebCore::FloatRect&&);
+ float headerHeightForPrinting(WebFrameProxy&);
+ float footerHeightForPrinting(WebFrameProxy&);
+ void drawHeaderForPrinting(WebFrameProxy&, WebCore::FloatRect&&);
+ void drawFooterForPrinting(WebFrameProxy&, WebCore::FloatRect&&);
#if PLATFORM(COCOA)
// Dictionary.
Modified: trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm (281242 => 281243)
--- trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm 2021-08-19 16:10:36 UTC (rev 281242)
+++ trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm 2021-08-19 16:23:36 UTC (rev 281243)
@@ -158,8 +158,8 @@
}
CGFloat scale = [info scalingFactor];
- [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeight(*_webFrame) * scale];
- [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeight(*_webFrame) * scale];
+ [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeightForPrinting(*_webFrame) * scale];
+ [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeightForPrinting(*_webFrame) * scale];
}
- (BOOL)_isPrintingPreview
@@ -662,18 +662,20 @@
NSSize paperSize = [printInfo paperSize];
CGFloat headerFooterLeft = [printInfo leftMargin] / scale;
CGFloat headerFooterWidth = (paperSize.width - ([printInfo leftMargin] + [printInfo rightMargin])) / scale;
- NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _webFrame->page()->footerHeight(*_webFrame), headerFooterWidth, _webFrame->page()->footerHeight(*_webFrame));
- NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _webFrame->page()->headerHeight(*_webFrame));
+ CGFloat headerHeight = _webFrame->page()->headerHeightForPrinting(*_webFrame);
+ CGFloat footerHeight = _webFrame->page()->footerHeightForPrinting(*_webFrame);
+ NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - footerHeight, headerFooterWidth, footerHeight);
+ NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, headerHeight);
NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
[currentContext saveGraphicsState];
NSRectClip(headerRect);
- _webFrame->page()->drawHeader(*_webFrame, headerRect);
+ _webFrame->page()->drawHeaderForPrinting(*_webFrame, headerRect);
[currentContext restoreGraphicsState];
[currentContext saveGraphicsState];
NSRectClip(footerRect);
- _webFrame->page()->drawFooter(*_webFrame, footerRect);
+ _webFrame->page()->drawFooterForPrinting(*_webFrame, footerRect);
[currentContext restoreGraphicsState];
}