Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: Source/core/page/PrintContext.h

Issue 469833003: Cannot preview PDFs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/page/PrintContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 class LocalFrame; 33 class LocalFrame;
34 class FloatRect; 34 class FloatRect;
35 class FloatSize; 35 class FloatSize;
36 class GraphicsContext; 36 class GraphicsContext;
37 class IntRect; 37 class IntRect;
38 class Node; 38 class Node;
39 39
40 class PrintContext : public NoBaseWillBeGarbageCollectedFinalized<PrintContext> { 40 class PrintContext : public NoBaseWillBeGarbageCollectedFinalized<PrintContext> {
41 public: 41 public:
42 explicit PrintContext(LocalFrame*); 42 explicit PrintContext(LocalFrame*);
43 ~PrintContext(); 43 ~PrintContext();
Vitaly Buka (NO REVIEWS) 2014/08/13 21:17:42 virtual destructor?
abarth-chromium 2014/08/13 21:23:14 Will do.
44 44
45 LocalFrame* frame() const { return m_frame; } 45 LocalFrame* frame() const { return m_frame; }
46 46
47 // Break up a page into rects without relayout. 47 // Break up a page into rects without relayout.
48 // 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. 48 // 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.
49 // FIXME: Header and footer height should be applied before layout, not afte r. 49 // FIXME: Header and footer height should be applied before layout, not afte r.
50 // FIXME: The printRect argument is only used to determine page aspect ratio , it would be better to pass a FloatSize with page dimensions instead. 50 // FIXME: The printRect argument is only used to determine page aspect ratio , it would be better to pass a FloatSize with page dimensions instead.
51 void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight, bool allowHorizontalT iling = false); 51 virtual void computePageRects(const FloatRect& printRect, float headerHeight , float footerHeight, float userScaleFactor, float& outPageHeight);
52 52
53 // Deprecated. Page size computation is already in this class, clients shoul dn't be copying it. 53 // Deprecated. Page size computation is already in this class, clients shoul dn't be copying it.
54 // FIXME: Everyone passes |false| for the second paramer. We should remove t he second parameter.
54 void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, bool al lowHorizontalTiling); 55 void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, bool al lowHorizontalTiling);
Vitaly Buka (NO REVIEWS) 2014/08/13 21:43:44 virtual, because it's also m_pageRects related an
55 56
56 // These are only valid after page rects are computed. 57 // These are only valid after page rects are computed.
57 size_t pageCount() const { return m_pageRects.size(); } 58 virtual size_t pageCount() const { return m_pageRects.size(); }
58 const IntRect& pageRect(size_t pageNumber) const { return m_pageRects[pageNu mber]; } 59 const IntRect& pageRect(size_t pageNumber) const { return m_pageRects[pageNu mber]; }
Vitaly Buka (NO REVIEWS) 2014/08/13 21:17:42 pageRect maybe called with incorrect pageNumber if
59 const Vector<IntRect>& pageRects() const { return m_pageRects; } 60 const Vector<IntRect>& pageRects() const { return m_pageRects; }
Vitaly Buka (NO REVIEWS) 2014/08/13 21:17:42 same
abarth-chromium 2014/08/13 21:23:14 That's true. What do you recommend?
Vitaly Buka (NO REVIEWS) 2014/08/13 21:43:44 maybe /*no virtual*/ size_t pageCount() const { r
60 61
Vitaly Buka (NO REVIEWS) 2014/08/13 21:53:27 Actually even better to do following all 3 non vir
61 // Enter print mode, updating layout for new page size. 62 // 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. 63 // 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); 64 void begin(float width, float height = 0);
Vitaly Buka (NO REVIEWS) 2014/08/13 21:17:42 begin should be virtual for consistency
abarth-chromium 2014/08/13 21:23:14 Will do.
64 65
65 // Return to screen mode. 66 // Return to screen mode.
66 void end(); 67 virtual void end();
67 68
68 // Used by layout tests. 69 // Used by layout tests.
69 static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels) ; // Returns -1 if page isn't found. 70 static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels) ; // Returns -1 if page isn't found.
70 static String pageProperty(LocalFrame* frame, const char* propertyName, int pageNumber); 71 static String pageProperty(LocalFrame* frame, const char* propertyName, int pageNumber);
71 static bool isPageBoxVisible(LocalFrame* frame, int pageNumber); 72 static bool isPageBoxVisible(LocalFrame* frame, int pageNumber);
72 static String pageSizeAndMarginsInPixels(LocalFrame* frame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int mar ginLeft); 73 static String pageSizeAndMarginsInPixels(LocalFrame* frame, int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int mar ginLeft);
73 static int numberOfPages(LocalFrame*, const FloatSize& pageSizeInPixels); 74 static int numberOfPages(LocalFrame*, const FloatSize& pageSizeInPixels);
74 75
75 virtual void trace(Visitor*); 76 virtual void trace(Visitor*);
76 77
(...skipping 10 matching lines...) Expand all
87 // Used to prevent misuses of begin() and end() (e.g., call end without begi n). 88 // Used to prevent misuses of begin() and end() (e.g., call end without begi n).
88 bool m_isPrinting; 89 bool m_isPrinting;
89 90
90 WillBeHeapHashMap<String, RawPtrWillBeMember<Element> > m_linkedDestinations ; 91 WillBeHeapHashMap<String, RawPtrWillBeMember<Element> > m_linkedDestinations ;
91 bool m_linkedDestinationsValid; 92 bool m_linkedDestinationsValid;
92 }; 93 };
93 94
94 } 95 }
95 96
96 #endif 97 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/page/PrintContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698