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

Side by Side Diff: Source/WebKit/chromium/src/WebViewImpl.cpp

Issue 13880019: [Android WebView] Update viewport size and scale calculation to match WebView Classic (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed Adam's comments Created 7 years, 8 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 | Annotate | Revision Log
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 3025 matching lines...) Expand 10 before | Expand all | Expand 10 after
3036 if (!contentsSize().width() || !m_size.width) 3036 if (!contentsSize().width() || !m_size.width)
3037 return; 3037 return;
3038 3038
3039 // When viewport tag is enabled, the scale needed to see the full 3039 // When viewport tag is enabled, the scale needed to see the full
3040 // content width is the default minimum. 3040 // content width is the default minimum.
3041 int viewWidthNotIncludingScrollbars = m_size.width; 3041 int viewWidthNotIncludingScrollbars = m_size.width;
3042 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar()) 3042 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar())
3043 viewWidthNotIncludingScrollbars -= view->verticalScrollbar()->width( ); 3043 viewWidthNotIncludingScrollbars -= view->verticalScrollbar()->width( );
3044 m_minimumPageScaleFactor = max(m_minimumPageScaleFactor, static_cast<flo at>(viewWidthNotIncludingScrollbars) / contentsSize().width()); 3044 m_minimumPageScaleFactor = max(m_minimumPageScaleFactor, static_cast<flo at>(viewWidthNotIncludingScrollbars) / contentsSize().width());
3045 m_maximumPageScaleFactor = max(m_minimumPageScaleFactor, m_maximumPageSc aleFactor); 3045 m_maximumPageScaleFactor = max(m_minimumPageScaleFactor, m_maximumPageSc aleFactor);
3046 if (m_initialPageScaleFactorOverride != -1) {
3047 m_minimumPageScaleFactor = min(m_minimumPageScaleFactor, m_initialPa geScaleFactorOverride);
3048 m_maximumPageScaleFactor = max(m_maximumPageScaleFactor, m_initialPa geScaleFactorOverride);
3049 }
3046 } 3050 }
3047 ASSERT(m_minimumPageScaleFactor <= m_maximumPageScaleFactor); 3051 ASSERT(m_minimumPageScaleFactor <= m_maximumPageScaleFactor);
3048 3052
3049 // Initialize and/or clamp the page scale factor if needed. 3053 // Initialize and/or clamp the page scale factor if needed.
3050 float initialPageScaleFactor = m_initialPageScaleFactor; 3054 float initialPageScaleFactor = m_initialPageScaleFactor;
3051 if (!settings()->viewportEnabled()) 3055 if (!settings()->viewportEnabled())
3052 initialPageScaleFactor = 1; 3056 initialPageScaleFactor = 1;
3053 if (m_initialPageScaleFactorOverride != -1) 3057 if (m_initialPageScaleFactorOverride != -1)
3054 initialPageScaleFactor = m_initialPageScaleFactorOverride; 3058 initialPageScaleFactor = m_initialPageScaleFactorOverride;
3055 float newPageScaleFactor = pageScaleFactor(); 3059 float newPageScaleFactor = pageScaleFactor();
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
4192 } 4196 }
4193 4197
4194 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4198 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4195 { 4199 {
4196 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4200 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4197 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4201 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4198 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4202 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4199 } 4203 }
4200 4204
4201 } // namespace WebKit 4205 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebSettingsImpl.cpp ('k') | Source/WebKit/chromium/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698