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

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: Rebased correctly 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 3029 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 if (!contentsSize().width() || !m_size.width) 3040 if (!contentsSize().width() || !m_size.width)
3041 return; 3041 return;
3042 3042
3043 // When viewport tag is enabled, the scale needed to see the full 3043 // When viewport tag is enabled, the scale needed to see the full
3044 // content width is the default minimum. 3044 // content width is the default minimum.
3045 int viewWidthNotIncludingScrollbars = m_size.width; 3045 int viewWidthNotIncludingScrollbars = m_size.width;
3046 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar()) 3046 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar())
3047 viewWidthNotIncludingScrollbars -= view->verticalScrollbar()->width( ); 3047 viewWidthNotIncludingScrollbars -= view->verticalScrollbar()->width( );
3048 m_minimumPageScaleFactor = max(m_minimumPageScaleFactor, static_cast<flo at>(viewWidthNotIncludingScrollbars) / contentsSize().width()); 3048 m_minimumPageScaleFactor = max(m_minimumPageScaleFactor, static_cast<flo at>(viewWidthNotIncludingScrollbars) / contentsSize().width());
3049 m_maximumPageScaleFactor = max(m_minimumPageScaleFactor, m_maximumPageSc aleFactor); 3049 m_maximumPageScaleFactor = max(m_minimumPageScaleFactor, m_maximumPageSc aleFactor);
3050 if (m_initialPageScaleFactorOverride != -1) {
3051 m_minimumPageScaleFactor = min(m_minimumPageScaleFactor, m_initialPa geScaleFactorOverride);
3052 m_maximumPageScaleFactor = max(m_maximumPageScaleFactor, m_initialPa geScaleFactorOverride);
3053 }
3050 } 3054 }
3051 ASSERT(m_minimumPageScaleFactor <= m_maximumPageScaleFactor); 3055 ASSERT(m_minimumPageScaleFactor <= m_maximumPageScaleFactor);
3052 3056
3053 // Initialize and/or clamp the page scale factor if needed. 3057 // Initialize and/or clamp the page scale factor if needed.
3054 float initialPageScaleFactor = m_initialPageScaleFactor; 3058 float initialPageScaleFactor = m_initialPageScaleFactor;
3055 if (!settings()->viewportEnabled()) 3059 if (!settings()->viewportEnabled())
3056 initialPageScaleFactor = 1; 3060 initialPageScaleFactor = 1;
3057 if (m_initialPageScaleFactorOverride != -1) 3061 if (m_initialPageScaleFactorOverride != -1)
3058 initialPageScaleFactor = m_initialPageScaleFactorOverride; 3062 initialPageScaleFactor = m_initialPageScaleFactorOverride;
3059 float newPageScaleFactor = pageScaleFactor(); 3063 float newPageScaleFactor = pageScaleFactor();
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
4191 } 4195 }
4192 4196
4193 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4197 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4194 { 4198 {
4195 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4199 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4196 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4200 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4197 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4201 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4198 } 4202 }
4199 4203
4200 } // namespace WebKit 4204 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698