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

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

Issue 2838343003: Blink Rename follow-up: Rename PrintContext::begin/end to Begin/EndPrintMode. (Closed)
Patch Set: Fix compilation of PrintContextTest.cpp Created 3 years, 7 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
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 30 matching lines...) Expand all
41 class CORE_EXPORT PrintContext 41 class CORE_EXPORT PrintContext
42 : public GarbageCollectedFinalized<PrintContext> { 42 : public GarbageCollectedFinalized<PrintContext> {
43 public: 43 public:
44 explicit PrintContext(LocalFrame*); 44 explicit PrintContext(LocalFrame*);
45 virtual ~PrintContext(); 45 virtual ~PrintContext();
46 46
47 LocalFrame* GetFrame() const { return frame_; } 47 LocalFrame* GetFrame() const { return 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 50 // FIXME: This means that CSS page breaks won't be on page boundary if the
51 // size is different than what was passed to begin(). That's probably not 51 // size is different than what was passed to BeginPrintMode(). That's probably
52 // always desirable. 52 // not always desirable.
53 // FIXME: Header and footer height should be applied before layout, not after. 53 // FIXME: Header and footer height should be applied before layout, not after.
54 // FIXME: The printRect argument is only used to determine page aspect ratio, 54 // FIXME: The printRect argument is only used to determine page aspect ratio,
55 // it would be better to pass a FloatSize with page dimensions instead. 55 // it would be better to pass a FloatSize with page dimensions instead.
56 virtual void ComputePageRects(const FloatRect& print_rect, 56 virtual void ComputePageRects(const FloatRect& print_rect,
57 float header_height, 57 float header_height,
58 float footer_height, 58 float footer_height,
59 float user_scale_factor, 59 float user_scale_factor,
60 float& out_page_height); 60 float& out_page_height);
61 61
62 // Deprecated. Page size computation is already in this class, clients 62 // Deprecated. Page size computation is already in this class, clients
63 // shouldn't be copying it. 63 // shouldn't be copying it.
64 // FIXME: Everyone passes |false| for the second paramer. We should remove the 64 // FIXME: Everyone passes |false| for the second paramer. We should remove the
65 // second parameter. 65 // second parameter.
66 virtual void ComputePageRectsWithPageSize( 66 virtual void ComputePageRectsWithPageSize(
67 const FloatSize& page_size_in_pixels); 67 const FloatSize& page_size_in_pixels);
68 68
69 // These are only valid after page rects are computed. 69 // These are only valid after page rects are computed.
70 size_t PageCount() const { return page_rects_.size(); } 70 size_t PageCount() const { return page_rects_.size(); }
71 const IntRect& PageRect(size_t page_number) const { 71 const IntRect& PageRect(size_t page_number) const {
72 return page_rects_[page_number]; 72 return page_rects_[page_number];
73 } 73 }
74 const Vector<IntRect>& PageRects() const { return page_rects_; } 74 const Vector<IntRect>& PageRects() const { return page_rects_; }
75 75
76 // Enter print mode, updating layout for new page size. 76 // Enter print mode, updating layout for new page size.
77 // This function can be called multiple times to apply new print options 77 // This function can be called multiple times to apply new print options
78 // without going back to screen mode. 78 // without going back to screen mode.
79 virtual void begin(float width, float height = 0); 79 virtual void BeginPrintMode(float width, float height = 0);
Łukasz Anforowicz 2017/04/26 22:28:10 |BeginPrintMode| seems like a good name to me, bec
80 80
81 // Return to screen mode. 81 // Return to screen mode.
82 virtual void end(); 82 virtual void EndPrintMode();
83 83
84 // Used by layout tests. 84 // Used by layout tests.
85 static int PageNumberForElement( 85 static int PageNumberForElement(
86 Element*, 86 Element*,
87 const FloatSize& page_size_in_pixels); // Returns -1 if page isn't found. 87 const FloatSize& page_size_in_pixels); // Returns -1 if page isn't found.
88 static String PageProperty(LocalFrame*, 88 static String PageProperty(LocalFrame*,
89 const char* property_name, 89 const char* property_name,
90 int page_number); 90 int page_number);
91 static bool IsPageBoxVisible(LocalFrame*, int page_number); 91 static bool IsPageBoxVisible(LocalFrame*, int page_number);
92 static String PageSizeAndMarginsInPixels(LocalFrame*, 92 static String PageSizeAndMarginsInPixels(LocalFrame*,
(...skipping 12 matching lines...) Expand all
105 void OutputLinkedDestinations(GraphicsContext&, const IntRect& page_rect); 105 void OutputLinkedDestinations(GraphicsContext&, const IntRect& page_rect);
106 106
107 Member<LocalFrame> frame_; 107 Member<LocalFrame> frame_;
108 Vector<IntRect> page_rects_; 108 Vector<IntRect> page_rects_;
109 109
110 private: 110 private:
111 void ComputePageRectsWithPageSizeInternal( 111 void ComputePageRectsWithPageSizeInternal(
112 const FloatSize& page_size_in_pixels); 112 const FloatSize& page_size_in_pixels);
113 void CollectLinkedDestinations(Node*); 113 void CollectLinkedDestinations(Node*);
114 114
115 // Used to prevent misuses of begin() and end() (e.g., call end without 115 // Used to prevent misuses of BeginPrintMode() and EndPrintMode() (e.g., call
116 // begin). 116 // EndPrintMode without BeginPrintMode).
117 bool is_printing_; 117 bool is_printing_;
118 118
119 HeapHashMap<String, Member<Element>> linked_destinations_; 119 HeapHashMap<String, Member<Element>> linked_destinations_;
120 bool linked_destinations_valid_; 120 bool linked_destinations_valid_;
121 }; 121 };
122 122
123 } // namespace blink 123 } // namespace blink
124 124
125 #endif 125 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp ('k') | third_party/WebKit/Source/core/page/PrintContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698