Changeset 54533 in webkit
- Timestamp:
- Feb 9, 2010 12:32:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r54530 r54533 1 2010-02-09 Shinichiro Hamaji <hamaji@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Provide a way to get total number of pages to be printed 6 https://bugs.webkit.org/show_bug.cgi?id=34699 7 8 * platform/gtk/Skipped: 9 * platform/qt/Skipped: 10 * platform/win/Skipped: 11 * printing/numberOfPages-expected.txt: Added. 12 * printing/numberOfPages.html: Added. 13 * printing/script-tests/numberOfPages.js: Added. 14 (createParagraph): 15 1 16 2010-02-09 Zoltan Herczeg <zherczeg@inf.u-szeged.hu> 2 17 -
trunk/LayoutTests/platform/gtk/Skipped
r54529 r54533 5810 5810 # https://bugs.webkit.org/show_bug.cgi?id=32717 5811 5811 fast/frames/flattening/ 5812 5813 # Implement LayoutTestController::numberOfPages(). 5814 printing/numberOfPages.html -
trunk/LayoutTests/platform/qt/Skipped
r54468 r54533 5078 5078 # Because ENABLE_DASHBOARD_SUPPORT=0 is the default option. (Apple's dashboard support in OS X) 5079 5079 fast/css/dashboard-regions-attr-crash.html 5080 5081 # Implement LayoutTestController::numberOfPages(). 5082 printing/numberOfPages.html -
trunk/LayoutTests/platform/win/Skipped
r54440 r54533 749 749 # https://bugs.webkit.org/show_bug.cgi?id=32717 750 750 fast/frames/flattening/ 751 752 # Implement LayoutTestController::numberOfPages(). 753 printing/numberOfPages.html -
trunk/WebCore/ChangeLog
r54527 r54533 1 2010-02-09 Shinichiro Hamaji <hamaji@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Provide a way to get total number of pages to be printed 6 https://bugs.webkit.org/show_bug.cgi?id=34699 7 8 Test: printing/numberOfPages.html 9 10 * WebCore.base.exp: 11 * page/PrintContext.cpp: 12 (WebCore::PrintContext::pageNumberForElement): 13 (WebCore::PrintContext::numberOfPages): 14 * page/PrintContext.h: 15 (WebCore::PrintContext::pageRects): 16 1 17 2010-02-08 Dominic Cooney <dominicc@google.com> 2 18 -
trunk/WebCore/WebCore.base.exp
r54405 r54533 251 251 __ZN7WebCore12IconDatabase9setClientEPNS_18IconDatabaseClientE 252 252 __ZN7WebCore12PluginWidget14invalidateRectERKNS_7IntRectE 253 __ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE 253 254 __ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE 254 255 __ZN7WebCore12RenderObject16repaintRectangleERKNS_7IntRectEb -
trunk/WebCore/page/PrintContext.cpp
r54205 r54533 185 185 return pageNumber; 186 186 } 187 printContext.end(); 187 188 return -1; 188 189 } 189 190 190 } 191 int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels) 192 { 193 frame->document()->updateLayout(); 194 195 FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); 196 PrintContext printContext(frame); 197 printContext.begin(pageRect.width()); 198 printContext.computePageRectsWithPageSize(pageSizeInPixels, 1); 199 printContext.end(); 200 return printContext.pageCount(); 201 } 202 203 } -
trunk/WebCore/page/PrintContext.h
r54221 r54533 40 40 int pageCount() const; 41 41 const IntRect& pageRect(int pageNumber) const; 42 const Vector<IntRect>& pageRects() const { return m_pageRects; }42 const Vector<IntRect>& pageRects() const { return m_pageRects; } 43 43 44 44 void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight); … … 54 54 // Used by layout tests. 55 55 static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels); 56 static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels); 56 57 57 58 protected: -
trunk/WebKit/mac/ChangeLog
r54516 r54533 1 2010-02-09 Shinichiro Hamaji <hamaji@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Provide a way to get total number of pages to be printed 6 https://bugs.webkit.org/show_bug.cgi?id=34699 7 8 * Misc/WebCoreStatistics.h: 9 * Misc/WebCoreStatistics.mm: 10 (-[WebFrame numberOfPages:pageWidthInPixels:]): 11 1 12 2010-02-08 Alexey Proskuryakov <ap@apple.com> 2 13 -
trunk/WebKit/mac/Misc/WebCoreStatistics.h
r54205 r54533 86 86 - (NSString *)counterValueForElement:(DOMElement*)element; 87 87 - (int)pageNumberForElement:(DOMElement*)element:(float)pageWidthInPixels:(float)pageHeightInPixels; 88 - (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels; 88 89 @end -
trunk/WebKit/mac/Misc/WebCoreStatistics.mm
r54205 r54533 257 257 } 258 258 259 - (int)numberOfPages:(float)pageWidthInPixels:(float)pageHeightInPixels 260 { 261 return PrintContext::numberOfPages(_private->coreFrame, FloatSize(pageWidthInPixels, pageHeightInPixels)); 262 } 263 259 264 @end -
trunk/WebKitTools/ChangeLog
r54516 r54533 1 2010-02-09 Shinichiro Hamaji <hamaji@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Provide a way to get total number of pages to be printed 6 https://bugs.webkit.org/show_bug.cgi?id=34699 7 8 * DumpRenderTree/LayoutTestController.cpp: 9 (parsePageParameters): 10 (pageNumberForElementByIdCallback): 11 (numberOfPagesCallback): 12 (LayoutTestController::staticFunctions): 13 * DumpRenderTree/LayoutTestController.h: 14 * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: 15 (LayoutTestController::numberOfPages): 16 * DumpRenderTree/mac/LayoutTestControllerMac.mm: 17 (LayoutTestController::numberOfPages): 18 * DumpRenderTree/win/LayoutTestControllerWin.cpp: 19 (LayoutTestController::numberOfPages): 20 1 21 2010-02-08 Alexey Proskuryakov <ap@apple.com> 2 22 -
trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp
r54205 r54533 466 466 } 467 467 468 static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)468 static bool parsePageParameters(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, float& pageWidthInPixels, float& pageHeightInPixels) 469 469 { 470 470 // FIXME: These values should sync with maxViewWidth/Height in 471 471 // DumpRenderTree.mm. Factor these values out to somewhere. 472 floatpageWidthInPixels = 800;473 floatpageHeightInPixels = 600;472 pageWidthInPixels = 800; 473 pageHeightInPixels = 600; 474 474 switch (argumentCount) { 475 case 1: 476 break; 477 case 3: 478 pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception)); 475 case 2: 476 pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[0], exception)); 479 477 if (*exception) 480 return JSValueMakeUndefined(context);481 pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[ 2], exception));478 return false; 479 pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception)); 482 480 if (*exception) 483 return JSValueMakeUndefined(context); 481 return false; 482 case 0: // Fall through. 484 483 break; 485 484 default: 486 return JSValueMakeUndefined(context);485 return false; 487 486 } 487 return true; 488 } 489 490 static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 491 { 492 float pageWidthInPixels = 0; 493 float pageHeightInPixels = 0; 494 if (!parsePageParameters(context, argumentCount - 1, arguments + 1, exception, pageWidthInPixels, pageHeightInPixels)) 495 return JSValueMakeUndefined(context); 488 496 489 497 JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception)); … … 494 502 int pageNumber = controller->pageNumberForElementById(elementId.get(), pageWidthInPixels, pageHeightInPixels); 495 503 return JSValueMakeNumber(context, pageNumber); 504 } 505 506 static JSValueRef numberOfPagesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 507 { 508 float pageWidthInPixels = 0; 509 float pageHeightInPixels = 0; 510 if (!parsePageParameters(context, argumentCount, arguments, exception, pageWidthInPixels, pageHeightInPixels)) 511 return JSValueMakeUndefined(context); 512 513 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 514 return JSValueMakeNumber(context, controller->numberOfPages(pageWidthInPixels, pageHeightInPixels)); 496 515 } 497 516 … … 1330 1349 { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1331 1350 { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1351 { "numberOfPages", numberOfPagesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1332 1352 { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 1333 1353 { "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -
trunk/WebKitTools/DumpRenderTree/LayoutTestController.h
r54205 r54533 57 57 void keepWebHistory(); 58 58 void notifyDone(); 59 int numberOfPages(float pageWidthInPixels, float pageHeightInPixels); 59 60 void overridePreference(JSStringRef key, JSStringRef value); 60 61 int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels); -
trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
r54461 r54533 150 150 } 151 151 152 int LayoutTestController::numberOfPages(float, float) 153 { 154 // FIXME: implement 155 return -1; 156 } 157 152 158 size_t LayoutTestController::webHistoryItemCount() 153 159 { -
trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
r54205 r54533 189 189 } 190 190 191 int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels) 192 { 193 return [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels]; 194 } 195 191 196 size_t LayoutTestController::webHistoryItemCount() 192 197 { -
trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
r54205 r54533 1110 1110 return -1; 1111 1111 } 1112 1113 int LayoutTestController::numberOfPages(float, float) 1114 { 1115 // FIXME: implement 1116 return -1; 1117 }
Note: See TracChangeset
for help on using the changeset viewer.