| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 2 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 3 * Copyright (C) 2007 Apple Inc. | 3 * Copyright (C) 2007 Apple Inc. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 // These are only valid after page rects are computed. | 56 // These are only valid after page rects are computed. |
| 57 size_t pageCount() const { return m_pageRects.size(); } | 57 size_t pageCount() const { return m_pageRects.size(); } |
| 58 const IntRect& pageRect(size_t pageNumber) const { return m_pageRects[pageNu
mber]; } | 58 const IntRect& pageRect(size_t pageNumber) const { return m_pageRects[pageNu
mber]; } |
| 59 const Vector<IntRect>& pageRects() const { return m_pageRects; } | 59 const Vector<IntRect>& pageRects() const { return m_pageRects; } |
| 60 | 60 |
| 61 // Enter print mode, updating layout for new page size. | 61 // Enter print mode, updating layout for new page size. |
| 62 // This function can be called multiple times to apply new print options wit
hout going back to screen mode. | 62 // This function can be called multiple times to apply new print options wit
hout going back to screen mode. |
| 63 void begin(float width, float height = 0); | 63 void begin(float width, float height = 0); |
| 64 | 64 |
| 65 // FIXME: eliminate width argument. | |
| 66 void spoolPage(GraphicsContext& ctx, int pageNumber, float width); | |
| 67 | |
| 68 // Return to screen mode. | 65 // Return to screen mode. |
| 69 void end(); | 66 void end(); |
| 70 | 67 |
| 71 // Used by layout tests. | 68 // Used by layout tests. |
| 72 static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels)
; // Returns -1 if page isn't found. | 69 static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels)
; // Returns -1 if page isn't found. |
| 73 static String pageProperty(LocalFrame* frame, const char* propertyName, int
pageNumber); | 70 static String pageProperty(LocalFrame* frame, const char* propertyName, int
pageNumber); |
| 74 static bool isPageBoxVisible(LocalFrame* frame, int pageNumber); | 71 static bool isPageBoxVisible(LocalFrame* frame, int pageNumber); |
| 75 static String pageSizeAndMarginsInPixels(LocalFrame* frame, int pageNumber,
int width, int height, int marginTop, int marginRight, int marginBottom, int mar
ginLeft); | 72 static String pageSizeAndMarginsInPixels(LocalFrame* frame, int pageNumber,
int width, int height, int marginTop, int marginRight, int marginBottom, int mar
ginLeft); |
| 76 static int numberOfPages(LocalFrame*, const FloatSize& pageSizeInPixels); | 73 static int numberOfPages(LocalFrame*, const FloatSize& pageSizeInPixels); |
| 77 // Draw all pages into a graphics context with lines which mean page boundar
ies. | |
| 78 // The height of the graphics context should be | |
| 79 // (pageSizeInPixels.height() + 1) * number-of-pages - 1 | |
| 80 static void spoolAllPagesWithBoundaries(LocalFrame*, GraphicsContext&, const
FloatSize& pageSizeInPixels); | |
| 81 | 74 |
| 82 virtual void trace(Visitor*); | 75 virtual void trace(Visitor*); |
| 83 | 76 |
| 84 protected: | 77 protected: |
| 85 void outputLinkedDestinations(GraphicsContext&, Node*, const IntRect& pageRe
ct); | 78 void outputLinkedDestinations(GraphicsContext&, Node*, const IntRect& pageRe
ct); |
| 86 | 79 |
| 87 LocalFrame* m_frame; | 80 LocalFrame* m_frame; |
| 88 Vector<IntRect> m_pageRects; | 81 Vector<IntRect> m_pageRects; |
| 89 | 82 |
| 90 private: | 83 private: |
| 91 void computePageRectsWithPageSizeInternal(const FloatSize& pageSizeInPixels,
bool allowHorizontalTiling); | 84 void computePageRectsWithPageSizeInternal(const FloatSize& pageSizeInPixels,
bool allowHorizontalTiling); |
| 92 void collectLinkedDestinations(Node*); | 85 void collectLinkedDestinations(Node*); |
| 93 | 86 |
| 94 // Used to prevent misuses of begin() and end() (e.g., call end without begi
n). | 87 // Used to prevent misuses of begin() and end() (e.g., call end without begi
n). |
| 95 bool m_isPrinting; | 88 bool m_isPrinting; |
| 96 | 89 |
| 97 WillBeHeapHashMap<String, RawPtrWillBeMember<Element> > m_linkedDestinations
; | 90 WillBeHeapHashMap<String, RawPtrWillBeMember<Element> > m_linkedDestinations
; |
| 98 bool m_linkedDestinationsValid; | 91 bool m_linkedDestinationsValid; |
| 99 }; | 92 }; |
| 100 | 93 |
| 101 } | 94 } |
| 102 | 95 |
| 103 #endif | 96 #endif |
| OLD | NEW |