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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 LocalFrame* frame() const { return m_frame; } | 47 LocalFrame* frame() const { return m_frame; } |
48 | 48 |
49 // Break up a page into rects without relayout. | 49 // Break up a page into rects without relayout. |
50 // FIXME: This means that CSS page breaks won't be on page boundary if the s
ize is different than what was passed to begin(). That's probably not always des
irable. | 50 // FIXME: This means that CSS page breaks won't be on page boundary if the s
ize is different than what was passed to begin(). That's probably not always des
irable. |
51 // FIXME: Header and footer height should be applied before layout, not afte
r. | 51 // FIXME: Header and footer height should be applied before layout, not afte
r. |
52 // FIXME: The printRect argument is only used to determine page aspect ratio
, it would be better to pass a FloatSize with page dimensions instead. | 52 // FIXME: The printRect argument is only used to determine page aspect ratio
, it would be better to pass a FloatSize with page dimensions instead. |
53 virtual void computePageRects(const FloatRect& printRect, float headerHeight
, float footerHeight, float userScaleFactor, float& outPageHeight); | 53 virtual void computePageRects(const FloatRect& printRect, float headerHeight
, float footerHeight, float userScaleFactor, float& outPageHeight); |
54 | 54 |
55 // Deprecated. Page size computation is already in this class, clients shoul
dn't be copying it. | 55 // Deprecated. Page size computation is already in this class, clients shoul
dn't be copying it. |
56 // FIXME: Everyone passes |false| for the second paramer. We should remove t
he second parameter. | 56 // FIXME: Everyone passes |false| for the second paramer. We should remove t
he second parameter. |
57 virtual void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels,
bool allowHorizontalTiling); | 57 virtual void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels)
; |
58 | 58 |
59 // These are only valid after page rects are computed. | 59 // These are only valid after page rects are computed. |
60 size_t pageCount() const { return m_pageRects.size(); } | 60 size_t pageCount() const { return m_pageRects.size(); } |
61 const IntRect& pageRect(size_t pageNumber) const { return m_pageRects[pageNu
mber]; } | 61 const IntRect& pageRect(size_t pageNumber) const { return m_pageRects[pageNu
mber]; } |
62 const Vector<IntRect>& pageRects() const { return m_pageRects; } | 62 const Vector<IntRect>& pageRects() const { return m_pageRects; } |
63 | 63 |
64 // Enter print mode, updating layout for new page size. | 64 // Enter print mode, updating layout for new page size. |
65 // This function can be called multiple times to apply new print options wit
hout going back to screen mode. | 65 // This function can be called multiple times to apply new print options wit
hout going back to screen mode. |
66 virtual void begin(float width, float height = 0); | 66 virtual void begin(float width, float height = 0); |
67 | 67 |
68 // Return to screen mode. | 68 // Return to screen mode. |
69 virtual void end(); | 69 virtual void end(); |
70 | 70 |
71 // Used by layout tests. | 71 // Used by layout tests. |
72 static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels)
; // Returns -1 if page isn't found. | 72 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); | 73 static String pageProperty(LocalFrame* frame, const char* propertyName, int
pageNumber); |
74 static bool isPageBoxVisible(LocalFrame* frame, int pageNumber); | 74 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); | 75 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); | 76 static int numberOfPages(LocalFrame*, const FloatSize& pageSizeInPixels); |
77 | 77 |
78 DECLARE_VIRTUAL_TRACE(); | 78 DECLARE_VIRTUAL_TRACE(); |
79 | 79 |
80 protected: | 80 protected: |
81 void outputLinkAndLinkedDestinations(GraphicsContext&, const IntRect& pageRe
ct); | 81 void outputLinkAndLinkedDestinations(GraphicsContext&, const IntRect& pageRe
ct); |
82 | 82 |
83 RawPtrWillBeMember<LocalFrame> m_frame; | 83 RawPtrWillBeMember<LocalFrame> m_frame; |
84 Vector<IntRect> m_pageRects; | 84 Vector<IntRect> m_pageRects; |
85 | 85 |
86 private: | 86 private: |
87 void computePageRectsWithPageSizeInternal(const FloatSize& pageSizeInPixels,
bool allowHorizontalTiling); | 87 void computePageRectsWithPageSizeInternal(const FloatSize& pageSizeInPixels)
; |
88 void collectLinkAndLinkedDestinations(Node*); | 88 void collectLinkAndLinkedDestinations(Node*); |
89 | 89 |
90 // Used to prevent misuses of begin() and end() (e.g., call end without begi
n). | 90 // Used to prevent misuses of begin() and end() (e.g., call end without begi
n). |
91 bool m_isPrinting; | 91 bool m_isPrinting; |
92 | 92 |
93 WillBeHeapHashMap<RawPtrWillBeMember<Element>, KURL> m_linkDestinations; | 93 WillBeHeapHashMap<RawPtrWillBeMember<Element>, KURL> m_linkDestinations; |
94 WillBeHeapHashMap<String, RawPtrWillBeMember<Element>> m_linkedDestinations; | 94 WillBeHeapHashMap<String, RawPtrWillBeMember<Element>> m_linkedDestinations; |
95 bool m_linkAndLinkedDestinationsValid; | 95 bool m_linkAndLinkedDestinationsValid; |
96 }; | 96 }; |
97 | 97 |
98 } | 98 } |
99 | 99 |
100 #endif | 100 #endif |
OLD | NEW |