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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 , m_spellCheckClient(0) | 353 , m_spellCheckClient(0) |
354 , m_chromeClientImpl(this) | 354 , m_chromeClientImpl(this) |
355 , m_contextMenuClientImpl(this) | 355 , m_contextMenuClientImpl(this) |
356 , m_dragClientImpl(this) | 356 , m_dragClientImpl(this) |
357 , m_editorClientImpl(this) | 357 , m_editorClientImpl(this) |
358 , m_inspectorClientImpl(this) | 358 , m_inspectorClientImpl(this) |
359 , m_backForwardClientImpl(this) | 359 , m_backForwardClientImpl(this) |
360 , m_spellCheckerClientImpl(this) | 360 , m_spellCheckerClientImpl(this) |
361 , m_storageClientImpl(this) | 361 , m_storageClientImpl(this) |
362 , m_fixedLayoutSizeLock(false) | 362 , m_fixedLayoutSizeLock(false) |
| 363 , m_forceZeroLayoutHeight(false) |
363 , m_shouldAutoResize(false) | 364 , m_shouldAutoResize(false) |
364 , m_zoomLevel(0) | 365 , m_zoomLevel(0) |
365 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) | 366 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) |
366 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) | 367 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) |
367 , m_doubleTapZoomPageScaleFactor(0) | 368 , m_doubleTapZoomPageScaleFactor(0) |
368 , m_doubleTapZoomPending(false) | 369 , m_doubleTapZoomPending(false) |
369 , m_enableFakePageScaleAnimationForTesting(false) | 370 , m_enableFakePageScaleAnimationForTesting(false) |
370 , m_fakePageScaleAnimationPageScaleFactor(0) | 371 , m_fakePageScaleAnimationPageScaleFactor(0) |
371 , m_fakePageScaleAnimationUseAnchor(false) | 372 , m_fakePageScaleAnimationUseAnchor(false) |
372 , m_contextMenuAllowed(false) | 373 , m_contextMenuAllowed(false) |
(...skipping 2669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3042 if (settings()->viewportEnabled()) { | 3043 if (settings()->viewportEnabled()) { |
3043 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra
ints().layoutSize); | 3044 layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConstra
ints().layoutSize); |
3044 | 3045 |
3045 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled(); | 3046 bool textAutosizingEnabled = page()->settings().textAutosizingEnabled(); |
3046 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt
h()) { | 3047 if (textAutosizingEnabled && layoutSize.width != view->layoutSize().widt
h()) { |
3047 if (TextAutosizer* textAutosizer = page()->deprecatedLocalMainFrame(
)->document()->textAutosizer()) | 3048 if (TextAutosizer* textAutosizer = page()->deprecatedLocalMainFrame(
)->document()->textAutosizer()) |
3048 textAutosizer->recalculateMultipliers(); | 3049 textAutosizer->recalculateMultipliers(); |
3049 } | 3050 } |
3050 } | 3051 } |
3051 | 3052 |
| 3053 if (m_forceZeroLayoutHeight) |
| 3054 layoutSize.height = 0; |
| 3055 |
3052 view->setLayoutSize(layoutSize); | 3056 view->setLayoutSize(layoutSize); |
3053 } | 3057 } |
3054 | 3058 |
3055 IntSize WebViewImpl::contentsSize() const | 3059 IntSize WebViewImpl::contentsSize() const |
3056 { | 3060 { |
3057 if (!page()->mainFrame()->isLocalFrame()) | 3061 if (!page()->mainFrame()->isLocalFrame()) |
3058 return IntSize(); | 3062 return IntSize(); |
3059 RenderView* root = page()->deprecatedLocalMainFrame()->contentRenderer(); | 3063 RenderView* root = page()->deprecatedLocalMainFrame()->contentRenderer(); |
3060 if (!root) | 3064 if (!root) |
3061 return IntSize(); | 3065 return IntSize(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3099 // Clear out the values for the current history item. This will prevent the
history item from clobbering the | 3103 // Clear out the values for the current history item. This will prevent the
history item from clobbering the |
3100 // value determined during page scale initialization, which may be less than
1. | 3104 // value determined during page scale initialization, which may be less than
1. |
3101 page()->deprecatedLocalMainFrame()->loader().clearScrollPositionAndViewState
(); | 3105 page()->deprecatedLocalMainFrame()->loader().clearScrollPositionAndViewState
(); |
3102 m_pageScaleConstraintsSet.setNeedsReset(true); | 3106 m_pageScaleConstraintsSet.setNeedsReset(true); |
3103 | 3107 |
3104 // Clobber saved scales and scroll offsets. | 3108 // Clobber saved scales and scroll offsets. |
3105 if (FrameView* view = page()->deprecatedLocalMainFrame()->document()->view()
) | 3109 if (FrameView* view = page()->deprecatedLocalMainFrame()->document()->view()
) |
3106 view->cacheCurrentScrollPosition(); | 3110 view->cacheCurrentScrollPosition(); |
3107 } | 3111 } |
3108 | 3112 |
| 3113 void WebViewImpl::setForceZeroLayoutHeight(bool enable) |
| 3114 { |
| 3115 if (m_forceZeroLayoutHeight == enable) |
| 3116 return; |
| 3117 |
| 3118 m_forceZeroLayoutHeight = enable; |
| 3119 updateMainFrameLayoutSize(); |
| 3120 } |
| 3121 |
3109 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) | 3122 void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize) |
3110 { | 3123 { |
3111 if (!page() || !page()->mainFrame()->isLocalFrame()) | 3124 if (!page() || !page()->mainFrame()->isLocalFrame()) |
3112 return; | 3125 return; |
3113 | 3126 |
3114 LocalFrame* frame = page()->deprecatedLocalMainFrame(); | 3127 LocalFrame* frame = page()->deprecatedLocalMainFrame(); |
3115 if (!frame) | 3128 if (!frame) |
3116 return; | 3129 return; |
3117 | 3130 |
3118 RefPtr<FrameView> view = frame->view(); | 3131 RefPtr<FrameView> view = frame->view(); |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4179 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4192 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4180 | 4193 |
4181 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4194 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4182 return false; | 4195 return false; |
4183 | 4196 |
4184 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4197 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4185 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4198 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4186 } | 4199 } |
4187 | 4200 |
4188 } // namespace blink | 4201 } // namespace blink |
OLD | NEW |