2010-06-23 Yuzo Fujishima <yuzo@google.com>
authoryuzo@google.com <yuzo@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jun 2010 07:30:04 +0000 (07:30 +0000)
committeryuzo@google.com <yuzo@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jun 2010 07:30:04 +0000 (07:30 +0000)
        Reviewed by Shinichiro Hamaji.

        Implement page format data programming interface.
        https://bugs.webkit.org/show_bug.cgi?id=37538

        * platform/chromium/test_expectations.txt:
        * platform/gtk/Skipped:
        * platform/qt/Skipped:
        * platform/win/Skipped:
        * printing/page-format-data-expected.txt: Added.
        * printing/page-format-data.html: Added.
2010-06-23  Yuzo Fujishima  <yuzo@google.com>

        Reviewed by Shinichiro Hamaji.

        Implement page format data programming interface.
        The final goal is to implement CSS Paged Media Module Level 3 (http://dev.w3.org/csswg/css3-page/).
        To begin with, this change adds methods to know:
        - if page box is visible,
        - the page area rectangle, and
        - preferred page size.

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

        Test: printing/page-format-data.html

        * WebCore.base.exp:
        * css/CSSParser.cpp:
        (WebCore::CSSParser::parseSizeParameter):
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        (WebCore::CSSStyleSelector::applyPageSizeProperty):
        (WebCore::CSSStyleSelector::pageSizeFromName):
        (WebCore::CSSStyleSelector::mmLength):
        (WebCore::CSSStyleSelector::inchLength):
        * css/CSSStyleSelector.h:
        * css/html.css:
        (@page):
        * dom/Document.cpp:
        (WebCore::Document::isPageBoxVisible):
        (WebCore::Document::pageAreaRectInPixels):
        (WebCore::Document::preferredPageSizeInPixels):
        * dom/Document.h:
        * page/PrintContext.cpp:
        (WebCore::PrintContext::isPageBoxVisible):
        (WebCore::PrintContext::pageAreaRectInPixels):
        (WebCore::PrintContext::preferredPageSizeInPixels):
        * page/PrintContext.h:
        * rendering/style/RenderStyle.h:
        (WebCore::InheritedFlags::pageSize):
        (WebCore::InheritedFlags::setPageSize):
        * rendering/style/StyleRareNonInheritedData.h:
2010-06-23  Yuzo Fujishima  <yuzo@google.com>

        Reviewed by Shinichiro Hamaji.

        Implement page format data programming interface.
        Add methods for testing.
        https://bugs.webkit.org/show_bug.cgi?id=37538

        * Misc/WebCoreStatistics.h:
        * Misc/WebCoreStatistics.mm:
        (-[WebFrame isPageBoxVisible:]):
        (-[WebFrame pageAreaRectInPixels:]):
        (-[WebFrame preferredPageSizeInPixels:]):
2010-06-23  Yuzo Fujishima  <yuzo@google.com>

        Reviewed by Shinichiro Hamaji.

        Implement page format data programming interface.
        Add methods for testing.
        https://bugs.webkit.org/show_bug.cgi?id=37538

        * DumpRenderTree/LayoutTestController.cpp:
        (parsePageNumber):
        (isPageBoxVisibleCallback):
        (pageAreaRectInPixelsCallback):
        (preferredPageSizeInPixelsCallback):
        (LayoutTestController::staticFunctions):
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
        (LayoutTestController::isPageBoxVisible):
        (LayoutTestController::pageAreaRectInPixels):
        (LayoutTestController::preferredPageSizeInPixels):
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::isPageBoxVisible):
        (LayoutTestController::pageAreaRectInPixels):
        (LayoutTestController::preferredPageSizeInPixels):
        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::isPageBoxVisible):
        (LayoutTestController::pageAreaRectInPixels):
        (LayoutTestController::preferredPageSizeInPixels):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@61670 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
LayoutTests/printing/page-format-data-expected.txt [new file with mode: 0644]
LayoutTests/printing/page-format-data.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/css/CSSParser.cpp
WebCore/css/CSSStyleSelector.cpp
WebCore/css/CSSStyleSelector.h
WebCore/css/html.css
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/page/PrintContext.cpp
WebCore/page/PrintContext.h
WebCore/rendering/style/RenderStyle.h
WebCore/rendering/style/StyleRareNonInheritedData.h
WebKit/mac/ChangeLog
WebKit/mac/Misc/WebCoreStatistics.h
WebKit/mac/Misc/WebCoreStatistics.mm
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/LayoutTestController.cpp
WebKitTools/DumpRenderTree/LayoutTestController.h
WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

index 1ba7636..ae910ed 100644 (file)
@@ -1,3 +1,17 @@
+2010-06-23  Yuzo Fujishima  <yuzo@google.com>
+
+        Reviewed by Shinichiro Hamaji.
+
+        Implement page format data programming interface.
+        https://bugs.webkit.org/show_bug.cgi?id=37538
+
+        * platform/chromium/test_expectations.txt:
+        * platform/gtk/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+        * printing/page-format-data-expected.txt: Added.
+        * printing/page-format-data.html: Added.
+
 2010-06-23  Nikolas Zimmermann  <nzimmermann@rim.com>
 
         Not reviewed. Forgot to include four files in the last commit.
index 846507d..27a0ce8 100644 (file)
@@ -2884,3 +2884,7 @@ BUG_HCLAM : fast/js/script-line-number.html = TEXT
 
 // Added by r61650
 BUG47259 WIN : http/tests/local/blob/send-data-blob.html = TEXT
+
+// LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels are not implemented yet for Chromium.
+BUGWK37538 : printing/page-format-data.html = TEXT
+
index b5ed3e9..7baf9a5 100644 (file)
@@ -5866,6 +5866,9 @@ fast/forms/slider-zoomed.html
 # LayoutTestController::pageProperty is not implemented for GTK yet.
 printing/page-rule-selection.html
 
+# LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels are not implemented yet for GTK.
+printing/page-format-data.html
+
 # Gtk seems to be pumping the lexer an extra time revealed by turning on the
 # HTML5 Lexer in r61234.
 # https://bugs.webkit.org/show_bug.cgi?id=40664
index 578d6e8..21e9288 100644 (file)
@@ -857,6 +857,9 @@ fast/ruby/rubyDOM-remove-text2.html
 # https://bugs.webkit.org/show_bug.cgi?id=35961
 printing/page-rule-selection.html
 
+# Missing LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels.
+printing/page-format-data.html
+
 # ============================================================================= #
 # ------- failing editing/input tests
 # ============================================================================= #
index f4722c6..85ec2eb 100644 (file)
@@ -932,3 +932,8 @@ fast/js/sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Con
 fast/js/sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.2_T7.html
 fast/js/sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.1_T9.html
 fast/js/sputnik/Conformance/10_Execution_Contexts/10.2_Entering_An_Execution_Context/10.2.2_Eval_Code/S10.2.2_A1.2_T9.html
+
+# LayoutTestController::isPageBoxVisible, pageAreaRectInPixels, and preferredPageSizeInPixels are not implemented yet for WIN.
+printing/page-format-data.html
+
+
diff --git a/LayoutTests/printing/page-format-data-expected.txt b/LayoutTests/printing/page-format-data-expected.txt
new file mode 100644 (file)
index 0000000..bd1ca54
--- /dev/null
@@ -0,0 +1,74 @@
+This tests page format data
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test default visibility
+PASS layoutTestController.isPageBoxVisible(0) is true
+Test display: none. display property doesn't apply to @page
+PASS layoutTestController.isPageBoxVisible(0) is true
+Test display: inline. display property doesn't apply to @page
+PASS layoutTestController.isPageBoxVisible(0) is true
+Test visibility: hidden
+PASS layoutTestController.isPageBoxVisible(0) is false
+Test visibility: visible
+PASS layoutTestController.isPageBoxVisible(0) is true
+
+Test default page size
+PASS layoutTestController.preferredPageSizeInPixels(0) is inchSize(8.5, 11)
+Test auto page size
+PASS layoutTestController.preferredPageSizeInPixels(0) is inchSize(8.5, 11)
+Test landscape
+PASS layoutTestController.preferredPageSizeInPixels(0) is inchSize(11, 8.5)
+Test portrait
+PASS layoutTestController.preferredPageSizeInPixels(0) is inchSize(8.5, 11)
+Test a5
+PASS layoutTestController.preferredPageSizeInPixels(0) is mmSize(148, 210)
+Test a5 landscape
+PASS layoutTestController.preferredPageSizeInPixels(0) is mmSize(210, 148)
+Test portrait a4
+PASS layoutTestController.preferredPageSizeInPixels(0) is mmSize(210, 297)
+Test a3
+PASS layoutTestController.preferredPageSizeInPixels(0) is mmSize(297, 420)
+Test b5
+PASS layoutTestController.preferredPageSizeInPixels(0) is mmSize(176, 250)
+Test b4
+PASS layoutTestController.preferredPageSizeInPixels(0) is mmSize(250, 353)
+Test letter
+PASS layoutTestController.preferredPageSizeInPixels(0) is inchSize(8.5, 11)
+Test legal
+PASS layoutTestController.preferredPageSizeInPixels(0) is inchSize(8.5, 14)
+Test ledger
+PASS layoutTestController.preferredPageSizeInPixels(0) is inchSize(11, 17)
+Test 10cm
+PASS layoutTestController.preferredPageSizeInPixels(0) is mmSize(100, 100)
+Test 20cm x 30cm
+PASS layoutTestController.preferredPageSizeInPixels(0) is mmSize(200, 300)
+Test 10000px 20000px
+PASS layoutTestController.preferredPageSizeInPixels(0) is '(10000,20000)'
+Test invalid page size: -10cm
+PASS layoutTestController.preferredPageSizeInPixels(0) is '(10000,20000)'
+Test invalid page size: a4 a4
+PASS layoutTestController.preferredPageSizeInPixels(0) is '(10000,20000)'
+Test invalid page size: landscape portrait
+PASS layoutTestController.preferredPageSizeInPixels(0) is '(10000,20000)'
+Test invalid page size: 10cm letter
+PASS layoutTestController.preferredPageSizeInPixels(0) is '(10000,20000)'
+Test invalid page size: 10cm 10cm 10cm
+PASS layoutTestController.preferredPageSizeInPixels(0) is '(10000,20000)'
+Test invalid page size: empty
+PASS layoutTestController.preferredPageSizeInPixels(0) is '(10000,20000)'
+
+Test page area when margin, padding, and border are 0px
+PASS layoutTestController.pageAreaRectInPixels(0) is '(0,0,10000,20000)'
+Test non-zero margin, padding, and border
+PASS layoutTestController.pageAreaRectInPixels(0) is '(2184,273,7270,18635)'
+Test percentage margin and padding
+PASS layoutTestController.pageAreaRectInPixels(0) is '(1500,2500,7000,15000)'
+Test visibility: hidden
+PASS layoutTestController.pageAreaRectInPixels(0) is '(1500,2500,7000,15000)'
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/page-format-data.html b/LayoutTests/printing/page-format-data.html
new file mode 100644 (file)
index 0000000..d13dcdb
--- /dev/null
@@ -0,0 +1,176 @@
+<!DOCTYPE html>
+<html>
+<head id="head_element">
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script src="../fast/js/resources/js-test-pre.js"></script>
+<style>
+</style>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    description("This tests page format data");
+
+    function appendStyle(styleString)
+    {
+        var styleElement = document.createElement("style");
+        styleElement.innerHTML = styleString;
+        document.getElementById("head_element").appendChild(styleElement);
+    }
+
+    function inchSize(width, height)
+    {
+        return "(" + Math.floor(width * 96) + "," + Math.floor(height * 96) + ")";
+    }
+
+    function mmSize(width, height)
+    {
+        return "(" + Math.floor(width * 96 / 25.4) + "," + Math.floor(height * 96 / 25.4) + ")";
+    }
+
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+
+        // Page box visibility tests.
+
+        debug("Test default visibility");
+        shouldBe("layoutTestController.isPageBoxVisible(0)", "true");
+
+        debug("Test display: none. display property doesn't apply to @page");
+        appendStyle("@page {display:none;}");
+        shouldBe("layoutTestController.isPageBoxVisible(0)", "true");
+
+        debug("Test display: inline. display property doesn't apply to @page");
+        appendStyle("@page {display:inline;}");
+        shouldBe("layoutTestController.isPageBoxVisible(0)", "true");
+
+        debug("Test visibility: hidden");
+        appendStyle("@page {visibility:hidden;}");
+        shouldBe("layoutTestController.isPageBoxVisible(0)", "false");
+
+        debug("Test visibility: visible");
+        appendStyle("@page {visibility:visible;}");
+        shouldBe("layoutTestController.isPageBoxVisible(0)", "true");
+
+        debug("");
+
+        // Page size tests
+
+        debug("Test default page size");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "inchSize(8.5, 11)"); // Letter
+
+        debug("Test auto page size");
+        appendStyle("@page {size:auto;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "inchSize(8.5, 11)");
+
+        debug("Test landscape");
+        appendStyle("@page {size:landscape;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "inchSize(11, 8.5)");
+
+        debug("Test portrait");
+        appendStyle("@page {size:portrait;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "inchSize(8.5, 11)");
+
+        debug("Test a5");
+        appendStyle("@page {size:a5;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "mmSize(148, 210)");
+
+        debug("Test a5 landscape");
+        appendStyle("@page {size:a5 landscape;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "mmSize(210, 148)");
+
+        debug("Test portrait a4");
+        appendStyle("@page {size:portrait a4;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "mmSize(210, 297)");
+
+        debug("Test a3");
+        appendStyle("@page {size:a3;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "mmSize(297, 420)");
+
+        debug("Test b5");
+        appendStyle("@page {size:b5;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "mmSize(176, 250)");
+
+        debug("Test b4");
+        appendStyle("@page {size:b4;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "mmSize(250, 353)");
+
+        debug("Test letter");
+        appendStyle("@page {size:letter;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "inchSize(8.5, 11)");
+
+        debug("Test legal");
+        appendStyle("@page {size:legal;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "inchSize(8.5, 14)");
+
+        debug("Test ledger");
+        appendStyle("@page {size:ledger;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "inchSize(11, 17)");
+
+        debug("Test 10cm");
+        appendStyle("@page {size:10cm;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "mmSize(100, 100)");
+
+        debug("Test 20cm x 30cm");
+        appendStyle("@page {size:20cm 30cm;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "mmSize(200, 300)");
+
+        debug("Test 10000px 20000px");
+        appendStyle("@page {size:10000px 20000px;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "'(10000,20000)'");
+
+        debug("Test invalid page size: -10cm");
+        appendStyle("@page {size:-10cm;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "'(10000,20000)'");
+
+        debug("Test invalid page size: a4 a4");
+        appendStyle("@page {size:a4 a4;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "'(10000,20000)'");
+
+        debug("Test invalid page size: landscape portrait");
+        appendStyle("@page {size:landscape portrait;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "'(10000,20000)'");
+
+        debug("Test invalid page size: 10cm letter");
+        appendStyle("@page {size:10cm letter;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "'(10000,20000)'");
+
+        debug("Test invalid page size: 10cm 10cm 10cm");
+        appendStyle("@page {size:10cm 10cm 10cm;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "'(10000,20000)'");
+
+        debug("Test invalid page size: empty");
+        appendStyle("@page {size:;}");
+        shouldBe("layoutTestController.preferredPageSizeInPixels(0)", "'(10000,20000)'");
+
+        debug("");
+
+        // Page area tests
+
+        debug("Test page area when margin, padding, and border are 0px");
+        appendStyle("@page {margin:0px;padding:0px;border:0px;}");
+        shouldBe("layoutTestController.pageAreaRectInPixels(0)", "'(0,0,10000,20000)'");
+
+        debug("Test non-zero margin, padding, and border");
+        appendStyle("@page {margin:1px 2px 4px 8px; padding:16px 32px 64px 128px; border-width:256px 512px 1024px 2048px;}"); // top, right, bottom, left
+        shouldBe("layoutTestController.pageAreaRectInPixels(0)", "'(2184,273,7270,18635)'");
+
+        debug("Test percentage margin and padding");
+        appendStyle("@page {margin:20% 10%; padding:5%; border-width:0px;}");
+        shouldBe("layoutTestController.pageAreaRectInPixels(0)", "'(1500,2500,7000,15000)'");
+
+        debug("Test visibility: hidden");
+        appendStyle("@page {visibility:hidden}");
+        shouldBe("layoutTestController.pageAreaRectInPixels(0)", "'(1500,2500,7000,15000)'");
+
+        debug("");
+
+    } else {
+        testFailed("This test can be run only with window.layoutTestController");
+    }
+    var successfullyParsed = true;
+</script>
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 47cc0c0..b8c376d 100644 (file)
@@ -1,3 +1,45 @@
+2010-06-23  Yuzo Fujishima  <yuzo@google.com>
+
+        Reviewed by Shinichiro Hamaji.
+
+        Implement page format data programming interface.
+        The final goal is to implement CSS Paged Media Module Level 3 (http://dev.w3.org/csswg/css3-page/).
+        To begin with, this change adds methods to know:
+        - if page box is visible,
+        - the page area rectangle, and
+        - preferred page size.
+
+        https://bugs.webkit.org/show_bug.cgi?id=37538
+
+        Test: printing/page-format-data.html
+
+        * WebCore.base.exp:
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseSizeParameter):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        (WebCore::CSSStyleSelector::applyPageSizeProperty):
+        (WebCore::CSSStyleSelector::pageSizeFromName):
+        (WebCore::CSSStyleSelector::mmLength):
+        (WebCore::CSSStyleSelector::inchLength):
+        * css/CSSStyleSelector.h:
+        * css/html.css:
+        (@page):
+        * dom/Document.cpp:
+        (WebCore::Document::isPageBoxVisible):
+        (WebCore::Document::pageAreaRectInPixels):
+        (WebCore::Document::preferredPageSizeInPixels):
+        * dom/Document.h:
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::isPageBoxVisible):
+        (WebCore::PrintContext::pageAreaRectInPixels):
+        (WebCore::PrintContext::preferredPageSizeInPixels):
+        * page/PrintContext.h:
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::pageSize):
+        (WebCore::InheritedFlags::setPageSize):
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2010-06-23  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index 14bf7c1..2744fe8 100644 (file)
@@ -250,7 +250,10 @@ __ZN7WebCore12IconDatabase9setClientEPNS_18IconDatabaseClientE
 __ZN7WebCore12PluginWidget14invalidateRectERKNS_7IntRectE
 __ZN7WebCore12PrintContext12pagePropertyEPNS_5FrameEPKci
 __ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE
+__ZN7WebCore12PrintContext16isPageBoxVisibleEPNS_5FrameEi
+__ZN7WebCore12PrintContext20pageAreaRectInPixelsEPNS_5FrameEi
 __ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE
+__ZN7WebCore12PrintContext25preferredPageSizeInPixelsEPNS_5FrameEi
 __ZN7WebCore12PrintContext28computePageRectsWithPageSizeERKNS_9FloatSizeEb
 __ZN7WebCore12PrintContextC1EPNS_5FrameE
 __ZN7WebCore12PrintContextD1Ev
@@ -622,11 +625,14 @@ __ZN7WebCore8Document11createRangeEv
 __ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
 __ZN7WebCore8Document13svgExtensionsEv
 __ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
+__ZN7WebCore8Document16isPageBoxVisibleEi
 __ZN7WebCore8Document17getFocusableNodesERN3WTF6VectorINS1_6RefPtrINS_4NodeEEELm0EEE
 __ZN7WebCore8Document19accessSVGExtensionsEv
+__ZN7WebCore8Document20pageAreaRectInPixelsEi
 __ZN7WebCore8Document22createDocumentFragmentEv
 __ZN7WebCore8Document23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE
 __ZN7WebCore8Document24setShouldCreateRenderersEb
+__ZN7WebCore8Document25preferredPageSizeInPixelsEi
 __ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
 __ZN7WebCore8Document4headEv
 __ZN7WebCore8FormDataD1Ev
index 4330d09..cd35061 100644 (file)
@@ -2246,13 +2246,13 @@ CSSParser::SizeParameterType CSSParser::parseSizeParameter(CSSValueList* parsedV
     case CSSValueLetter:
         if (prevParamType == None || prevParamType == Orientation) {
             // Normalize to Page Size then Orientation order by prepending.
-            // This is not specified by the CSS3 Paged Media specification, but for simpler processing hereafter.
+            // This is not specified by the CSS3 Paged Media specification, but for simpler processing later (CSSStyleSelector::applyPageSizeProperty).
             parsedValues->prepend(CSSPrimitiveValue::createIdentifier(value->id));
             return PageSize;
         }
         return None;
     case 0:
-        if (validUnit(value, FLength, m_strict) && (prevParamType == None || prevParamType == Length)) {
+        if (validUnit(value, FLength | FNonNeg, m_strict) && (prevParamType == None || prevParamType == Length)) {
             parsedValues->append(CSSPrimitiveValue::create(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit)));
             return Length;
         }
index 8634332..aa010fd 100644 (file)
@@ -30,6 +30,7 @@
 #include "CSSBorderImageValue.h"
 #include "CSSCursorImageValue.h"
 #include "CSSFontFaceRule.h"
+#include "CSSHelper.h"
 #include "CSSImportRule.h"
 #include "CSSMediaRule.h"
 #include "CSSPageRule.h"
@@ -5457,12 +5458,14 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
             m_style->setColorSpace(*primitiveValue);
         }
         return;
+    case CSSPropertySize:
+        applyPageSizeProperty(value);
+        return;
     case CSSPropertyInvalid:
         return;
     case CSSPropertyFontStretch:
     case CSSPropertyPage:
     case CSSPropertyQuotes:
-    case CSSPropertySize:
     case CSSPropertyTextLineThrough:
     case CSSPropertyTextLineThroughColor:
     case CSSPropertyTextLineThroughMode:
@@ -5510,6 +5513,161 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     }
 }
 
+void CSSStyleSelector::applyPageSizeProperty(CSSValue* value)
+{
+    if (!value->isValueList())
+        return;
+    CSSValueList* valueList = static_cast<CSSValueList*>(value);
+    Length width;
+    Length height;
+    switch (valueList->length()) {
+    case 2: {
+        // <length>{2} | <page-size> <orientation>
+        if (!valueList->item(0)->isPrimitiveValue() || !valueList->item(1)->isPrimitiveValue())
+            return;
+        CSSPrimitiveValue* primitiveValue0 = static_cast<CSSPrimitiveValue*>(valueList->item(0));
+        CSSPrimitiveValue* primitiveValue1 = static_cast<CSSPrimitiveValue*>(valueList->item(1));
+        int type0 = primitiveValue0->primitiveType();
+        int type1 = primitiveValue1->primitiveType();
+        if (CSSPrimitiveValue::isUnitTypeLength(type0)) {
+            // <length>{2}
+            if (!CSSPrimitiveValue::isUnitTypeLength(type1))
+                return;
+            width = Length(primitiveValue0->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
+            height = Length(primitiveValue1->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
+        } else {
+            // <page-size> <orientation>
+            // The value order is guaranteed. See CSSParser::parseSizeParameter.
+            if (!pageSizeFromName(primitiveValue0, primitiveValue1, width, height))
+                return;
+        }
+        break;
+    }
+    case 1: {
+        // <length> | auto | <page-size> | [ portrait | landscape]
+        if (!valueList->item(0)->isPrimitiveValue())
+            return;
+        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valueList->item(0));
+        int type = primitiveValue->primitiveType();
+        if (CSSPrimitiveValue::isUnitTypeLength(type)) {
+            // <length>
+            width = height = Length(primitiveValue->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
+        } else {
+            if (type != CSSPrimitiveValue::CSS_IDENT)
+                return;
+            switch (primitiveValue->getIdent()) {
+            case CSSValueAuto:
+                // auto
+                if (!pageSizeFromName(0, 0, width, height))
+                    return;
+                break;
+            case CSSValuePortrait:
+            case CSSValueLandscape:
+                // <page-size>
+                if (!pageSizeFromName(0, primitiveValue, width, height))
+                    return;
+                break;
+            default:
+                // [ portrait | landscape]
+                if (!pageSizeFromName(primitiveValue, 0, width, height))
+                    return;
+            }
+        }
+        break;
+    }
+    default:
+        return;
+    }
+    m_style->setPageSize(LengthSize(width, height));
+    return;
+}
+
+bool CSSStyleSelector::pageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height)
+{
+    static const Length a5Width = mmLength(148), a5Height = mmLength(210);
+    static const Length a4Width = mmLength(210), a4Height = mmLength(297);
+    static const Length a3Width = mmLength(297), a3Height = mmLength(420);
+    static const Length b5Width = mmLength(176), b5Height = mmLength(250);
+    static const Length b4Width = mmLength(250), b4Height = mmLength(353);
+    static const Length letterWidth = inchLength(8.5), letterHeight = inchLength(11);
+    static const Length legalWidth = inchLength(8.5), legalHeight = inchLength(14);
+    static const Length ledgerWidth = inchLength(11), ledgerHeight = inchLength(17);
+
+    // FIXME: Define UA default page size. Assume letter for now.
+    int ident = CSSValueLetter;
+    if (pageSizeName) {
+        if (pageSizeName->primitiveType() != CSSPrimitiveValue::CSS_IDENT)
+            return false;
+        ident = pageSizeName->getIdent();
+    }
+
+    // FIXME: Define UA default page orientation. Assume portrait for now.
+    bool portrait = true;
+    if (pageOrientation) {
+        if (pageOrientation->primitiveType() != CSSPrimitiveValue::CSS_IDENT)
+            return false;
+        switch (pageOrientation->getIdent()) {
+        case CSSValueLandscape:
+            portrait = false;
+            break;
+        case CSSValuePortrait:
+            portrait = true;
+            break;
+        default:
+            return false;
+        }
+    }
+    switch (ident) {
+    case CSSValueA5:
+        width = a5Width;
+        height = a5Height;
+        break;
+    case CSSValueA4:
+        width = a4Width;
+        height = a4Height;
+        break;
+    case CSSValueA3:
+        width = a3Width;
+        height = a3Height;
+        break;
+    case CSSValueB5:
+        width = b5Width;
+        height = b5Height;
+        break;
+    case CSSValueB4:
+        width = b4Width;
+        height = b4Height;
+        break;
+    case CSSValueLetter:
+        width = letterWidth;
+        height = letterHeight;
+        break;
+    case CSSValueLegal:
+        width = legalWidth;
+        height = legalHeight;
+        break;
+    case CSSValueLedger:
+        width = ledgerWidth;
+        height = ledgerHeight;
+        break;
+    default:
+        return false;
+    }
+    if (!portrait)
+        swap(width, height);
+    return true;
+}
+
+Length CSSStyleSelector::mmLength(double mm)
+{
+    return Length(CSSPrimitiveValue::create(mm, CSSPrimitiveValue::CSS_MM)->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
+}
+
+Length CSSStyleSelector::inchLength(double inch)
+{
+    return Length(CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
+}
+
 void CSSStyleSelector::mapFillAttachment(FillLayer* layer, CSSValue* value)
 {
     if (value->cssValueType() == CSSValue::CSS_INITIAL) {
index 05cd109..f0de83b 100644 (file)
@@ -260,6 +260,10 @@ public:
         void mapNinePieceImage(CSSValue*, NinePieceImage&);
 
         void applyProperty(int id, CSSValue*);
+        void applyPageSizeProperty(CSSValue*);
+        bool pageSizeFromName(CSSPrimitiveValue*, CSSPrimitiveValue*, Length& width, Length& height);
+        Length mmLength(double mm);
+        Length inchLength(double inch);
 #if ENABLE(SVG)
         void applySVGProperty(int id, CSSValue*);
 #endif
index 16334cf..1051659 100644 (file)
@@ -727,6 +727,7 @@ iframe {
 
 @page {
     /* FIXME: Define the right default values for page properties. */
+    size: auto;
     margin: 1in;
 }
 
index f192ed6..b132a13 100644 (file)
@@ -1502,6 +1502,37 @@ PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex)
     return style.release();
 }
 
+bool Document::isPageBoxVisible(int pageIndex)
+{
+    RefPtr<RenderStyle> style = styleForPage(pageIndex);
+    return style->visibility() != HIDDEN; // display property doesn't apply to @page.
+}
+
+IntRect Document::pageAreaRectInPixels(int pageIndex)
+{
+    RefPtr<RenderStyle> style = styleForPage(pageIndex);
+    IntSize pageSize = preferredPageSizeInPixels(pageIndex);
+    // 100% value for margin-{left,right,top,bottom}. This is used also for top and bottom. http://www.w3.org/TR/CSS2/box.html#value-def-margin-width
+    int maxValue = pageSize.width();
+    int surroundLeft = style->marginLeft().calcValue(maxValue) + style->borderLeft().width() + style->paddingLeft().calcValue(maxValue);
+    int surroundRight = style->marginRight().calcValue(maxValue) + style->borderRight().width() + style->paddingRight().calcValue(maxValue);
+    int surroundTop = style->marginTop().calcValue(maxValue) + style->borderTop().width() + style->paddingTop().calcValue(maxValue);
+    int surroundBottom = style->marginBottom().calcValue(maxValue) + style->borderBottom().width() + style->paddingBottom().calcValue(maxValue);
+    int width = pageSize.width() - surroundLeft - surroundRight;
+    int height = pageSize.height() - surroundTop - surroundBottom;
+
+    return IntRect(surroundLeft, surroundTop, width, height);
+}
+
+IntSize Document::preferredPageSizeInPixels(int pageIndex)
+{
+    RefPtr<RenderStyle> style = styleForPage(pageIndex);
+    LengthSize size = style->pageSize();
+    ASSERT(size.width().isFixed());
+    ASSERT(size.height().isFixed());
+    return IntSize(size.width().calcValue(0), size.height().calcValue(0));
+}
+
 void Document::createStyleSelector()
 {
     bool matchAuthorAndUserStyles = true;
index bc12da3..317fbb7 100644 (file)
@@ -483,6 +483,9 @@ public:
     void updateLayoutIgnorePendingStylesheets();
     PassRefPtr<RenderStyle> styleForElementIgnoringPendingStylesheets(Element*);
     PassRefPtr<RenderStyle> styleForPage(int pageIndex);
+    bool isPageBoxVisible(int pageIndex);
+    IntRect pageAreaRectInPixels(int pageIndex);
+    IntSize preferredPageSizeInPixels(int pageIndex);
     static void updateStyleForAllDocuments(); // FIXME: Try to reduce the # of calls to this function.
     DocLoader* docLoader() { return m_docLoader.get(); }
 
index 8ff8a62..4ab7367 100644 (file)
@@ -218,6 +218,23 @@ String PrintContext::pageProperty(Frame* frame, const char* propertyName, int pa
     return String::format("pageProperty() unimplemented for: %s", propertyName);
 }
 
+bool PrintContext::isPageBoxVisible(Frame* frame, int pageNumber)
+{
+    return frame->document()->isPageBoxVisible(pageNumber);
+}
+
+String PrintContext::pageAreaRectInPixels(Frame* frame, int pageNumber)
+{
+    IntRect pageArea = frame->document()->pageAreaRectInPixels(pageNumber);
+    return String::format("(%d,%d,%d,%d)", pageArea.x(), pageArea.y(), pageArea.width(), pageArea.height());
+}
+
+String PrintContext::preferredPageSizeInPixels(Frame* frame, int pageNumber)
+{
+    IntSize pageSize = frame->document()->preferredPageSizeInPixels(pageNumber);
+    return String::format("(%d,%d)", pageSize.width(), pageSize.height());
+}
+
 int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels)
 {
     frame->document()->updateLayout();
index 9398a6e..81a9b76 100644 (file)
@@ -56,6 +56,9 @@ public:
     // Used by layout tests.
     static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels);
     static String pageProperty(Frame* frame, const char* propertyName, int pageNumber);
+    static bool isPageBoxVisible(Frame* frame, int pageNumber);
+    static String pageAreaRectInPixels(Frame* frame, int pageNumber);
+    static String preferredPageSizeInPixels(Frame* frame, int pageNumber);
     static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels);
 
 protected:
index 44e5b88..49fd94d 100644 (file)
@@ -703,6 +703,7 @@ public:
     bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
     Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
     Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
+    LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; }
     
 #if USE(ACCELERATED_COMPOSITING)
     // When set, this ensures that styles compare as different. Used during accelerated animations.
@@ -1029,6 +1030,7 @@ public:
     void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
     void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
     void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
+    void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
 
 #if USE(ACCELERATED_COMPOSITING)
     void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
index 0b704c4..74e736c 100644 (file)
@@ -40,6 +40,7 @@ namespace WebCore {
 
 class AnimationList;
 class CSSStyleSelector;
+class LengthSize;
 class ShadowData;
 class StyleFlexibleBoxData;
 class StyleMarqueeData;
@@ -123,6 +124,8 @@ public:
     Length m_perspectiveOriginX;
     Length m_perspectiveOriginY;
 
+    LengthSize m_pageSize;
+
 #if ENABLE(XBL)
     OwnPtr<BindingURI> bindingURI; // The XBL binding URI list.
 #endif
index c0c0ba1..dc3f43c 100644 (file)
@@ -1,3 +1,17 @@
+2010-06-23  Yuzo Fujishima  <yuzo@google.com>
+
+        Reviewed by Shinichiro Hamaji.
+
+        Implement page format data programming interface.
+        Add methods for testing.
+        https://bugs.webkit.org/show_bug.cgi?id=37538
+
+        * Misc/WebCoreStatistics.h:
+        * Misc/WebCoreStatistics.mm:
+        (-[WebFrame isPageBoxVisible:]):
+        (-[WebFrame pageAreaRectInPixels:]):
+        (-[WebFrame preferredPageSizeInPixels:]):
+
 2010-06-22  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Sam Weinig.
index c79c96d..e357b72 100644 (file)
@@ -88,4 +88,7 @@
 - (int)pageNumberForElement:(DOMElement*)element:(float)pageWidthInPixels:(float)pageHeightInPixels;
 - (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels;
 - (NSString *)pageProperty:(const char*)propertyName:(int)pageNumber;
+- (bool)isPageBoxVisible:(int)pageNumber;
+- (NSString *)pageAreaRectInPixels:(int)pageNumber;
+- (NSString *)preferredPageSizeInPixels:(int)pageNumber;
 @end
index 89f70fd..9112d21 100644 (file)
@@ -280,4 +280,18 @@ using namespace WebCore;
     return PrintContext::pageProperty(_private->coreFrame, propertyName, pageNumber);
 }
 
+- (bool)isPageBoxVisible:(int)pageNumber
+{
+    return PrintContext::isPageBoxVisible(_private->coreFrame, pageNumber);
+}
+
+- (NSString *)pageAreaRectInPixels:(int)pageNumber
+{
+    return PrintContext::pageAreaRectInPixels(_private->coreFrame, pageNumber);
+}
+
+- (NSString *)preferredPageSizeInPixels:(int)pageNumber;
+{
+    return PrintContext::preferredPageSizeInPixels(_private->coreFrame, pageNumber);
+}
 @end
index ad4f3e4..536ba39 100644 (file)
@@ -1,3 +1,31 @@
+2010-06-23  Yuzo Fujishima  <yuzo@google.com>
+
+        Reviewed by Shinichiro Hamaji.
+
+        Implement page format data programming interface.
+        Add methods for testing.
+        https://bugs.webkit.org/show_bug.cgi?id=37538
+
+        * DumpRenderTree/LayoutTestController.cpp:
+        (parsePageNumber):
+        (isPageBoxVisibleCallback):
+        (pageAreaRectInPixelsCallback):
+        (preferredPageSizeInPixelsCallback):
+        (LayoutTestController::staticFunctions):
+        * DumpRenderTree/LayoutTestController.h:
+        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+        (LayoutTestController::isPageBoxVisible):
+        (LayoutTestController::pageAreaRectInPixels):
+        (LayoutTestController::preferredPageSizeInPixels):
+        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+        (LayoutTestController::isPageBoxVisible):
+        (LayoutTestController::pageAreaRectInPixels):
+        (LayoutTestController::preferredPageSizeInPixels):
+        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+        (LayoutTestController::isPageBoxVisible):
+        (LayoutTestController::pageAreaRectInPixels):
+        (LayoutTestController::preferredPageSizeInPixels):
+
 2010-06-23  Sam Magnuson  <smagnuson@netflix.com>
 
         Reviewed by Shinichiro Hamaji.
index db5340d..02c77a4 100644 (file)
@@ -552,6 +552,15 @@ static bool parsePagePropertyParameters(JSContextRef context, int argumentCount,
     }
 }
 
+static bool parsePageNumber(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, int& pageNumber)
+{
+    pageNumber = 0;
+    if (argumentCount != 1)
+        return false;
+    pageNumber = static_cast<int>(JSValueToNumber(context, arguments[0], exception));
+    return !*exception;
+}
+
 static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     float pageWidthInPixels = 0;
@@ -593,6 +602,36 @@ static JSValueRef pagePropertyCallback(JSContextRef context, JSObjectRef functio
     return value;
 }
 
+static JSValueRef isPageBoxVisibleCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    int pageNumber = 0;
+    if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber))
+        return JSValueMakeUndefined(context);
+
+    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    return JSValueMakeBoolean(context, controller->isPageBoxVisible(pageNumber));
+}
+
+static JSValueRef pageAreaRectInPixelsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    int pageNumber = 0;
+    if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber))
+        return JSValueMakeUndefined(context);
+
+    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    return JSValueMakeString(context, controller->pageAreaRectInPixels(pageNumber).get());
+}
+
+static JSValueRef preferredPageSizeInPixelsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    int pageNumber = 0;
+    if (!parsePageNumber(context, argumentCount, arguments, exception, pageNumber))
+        return JSValueMakeUndefined(context);
+
+    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    return JSValueMakeString(context, controller->preferredPageSizeInPixels(pageNumber).get());
+}
+
 static JSValueRef queueBackNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     // Has mac & windows implementation
@@ -1651,6 +1690,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
         { "counterValueForElementById", counterValueForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 
         { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "isPageBoxVisible", isPageBoxVisibleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "layerTreeAsText", layerTreeAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "numberOfPages", numberOfPagesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -1659,10 +1699,12 @@ JSStaticFunction* LayoutTestController::staticFunctions()
         { "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "pageNumberForElementById", pageNumberForElementByIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "pageAreaRectInPixels", pageAreaRectInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "pageProperty", pagePropertyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "pathToLocalResource", pathToLocalResourceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "preferredPageSizeInPixels", preferredPageSizeInPixelsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "sampleSVGAnimationForElementAtTime", sampleSVGAnimationForElementAtTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
index 2909783..6af2c57 100644 (file)
@@ -64,6 +64,9 @@ public:
     void overridePreference(JSStringRef key, JSStringRef value);
     int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels);
     JSRetainPtr<JSStringRef> pageProperty(const char* propertyName, int pageNumber) const;
+    bool isPageBoxVisible(int pageNumber) const;
+    JSRetainPtr<JSStringRef> pageAreaRectInPixels(int pageNumber) const;
+    JSRetainPtr<JSStringRef> preferredPageSizeInPixels(int pageNumber) const;
     JSStringRef pathToLocalResource(JSContextRef, JSStringRef url);
     void queueBackNavigation(int howFarBackward);
     void queueForwardNavigation(int howFarForward);
index 2bdd80c..6f8e637 100644 (file)
@@ -177,6 +177,24 @@ JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* property
     return JSRetainPtr<JSStringRef>();
 }
 
+bool LayoutTestController::isPageBoxVisible(int pageNumber) const
+{
+    // FIXME: implement
+    return false;
+}
+
+JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const
+{
+    // FIXME: implement
+    return JSRetainPtr<JSStringRef>();
+}
+
+JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const
+{
+    // FIXME: implement
+    return JSRetainPtr<JSStringRef>();
+}
+
 size_t LayoutTestController::webHistoryItemCount()
 {
     // FIXME: implement
index 644a404..d0599e0 100644 (file)
@@ -218,6 +218,23 @@ JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* property
     return propertyValue;
 }
 
+bool LayoutTestController::isPageBoxVisible(int pageNumber) const
+{
+    return [mainFrame isPageBoxVisible:pageNumber];
+}
+
+JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const
+{
+    JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame pageAreaRectInPixels:pageNumber]));
+    return propertyValue;
+}
+
+JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const
+{
+    JSRetainPtr<JSStringRef> propertyValue(Adopt, JSStringCreateWithCFString((CFStringRef)[mainFrame preferredPageSizeInPixels:pageNumber]));
+    return propertyValue;
+}
+
 int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels)
 {
     return [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels];
index b2a345b..e0d5731 100644 (file)
@@ -1248,6 +1248,24 @@ void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data,
 
 }
 
+bool LayoutTestController::isPageBoxVisible(int pageNumber) const
+{
+    // FIXME: implement
+    return false;
+}
+
+JSRetainPtr<JSStringRef> LayoutTestController::pageAreaRectInPixels(int pageNumber) const
+{
+    // FIXME: implement
+    return JSRetainPtr<JSStringRef>();
+}
+
+JSRetainPtr<JSStringRef> LayoutTestController::preferredPageSizeInPixels(int pageNumber) const
+{
+    // FIXME: implement
+    return JSRetainPtr<JSStringRef>();
+}
+
 void LayoutTestController::apiTestGoToCurrentBackForwardItem()
 {
     COMPtr<IWebView> webView;