not a damage rect that can be changed when intersected with the clip regions of the web page.
Reviewed by john
* khtml/rendering/render_canvas.h:
(khtml::RenderCanvas::printRect):
(khtml::RenderCanvas::setPrintRect):
* khtml/rendering/render_flow.cpp:
(RenderFlow::paintLines):
* khtml/rendering/render_list.cpp:
(RenderListMarker::paint):
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::adjustPageHeight):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8140
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2004-12-06 David Hyatt <hyatt@apple.com>
+
+ Fix for 3787133, some web pages print with many blank pages. Make sure to use the real page print rect and
+ not a damage rect that can be changed when intersected with the clip regions of the web page.
+
+ Reviewed by john
+
+ * khtml/rendering/render_canvas.h:
+ (khtml::RenderCanvas::printRect):
+ (khtml::RenderCanvas::setPrintRect):
+ * khtml/rendering/render_flow.cpp:
+ (RenderFlow::paintLines):
+ * khtml/rendering/render_list.cpp:
+ (RenderListMarker::paint):
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::adjustPageHeight):
+
2004-12-06 David Harrison <harrison@apple.com>
Reviewed by Ken Kocienda and Dave Hyatt (OOPS!).
virtual void selectionStartEnd(int& spos, int& epos);
+ QRect printRect() const { return m_printRect; }
+ void setPrintRect(const QRect& r) { m_printRect = r; }
+
protected:
KHTMLView *m_view;
int m_truncatedAt;
int m_maximalOutlineSize; // Used to apply a fudge factor to dirty-rect checks on blocks/tables.
+ QRect m_printRect; // Used when printing.
};
};
// FIXME: This is a feeble effort to avoid splitting a line across two pages.
// It is utterly inadequate, and this should not be done at paint time at all.
// The whole way objects break across pages needs to be redone.
- if (_ty + curr->root()->bottomOverflow() > i.r.y() + i.r.height()) {
- RenderCanvas* canvasObj = canvas();
- if (_ty + curr->root()->topOverflow() < canvasObj->truncatedAt())
- canvasObj->setBestTruncatedAt(_ty + curr->root()->topOverflow(), this);
+ RenderCanvas* c = canvas();
+ if (_ty + curr->root()->bottomOverflow() > c->printRect().y() + c->printRect().height()) {
+ if (_ty + curr->root()->topOverflow() < c->truncatedAt())
+ c->setBestTruncatedAt(_ty + curr->root()->topOverflow(), this);
// Let's stop here.
break;
}
}
bool isPrinting = (p->device()->devType() == QInternal::Printer);
- if (isPrinting)
- {
+ if (isPrinting) {
if (_ty < i.r.y())
- {
// This has been printed already we suppose.
return;
- }
- if (_ty + m_height + paddingBottom() + borderBottom() >= i.r.y() + i.r.height())
- {
- RenderCanvas *rootObj = canvas();
- if (_ty < rootObj->truncatedAt())
-#if APPLE_CHANGES
- rootObj->setBestTruncatedAt(_ty, this);
-#else
- rootObj->setTruncatedAt(_ty);
-#endif
+
+ RenderCanvas* c = canvas();
+ if (_ty + m_height + paddingBottom() + borderBottom() >= c->printRect().y() + c->printRect().height()) {
+ if (_ty < c->truncatedAt())
+ c->setBestTruncatedAt(_ty, this);
// Let's print this on the next page.
return;
}
root->setTruncatedAt((int)floor(oldBottom));
QRect dirtyRect(0, (int)floor(oldTop),
root->docWidth(), (int)ceil(oldBottom-oldTop));
+ root->setPrintRect(dirtyRect);
root->layer()->paint(&painter, dirtyRect);
*newBottom = root->bestTruncatedAt();
if (*newBottom == 0) {