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

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: incorporated review comments 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 FloatSize expectedPageSize(std::min<float>(documentRect.width().toFl oat(), pageSize.width() * maximumShrinkFactor), std::min<float>(documentRect.hei ght().toFloat(), pageSize.height() * maximumShrinkFactor));
2869 int expectedPageHeight = std::min<float>(documentRect.height(), page Size.height() * maximumShrinkFactor); 2869 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi ze(originalPageSize.width(), originalPageSize.height()), expectedPageSize);
leviw_travelin_and_unemployed 2014/03/18 19:26:30 This is actually a change in behavior (we'd floor
2870 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi ze(originalPageSize.width(), originalPageSize.height()), FloatSize(expectedPageW idth, expectedPageHeight));
2871 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max PageSize.height(); 2870 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max PageSize.height();
2872 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m axPageSize.width(); 2871 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m axPageSize.width();
2873 2872
2874 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth); 2873 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth);
2875 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight ); 2874 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight );
2876 renderView->setLogicalWidth(flooredPageLogicalWidth); 2875 renderView->setLogicalWidth(flooredPageLogicalWidth);
2877 renderView->setPageLogicalHeight(flooredPageLogicalHeight); 2876 renderView->setPageLogicalHeight(flooredPageLogicalHeight);
2878 renderView->setNeedsLayoutAndPrefWidthsRecalc(); 2877 renderView->setNeedsLayoutAndPrefWidthsRecalc();
2879 forceLayout(); 2878 forceLayout();
2880 2879
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3202 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3204 { 3203 {
3205 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3204 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3206 if (AXObjectCache* cache = axObjectCache()) { 3205 if (AXObjectCache* cache = axObjectCache()) {
3207 cache->remove(scrollbar); 3206 cache->remove(scrollbar);
3208 cache->handleScrollbarUpdate(this); 3207 cache->handleScrollbarUpdate(this);
3209 } 3208 }
3210 } 3209 }
3211 3210
3212 } // namespace WebCore 3211 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698