Commit 478c5093 authored by kaustubh@motorola.com's avatar kaustubh@motorola.com

[DRT] LTC:: Move printing related APIs from LayoutTestController to Internals

https://bugs.webkit.org/show_bug.cgi?id=92735

Reviewed by Hajime Morita.

.: 

Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.
Added symbols for GTK builds for corresponding APIs.

* Source/autotools/symbols.filter:

Source/WebCore: 

Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.

Covered by existing test cases.

* testing/Internals.cpp:
(WebCore::Internals::numberOfPages):
(WebCore):
(WebCore::Internals::pageProperty):
(WebCore::Internals::pageSizeAndMarginsInPixels):
* testing/Internals.h:
(Internals):
* testing/Internals.idl:

Source/WebKit/efl: 

Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
* WebCoreSupport/DumpRenderTreeSupportEfl.h:

Source/WebKit/gtk: 

Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
* WebCoreSupport/DumpRenderTreeSupportGtk.h:
(DumpRenderTreeSupportGtk):

Source/WebKit/qt: 

Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld):
* WebCoreSupport/DumpRenderTreeSupportQt.h:

Source/WebKit/win: 

Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.
Kept the function defination and declaration to keep binary compatibility for IWebFramePrivate.idl

* WebFrame.cpp:
(WebFrame::numberOfPages):

Source/WebKit2: 

Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.
Add symbols for Mac Win builds for corresponding newly added APIs.

* win/WebKit2.def:
* win/WebKit2CFLite.def:

Tools: 

Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.

* DumpRenderTree/TestRunner.cpp:
(TestRunner::staticFunctions):
* DumpRenderTree/TestRunner.h:
(TestRunner):
* DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp:
(TestRunner::addUserStyleSheet):
* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
(DRTTestRunner::hasCustomPageSizeStyle):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/efl/TestRunnerEfl.cpp:
* DumpRenderTree/gtk/TestRunnerGtk.cpp:
* DumpRenderTree/mac/TestRunnerMac.mm:
* DumpRenderTree/qt/TestRunnerQt.cpp:
(TestRunner::evaluateScriptInIsolatedWorld):
* DumpRenderTree/qt/TestRunnerQt.h:
(TestRunner):
* DumpRenderTree/win/TestRunnerWin.cpp:
* DumpRenderTree/wx/TestRunnerWx.cpp:
(TestRunner::abortModal):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(TestRunner):

LayoutTests: 

Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.
Fixed test cases to use internals API instead of testRunner.

* printing/numberOfPages-expected.txt:
* printing/page-count-layout-overflow.html:
* printing/page-count-relayout-shrink.html:
* printing/page-count-with-one-word.html:
* printing/page-format-data-display-none.html:
* printing/page-format-data-expected.txt:
* printing/page-format-data.html:
* printing/page-rule-selection-expected.txt:
* printing/page-rule-selection.html:
* printing/resources/paged-media-test-utils.js:
(numberOfPagesShouldBe):
* printing/script-tests/numberOfPages.js:
* printing/zoomed-document.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 193d2872
2012-09-05 Kaustubh Atrawalkar <kaustubh@motorola.com>
[DRT] LTC:: Move printing related APIs from LayoutTestController to Internals
https://bugs.webkit.org/show_bug.cgi?id=92735
Reviewed by Hajime Morita.
Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.
Added symbols for GTK builds for corresponding APIs.
* Source/autotools/symbols.filter:
2012-09-04 Julien Chaffraix <jchaffraix@webkit.org>
REGRESSION(r120832): RenderLayer::clampScrollOffset doesn't properly clamp
......
2012-09-05 Kaustubh Atrawalkar <kaustubh@motorola.com>
[DRT] LTC:: Move printing related APIs from LayoutTestController to Internals
https://bugs.webkit.org/show_bug.cgi?id=92735
Reviewed by Hajime Morita.
Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.
Fixed test cases to use internals API instead of testRunner.
* printing/numberOfPages-expected.txt:
* printing/page-count-layout-overflow.html:
* printing/page-count-relayout-shrink.html:
* printing/page-count-with-one-word.html:
* printing/page-format-data-display-none.html:
* printing/page-format-data-expected.txt:
* printing/page-format-data.html:
* printing/page-rule-selection-expected.txt:
* printing/page-rule-selection.html:
* printing/resources/paged-media-test-utils.js:
(numberOfPagesShouldBe):
* printing/script-tests/numberOfPages.js:
* printing/zoomed-document.html:
2012-09-05 Dominik Röttsches <dominik.rottsches@intel.com>
[EFL] Unreviewed gardening after r127513
Test for testRunner.numberOfPages()
Test for internals.numberOfPages()
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
......@@ -21,7 +21,7 @@ function runTest()
for (var i = 0; i < 7; i++)
lines = lines.concat(lines);
document.body.innerHTML = '<p>' + lines.join('') + '</p>';
document.body.textContent = 'When printing, layout overflow must be cleared after current document size is queried: ' + (testRunner.numberOfPages() > 1 ? 'PASS' : 'FAIL');
document.body.textContent = 'When printing, layout overflow must be cleared after current document size is queried: ' + (internals.numberOfPages() > 1 ? 'PASS' : 'FAIL');
}
</script>
......
......@@ -17,7 +17,7 @@ function runTest()
document.body.appendChild(block.cloneNode(true));
testRunner.dumpAsText();
var pages = testRunner.numberOfPages();
var pages = internals.numberOfPages();
document.body.textContent = 'Document has ' + pages + ' pages.';
}
......
......@@ -13,7 +13,7 @@ if (window.testRunner) {
// Test the range around A4 portrait paper size
for (var i = 530; i < 560; i++) {
for (var j = 730; j < 760; j++) {
var numberOfPages = testRunner.numberOfPages(i, j);
var numberOfPages = internals.numberOfPages(i, j);
if (numberOfPages != 1) {
pass = false;
......
......@@ -22,7 +22,7 @@ if (window.testRunner) {
testRunner.dumpAsText();
// The test passes if the following line doesn't cause a crash.
testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4);
internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4);
document.getElementById("output").innerHTML = "PASS";
}
......
......@@ -15,68 +15,68 @@ Test visibility: visible
PASS internals.isPageBoxVisible(document, 0) is true
Test default page size
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(100, 200)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(100, 200)' + pxMargins(1, 2, 3, 4)
Test auto page size
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(100, 200)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(100, 200)' + pxMargins(1, 2, 3, 4)
Test landscape
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(200, 100)' + pxMargins(1, 2, 3, 4)
PASS testRunner.pageSizeAndMarginsInPixels(0, 200, 100, 1, 2, 3, 4) is '(200, 100)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(200, 100)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 200, 100, 1, 2, 3, 4) is '(200, 100)' + pxMargins(1, 2, 3, 4)
Test portrait
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(100, 200)' + pxMargins(1, 2, 3, 4)
PASS testRunner.pageSizeAndMarginsInPixels(0, 200, 100, 1, 2, 3, 4) is '(100, 200)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(100, 200)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 200, 100, 1, 2, 3, 4) is '(100, 200)' + pxMargins(1, 2, 3, 4)
Test a5
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(148, 210) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(148, 210) + pxMargins(1, 2, 3, 4)
Test a5 landscape
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(210, 148) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(210, 148) + pxMargins(1, 2, 3, 4)
Test portrait a4
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(210, 297) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(210, 297) + pxMargins(1, 2, 3, 4)
Test a3
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(297, 420) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(297, 420) + pxMargins(1, 2, 3, 4)
Test b5
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(176, 250) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(176, 250) + pxMargins(1, 2, 3, 4)
Test b4
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(250, 353) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(250, 353) + pxMargins(1, 2, 3, 4)
Test letter
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is inchSize(8.5, 11) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is inchSize(8.5, 11) + pxMargins(1, 2, 3, 4)
Test legal
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is inchSize(8.5, 14) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is inchSize(8.5, 14) + pxMargins(1, 2, 3, 4)
Test ledger
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is inchSize(11, 17) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is inchSize(11, 17) + pxMargins(1, 2, 3, 4)
Test 10cm
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(100, 100) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(100, 100) + pxMargins(1, 2, 3, 4)
Test 20cm x 30cm
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(200, 300) + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is mmSize(200, 300) + pxMargins(1, 2, 3, 4)
Test 10000px 20000px
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
Test invalid page size: -10cm
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
Test invalid page size: a4 a4
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
Test invalid page size: landscape portrait
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
Test invalid page size: 10cm letter
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
Test invalid page size: 10cm 10cm 10cm
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
Test invalid page size: empty
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 2, 3, 4)
Test 0px margins
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(0, 0, 0, 0)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(0, 0, 0, 0)
Test non-zero margins
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(10, 20, 40, 80)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(10, 20, 40, 80)
Test percentage margin
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 400, 200, 100)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 400, 200, 100)
Test margin: auto 4% 2% 1%
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 400, 200, 100)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(1, 400, 200, 100)
Test margin: 8% auto 2% 1%
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 2, 200, 100)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 2, 200, 100)
Test margin: 8% 4% auto 1%
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 400, 3, 100)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 400, 3, 100)
Test margin: 8% 4% 2% auto
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 400, 200, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 400, 200, 4)
Test visibility: hidden
PASS testRunner.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 400, 200, 4)
PASS internals.pageSizeAndMarginsInPixels(0, 100, 200, 1, 2, 3, 4) is '(10000, 20000)' + pxMargins(800, 400, 200, 4)
PASS successfullyParsed is true
......
This diff is collapsed.
......@@ -4,55 +4,55 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Default margin is auto.
PASS testRunner.pageProperty('margin-left', 0) is "auto"
PASS testRunner.pageProperty('margin-left', 1) is "auto"
PASS testRunner.pageProperty('margin-left', 2) is "auto"
PASS testRunner.pageProperty('margin-left', 3) is "auto"
PASS testRunner.pageProperty('margin-left', 4) is "auto"
PASS internals.pageProperty('margin-left', 0) is "auto"
PASS internals.pageProperty('margin-left', 1) is "auto"
PASS internals.pageProperty('margin-left', 2) is "auto"
PASS internals.pageProperty('margin-left', 3) is "auto"
PASS internals.pageProperty('margin-left', 4) is "auto"
Set margin to 200px via user style sheet.
PASS testRunner.pageProperty('margin-left', 0) is "200"
PASS testRunner.pageProperty('margin-left', 1) is "200"
PASS testRunner.pageProperty('margin-left', 2) is "200"
PASS testRunner.pageProperty('margin-left', 3) is "200"
PASS testRunner.pageProperty('margin-left', 4) is "200"
PASS internals.pageProperty('margin-left', 0) is "200"
PASS internals.pageProperty('margin-left', 1) is "200"
PASS internals.pageProperty('margin-left', 2) is "200"
PASS internals.pageProperty('margin-left', 3) is "200"
PASS internals.pageProperty('margin-left', 4) is "200"
Set margin to 100px.
PASS testRunner.pageProperty('margin-left', 0) is "100"
PASS testRunner.pageProperty('margin-left', 1) is "100"
PASS testRunner.pageProperty('margin-left', 2) is "100"
PASS testRunner.pageProperty('margin-left', 3) is "100"
PASS testRunner.pageProperty('margin-left', 4) is "100"
PASS internals.pageProperty('margin-left', 0) is "100"
PASS internals.pageProperty('margin-left', 1) is "100"
PASS internals.pageProperty('margin-left', 2) is "100"
PASS internals.pageProperty('margin-left', 3) is "100"
PASS internals.pageProperty('margin-left', 4) is "100"
Set margin for right pages to 50px. The first page is a right page.
PASS testRunner.pageProperty('margin-left', 0) is "50"
PASS testRunner.pageProperty('margin-left', 1) is "100"
PASS testRunner.pageProperty('margin-left', 2) is "50"
PASS testRunner.pageProperty('margin-left', 3) is "100"
PASS testRunner.pageProperty('margin-left', 4) is "50"
PASS internals.pageProperty('margin-left', 0) is "50"
PASS internals.pageProperty('margin-left', 1) is "100"
PASS internals.pageProperty('margin-left', 2) is "50"
PASS internals.pageProperty('margin-left', 3) is "100"
PASS internals.pageProperty('margin-left', 4) is "50"
Set margin for left pages to 75px.
PASS testRunner.pageProperty('margin-left', 0) is "50"
PASS testRunner.pageProperty('margin-left', 1) is "75"
PASS testRunner.pageProperty('margin-left', 2) is "50"
PASS testRunner.pageProperty('margin-left', 3) is "75"
PASS testRunner.pageProperty('margin-left', 4) is "50"
PASS internals.pageProperty('margin-left', 0) is "50"
PASS internals.pageProperty('margin-left', 1) is "75"
PASS internals.pageProperty('margin-left', 2) is "50"
PASS internals.pageProperty('margin-left', 3) is "75"
PASS internals.pageProperty('margin-left', 4) is "50"
Set margin for the first page to 125px.
PASS testRunner.pageProperty('margin-left', 0) is "125"
PASS testRunner.pageProperty('margin-left', 1) is "75"
PASS testRunner.pageProperty('margin-left', 2) is "50"
PASS testRunner.pageProperty('margin-left', 3) is "75"
PASS testRunner.pageProperty('margin-left', 4) is "50"
PASS internals.pageProperty('margin-left', 0) is "125"
PASS internals.pageProperty('margin-left', 1) is "75"
PASS internals.pageProperty('margin-left', 2) is "50"
PASS internals.pageProperty('margin-left', 3) is "75"
PASS internals.pageProperty('margin-left', 4) is "50"
Change the document direction to RTL. This makes the first page a left page.
PASS testRunner.pageProperty('margin-left', 0) is "125"
PASS testRunner.pageProperty('margin-left', 1) is "50"
PASS testRunner.pageProperty('margin-left', 2) is "75"
PASS testRunner.pageProperty('margin-left', 3) is "50"
PASS testRunner.pageProperty('margin-left', 4) is "75"
PASS internals.pageProperty('margin-left', 0) is "125"
PASS internals.pageProperty('margin-left', 1) is "50"
PASS internals.pageProperty('margin-left', 2) is "75"
PASS internals.pageProperty('margin-left', 3) is "50"
PASS internals.pageProperty('margin-left', 4) is "75"
Check font update and line height override.
PASS testRunner.pageProperty('line-height', 0) is "180"
PASS testRunner.pageProperty('font-family', 0) is "Arial"
PASS testRunner.pageProperty('font-size', 0) is "30"
PASS internals.pageProperty('line-height', 0) is "180"
PASS internals.pageProperty('font-family', 0) is "Arial"
PASS internals.pageProperty('font-size', 0) is "30"
Check @media rules.
PASS testRunner.pageProperty('size', 0) is "100 200"
PASS testRunner.pageProperty('size', 0) is "150 250"
PASS testRunner.pageProperty('size', 0) is "150 250"
PASS internals.pageProperty('size', 0) is "100 200"
PASS internals.pageProperty('size', 0) is "150 250"
PASS internals.pageProperty('size', 0) is "150 250"
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -20,77 +20,77 @@
testRunner.dumpAsText();
debug("Default margin is auto.");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 0)", "auto");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 1)", "auto");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 2)", "auto");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 3)", "auto");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 4)", "auto");
shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "auto");
shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "auto");
shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "auto");
shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "auto");
shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "auto");
debug("Set margin to 200px via user style sheet.");
testRunner.addUserStyleSheet("@page { margin:200px; }", true);
shouldBeEqualToString("testRunner.pageProperty('margin-left', 0)", "200");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 1)", "200");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 2)", "200");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 3)", "200");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 4)", "200");
shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "200");
shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "200");
shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "200");
shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "200");
shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "200");
debug("Set margin to 100px.");
appendStyle("@page { margin:100px; }");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 0)", "100");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 1)", "100");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 2)", "100");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 3)", "100");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 4)", "100");
shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "100");
shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "100");
shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "100");
shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "100");
shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "100");
debug("Set margin for right pages to 50px. The first page is a right page.");
appendStyle("@page :right { margin:50px; }");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 0)", "50");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 1)", "100");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 2)", "50");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 3)", "100");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 4)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "100");
shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "100");
shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "50");
debug("Set margin for left pages to 75px.");
appendStyle("@page :left { margin:75px; }");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 0)", "50");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 1)", "75");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 2)", "50");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 3)", "75");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 4)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "75");
shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "75");
shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "50");
debug("Set margin for the first page to 125px.");
appendStyle("@page :first { margin:125px; }");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 0)", "125");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 1)", "75");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 2)", "50");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 3)", "75");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 4)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "125");
shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "75");
shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "75");
shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "50");
debug("Change the document direction to RTL. This makes the first page a left page.");
document.getElementById("html_element").setAttribute("dir", "rtl");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 0)", "125");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 1)", "50");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 2)", "75");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 3)", "50");
shouldBeEqualToString("testRunner.pageProperty('margin-left', 4)", "75");
shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "125");
shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "75");
shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "50");
shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "75");
debug("Check font update and line height override.");
appendStyle("@page { line-height:1em; }");
appendStyle("@page { font-family:Futura; }");
appendStyle("@page { font:15px/6em Arial; }");
appendStyle("@page { zoom:200%; }");
shouldBeEqualToString("testRunner.pageProperty('line-height', 0)", "180");
shouldBeEqualToString("testRunner.pageProperty('font-family', 0)", "Arial");
shouldBeEqualToString("testRunner.pageProperty('font-size', 0)", "30");
shouldBeEqualToString("internals.pageProperty('line-height', 0)", "180");
shouldBeEqualToString("internals.pageProperty('font-family', 0)", "Arial");
shouldBeEqualToString("internals.pageProperty('font-size', 0)", "30");
appendStyle("@page { zoom:100%; }");
debug("Check @media rules.");
appendStyle("@page { size:100px 200px; }");
shouldBeEqualToString("testRunner.pageProperty('size', 0)", "100 200");
shouldBeEqualToString("internals.pageProperty('size', 0)", "100 200");
appendStyle("@media print { @page { size:150px 250px; } }");
shouldBeEqualToString("testRunner.pageProperty('size', 0)", "150 250");
shouldBeEqualToString("internals.pageProperty('size', 0)", "150 250");
appendStyle("@media screen { @page { size:300px 500px; } }");
shouldBeEqualToString("testRunner.pageProperty('size', 0)", "150 250");
shouldBeEqualToString("internals.pageProperty('size', 0)", "150 250");
} else {
testFailed("This test can be run only with window.testRunner");
......
......@@ -26,9 +26,9 @@ function numberOfPagesShouldBe(expectedNumberOfPages, pageWidthInPixels, pageHei
// pageWidthInPixels and pageHeightInPixels can be omitted. If omitted, 800x600 is used.
var actualNumberOfPages;
if (pageWidthInPixels && pageHeightInPixels)
actualNumberOfPages = testRunner.numberOfPages(pageWidthInPixels, pageHeightInPixels);
actualNumberOfPages = internals.numberOfPages(pageWidthInPixels, pageHeightInPixels);
else
actualNumberOfPages = testRunner.numberOfPages();
actualNumberOfPages = internals.numberOfPages();
if (actualNumberOfPages == expectedNumberOfPages)
appendResult('PASS: number of pages is ' + actualNumberOfPages);
......
description("Test for testRunner.numberOfPages()");
description("Test for internals.numberOfPages()");
function test()
{
......
......@@ -13,7 +13,7 @@ if (window.testRunner) {
// Determine minium page size height where text fits on a single page.
var height;
for (var i = 10; i < 100; i += 5) {
if (testRunner.numberOfPages(100, i) == 1) {
if (internals.numberOfPages(100, i) == 1) {
height = i;
break;
}
......@@ -21,7 +21,7 @@ if (window.testRunner) {
// Zoom in and verify that page count does not change.
for (var i = 0; i < 10; i++) {
var numberOfPages = testRunner.numberOfPages(100, height);
var numberOfPages = internals.numberOfPages(100, height);
if (numberOfPages != 1) {
pass = false;
msg += 'Got ' + numberOfPages + ' pages, expected 1 page.\n';
......
2012-09-05 Kaustubh Atrawalkar <kaustubh@motorola.com>
[DRT] LTC:: Move printing related APIs from LayoutTestController to Internals
https://bugs.webkit.org/show_bug.cgi?id=92735
Reviewed by Hajime Morita.
Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.
Covered by existing test cases.
* testing/Internals.cpp:
(WebCore::Internals::numberOfPages):
(WebCore):
(WebCore::Internals::pageProperty):
(WebCore::Internals::pageSizeAndMarginsInPixels):
* testing/Internals.h:
(Internals):
* testing/Internals.idl:
2012-09-05 Simon Hausmann <simon.hausmann@nokia.com>
[Qt] Automate the use of AllInOne files in the Qt build
......@@ -1170,6 +1170,34 @@ PassRefPtr<DOMStringList> Internals::iconURLs(Document* document) const
return stringList.release();
}
int Internals::numberOfPages(float pageWidth, float pageHeight)
{
if (!frame())
return -1;
return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight));
}
String Internals::pageProperty(String propertyName, int pageNumber, ExceptionCode& ec) const
{
if (!frame()) {
ec = INVALID_ACCESS_ERR;
return String();
}
return PrintContext::pageProperty(frame(), propertyName.utf8().data(), pageNumber);
}
String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionCode& ec) const
{
if (!frame()) {
ec = INVALID_ACCESS_ERR;
return String();
}
return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
}
#if ENABLE(FULLSCREEN_API)
void Internals::webkitWillEnterFullScreenForElement(Document* document, Element* element)
{
......
......@@ -27,6 +27,7 @@
#define Internals_h
#include "ContextDestructionObserver.h"
#include "ExceptionCodePlaceholder.h"
#include "NodeList.h"
#include "PlatformString.h"
#include <wtf/PassRefPtr.h>
......@@ -199,6 +200,10 @@ public:
int pageNumber(Element*, float pageWidth = 800, float pageHeight = 600);
PassRefPtr<DOMStringList> iconURLs(Document*) const;
int numberOfPages(float pageWidthInPixels = 800, float pageHeightInPixels = 600);
String pageProperty(String, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;
String pageSizeAndMarginsInPixels(int, int, int, int, int, int, int, ExceptionCode& = ASSERT_NO_EXCEPTION) const;
#if ENABLE(FULLSCREEN_API)
void webkitWillEnterFullScreenForElement(Document*, Element*);
void webkitDidEnterFullScreenForElement(Document*, Element*);
......
......@@ -175,6 +175,10 @@ module window {
DOMString counterValue(in Element element);
long pageNumber(in Element element, in [Optional] float pageWidth, in [Optional] float pageHeight);
DOMString[] iconURLs(in Document document);
long numberOfPages(in [Optional] double pageWidthInPixels, in [Optional] double pageHeightInPixels);
DOMString pageProperty(in DOMString propertyName, in long pageNumber) raises (DOMException);
DOMString pageSizeAndMarginsInPixels(in long pageIndex, in long width, in long height, in long marginTop, in long marginRight, in long marginBottom, in long marginLeft) raises (DOMException);
#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
void webkitWillEnterFullScreenForElement(in Document document, in Element element);
......
2012-09-05 Kaustubh Atrawalkar <kaustubh@motorola.com>
[DRT] LTC:: Move printing related APIs from LayoutTestController to Internals
https://bugs.webkit.org/show_bug.cgi?id=92735
Reviewed by Hajime Morita.
Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.
* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
* WebCoreSupport/DumpRenderTreeSupportEfl.h:
2012-09-04 Michał Pakuła vel Rutka <m.pakula@samsung.com>
[EFL] Context menu restore.
......
......@@ -155,27 +155,6 @@ void DumpRenderTreeSupportEfl::layoutFrame(Evas_Object* ewkFrame)
frame->view()->layout();
}
int DumpRenderTreeSupportEfl::numberOfPages(const Evas_Object* ewkFrame, float pageWidth, float pageHeight)
{
DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);
return WebCore::PrintContext::numberOfPages(frame, WebCore::FloatSize(pageWidth, pageHeight));
}
String DumpRenderTreeSupportEfl::pageSizeAndMarginsInPixels(const Evas_Object* ewkFrame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft)
{
DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, String());
return WebCore::PrintContext::pageSizeAndMarginsInPixels(frame, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
}
String DumpRenderTreeSupportEfl::pageProperty(const Evas_Object* ewkFrame, const char* propertyName, int pageNumber)
{
DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, String());
return WebCore::PrintContext::pageProperty(frame, propertyName, pageNumber);
}
bool DumpRenderTreeSupportEfl::pauseAnimation(Evas_Object* ewkFrame, const char* name, const char* elementId, double time)
{
DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, false);
......
......@@ -57,10 +57,6 @@ public:
static Eina_List* frameChildren(const Evas_Object* ewkFrame);
static WebCore::Frame* frameParent(const Evas_Object* ewkFrame);
static void layoutFrame(Evas_Object* ewkFrame);
static int numberOfPages(const Evas_Object* ewkFrame, float pageWidth, float pageHeight);
static int numberOfPagesForElementId(const Evas_Object* ewkFrame, const char* elementId, float pageWidth, float pageHeight);
static String pageProperty(const Evas_Object* ewkFrame, const char* propertyName, int pageNumber);
static String pageSizeAndMarginsInPixels(const Evas_Object* ewkFrame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft);
static bool pauseAnimation(Evas_Object* ewkFrame, const char* name, const char* elementId, double time);
static bool pauseTransition(Evas_Object* ewkFrame, const char* name, const char* elementId, double time);
static unsigned pendingUnloadEventCount(const Evas_Object* ewkFrame);
......
2012-09-05 Kaustubh Atrawalkar <kaustubh@motorola.com>
[DRT] LTC:: Move printing related APIs from LayoutTestController to Internals
https://bugs.webkit.org/show_bug.cgi?id=92735
Reviewed by Hajime Morita.
Move numberOfPages, pageProperty & pageSizeAndMarginsInPixels in Internals and remove duplicated code from DumprenderTree & WebkitTestRunner.
* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
* WebCoreSupport/DumpRenderTreeSupportGtk.h:
(DumpRenderTreeSupportGtk):
2012-09-04 Joanmarie Diggs <jdiggs@igalia.com>
[GTK] Crash in AccessibilityObject::accessibilityPlatformIncludesObject()
......
......@@ -189,68 +189,6 @@ CString DumpRenderTreeSupportGtk::dumpRenderTree(WebKitWebFrame* frame)
return externalRepresentation(coreFrame).utf8();
}
/**
* numberOfPagesForFrame
* @frame: a #WebKitWebFrame
* @pageWidth: width of a page
* @pageHeight: height of a page
*
* Return value: The number of pages to be printed.
*/
int DumpRenderTreeSupportGtk::numberOfPagesForFrame(WebKitWebFrame* frame, float pageWidth, float pageHeight)
{
g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), 0);
Frame* coreFrame = core(frame);
if (!coreFrame)
return -1;