2011-04-05 Chang Shu <cshu@webkit.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 03:05:04 +0000 (03:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 03:05:04 +0000 (03:05 +0000)
        Reviewed by Darin Adler.

        WebKitTestRunner needs layoutTestController.numberOfPages
        https://bugs.webkit.org/show_bug.cgi?id=42694

        Unskip passed tests.

        * platform/mac-wk2/Skipped:
        * platform/qt-wk2/Skipped:
2011-04-05  Chang Shu  <cshu@webkit.org>

        Reviewed by Darin Adler.

        WebKitTestRunner needs layoutTestController.numberOfPages
        https://bugs.webkit.org/show_bug.cgi?id=42694

        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
        (WKBundleNumberOfPages):
        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
        * WebProcess/InjectedBundle/InjectedBundle.cpp:
        (WebKit::InjectedBundle::numberOfPages):
        * WebProcess/InjectedBundle/InjectedBundle.h:
2011-04-05  Chang Shu  <cshu@webkit.org>

        Reviewed by Darin Adler.

        WebKitTestRunner needs layoutTestController.numberOfPages
        https://bugs.webkit.org/show_bug.cgi?id=42694

        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
        (WTR::LayoutTestController::numberOfPages):
        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/Skipped
LayoutTests/platform/qt-wk2/Skipped
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h

index 5e05fc2..fefdc58 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-05  Chang Shu  <cshu@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKitTestRunner needs layoutTestController.numberOfPages
+        https://bugs.webkit.org/show_bug.cgi?id=42694
+
+        Unskip passed tests.
+
+        * platform/mac-wk2/Skipped:
+        * platform/qt-wk2/Skipped:
+
 2011-04-05  Adrienne Walker  <enne@google.com>
 
        Unreviewed, temporarily mark two tests as more generally failing.
index 07d81fd..0b93807 100644 (file)
@@ -1447,11 +1447,6 @@ printing/page-rule-in-media-query.html
 printing/setPrinting.html
 printing/simultaneous-position-float-change.html
 
-# WebKitTestRunner needs layoutTestController.numberOfPages
-# <https://bugs.webkit.org/show_bug.cgi?id=42694>
-printing/numberOfPages.html
-printing/stretch-to-view-height.html
-
 # WebKitTestRunner needs layoutTestController.isPageBoxVisible
 # <https://bugs.webkit.org/show_bug.cgi?id=42695>
 printing/page-format-data.html
index 9863810..c751b17 100644 (file)
@@ -1834,11 +1834,6 @@ printing/media-queries-print.html
 printing/page-rule-in-media-query.html
 printing/setPrinting.html
 
-# WebKitTestRunner needs layoutTestController.numberOfPages
-# <https://bugs.webkit.org/show_bug.cgi?id=42694>
-printing/numberOfPages.html
-printing/stretch-to-view-height.html
-
 # WebKitTestRunner needs layoutTestController.isPageBoxVisible
 # <https://bugs.webkit.org/show_bug.cgi?id=42695>
 printing/page-format-data.html
index 6a0073b..f70b215 100644 (file)
@@ -1,3 +1,17 @@
+2011-04-05  Chang Shu  <cshu@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKitTestRunner needs layoutTestController.numberOfPages
+        https://bugs.webkit.org/show_bug.cgi?id=42694
+
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleNumberOfPages):
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::numberOfPages):
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+
 2011-04-05  Darin Adler  <darin@apple.com>
 
         Reviewed by Alexey Proskuryakov.
index adfe603..5724459 100644 (file)
@@ -152,3 +152,8 @@ void WKBundleSetDatabaseQuota(WKBundleRef bundleRef, uint64_t quota)
 {
     toImpl(bundleRef)->setDatabaseQuota(quota);
 }
+
+int WKBundleNumberOfPages(WKBundleRef bundleRef, WKBundleFrameRef frameRef, double pageWidthInPixels, double pageHeightInPixels)
+{
+    return toImpl(bundleRef)->numberOfPages(toImpl(frameRef), pageWidthInPixels, pageHeightInPixels);
+}
index 2e4c0cc..781a0f0 100644 (file)
@@ -69,6 +69,7 @@ WK_EXPORT void WKBundleOverrideAllowUniversalAccessFromFileURLsForTestRunner(WKB
 WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleClearAllDatabases(WKBundleRef bundle);
 WK_EXPORT void WKBundleSetDatabaseQuota(WKBundleRef bundle, uint64_t);
+WK_EXPORT int WKBundleNumberOfPages(WKBundleRef bundle, WKBundleFrameRef frameRef, double pageWidthInPixels, double pageHeightInPixels);
 
 #ifdef __cplusplus
 }
index a361eb2..88d5078 100644 (file)
 #include "WebContextMessageKinds.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebDatabaseManager.h"
+#include "WebFrame.h"
 #include "WebPage.h"
 #include "WebPreferencesStore.h"
 #include "WebProcess.h"
 #include <JavaScriptCore/APICast.h>
 #include <JavaScriptCore/JSLock.h>
+#include <WebCore/Frame.h>
+#include <WebCore/FrameView.h>
 #include <WebCore/GCController.h>
 #include <WebCore/JSDOMWindow.h>
 #include <WebCore/Page.h>
 #include <WebCore/PageGroup.h>
+#include <WebCore/PrintContext.h>
 #include <WebCore/Settings.h>
 #include <wtf/OwnArrayPtr.h>
 #include <wtf/PassOwnArrayPtr.h>
@@ -141,6 +145,19 @@ void InjectedBundle::setDatabaseQuota(uint64_t quota)
     WebDatabaseManager::shared().setQuotaForOrigin("file:///", quota);
 }
 
+int InjectedBundle::numberOfPages(WebFrame* frame, double pageWidthInPixels, double pageHeightInPixels)
+{
+    Frame* coreFrame = frame ? frame->coreFrame() : 0;
+    if (!coreFrame)
+        return -1;
+    if (!pageWidthInPixels)
+        pageWidthInPixels = coreFrame->view()->width();
+    if (!pageHeightInPixels)
+        pageHeightInPixels = coreFrame->view()->height();
+
+    return PrintContext::numberOfPages(coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
+}
+
 static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* patterns)
 {
     if (!patterns)
index 6265ce8..d05c7bd 100644 (file)
@@ -60,6 +60,7 @@ typedef void* PlatformBundle;
 class ImmutableArray;
 class InjectedBundleScriptWorld;
 class WebCertificateInfo;
+class WebFrame;
 class WebPage;
 class WebPageGroupProxy;
 
@@ -92,6 +93,7 @@ public:
     void overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled);
     void overrideAllowUniversalAccessFromFileURLsForTestRunner(WebPageGroupProxy*, bool);
     void setAllowFileAccessFromFileURLs(WebPageGroupProxy*, bool);
+    int numberOfPages(WebFrame*, double, double);
 
     // UserContent API
     void addUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames);
index bfa595d..5906223 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-05  Chang Shu  <cshu@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKitTestRunner needs layoutTestController.numberOfPages
+        https://bugs.webkit.org/show_bug.cgi?id=42694
+
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::numberOfPages):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+
 2011-04-05  Tony Chang  <tony@chromium.org>
 
         Reviewed by Mihai Parparita.
index cc442d7..1b9d288 100644 (file)
@@ -64,6 +64,9 @@ module WTR {
         void repaintSweepHorizontally();
         void display();
 
+        // Printing
+        int numberOfPages(in double pageWidthInPixels, in double pageHeightInPixels);
+
         // Animation testing.
         int numberOfActiveAnimations();
         boolean pauseAnimationAtTimeOnElementWithId(in DOMString animationName, in double time, in DOMString elementId);
index 5774878..d705b14 100644 (file)
@@ -29,7 +29,9 @@
 #include "InjectedBundle.h"
 #include "InjectedBundlePage.h"
 #include "JSLayoutTestController.h"
+#include "PlatformWebView.h"
 #include "StringFunctions.h"
+#include "TestController.h"
 #include <WebKit2/WKBundleBackForwardList.h>
 #include <WebKit2/WKBundleFrame.h>
 #include <WebKit2/WKBundleFramePrivate.h>
@@ -323,6 +325,12 @@ void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled)
     WKBundleSetAllowFileAccessFromFileURLs(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
 }
 
+int LayoutTestController::numberOfPages(double pageWidthInPixels, double pageHeightInPixels)
+{
+    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+    return WKBundleNumberOfPages(InjectedBundle::shared().bundle(), mainFrame, pageWidthInPixels, pageHeightInPixels);
+}
+
 unsigned LayoutTestController::windowCount()
 {
     return InjectedBundle::shared().pageCount();
index 1b25d21..d6f4f66 100644 (file)
@@ -112,6 +112,9 @@ public:
     void clearAllDatabases();
     void setDatabaseQuota(uint64_t);
 
+    // Printing
+    int numberOfPages(double pageWidthInPixels, double pageHeightInPixels);
+
     enum WhatToDump { RenderTree, MainFrameText, AllFramesText };
     WhatToDump whatToDump() const { return m_whatToDump; }