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

        WebKitTestRunner needs layoutTestController.pageNumberForElementById
        https://bugs.webkit.org/show_bug.cgi?id=42329

        Unskip passed tests.

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

        Reviewed by Darin Adler.

        WebKitTestRunner needs layoutTestController.pageNumberForElementById
        https://bugs.webkit.org/show_bug.cgi?id=42329

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

        Reviewed by Darin Adler.

        WebKitTestRunner needs layoutTestController.pageNumberForElementById
        https://bugs.webkit.org/show_bug.cgi?id=42329

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83071 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 371d3a2..30ac1a3 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-06  Chang Shu  <cshu@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKitTestRunner needs layoutTestController.pageNumberForElementById
+        https://bugs.webkit.org/show_bug.cgi?id=42329
+
+        Unskip passed tests.
+
+        * platform/mac-wk2/Skipped:
+        * platform/qt-wk2/Skipped:
+
 2011-04-06  Steve Lacey  <sjl@chromium.org>
 
         Reviewed by Eric Carlson.
index 0b93807..e31a69c 100644 (file)
@@ -1008,34 +1008,6 @@ webarchive/test-xml-stylesheet.xml
 # <https://bugs.webkit.org/show_bug.cgi?id=42328>
 fast/profiler
 
-# WebKitTestRunner needs to support layoutTestController.pageNumberForElementById
-# <https://bugs.webkit.org/show_bug.cgi?id=42329>
-printing/page-count-percentage-height.html
-printing/allowed-page-breaks.html
-printing/css2.1/page-break-after-000.html
-printing/css2.1/page-break-after-001.html
-printing/css2.1/page-break-after-002.html
-printing/css2.1/page-break-after-003.html
-printing/css2.1/page-break-after-004.html
-printing/css2.1/page-break-before-000.html
-printing/css2.1/page-break-before-001.html
-printing/css2.1/page-break-before-002.html
-printing/css2.1/page-break-inside-000.html
-printing/no-content-empty-pages.html
-printing/page-break-after-avoid.html
-printing/page-break-always.html
-printing/page-break-avoid.html
-printing/page-break-before-avoid.html
-printing/page-break-display-none.html
-printing/page-break-inside-avoid.html
-printing/page-break-margin-collapsed.html
-printing/page-break-orphans-and-widows.html
-printing/page-break-orphans.html
-printing/page-break-widows.html
-printing/pageNumerForElementById.html
-printing/return-from-printing-mode.html
-printing/page-count-layout-overflow.html
-
 # WebKitTestRunner needs layoutTestController.waitForPolicyDelegate
 # <https://bugs.webkit.org/show_bug.cgi?id=42330>
 fast/encoding/mailto-always-utf-8.html
index c751b17..a14ac2c 100644 (file)
@@ -1497,32 +1497,6 @@ http/tests/security/isolatedWorld/world-reuse.html
 # <https://bugs.webkit.org/show_bug.cgi?id=42328>
 fast/profiler
 
-# WebKitTestRunner needs to support layoutTestController.pageNumberForElementById
-# <https://bugs.webkit.org/show_bug.cgi?id=42329>
-printing/allowed-page-breaks.html
-printing/css2.1/page-break-after-000.html
-printing/css2.1/page-break-after-001.html
-printing/css2.1/page-break-after-002.html
-printing/css2.1/page-break-after-003.html
-printing/css2.1/page-break-after-004.html
-printing/css2.1/page-break-before-000.html
-printing/css2.1/page-break-before-001.html
-printing/css2.1/page-break-before-002.html
-printing/css2.1/page-break-inside-000.html
-printing/no-content-empty-pages.html
-printing/page-break-after-avoid.html
-printing/page-break-always.html
-printing/page-break-avoid.html
-printing/page-break-before-avoid.html
-printing/page-break-display-none.html
-printing/page-break-inside-avoid.html
-printing/page-break-margin-collapsed.html
-printing/page-break-orphans-and-widows.html
-printing/page-break-orphans.html
-printing/page-break-widows.html
-printing/pageNumerForElementById.html
-printing/return-from-printing-mode.html
-
 # WebKitTestRunner needs layoutTestController.waitForPolicyDelegate
 # <https://bugs.webkit.org/show_bug.cgi?id=42330>
 fast/encoding/mailto-always-utf-8.html
index 0349bbe..41a855b 100644 (file)
@@ -1,3 +1,17 @@
+2011-04-06  Chang Shu  <cshu@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKitTestRunner needs layoutTestController.pageNumberForElementById
+        https://bugs.webkit.org/show_bug.cgi?id=42329
+
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundlePageNumberForElementById):
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::pageNumberForElementById):
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+
 2011-04-05  Enrica Casucci  <enrica@apple.com>
 
         Reviewed by Darin Adler.
index 5724459..87ec365 100644 (file)
@@ -157,3 +157,8 @@ int WKBundleNumberOfPages(WKBundleRef bundleRef, WKBundleFrameRef frameRef, doub
 {
     return toImpl(bundleRef)->numberOfPages(toImpl(frameRef), pageWidthInPixels, pageHeightInPixels);
 }
+
+int WKBundlePageNumberForElementById(WKBundleRef bundleRef, WKBundleFrameRef frameRef, WKStringRef idRef, double pageWidthInPixels, double pageHeightInPixels)
+{
+    return toImpl(bundleRef)->pageNumberForElementById(toImpl(frameRef), toImpl(idRef)->string(), pageWidthInPixels, pageHeightInPixels);
+}
index 781a0f0..f4ace79 100644 (file)
@@ -70,6 +70,7 @@ WK_EXPORT void WKBundleSetAllowFileAccessFromFileURLs(WKBundleRef bundle, WKBund
 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);
+WK_EXPORT int WKBundlePageNumberForElementById(WKBundleRef bundle, WKBundleFrameRef frameRef, WKStringRef idRef, double pageWidthInPixels, double pageHeightInPixels);
 
 #ifdef __cplusplus
 }
index 88d5078..5157965 100644 (file)
@@ -158,6 +158,24 @@ int InjectedBundle::numberOfPages(WebFrame* frame, double pageWidthInPixels, dou
     return PrintContext::numberOfPages(coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
 }
 
+int InjectedBundle::pageNumberForElementById(WebFrame* frame, const String& id, double pageWidthInPixels, double pageHeightInPixels)
+{
+    Frame* coreFrame = frame ? frame->coreFrame() : 0;
+    if (!coreFrame)
+        return -1;
+
+    Element* element = coreFrame->document()->getElementById(AtomicString(id));
+    if (!element)
+        return -1;
+
+    if (!pageWidthInPixels)
+        pageWidthInPixels = coreFrame->view()->width();
+    if (!pageHeightInPixels)
+        pageHeightInPixels = coreFrame->view()->height();
+
+    return PrintContext::pageNumberForElement(element, FloatSize(pageWidthInPixels, pageHeightInPixels));
+}
+
 static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* patterns)
 {
     if (!patterns)
index d05c7bd..74fc7b0 100644 (file)
@@ -94,6 +94,7 @@ public:
     void overrideAllowUniversalAccessFromFileURLsForTestRunner(WebPageGroupProxy*, bool);
     void setAllowFileAccessFromFileURLs(WebPageGroupProxy*, bool);
     int numberOfPages(WebFrame*, double, double);
+    int pageNumberForElementById(WebFrame*, const String&, double, double);
 
     // UserContent API
     void addUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames);
index eba2016..8182f4d 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-06  Chang Shu  <cshu@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        WebKitTestRunner needs layoutTestController.pageNumberForElementById
+        https://bugs.webkit.org/show_bug.cgi?id=42329
+
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::pageNumberForElementById):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+
 2011-04-06  Sergio Villar Senin  <svillar@igalia.com>
 
         Reviewed by Martin Robinson.
index 1b9d288..7b803a3 100644 (file)
@@ -66,6 +66,7 @@ module WTR {
 
         // Printing
         int numberOfPages(in double pageWidthInPixels, in double pageHeightInPixels);
+        int pageNumberForElementById(in DOMString id, in double pageWidthInPixels, in double pageHeightInPixels);
 
         // Animation testing.
         int numberOfActiveAnimations();
index d705b14..0283c1a 100644 (file)
@@ -331,6 +331,12 @@ int LayoutTestController::numberOfPages(double pageWidthInPixels, double pageHei
     return WKBundleNumberOfPages(InjectedBundle::shared().bundle(), mainFrame, pageWidthInPixels, pageHeightInPixels);
 }
 
+int LayoutTestController::pageNumberForElementById(JSStringRef id, double pageWidthInPixels, double pageHeightInPixels)
+{
+    WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+    return WKBundlePageNumberForElementById(InjectedBundle::shared().bundle(), mainFrame, toWK(id).get(), pageWidthInPixels, pageHeightInPixels);
+}
+
 unsigned LayoutTestController::windowCount()
 {
     return InjectedBundle::shared().pageCount();
index d6f4f66..2aef8b7 100644 (file)
@@ -114,6 +114,7 @@ public:
 
     // Printing
     int numberOfPages(double pageWidthInPixels, double pageHeightInPixels);
+    int pageNumberForElementById(JSStringRef, double pageWidthInPixels, double pageHeightInPixels);
 
     enum WhatToDump { RenderTree, MainFrameText, AllFramesText };
     WhatToDump whatToDump() const { return m_whatToDump; }