haikuwebkit/LayoutTests/printing/printing-events.html

29 lines
586 B
HTML
Raw Permalink Normal View History

[WK2] Add support for Window's beforeprint / afterprint events https://bugs.webkit.org/show_bug.cgi?id=196478 Reviewed by Alex Christensen. LayoutTests/imported/w3c: Rebaseline WPT tests now that more checks are passing. * web-platform-tests/html/browsers/the-window-object/security-window/window-security.https-expected.txt: * web-platform-tests/html/browsers/the-window-object/security-window/window-security.sub-expected.txt: * web-platform-tests/html/browsers/the-window-object/window-properties.https-expected.txt: * web-platform-tests/html/dom/interfaces-expected.txt: * web-platform-tests/html/webappapis/scripting/events/body-exposed-window-event-handlers-expected.txt: * web-platform-tests/html/webappapis/scripting/events/event-handler-attributes-body-window-expected.txt: Source/WebCore: Add support for Window's beforeprint / afterprint events as per: - https://html.spec.whatwg.org/#dom-print Blink and Gecko already support this. Test: printing/printing-events.html * dom/EventNames.h: * html/HTMLAttributeNames.in: * html/HTMLBodyElement.cpp: (WebCore::HTMLBodyElement::createWindowEventHandlerNameMap): * page/Page.cpp: (WebCore::dispatchPrintEvent): (WebCore::Page::dispatchBeforePrintEvent): (WebCore::Page::dispatchAfterPrintEvent): * page/Page.h: * page/WindowEventHandlers.idl: Source/WebKit: Add support for Window's beforeprint / afterprint events as per: - https://html.spec.whatwg.org/#dom-print Blink and Gecko already support this. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::beginPrinting): (WebKit::WebPage::endPrinting): Tools: Add minimal implementation for printFrame in WebKitTestRunner. * WebKitTestRunner/TestController.cpp: (WTR::printFrame): (WTR::TestController::createOtherPage): (WTR::TestController::createWebViewWithOptions): LayoutTests: Add layout test coverage. * TestExpectations: * platform/wk2/TestExpectations: * printing/printing-events-expected.txt: Added. * printing/printing-events.html: Added. Canonical link: https://commits.webkit.org/210773@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243762 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-04-02 21:43:24 +00:00
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<script>
description("Basic testing for beforeprint / afterprint events");
jsTestIsAsync = true;
let receivedBeforePrintEvent = false;
addEventListener("beforeprint", () => {
debug("* Received beforeprint event");
receivedBeforePrintEvent = true;
});
addEventListener("afterprint", () => {
debug("* Received afterprint event");
shouldBeTrue("receivedBeforePrintEvent");
finishJSTest();
});
onload = () => {
evalAndLog("window.print()");
};
</script>
</body>
</html>