Changeset 67771 in webkit
- Timestamp:
- Sep 17, 2010 7:13:48 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r67770 r67771 1 2010-09-17 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 https://bugs.webkit.org/show_bug.cgi?id=45993, convert printing to the new pagination model. 6 7 Remove the overflow test, since the new model treats overflow:auto/scroll as unsplittable. 8 9 * printing/page-break-always-for-overflow-expected.txt: Removed. 10 * printing/page-break-always-for-overflow.html: Removed. 11 1 12 2010-09-17 Dan Bernstein <mitz@apple.com> 2 13 -
trunk/LayoutTests/platform/mac/printing/media-queries-print-expected.txt
r64409 r67771 1 layer at (0,0) size 1000x 6002 RenderView at (0,0) size 1000x 6003 layer at (0,0) size 1000x 6004 RenderBlock {HTML} at (0,0) size 1000x 6005 RenderBody {BODY} at (8,8) size 984x 5841 layer at (0,0) size 1000x134 2 RenderView at (0,0) size 1000x134 3 layer at (0,0) size 1000x134 4 RenderBlock {HTML} at (0,0) size 1000x134 5 RenderBody {BODY} at (8,8) size 984x118 6 6 RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#008000] 7 7 RenderBlock (anonymous) at (0,100) size 984x18 -
trunk/LayoutTests/printing/page-break-margin-collapsed-expected.txt
r64409 r67771 6 6 7 7 PASS: page number of "page1" is 1 8 FAIL: expected page number of "page2" is 2. Was 134 8 PASS: page number of "page2" is 2 9 All tests passed 9 10 10 11 PASS successfullyParsed is true -
trunk/WebCore/ChangeLog
r67770 r67771 1 2010-09-17 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 https://bugs.webkit.org/show_bug.cgi?id=45993, convert printing to the new pagination model. 6 7 Make printing store the page height in the RenderView and push that into the layout state to 8 use the new pagination model. The old pagination model is retained because it is still used 9 for embedded WebViews. 10 11 * page/FrameView.cpp: 12 (WebCore::FrameView::reset): 13 (WebCore::FrameView::layout): 14 (WebCore::FrameView::forceLayout): 15 (WebCore::FrameView::forceLayoutForPagination): 16 (WebCore::FrameView::adjustPageHeight): 17 * page/FrameView.h: 18 * page/PrintContext.cpp: 19 (WebCore::PrintContext::computePageRectsWithPageSizeInternal): 20 * rendering/RenderBlock.cpp: 21 (WebCore::RenderBlock::paintChildren): 22 * rendering/RenderBox.cpp: 23 (WebCore::RenderBox::calcHeight): 24 * rendering/RenderImage.cpp: 25 (WebCore::RenderImage::paintReplaced): 26 * rendering/RenderLineBoxList.cpp: 27 (WebCore::RenderLineBoxList::paint): 28 * rendering/RenderVideo.cpp: 29 (WebCore::RenderVideo::paintReplaced): 30 * rendering/RenderView.cpp: 31 (WebCore::RenderView::RenderView): 32 (WebCore::RenderView::layout): 33 (WebCore::RenderView::paint): 34 (WebCore::RenderView::setBestTruncatedAt): 35 * rendering/RenderView.h: 36 (WebCore::RenderView::popLayoutState): 37 (WebCore::RenderView::pageHeight): 38 (WebCore::RenderView::setPageHeight): 39 (WebCore::RenderView::bestTruncatedAt): 40 (WebCore::RenderView::truncatedAt): 41 (WebCore::RenderView::setTruncatedAt): 42 (WebCore::RenderView::printRect): 43 (WebCore::RenderView::setPrintRect): 44 (WebCore::RenderView::pushLayoutState): 45 (WebCore::LayoutStateMaintainer::LayoutStateMaintainer): 46 (WebCore::LayoutStateMaintainer::push): 47 (WebCore::LayoutStateMaintainer::pop): 48 1 49 2010-09-17 Dan Bernstein <mitz@apple.com> 2 50 -
trunk/WebCore/WebCore.exp.in
r67762 r67771 769 769 __ZN7WebCore9FrameView14setTransparentEb 770 770 __ZN7WebCore9FrameView15setMarginHeightEi 771 __ZN7WebCore9FrameView 16adjustPageHeightEPffff771 __ZN7WebCore9FrameView26adjustPageHeightDeprecatedEPffff 772 772 __ZN7WebCore9FrameView16setPaintBehaviorEj 773 773 __ZN7WebCore9FrameView18updateControlTintsEv -
trunk/WebCore/page/FrameView.cpp
r67762 r67771 206 206 m_lastLayoutSize = IntSize(); 207 207 m_lastZoomFactor = 1.0f; 208 m_pageHeight = 0;209 208 m_deferringRepaints = 0; 210 209 m_repaintCount = 0; … … 771 770 if (subtree) { 772 771 RenderView* view = root->view(); 773 view->popLayoutState( );772 view->popLayoutState(root); 774 773 if (disableLayoutState) 775 774 view->enableLayoutState(); … … 2077 2076 { 2078 2077 layout(allowSubtree); 2079 // We cannot unschedule a pending relayout, since the force can be called with2080 // a tiny rectangle from a drawRect update. By unscheduling we in effect2081 // "validate" and stop the necessary full repaint from occurring. Basically any basic2082 // append/remove DHTML is broken by this call. For now, I have removed the optimization2083 // until we have a better invalidation stategy. -dwh2084 //unscheduleRelayout();2085 2078 } 2086 2079 … … 2092 2085 if (root) { 2093 2086 int pageW = ceilf(pageSize.width()); 2094 m_pageHeight = pageSize.height() ? pageSize.height() : visibleHeight();2095 2087 root->setWidth(pageW); 2088 root->setPageHeight(pageSize.height()); 2096 2089 root->setNeedsLayoutAndPrefWidthsRecalc(); 2097 2090 forceLayout(); … … 2105 2098 pageW = std::min<int>(rightmostPos, ceilf(pageSize.width() * maximumShrinkFactor)); 2106 2099 if (pageSize.height()) 2107 m_pageHeight = pageW / pageSize.width() * pageSize.height();2100 root->setPageHeight(pageW / pageSize.width() * pageSize.height()); 2108 2101 root->setWidth(pageW); 2109 2102 root->setNeedsLayoutAndPrefWidthsRecalc(); … … 2114 2107 if (shouldAdjustViewSize) 2115 2108 adjustViewSize(); 2116 m_pageHeight = 0; 2117 } 2118 2119 void FrameView::adjustPageHeight(float *newBottom, float oldTop, float oldBottom, float /*bottomLimit*/) 2109 } 2110 2111 void FrameView::adjustPageHeightDeprecated(float *newBottom, float oldTop, float oldBottom, float /*bottomLimit*/) 2120 2112 { 2121 2113 RenderView* root = m_frame->contentRenderer(); … … 2125 2117 root->setTruncatedAt((int)floorf(oldBottom)); 2126 2118 IntRect dirtyRect(0, (int)floorf(oldTop), root->rightLayoutOverflow(), (int)ceilf(oldBottom - oldTop)); 2119 root->setPrintRect(dirtyRect); 2127 2120 root->layer()->paint(&context, dirtyRect); 2128 2121 *newBottom = root->bestTruncatedAt(); 2129 2122 if (*newBottom == 0) 2130 2123 *newBottom = oldBottom; 2124 root->setPrintRect(IntRect()); 2131 2125 } else 2132 2126 *newBottom = oldBottom; -
trunk/WebCore/page/FrameView.h
r67762 r67771 201 201 void forceLayout(bool allowSubtree = false); 202 202 void forceLayoutForPagination(const FloatSize& pageSize, float maximumShrinkFactor, Frame::AdjustViewSizeOrNot); 203 int pageHeight() const { return m_pageHeight; } 204 205 void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit); 203 204 // FIXME: This method is retained because of embedded WebViews in AppKit. When a WebView is embedded inside 205 // some enclosing view with auto-pagination, no call happens to resize the view. The new pagination model 206 // needs the view to resize as a result of the breaks, but that means that the enclosing view has to potentially 207 // resize around that view. Auto-pagination uses the bounds of the actual view that's being printed to determine 208 // the edges of the print operation, so the resize is necessary if the enclosing view's bounds depend on the 209 // web document's bounds. 210 // 211 // This is already a problem if the view needs to be a different size because of printer fonts or because of print stylesheets. 212 // Mail/Dictionary work around this problem by using the _layoutForPrinting SPI 213 // to at least get print stylesheets and printer fonts into play, but since WebKit doesn't know about the page offset or 214 // page size, it can't actually paginate correctly during _layoutForPrinting. 215 // 216 // We can eventually move Mail to a newer SPI that would let them opt in to the layout-time pagination model, 217 // but that doesn't solve the general problem of how other AppKit views could opt in to the better model. 218 // 219 // NO OTHER PLATFORM BESIDES MAC SHOULD USE THIS METHOD. 220 void adjustPageHeightDeprecated(float* newBottom, float oldTop, float oldBottom, float bottomLimit); 206 221 207 222 bool scrollToFragment(const KURL&); … … 331 346 String m_mediaTypeWhenNotPrinting; 332 347 333 int m_pageHeight;334 335 348 unsigned m_enqueueEvents; 336 349 Vector<ScheduledEvent*> m_scheduledEvents; -
trunk/WebCore/page/PrintContext.cpp
r65137 r67771 96 96 if (!m_frame->document() || !m_frame->view() || !m_frame->document()->renderer()) 97 97 return; 98 98 99 RenderView* root = toRenderView(m_frame->document()->renderer()); 99 100 100 const float pageWidth = pageSizeInPixels.width(); 101 const float docWidth = root->layer()->width(); 102 const float docHeight = root->layer()->height(); 103 float currPageHeight = pageSizeInPixels.height(); 104 105 // always return at least one page, since empty files should print a blank page 106 float printedPagesHeight = 0; 107 do { 108 float proposedBottom = std::min(docHeight, printedPagesHeight + pageSizeInPixels.height()); 109 m_frame->view()->adjustPageHeight(&proposedBottom, printedPagesHeight, proposedBottom, printedPagesHeight); 110 currPageHeight = max(1.0f, proposedBottom - printedPagesHeight); 101 int docWidth = root->layer()->width(); 102 int docHeight = root->layer()->height(); 103 int pageWidth = pageSizeInPixels.width(); 104 int pageHeight = pageSizeInPixels.height(); 105 106 unsigned pageCount = ceilf((float)docHeight / pageHeight); 107 for (unsigned i = 0; i < pageCount; ++i) { 111 108 if (allowHorizontalMultiPages) { 112 for ( float curWidth = 0; curWidth < docWidth; curWidth += pageWidth)113 m_pageRects.append(IntRect(cur Width, (int)printedPagesHeight, (int)pageWidth, (int)currPageHeight));109 for (int currWidth = 0; currWidth < docWidth; currWidth += pageWidth) 110 m_pageRects.append(IntRect(currWidth, i * pageHeight, pageWidth, pageHeight)); 114 111 } else 115 m_pageRects.append(IntRect(0, (int)printedPagesHeight, (int)pageWidth, (int)currPageHeight)); 116 printedPagesHeight += currPageHeight; 117 } while (printedPagesHeight < docHeight); 112 m_pageRects.append(IntRect(0, i * pageHeight, pageWidth, pageHeight)); 113 } 118 114 } 119 115 -
trunk/WebCore/rendering/RenderBlock.cpp
r67673 r67771 2209 2209 info.updatePaintingRootForChildren(this); 2210 2210 2211 // FIXME: Paint-time pagination is obsolete and is now only used by embedded WebViews inside AppKit 2212 // NSViews. Do not add any more code for this. 2211 2213 RenderView* renderView = view(); 2212 2214 bool usePrintRect = !renderView->printRect().isEmpty(); 2213 2215 2214 bool checkPageBreaks = document()->paginated() && !document()->settings()->paginateDuringLayoutEnabled();2215 2216 2216 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { 2217 2217 // Check for page-break-before: always, and if it's set, break and bail. 2218 bool checkBeforeAlways = !childrenInline() && ( checkPageBreaks&& child->style()->pageBreakBefore() == PBALWAYS);2218 bool checkBeforeAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakBefore() == PBALWAYS); 2219 2219 if (checkBeforeAlways 2220 2220 && (ty + child->y()) > paintInfo.rect.y() … … 2239 2239 2240 2240 // Check for page-break-after: always, and if it's set, break and bail. 2241 bool checkAfterAlways = !childrenInline() && ( checkPageBreaks&& child->style()->pageBreakAfter() == PBALWAYS);2241 bool checkAfterAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakAfter() == PBALWAYS); 2242 2242 if (checkAfterAlways 2243 2243 && (ty + child->y() + child->height()) > paintInfo.rect.y() … … 5908 5908 // FIXME: Add page break checking here when we support printing. 5909 5909 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); 5910 bool checkBeforeAlways = checkColumnBreaks && child->style()->columnBreakBefore() == PBALWAYS; 5910 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageHeight; // FIXME: Once columns can print we have to check this. 5911 bool checkBeforeAlways = (checkColumnBreaks && child->style()->columnBreakBefore() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakBefore() == PBALWAYS); 5911 5912 if (checkBeforeAlways && inNormalFlow(child)) { 5912 5913 if (checkColumnBreaks) … … 5921 5922 // FIXME: Add page break checking here when we support printing. 5922 5923 bool checkColumnBreaks = view()->layoutState()->isPaginatingColumns(); 5923 bool checkAfterAlways = checkColumnBreaks && child->style()->columnBreakAfter() == PBALWAYS; 5924 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->m_pageHeight; // FIXME: Once columns can print we have to check this. 5925 bool checkAfterAlways = (checkColumnBreaks && child->style()->columnBreakAfter() == PBALWAYS) || (checkPageBreaks && child->style()->pageBreakAfter() == PBALWAYS); 5924 5926 if (checkAfterAlways && inNormalFlow(child)) { 5925 5927 marginInfo.setBottomQuirk(true); // Cause margins to be discarded for any following content. -
trunk/WebCore/rendering/RenderBox.cpp
r67660 r67771 1516 1516 // height since we don't set a height in RenderView when we're printing. So without this quirk, the 1517 1517 // height has nothing to be a percentage of, and it ends up being 0. That is bad. 1518 bool paginatedContentNeedsBaseHeight = document()->p aginated() && h.isPercent()1518 bool paginatedContentNeedsBaseHeight = document()->printing() && h.isPercent() 1519 1519 && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->height().isPercent())); 1520 1520 if (stretchesToViewHeight() || paginatedContentNeedsBaseHeight) { 1521 1521 int margins = collapsedMarginTop() + collapsedMarginBottom(); 1522 int visHeight = document()->printing() ? view()-> frameView()->pageHeight() : view()->viewHeight();1522 int visHeight = document()->printing() ? view()->pageHeight() : view()->viewHeight(); 1523 1523 if (isRoot()) 1524 1524 setHeight(max(height(), visHeight - margins)); -
trunk/WebCore/rendering/RenderImage.cpp
r67770 r67771 215 215 int topPad = paddingTop(); 216 216 217 if (document()->printing() && !view()->printImages())218 return;219 220 217 GraphicsContext* context = paintInfo.context; 221 218 -
trunk/WebCore/rendering/RenderLineBoxList.cpp
r67660 r67771 160 160 return; 161 161 162 // FIXME: Paint-time pagination is obsolete and is now only used by embedded WebViews inside AppKit 163 // NSViews. Do not add any more code for this. 162 164 RenderView* v = renderer->view(); 163 165 bool usePrintRect = !v->printRect().isEmpty(); -
trunk/WebCore/rendering/RenderVideo.cpp
r67770 r67771 189 189 bool displayingPoster = videoElement()->shouldDisplayPosterImage(); 190 190 191 if (displayingPoster && document()->printing() && !view()->printImages())192 return;193 194 191 if (!displayingPoster) { 195 192 if (!mediaPlayer) -
trunk/WebCore/rendering/RenderView.cpp
r67762 r67771 49 49 , m_selectionStartPos(-1) 50 50 , m_selectionEndPos(-1) 51 , m_printImages(true)52 51 , m_maximalOutlineSize(0) 53 , m_bestTruncatedAt(0) 54 , m_truncatorWidth(0) 55 , m_forcedPageBreak(false) 52 , m_pageHeight(0) 56 53 , m_layoutState(0) 57 54 , m_layoutStateDisableCount(0) … … 101 98 void RenderView::layout() 102 99 { 100 if (!document()->paginated()) 101 setPageHeight(0); 102 103 103 if (printing()) 104 104 m_minPrefWidth = m_maxPrefWidth = width(); … … 118 118 // FIXME: May be better to push a clip and avoid issuing offscreen repaints. 119 119 state.m_clipped = false; 120 state.m_pageHeight = m_pageHeight; 120 121 m_layoutState = &state; 121 122 … … 126 127 m_overflow.clear(); 127 128 addLayoutOverflow(IntRect(0, 0, docWidth(), docHeight())); 128 129 129 130 130 ASSERT(layoutDelta() == IntSize()); … … 155 155 // If we ever require layout but receive a paint anyway, something has gone horribly wrong. 156 156 ASSERT(!needsLayout()); 157 158 // Cache the print rect because the dirty rect could get changed during painting.159 if (document()->paginated())160 setPrintRect(paintInfo.rect);161 else162 setPrintRect(IntRect());163 157 paintObject(paintInfo, tx, ty); 164 158 } … … 669 663 } 670 664 671 // The idea here is to take into account what object is moving the pagination point, and672 // thus choose the best place to chop it.673 void RenderView::setBestTruncatedAt(int y, RenderBoxModelObject* forRenderer, bool forcedBreak)674 {675 // Nobody else can set a page break once we have a forced break.676 if (m_forcedPageBreak)677 return;678 679 // Forced breaks always win over unforced breaks.680 if (forcedBreak) {681 m_forcedPageBreak = true;682 m_bestTruncatedAt = y;683 return;684 }685 686 // Prefer the widest object that tries to move the pagination point687 IntRect boundingBox = forRenderer->borderBoundingBox();688 if (boundingBox.width() > m_truncatorWidth) {689 m_truncatorWidth = boundingBox.width();690 m_bestTruncatedAt = y;691 }692 }693 694 665 void RenderView::pushLayoutState(RenderObject* root) 695 666 { … … 725 696 } 726 697 698 // FIXME: This function is obsolete and only used by embedded WebViews inside AppKit NSViews. 699 // Do not add callers of this function! 700 // The idea here is to take into account what object is moving the pagination point, and 701 // thus choose the best place to chop it. 702 void RenderView::setBestTruncatedAt(int y, RenderBoxModelObject* forRenderer, bool forcedBreak) 703 { 704 // Nobody else can set a page break once we have a forced break. 705 if (m_legacyPrinting.m_forcedPageBreak) 706 return; 707 708 // Forced breaks always win over unforced breaks. 709 if (forcedBreak) { 710 m_legacyPrinting.m_forcedPageBreak = true; 711 m_legacyPrinting.m_bestTruncatedAt = y; 712 return; 713 } 714 715 // Prefer the widest object that tries to move the pagination point 716 IntRect boundingBox = forRenderer->borderBoundingBox(); 717 if (boundingBox.width() > m_legacyPrinting.m_truncatorWidth) { 718 m_legacyPrinting.m_truncatorWidth = boundingBox.width(); 719 m_legacyPrinting.m_bestTruncatedAt = y; 720 } 721 } 722 727 723 #if USE(ACCELERATED_COMPOSITING) 728 724 bool RenderView::usesCompositing() const -
trunk/WebCore/rendering/RenderView.h
r67660 r67771 78 78 79 79 bool printing() const; 80 void setPrintImages(bool enable) { m_printImages = enable; }81 bool printImages() const { return m_printImages; }82 83 IntRect printRect() const { return m_printRect; }84 void setPrintRect(const IntRect& r) { m_printRect = r; }85 86 void setTruncatedAt(int y) { m_truncatedAt = y; m_bestTruncatedAt = m_truncatorWidth = 0; m_forcedPageBreak = false; }87 void setBestTruncatedAt(int y, RenderBoxModelObject* forRenderer, bool forcedBreak = false);88 int bestTruncatedAt() const { return m_bestTruncatedAt; }89 90 int truncatedAt() const { return m_truncatedAt; }91 80 92 81 virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); … … 121 110 bool doingFullRepaint() const { return m_frameView->needsFullRepaint(); } 122 111 123 void pushLayoutState(RenderBox* renderer, const IntSize& offset, int pageHeight = 0, ColumnInfo* colInfo = 0) 124 { 125 // We push LayoutState even if layoutState is disabled because it stores layoutDelta too. 126 if (!doingFullRepaint() || renderer->hasColumns() || m_layoutState->isPaginated()) 127 m_layoutState = new (renderArena()) LayoutState(m_layoutState, renderer, offset, pageHeight, colInfo); 128 } 129 112 // Subtree push/pop 130 113 void pushLayoutState(RenderObject*); 131 132 void popLayoutState() 133 { 134 LayoutState* state = m_layoutState; 135 if (doingFullRepaint() && !m_layoutState->isPaginated()) 136 return; 137 m_layoutState = state->m_next; 138 state->destroy(renderArena()); 139 } 114 void popLayoutState(RenderObject*) { return popLayoutState(); } // Just doing this to keep popLayoutState() private and to make the subtree calls symmetrical. 140 115 141 116 bool shouldDisableLayoutStateForSubtree(RenderObject*) const; … … 154 129 virtual void updateHitTestResult(HitTestResult&, const IntPoint&); 155 130 131 unsigned pageHeight() const { return m_pageHeight; } 132 void setPageHeight(unsigned height) 133 { 134 if (m_pageHeight != height) { 135 m_pageHeight = height; 136 markDescendantBlocksAndLinesForLayout(); 137 } 138 } 139 140 // FIXME: These functions are deprecated. No code should be added that uses these. 141 int bestTruncatedAt() const { return m_legacyPrinting.m_bestTruncatedAt; } 142 void setBestTruncatedAt(int y, RenderBoxModelObject* forRenderer, bool forcedBreak = false); 143 int truncatedAt() const { return m_legacyPrinting.m_truncatedAt; } 144 void setTruncatedAt(int y) 145 { 146 m_legacyPrinting.m_truncatedAt = y; 147 m_legacyPrinting.m_bestTruncatedAt = 0; 148 m_legacyPrinting.m_truncatorWidth = 0; 149 m_legacyPrinting.m_forcedPageBreak = false; 150 } 151 const IntRect& printRect() const { return m_legacyPrinting.m_printRect; } 152 void setPrintRect(const IntRect& r) { m_legacyPrinting.m_printRect = r; } 153 // End deprecated functions. 154 156 155 // Notifications that this view became visible in a window, or will be 157 156 // removed from the window. … … 174 173 int docWidth() const; 175 174 175 // These functions may only be accessed by LayoutStateMaintainer. 176 bool pushLayoutState(RenderBox* renderer, const IntSize& offset, int pageHeight = 0, ColumnInfo* colInfo = 0) 177 { 178 // We push LayoutState even if layoutState is disabled because it stores layoutDelta too. 179 if (!doingFullRepaint() || renderer->hasColumns() || m_layoutState->isPaginated()) { 180 m_layoutState = new (renderArena()) LayoutState(m_layoutState, renderer, offset, pageHeight, colInfo); 181 return true; 182 } 183 return false; 184 } 185 186 void popLayoutState() 187 { 188 LayoutState* state = m_layoutState; 189 m_layoutState = state->m_next; 190 state->destroy(renderArena()); 191 } 192 193 friend class LayoutStateMaintainer; 194 176 195 protected: 177 196 FrameView* m_frameView; … … 182 201 int m_selectionEndPos; 183 202 184 // used to ignore viewport width when printing to the printer 185 bool m_printImages; 186 int m_truncatedAt; 203 // FIXME: Only used by embedded WebViews inside AppKit NSViews. Find a way to remove. 204 struct LegacyPrinting { 205 LegacyPrinting() 206 : m_bestTruncatedAt(0) 207 , m_truncatedAt(0) 208 , m_truncatorWidth(0) 209 , m_forcedPageBreak(false) 210 { } 211 212 int m_bestTruncatedAt; 213 int m_truncatedAt; 214 int m_truncatorWidth; 215 IntRect m_printRect; 216 bool m_forcedPageBreak; 217 }; 218 LegacyPrinting m_legacyPrinting; 219 // End deprecated members. 187 220 188 221 int m_maximalOutlineSize; // Used to apply a fudge factor to dirty-rect checks on blocks/tables. 189 IntRect m_printRect; // Used when printing.190 222 191 223 typedef HashSet<RenderWidget*> RenderWidgetSet; 192 193 224 RenderWidgetSet m_widgets; 194 225 195 226 private: 196 int m_bestTruncatedAt; 197 int m_truncatorWidth; 198 bool m_forcedPageBreak; 227 unsigned m_pageHeight; 199 228 LayoutState* m_layoutState; 200 229 unsigned m_layoutStateDisableCount; … … 229 258 , m_didStart(false) 230 259 , m_didEnd(false) 260 , m_didCreateLayoutState(false) 231 261 { 232 262 push(root, offset, pageHeight, colInfo); … … 239 269 , m_didStart(false) 240 270 , m_didEnd(false) 271 , m_didCreateLayoutState(false) 241 272 { 242 273 } … … 251 282 ASSERT(!m_didStart); 252 283 // We push state even if disabled, because we still need to store layoutDelta 253 m_ view->pushLayoutState(root, offset, pageHeight, colInfo);254 if (m_disabled )284 m_didCreateLayoutState = m_view->pushLayoutState(root, offset, pageHeight, colInfo); 285 if (m_disabled && m_didCreateLayoutState) 255 286 m_view->disableLayoutState(); 256 287 m_didStart = true; … … 261 292 if (m_didStart) { 262 293 ASSERT(!m_didEnd); 263 m_view->popLayoutState(); 264 if (m_disabled) 265 m_view->enableLayoutState(); 294 if (m_didCreateLayoutState) { 295 m_view->popLayoutState(); 296 if (m_disabled) 297 m_view->enableLayoutState(); 298 } 299 266 300 m_didEnd = true; 267 301 } … … 275 309 bool m_didStart : 1; // true if we did a push or disable 276 310 bool m_didEnd : 1; // true if we popped or re-enabled 311 bool m_didCreateLayoutState : 1; // true if we actually made a layout state. 277 312 }; 278 313 -
trunk/WebKit/mac/ChangeLog
r67762 r67771 1 2010-09-17 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 https://bugs.webkit.org/show_bug.cgi?id=45993, convert printing to the new pagination model. 6 7 Make printing store the page height in the RenderView and push that into the layout state to 8 use the new pagination model. The old pagination model is retained because it is still used 9 for embedded WebViews. 10 11 * WebView/WebHTMLView.mm: 12 (-[WebHTMLView _adjustedBottomOfPageWithTop:bottom:limit:]): 13 1 14 2010-09-17 Darin Adler <darin@apple.com> 2 15 -
trunk/WebKit/mac/WebView/WebHTMLView.mm
r67691 r67771 2303 2303 2304 2304 float newBottom; 2305 view->adjustPageHeight (&newBottom, top, bottom, bottomLimit);2305 view->adjustPageHeightDeprecated(&newBottom, top, bottom, bottomLimit); 2306 2306 2307 2307 #ifdef __LP64__
Note: See TracChangeset
for help on using the changeset viewer.