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

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: 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
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 2847 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 forceLayout(); 2858 forceLayout();
2859 2859
2860 // If we don't fit in the given page width, we'll lay out again. If we d on't fit in the 2860 // If we don't fit in the given page width, we'll lay out again. If we d on't fit in the
2861 // page width when shrunk, we will lay out at maximum shrink and clip ex tra content. 2861 // page width when shrunk, we will lay out at maximum shrink and clip ex tra content.
2862 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr opping 2862 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr opping
2863 // implementation should not do this! 2863 // implementation should not do this!
2864 bool horizontalWritingMode = renderView->style()->isHorizontalWritingMod e(); 2864 bool horizontalWritingMode = renderView->style()->isHorizontalWritingMod e();
2865 const LayoutRect& documentRect = renderView->documentRect(); 2865 const LayoutRect& documentRect = renderView->documentRect();
2866 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width( ) : documentRect.height(); 2866 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width( ) : documentRect.height();
2867 if (docLogicalWidth > pageLogicalWidth) { 2867 if (docLogicalWidth > pageLogicalWidth) {
2868 int expectedPageWidth = std::min<float>(documentRect.width(), pageSi ze.width() * maximumShrinkFactor); 2868 int expectedPageWidth = std::min<float>(documentRect.width().toFloat (), pageSize.width() * maximumShrinkFactor);
leviw_travelin_and_unemployed 2014/03/14 18:25:26 It seems wrong not to call .toInt() on the LayoutU
gnana 2014/03/18 14:20:18 Made it float, because resizePageRectsKeepingRatio
2869 int expectedPageHeight = std::min<float>(documentRect.height(), page Size.height() * maximumShrinkFactor); 2869 int expectedPageHeight = std::min<float>(documentRect.height().toFlo at(), pageSize.height() * maximumShrinkFactor);
2870 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi ze(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageW idth, expectedPageHeight)); 2870 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi ze(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageW idth, expectedPageHeight));
2871 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max PageSize.height(); 2871 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max PageSize.height();
2872 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m axPageSize.width(); 2872 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m axPageSize.width();
2873 2873
2874 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth); 2874 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
2875 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight ); 2875 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight );
2876 renderView->setLogicalWidth(flooredPageLogicalWidth); 2876 renderView->setLogicalWidth(flooredPageLogicalWidth);
2877 renderView->setPageLogicalHeight(flooredPageLogicalHeight); 2877 renderView->setPageLogicalHeight(flooredPageLogicalHeight);
2878 renderView->setNeedsLayoutAndPrefWidthsRecalc(); 2878 renderView->setNeedsLayoutAndPrefWidthsRecalc();
2879 forceLayout(); 2879 forceLayout();
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3203 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3204 { 3204 {
3205 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3205 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3206 if (AXObjectCache* cache = axObjectCache()) { 3206 if (AXObjectCache* cache = axObjectCache()) {
3207 cache->remove(scrollbar); 3207 cache->remove(scrollbar);
3208 cache->handleScrollbarUpdate(this); 3208 cache->handleScrollbarUpdate(this);
3209 } 3209 }
3210 } 3210 }
3211 3211
3212 } // namespace WebCore 3212 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698