OLD | NEW |
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 Loading... |
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() const | |
3214 { | |
3215 if (!pinchVirtualViewportEnabled()) | |
3216 return m_size; | |
3217 | |
3218 FrameView* view = page()->deprecatedLocalMainFrame()->view(); | |
3219 | |
3220 int contentAndScrollbarWidth = contentsSize().width(); | |
3221 | |
3222 if (view && view->verticalScrollbar() && !view->verticalScrollbar()->isOverl
ayScrollbar()) | |
3223 contentAndScrollbarWidth += view->verticalScrollbar()->width(); | |
3224 | |
3225 return m_pageScaleConstraintsSet.mainFrameSize(contentAndScrollbarWidth); | |
3226 } | |
3227 | |
3228 void WebViewImpl::refreshPageScaleFactorAfterLayout() | 3213 void WebViewImpl::refreshPageScaleFactorAfterLayout() |
3229 { | 3214 { |
3230 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()-
>isLocalFrame() || !page()->deprecatedLocalMainFrame()->view()) | 3215 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()-
>isLocalFrame() || !page()->deprecatedLocalMainFrame()->view()) |
3231 return; | 3216 return; |
3232 FrameView* view = page()->deprecatedLocalMainFrame()->view(); | 3217 FrameView* view = page()->deprecatedLocalMainFrame()->view(); |
3233 | 3218 |
3234 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v
iewportDescription()); | 3219 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v
iewportDescription()); |
3235 m_pageScaleConstraintsSet.computeFinalConstraints(); | 3220 m_pageScaleConstraintsSet.computeFinalConstraints(); |
3236 | 3221 |
3237 if (settings()->shrinksViewportContentToFit()) { | 3222 if (settings()->shrinksViewportContentToFit()) { |
3238 int verticalScrollbarWidth = 0; | 3223 int verticalScrollbarWidth = 0; |
3239 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc
rollbar()) | 3224 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc
rollbar()) |
3240 verticalScrollbarWidth = view->verticalScrollbar()->width(); | 3225 verticalScrollbarWidth = view->verticalScrollbar()->width(); |
3241 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(contentsS
ize(), verticalScrollbarWidth); | 3226 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(contentsS
ize(), verticalScrollbarWidth); |
3242 } | 3227 } |
3243 | 3228 |
3244 if (pinchVirtualViewportEnabled()) | 3229 if (pinchVirtualViewportEnabled()) { |
3245 view->resize(mainFrameSize()); | 3230 int contentAndScrollbarWidth = contentsSize().width(); |
| 3231 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc
rollbar()) |
| 3232 contentAndScrollbarWidth += view->verticalScrollbar()->width(); |
| 3233 |
| 3234 view->resize(m_pageScaleConstraintsSet.mainFrameSize(contentAndScrollbar
Width)); |
| 3235 } |
3246 | 3236 |
3247 float newPageScaleFactor = pageScaleFactor(); | 3237 float newPageScaleFactor = pageScaleFactor(); |
3248 if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.fina
lConstraints().initialScale != -1) { | 3238 if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.fina
lConstraints().initialScale != -1) { |
3249 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().initia
lScale; | 3239 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().initia
lScale; |
3250 m_pageScaleConstraintsSet.setNeedsReset(false); | 3240 m_pageScaleConstraintsSet.setNeedsReset(false); |
3251 } | 3241 } |
3252 setPageScaleFactor(newPageScaleFactor); | 3242 setPageScaleFactor(newPageScaleFactor); |
3253 | 3243 |
3254 updateLayerTreeViewport(); | 3244 updateLayerTreeViewport(); |
3255 | 3245 |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4505 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4495 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4506 | 4496 |
4507 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4497 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4508 return false; | 4498 return false; |
4509 | 4499 |
4510 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4500 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4511 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4501 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4512 } | 4502 } |
4513 | 4503 |
4514 } // namespace blink | 4504 } // namespace blink |
OLD | NEW |