[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756
hamaji at chromium.org
hamaji at chromium.org
Fri Feb 26 22:15:31 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit e25b9296eab308d4b8250609e615098205868c07
Author: hamaji at chromium.org <hamaji at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Feb 9 08:32:53 2010 +0000
2010-02-09 Shinichiro Hamaji <hamaji at chromium.org>
Reviewed by Darin Adler.
Provide a way to get total number of pages to be printed
https://bugs.webkit.org/show_bug.cgi?id=34699
* platform/gtk/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
* printing/numberOfPages-expected.txt: Added.
* printing/numberOfPages.html: Added.
* printing/script-tests/numberOfPages.js: Added.
(createParagraph):
2010-02-09 Shinichiro Hamaji <hamaji at chromium.org>
Reviewed by Darin Adler.
Provide a way to get total number of pages to be printed
https://bugs.webkit.org/show_bug.cgi?id=34699
Test: printing/numberOfPages.html
* WebCore.base.exp:
* page/PrintContext.cpp:
(WebCore::PrintContext::pageNumberForElement):
(WebCore::PrintContext::numberOfPages):
* page/PrintContext.h:
(WebCore::PrintContext::pageRects):
2010-02-09 Shinichiro Hamaji <hamaji at chromium.org>
Reviewed by Darin Adler.
Provide a way to get total number of pages to be printed
https://bugs.webkit.org/show_bug.cgi?id=34699
* Misc/WebCoreStatistics.h:
* Misc/WebCoreStatistics.mm:
(-[WebFrame numberOfPages:pageWidthInPixels:]):
2010-02-09 Shinichiro Hamaji <hamaji at chromium.org>
Reviewed by Darin Adler.
Provide a way to get total number of pages to be printed
https://bugs.webkit.org/show_bug.cgi?id=34699
* DumpRenderTree/LayoutTestController.cpp:
(parsePageParameters):
(pageNumberForElementByIdCallback):
(numberOfPagesCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
* DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
(LayoutTestController::numberOfPages):
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::numberOfPages):
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::numberOfPages):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54533 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2d13e20..226655b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-02-09 Shinichiro Hamaji <hamaji at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Provide a way to get total number of pages to be printed
+ https://bugs.webkit.org/show_bug.cgi?id=34699
+
+ * platform/gtk/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+ * printing/numberOfPages-expected.txt: Added.
+ * printing/numberOfPages.html: Added.
+ * printing/script-tests/numberOfPages.js: Added.
+ (createParagraph):
+
2010-02-09 Zoltan Herczeg <zherczeg at inf.u-szeged.hu>
Reviewed by Oliver Hunt.
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 322e829..9fbb279 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5809,3 +5809,6 @@ http/tests/incremental/split-hex-entities.pl
# Skip frame flattening tests until it can be tested by this DRT
# https://bugs.webkit.org/show_bug.cgi?id=32717
fast/frames/flattening/
+
+# Implement LayoutTestController::numberOfPages().
+printing/numberOfPages.html
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 3932870..83c3cc7 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -5077,3 +5077,6 @@ printing/pageNumerForElementById.html
# Because ENABLE_DASHBOARD_SUPPORT=0 is the default option. (Apple's dashboard support in OS X)
fast/css/dashboard-regions-attr-crash.html
+
+# Implement LayoutTestController::numberOfPages().
+printing/numberOfPages.html
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index edc06fc..da8f3de 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -748,3 +748,6 @@ http/tests/security/xss-DENIED-window-open-javascript-url.html
# Skip frame flattening tests until it can be tested by this DRT
# https://bugs.webkit.org/show_bug.cgi?id=32717
fast/frames/flattening/
+
+# Implement LayoutTestController::numberOfPages().
+printing/numberOfPages.html
diff --git a/LayoutTests/printing/numberOfPages-expected.txt b/LayoutTests/printing/numberOfPages-expected.txt
new file mode 100644
index 0000000..8adb6be
--- /dev/null
+++ b/LayoutTests/printing/numberOfPages-expected.txt
@@ -0,0 +1,11 @@
+Test for layoutTestController.numberOfPages()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS layoutTestController.numberOfPages(1000, 1000) is 2
+PASS layoutTestController.numberOfPages(10000, 10000) is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/numberOfPages.html b/LayoutTests/printing/numberOfPages.html
new file mode 100644
index 0000000..5066821
--- /dev/null
+++ b/LayoutTests/printing/numberOfPages.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
+<script src="../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/numberOfPages.js"></script>
+<script src="../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/script-tests/numberOfPages.js b/LayoutTests/printing/script-tests/numberOfPages.js
new file mode 100644
index 0000000..ca64903
--- /dev/null
+++ b/LayoutTests/printing/script-tests/numberOfPages.js
@@ -0,0 +1,23 @@
+description("Test for layoutTestController.numberOfPages()");
+
+function createParagraph(id)
+{
+ var element = document.createElement("div");
+ element.id = id;
+ element.width = 100;
+ document.getElementById("sandbox").appendChild(element);
+ return element;
+}
+
+var firstPage = createParagraph("firstPage");
+firstPage.style.height = 700;
+
+var secondPage = createParagraph("secondPage");
+secondPage.style.height = 700;
+
+shouldBe("layoutTestController.numberOfPages(1000, 1000)", "2");
+shouldBe("layoutTestController.numberOfPages(10000, 10000)", "1");
+
+document.body.removeChild(document.getElementById("sandbox"));
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9fdf2cf..538ca7b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-02-09 Shinichiro Hamaji <hamaji at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Provide a way to get total number of pages to be printed
+ https://bugs.webkit.org/show_bug.cgi?id=34699
+
+ Test: printing/numberOfPages.html
+
+ * WebCore.base.exp:
+ * page/PrintContext.cpp:
+ (WebCore::PrintContext::pageNumberForElement):
+ (WebCore::PrintContext::numberOfPages):
+ * page/PrintContext.h:
+ (WebCore::PrintContext::pageRects):
+
2010-02-08 Dominic Cooney <dominicc at google.com>
Reviewed by Adam Barth.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 1f2cc91..8741c84 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -250,6 +250,7 @@ __ZN7WebCore12IconDatabase4openERKNS_6StringE
__ZN7WebCore12IconDatabase5closeEv
__ZN7WebCore12IconDatabase9setClientEPNS_18IconDatabaseClientE
__ZN7WebCore12PluginWidget14invalidateRectERKNS_7IntRectE
+__ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE
__ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE
__ZN7WebCore12RenderObject16repaintRectangleERKNS_7IntRectEb
__ZN7WebCore12RenderWidget19showSubstituteImageEN3WTF10PassRefPtrINS_5ImageEEE
diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp
index 4c902a9..31c8777 100644
--- a/WebCore/page/PrintContext.cpp
+++ b/WebCore/page/PrintContext.cpp
@@ -184,7 +184,20 @@ int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi
if (page.x() <= left && left < page.right() && page.y() <= top && top < page.bottom())
return pageNumber;
}
+ printContext.end();
return -1;
}
+int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels)
+{
+ frame->document()->updateLayout();
+
+ FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels);
+ PrintContext printContext(frame);
+ printContext.begin(pageRect.width());
+ printContext.computePageRectsWithPageSize(pageSizeInPixels, 1);
+ printContext.end();
+ return printContext.pageCount();
+}
+
}
diff --git a/WebCore/page/PrintContext.h b/WebCore/page/PrintContext.h
index 38b28c4..ec15b84 100644
--- a/WebCore/page/PrintContext.h
+++ b/WebCore/page/PrintContext.h
@@ -39,7 +39,7 @@ public:
int pageCount() const;
const IntRect& pageRect(int pageNumber) const;
- const Vector<IntRect>& pageRects() const { return m_pageRects; }
+ const Vector<IntRect>& pageRects() const { return m_pageRects; }
void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight);
@@ -53,6 +53,7 @@ public:
// Used by layout tests.
static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels);
+ static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels);
protected:
void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, float userScaleFactor);
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 1423e06..268b08b 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,14 @@
+2010-02-09 Shinichiro Hamaji <hamaji at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Provide a way to get total number of pages to be printed
+ https://bugs.webkit.org/show_bug.cgi?id=34699
+
+ * Misc/WebCoreStatistics.h:
+ * Misc/WebCoreStatistics.mm:
+ (-[WebFrame numberOfPages:pageWidthInPixels:]):
+
2010-02-08 Alexey Proskuryakov <ap at apple.com>
Reviewed by Darin Adler.
diff --git a/WebKit/mac/Misc/WebCoreStatistics.h b/WebKit/mac/Misc/WebCoreStatistics.h
index 6c45fb9..73d5f80 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.h
+++ b/WebKit/mac/Misc/WebCoreStatistics.h
@@ -85,4 +85,5 @@
- (NSString *)renderTreeAsExternalRepresentation;
- (NSString *)counterValueForElement:(DOMElement*)element;
- (int)pageNumberForElement:(DOMElement*)element:(float)pageWidthInPixels:(float)pageHeightInPixels;
+- (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels;
@end
diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm
index b18ee29..c59d66c 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.mm
+++ b/WebKit/mac/Misc/WebCoreStatistics.mm
@@ -256,4 +256,9 @@ using namespace WebCore;
return PrintContext::pageNumberForElement(core(element), FloatSize(pageWidthInPixels, pageHeightInPixels));
}
+- (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels
+{
+ return PrintContext::numberOfPages(_private->coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels));
+}
+
@end
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 64fa0da..4c56b08 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,23 @@
+2010-02-09 Shinichiro Hamaji <hamaji at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Provide a way to get total number of pages to be printed
+ https://bugs.webkit.org/show_bug.cgi?id=34699
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (parsePageParameters):
+ (pageNumberForElementByIdCallback):
+ (numberOfPagesCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::numberOfPages):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::numberOfPages):
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::numberOfPages):
+
2010-02-08 Alexey Proskuryakov <ap at apple.com>
Reviewed by Darin Adler.
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index 0537d7c..5eb4774 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -465,26 +465,34 @@ static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function,
return JSValueMakeUndefined(context);
}
-static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+static bool parsePageParameters(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, float& pageWidthInPixels, float& pageHeightInPixels)
{
// FIXME: These values should sync with maxViewWidth/Height in
// DumpRenderTree.mm. Factor these values out to somewhere.
- float pageWidthInPixels = 800;
- float pageHeightInPixels = 600;
+ pageWidthInPixels = 800;
+ pageHeightInPixels = 600;
switch (argumentCount) {
- case 1:
- break;
- case 3:
- pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception));
+ case 2:
+ pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[0], exception));
if (*exception)
- return JSValueMakeUndefined(context);
- pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[2], exception));
+ return false;
+ pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception));
if (*exception)
- return JSValueMakeUndefined(context);
+ return false;
+ case 0: // Fall through.
break;
default:
- return JSValueMakeUndefined(context);
+ return false;
}
+ return true;
+}
+
+static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ float pageWidthInPixels = 0;
+ float pageHeightInPixels = 0;
+ if (!parsePageParameters(context, argumentCount - 1, arguments + 1, exception, pageWidthInPixels, pageHeightInPixels))
+ return JSValueMakeUndefined(context);
JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
if (*exception)
@@ -495,6 +503,17 @@ static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjec
return JSValueMakeNumber(context, pageNumber);
}
+static JSValueRef numberOfPagesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ float pageWidthInPixels = 0;
+ float pageHeightInPixels = 0;
+ if (!parsePageParameters(context, argumentCount, arguments, exception, pageWidthInPixels, pageHeightInPixels))
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ return JSValueMakeNumber(context, controller->numberOfPages(pageWidthInPixels, pageHeightInPixels));
+}
+
static JSValueRef queueBackNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac & windows implementation
@@ -1329,6 +1348,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "numberOfPages", numberOfPagesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 76e7cb3..777bc1c 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -56,6 +56,7 @@ public:
bool isCommandEnabled(JSStringRef name);
void keepWebHistory();
void notifyDone();
+ int numberOfPages(float pageWidthInPixels, float pageHeightInPixels);
void overridePreference(JSStringRef key, JSStringRef value);
int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels);
JSStringRef pathToLocalResource(JSContextRef, JSStringRef url);
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index e3a82a9..8af46d3 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -149,6 +149,12 @@ int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWid
return pageNumber;
}
+int LayoutTestController::numberOfPages(float, float)
+{
+ // FIXME: implement
+ return -1;
+}
+
size_t LayoutTestController::webHistoryItemCount()
{
// FIXME: implement
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 67c8c91..6c0e3da 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -188,6 +188,11 @@ int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWid
return [mainFrame pageNumberForElement:element:pageWidthInPixels:pageHeightInPixels];
}
+int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels)
+{
+ return [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels];
+}
+
size_t LayoutTestController::webHistoryItemCount()
{
return [[[WebHistory optionalSharedHistory] allItems] count];
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 4f5e925..c86d7f5 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -1109,3 +1109,9 @@ int LayoutTestController::pageNumberForElementById(JSStringRef, float, float)
// FIXME: implement
return -1;
}
+
+int LayoutTestController::numberOfPages(float, float)
+{
+ // FIXME: implement
+ return -1;
+}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list