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

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 200023002: Making LayoutUnit conversions to Float type explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase to trunk Created 6 years, 9 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 | « Source/core/dom/Document.cpp ('k') | Source/core/html/ImageDocument.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) 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 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after
2872 forceLayout(); 2872 forceLayout();
2873 2873
2874 // If we don't fit in the given page width, we'll lay out again. If we d on't fit in the 2874 // If we don't fit in the given page width, we'll lay out again. If we d on't fit in the
2875 // page width when shrunk, we will lay out at maximum shrink and clip ex tra content. 2875 // page width when shrunk, we will lay out at maximum shrink and clip ex tra content.
2876 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr opping 2876 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr opping
2877 // implementation should not do this! 2877 // implementation should not do this!
2878 bool horizontalWritingMode = renderView->style()->isHorizontalWritingMod e(); 2878 bool horizontalWritingMode = renderView->style()->isHorizontalWritingMod e();
2879 const LayoutRect& documentRect = renderView->documentRect(); 2879 const LayoutRect& documentRect = renderView->documentRect();
2880 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width( ) : documentRect.height(); 2880 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width( ) : documentRect.height();
2881 if (docLogicalWidth > pageLogicalWidth) { 2881 if (docLogicalWidth > pageLogicalWidth) {
2882 int expectedPageWidth = std::min<float>(documentRect.width(), pageSi ze.width() * maximumShrinkFactor); 2882 FloatSize expectedPageSize(std::min<float>(documentRect.width().toFl oat(), pageSize.width() * maximumShrinkFactor), std::min<float>(documentRect.hei ght().toFloat(), pageSize.height() * maximumShrinkFactor));
2883 int expectedPageHeight = std::min<float>(documentRect.height(), page Size.height() * maximumShrinkFactor); 2883 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi ze(originalPageSize.width(), originalPageSize.height()), expectedPageSize);
2884 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi ze(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageW idth, expectedPageHeight));
2885 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max PageSize.height(); 2884 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max PageSize.height();
2886 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m axPageSize.width(); 2885 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m axPageSize.width();
2887 2886
2888 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth); 2887 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
2889 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight ); 2888 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight );
2890 renderView->setLogicalWidth(flooredPageLogicalWidth); 2889 renderView->setLogicalWidth(flooredPageLogicalWidth);
2891 renderView->setPageLogicalHeight(flooredPageLogicalHeight); 2890 renderView->setPageLogicalHeight(flooredPageLogicalHeight);
2892 renderView->setNeedsLayoutAndPrefWidthsRecalc(); 2891 renderView->setNeedsLayoutAndPrefWidthsRecalc();
2893 forceLayout(); 2892 forceLayout();
2894 2893
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3217 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3216 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3218 { 3217 {
3219 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3218 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3220 if (AXObjectCache* cache = axObjectCache()) { 3219 if (AXObjectCache* cache = axObjectCache()) {
3221 cache->remove(scrollbar); 3220 cache->remove(scrollbar);
3222 cache->handleScrollbarUpdate(this); 3221 cache->handleScrollbarUpdate(this);
3223 } 3222 }
3224 } 3223 }
3225 3224
3226 } // namespace WebCore 3225 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/html/ImageDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698