summaryrefslogtreecommitdiffstats
path: root/WebCore/page/PrintContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/page/PrintContext.cpp')
-rw-r--r--WebCore/page/PrintContext.cpp13
1 files changed, 13 insertions, 0 deletions
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();
+}
+
}