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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 2854143003: Fix incorrectly rounded page size (Closed)
Patch Set: fix tests Created 3 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 | « third_party/WebKit/Source/core/page/PrintContext.cpp ('k') | no next file » | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 DCHECK(web_view_helper_.WebView()); 2004 DCHECK(web_view_helper_.WebView());
2005 Element* element = static_cast<Element*>( 2005 Element* element = static_cast<Element*>(
2006 web_view_helper_.WebView()->MainFrame()->GetDocument().GetElementById( 2006 web_view_helper_.WebView()->MainFrame()->GetDocument().GetElementById(
2007 id)); 2007 id));
2008 return TapElement(type, element); 2008 return TapElement(type, element);
2009 } 2009 }
2010 2010
2011 IntSize WebViewTest::PrintICBSizeFromPageSize(const FloatSize& page_size) { 2011 IntSize WebViewTest::PrintICBSizeFromPageSize(const FloatSize& page_size) {
2012 // This needs to match |kPrintingMinimumShrinkFactor| in PrintContext.cpp. The 2012 // This needs to match |kPrintingMinimumShrinkFactor| in PrintContext.cpp. The
2013 // layout is scaled by this factor for printing. 2013 // layout is scaled by this factor for printing.
2014 constexpr float kMinimumShrinkFactor = 1.333f; 2014 constexpr float kMinimumShrinkFactor = 1.33333333f;
2015 2015
2016 // The expected layout size comes from the calculation done in 2016 // The expected layout size comes from the calculation done in
2017 // ResizePageRectsKeepingRatio() which is used from PrintContext::begin() to 2017 // ResizePageRectsKeepingRatio() which is used from PrintContext::begin() to
2018 // scale the page size. 2018 // scale the page size.
2019 const float ratio = page_size.Height() / (float)page_size.Width(); 2019 const float ratio = page_size.Height() / (float)page_size.Width();
2020 const int icb_width = floor(page_size.Width() * kMinimumShrinkFactor); 2020 const int icb_width = floor(page_size.Width() * kMinimumShrinkFactor);
2021 const int icb_height = floor(icb_width * ratio); 2021 const int icb_height = floor(icb_width * ratio);
2022 return IntSize(icb_width, icb_height); 2022 return IntSize(icb_width, icb_height);
2023 } 2023 }
2024 2024
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after
4344 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars()); 4344 EXPECT_FALSE(frame_view->VisualViewportSuppliesScrollbars());
4345 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 4345 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
4346 EXPECT_NE(nullptr, 4346 EXPECT_NE(nullptr,
4347 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar()); 4347 frame_view->LayoutViewportScrollableArea()->VerticalScrollbar());
4348 } else { 4348 } else {
4349 EXPECT_NE(nullptr, frame_view->VerticalScrollbar()); 4349 EXPECT_NE(nullptr, frame_view->VerticalScrollbar());
4350 } 4350 }
4351 } 4351 }
4352 4352
4353 } // namespace blink 4353 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/PrintContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698