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

Side by Side Diff: Source/WebCore/page/Frame.cpp

Issue 10427008: Merge 118039 - Source/WebCore: Fix iframe printing. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 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
« no previous file with comments | « no previous file | Source/WebCore/rendering/RenderView.h » ('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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSiz e& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustV iewSize) 515 void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSiz e& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustV iewSize)
516 { 516 {
517 // In setting printing, we should not validate resources already cached for the document. 517 // In setting printing, we should not validate resources already cached for the document.
518 // See https://bugs.webkit.org/show_bug.cgi?id=43704 518 // See https://bugs.webkit.org/show_bug.cgi?id=43704
519 ResourceCacheValidationSuppressor validationSuppressor(m_doc->cachedResource Loader()); 519 ResourceCacheValidationSuppressor validationSuppressor(m_doc->cachedResource Loader());
520 520
521 m_doc->setPrinting(printing); 521 m_doc->setPrinting(printing);
522 view()->adjustMediaTypeForPrinting(printing); 522 view()->adjustMediaTypeForPrinting(printing);
523 523
524 m_doc->styleResolverChanged(RecalcStyleImmediately); 524 m_doc->styleResolverChanged(RecalcStyleImmediately);
525 if (printing) 525 if (printing && !tree()->parent()) {
526 // Only root frame should be fit to page size. Subframes should be const rained by parents only.
526 view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShri nkRatio, shouldAdjustViewSize); 527 view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShri nkRatio, shouldAdjustViewSize);
527 else { 528 } else {
528 view()->forceLayout(); 529 view()->forceLayout();
529 if (shouldAdjustViewSize == AdjustViewSize) 530 if (shouldAdjustViewSize == AdjustViewSize)
530 view()->adjustViewSize(); 531 view()->adjustViewSize();
531 } 532 }
532 533
533 // Subframes of the one we're printing don't lay out to the page size. 534 // Subframes of the one we're printing don't lay out to the page size.
534 for (Frame* child = tree()->firstChild(); child; child = child->tree()->next Sibling()) 535 for (Frame* child = tree()->firstChild(); child; child = child->tree()->next Sibling())
535 child->setPrinting(printing, FloatSize(), FloatSize(), 0, shouldAdjustVi ewSize); 536 child->setPrinting(printing, FloatSize(), FloatSize(), 0, shouldAdjustVi ewSize);
536 } 537 }
537 538
538 FloatSize Frame::resizePageRectsKeepingRatio(const FloatSize& originalSize, cons t FloatSize& expectedSize) 539 FloatSize Frame::resizePageRectsKeepingRatio(const FloatSize& originalSize, cons t FloatSize& expectedSize)
539 { 540 {
540 FloatSize resultSize; 541 FloatSize resultSize;
541 if (!contentRenderer()) 542 if (!contentRenderer())
542 return FloatSize(); 543 return FloatSize();
543 544
544 if (contentRenderer()->style()->isHorizontalWritingMode()) { 545 if (contentRenderer()->style()->isHorizontalWritingMode()) {
546 ASSERT(fabs(originalSize.width()) > numeric_limits<float>::epsilon());
545 float ratio = originalSize.height() / originalSize.width(); 547 float ratio = originalSize.height() / originalSize.width();
546 resultSize.setWidth(floorf(expectedSize.width())); 548 resultSize.setWidth(floorf(expectedSize.width()));
547 resultSize.setHeight(floorf(resultSize.width() * ratio)); 549 resultSize.setHeight(floorf(resultSize.width() * ratio));
548 } else { 550 } else {
551 ASSERT(fabs(originalSize.height()) > numeric_limits<float>::epsilon());
549 float ratio = originalSize.width() / originalSize.height(); 552 float ratio = originalSize.width() / originalSize.height();
550 resultSize.setHeight(floorf(expectedSize.height())); 553 resultSize.setHeight(floorf(expectedSize.height()));
551 resultSize.setWidth(floorf(resultSize.height() * ratio)); 554 resultSize.setWidth(floorf(resultSize.height() * ratio));
552 } 555 }
553 return resultSize; 556 return resultSize;
554 } 557 }
555 558
556 void Frame::injectUserScripts(UserScriptInjectionTime injectionTime) 559 void Frame::injectUserScripts(UserScriptInjectionTime injectionTime)
557 { 560 {
558 if (!m_page) 561 if (!m_page)
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 1116
1114 m_view->paintContents(buffer->context(), paintingRect); 1117 m_view->paintContents(buffer->context(), paintingRect);
1115 1118
1116 RefPtr<Image> image = buffer->copyImage(); 1119 RefPtr<Image> image = buffer->copyImage();
1117 return createDragImageFromImage(image.get()); 1120 return createDragImageFromImage(image.get());
1118 } 1121 }
1119 1122
1120 #endif 1123 #endif
1121 1124
1122 } // namespace WebCore 1125 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/rendering/RenderView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698