#ifndef PrintContext_h
#define PrintContext_h
+#include "platform/heap/Handle.h"
#include "wtf/Forward.h"
#include "wtf/HashMap.h"
#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
-namespace WebCore {
+namespace blink {
class Element;
class LocalFrame;
class IntRect;
class Node;
-class PrintContext {
+class PrintContext : public NoBaseWillBeGarbageCollectedFinalized<PrintContext> {
public:
explicit PrintContext(LocalFrame*);
- ~PrintContext();
+ virtual ~PrintContext();
LocalFrame* frame() const { return m_frame; }
// FIXME: This means that CSS page breaks won't be on page boundary if the size is different than what was passed to begin(). That's probably not always desirable.
// FIXME: Header and footer height should be applied before layout, not after.
// FIXME: The printRect argument is only used to determine page aspect ratio, it would be better to pass a FloatSize with page dimensions instead.
- void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight, bool allowHorizontalTiling = false);
+ virtual void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight);
// Deprecated. Page size computation is already in this class, clients shouldn't be copying it.
- void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, bool allowHorizontalTiling);
+ // FIXME: Everyone passes |false| for the second paramer. We should remove the second parameter.
+ virtual void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, bool allowHorizontalTiling);
// These are only valid after page rects are computed.
size_t pageCount() const { return m_pageRects.size(); }
// Enter print mode, updating layout for new page size.
// This function can be called multiple times to apply new print options without going back to screen mode.
- void begin(float width, float height = 0);
-
- // FIXME: eliminate width argument.
- void spoolPage(GraphicsContext& ctx, int pageNumber, float width);
+ virtual void begin(float width, float height = 0);
// Return to screen mode.
- void end();
+ virtual void end();
// Used by layout tests.
static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels); // Returns -1 if page isn't found.
static bool isPageBoxVisible(LocalFrame* frame, int pageNumber);
static String pageSizeAndMarginsInPixels(LocalFrame* frame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft);
static int numberOfPages(LocalFrame*, const FloatSize& pageSizeInPixels);
- // Draw all pages into a graphics context with lines which mean page boundaries.
- // The height of the graphics context should be
- // (pageSizeInPixels.height() + 1) * number-of-pages - 1
- static void spoolAllPagesWithBoundaries(LocalFrame*, GraphicsContext&, const FloatSize& pageSizeInPixels);
+
+ virtual void trace(Visitor*);
protected:
void outputLinkedDestinations(GraphicsContext&, Node*, const IntRect& pageRect);
// Used to prevent misuses of begin() and end() (e.g., call end without begin).
bool m_isPrinting;
- HashMap<String, Element*> m_linkedDestinations;
+ WillBeHeapHashMap<String, RawPtrWillBeMember<Element> > m_linkedDestinations;
bool m_linkedDestinationsValid;
};