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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 705423002: Use expected main frame size from WebViewImpl when creating a new FrameView. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing build break from bad rebase Created 6 years, 1 month 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 | « Source/web/WebViewImpl.h ('k') | Source/web/tests/PinchViewportTest.cpp » ('j') | 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 3192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 if (ignore) { 3203 if (ignore) {
3204 constraints.minimumScale = m_pageScaleConstraintsSet.defaultConstraints( ).minimumScale; 3204 constraints.minimumScale = m_pageScaleConstraintsSet.defaultConstraints( ).minimumScale;
3205 constraints.maximumScale = m_pageScaleConstraintsSet.defaultConstraints( ).maximumScale; 3205 constraints.maximumScale = m_pageScaleConstraintsSet.defaultConstraints( ).maximumScale;
3206 } else { 3206 } else {
3207 constraints.minimumScale = -1; 3207 constraints.minimumScale = -1;
3208 constraints.maximumScale = -1; 3208 constraints.maximumScale = -1;
3209 } 3209 }
3210 setUserAgentPageScaleConstraints(constraints); 3210 setUserAgentPageScaleConstraints(constraints);
3211 } 3211 }
3212 3212
3213 IntSize WebViewImpl::mainFrameSize()
3214 {
3215 if (!pinchVirtualViewportEnabled() || !localFrameRootTemporary())
3216 return m_size;
3217
3218 FrameView* view = localFrameRootTemporary()->frameView();
3219
3220 if (!view)
3221 return m_size;
3222
3223 int contentAndScrollbarWidth = contentsSize().width();
3224
3225 if (view && view->verticalScrollbar() && !view->verticalScrollbar()->isOverl ayScrollbar())
3226 contentAndScrollbarWidth += view->verticalScrollbar()->width();
3227
3228 return m_pageScaleConstraintsSet.mainFrameSize(contentAndScrollbarWidth);
3229 }
3230
3213 void WebViewImpl::refreshPageScaleFactorAfterLayout() 3231 void WebViewImpl::refreshPageScaleFactorAfterLayout()
3214 { 3232 {
3215 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()- >isLocalFrame() || !page()->deprecatedLocalMainFrame()->view()) 3233 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()- >isLocalFrame() || !page()->deprecatedLocalMainFrame()->view())
3216 return; 3234 return;
3217 FrameView* view = page()->deprecatedLocalMainFrame()->view(); 3235 FrameView* view = page()->deprecatedLocalMainFrame()->view();
3218 3236
3219 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v iewportDescription()); 3237 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v iewportDescription());
3220 m_pageScaleConstraintsSet.computeFinalConstraints(); 3238 m_pageScaleConstraintsSet.computeFinalConstraints();
3221 3239
3222 if (settings()->shrinksViewportContentToFit()) { 3240 if (settings()->shrinksViewportContentToFit()) {
3223 int verticalScrollbarWidth = 0; 3241 int verticalScrollbarWidth = 0;
3224 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar()) 3242 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar())
3225 verticalScrollbarWidth = view->verticalScrollbar()->width(); 3243 verticalScrollbarWidth = view->verticalScrollbar()->width();
3226 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(contentsS ize(), verticalScrollbarWidth); 3244 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(contentsS ize(), verticalScrollbarWidth);
3227 } 3245 }
3228 3246
3229 if (pinchVirtualViewportEnabled()) { 3247 if (pinchVirtualViewportEnabled())
3230 int contentAndScrollbarWidth = contentsSize().width(); 3248 view->resize(mainFrameSize());
3231 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar())
3232 contentAndScrollbarWidth += view->verticalScrollbar()->width();
3233
3234 view->resize(m_pageScaleConstraintsSet.mainFrameSize(contentAndScrollbar Width));
3235 }
3236 3249
3237 float newPageScaleFactor = pageScaleFactor(); 3250 float newPageScaleFactor = pageScaleFactor();
3238 if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.fina lConstraints().initialScale != -1) { 3251 if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.fina lConstraints().initialScale != -1) {
3239 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().initia lScale; 3252 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().initia lScale;
3240 m_pageScaleConstraintsSet.setNeedsReset(false); 3253 m_pageScaleConstraintsSet.setNeedsReset(false);
3241 } 3254 }
3242 setPageScaleFactor(newPageScaleFactor); 3255 setPageScaleFactor(newPageScaleFactor);
3243 3256
3244 updateLayerTreeViewport(); 3257 updateLayerTreeViewport();
3245 3258
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
4500 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4513 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4501 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4514 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4502 } 4515 }
4503 4516
4504 void WebViewImpl::forceNextWebGLContextCreationToFail() 4517 void WebViewImpl::forceNextWebGLContextCreationToFail()
4505 { 4518 {
4506 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4519 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4507 } 4520 }
4508 4521
4509 } // namespace blink 4522 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/PinchViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698