| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 #include "web/FullscreenController.h" | 165 #include "web/FullscreenController.h" |
| 166 #include "web/InspectorOverlay.h" | 166 #include "web/InspectorOverlay.h" |
| 167 #include "web/LinkHighlightImpl.h" | 167 #include "web/LinkHighlightImpl.h" |
| 168 #include "web/PageOverlay.h" | 168 #include "web/PageOverlay.h" |
| 169 #include "web/PrerendererClientImpl.h" | 169 #include "web/PrerendererClientImpl.h" |
| 170 #include "web/ResizeViewportAnchor.h" | 170 #include "web/ResizeViewportAnchor.h" |
| 171 #include "web/RotationViewportAnchor.h" | 171 #include "web/RotationViewportAnchor.h" |
| 172 #include "web/SpeechRecognitionClientProxy.h" | 172 #include "web/SpeechRecognitionClientProxy.h" |
| 173 #include "web/StorageQuotaClientImpl.h" | 173 #include "web/StorageQuotaClientImpl.h" |
| 174 #include "web/ValidationMessageClientImpl.h" | 174 #include "web/ValidationMessageClientImpl.h" |
| 175 #include "web/ViewportAnchor.h" | |
| 176 #include "web/WebDevToolsAgentImpl.h" | 175 #include "web/WebDevToolsAgentImpl.h" |
| 177 #include "web/WebInputEventConversion.h" | 176 #include "web/WebInputEventConversion.h" |
| 178 #include "web/WebLocalFrameImpl.h" | 177 #include "web/WebLocalFrameImpl.h" |
| 179 #include "web/WebPagePopupImpl.h" | 178 #include "web/WebPagePopupImpl.h" |
| 180 #include "web/WebPluginContainerImpl.h" | 179 #include "web/WebPluginContainerImpl.h" |
| 181 #include "web/WebRemoteFrameImpl.h" | 180 #include "web/WebRemoteFrameImpl.h" |
| 182 #include "web/WebSettingsImpl.h" | 181 #include "web/WebSettingsImpl.h" |
| 183 #include "wtf/AutoReset.h" | 182 #include "wtf/AutoReset.h" |
| 184 #include "wtf/CurrentTime.h" | 183 #include "wtf/CurrentTime.h" |
| 185 #include "wtf/PtrUtil.h" | 184 #include "wtf/PtrUtil.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 469 |
| 471 setVisibilityState(visibilityState, true); | 470 setVisibilityState(visibilityState, true); |
| 472 | 471 |
| 473 initializeLayerTreeView(); | 472 initializeLayerTreeView(); |
| 474 | 473 |
| 475 m_devToolsEmulator = DevToolsEmulator::create(this); | 474 m_devToolsEmulator = DevToolsEmulator::create(this); |
| 476 | 475 |
| 477 allInstances().add(this); | 476 allInstances().add(this); |
| 478 | 477 |
| 479 m_pageImportanceSignals.setObserver(client); | 478 m_pageImportanceSignals.setObserver(client); |
| 479 m_resizeViewportAnchor = new ResizeViewportAnchor(*m_page); |
| 480 } | 480 } |
| 481 | 481 |
| 482 WebViewImpl::~WebViewImpl() | 482 WebViewImpl::~WebViewImpl() |
| 483 { | 483 { |
| 484 DCHECK(!m_page); | 484 DCHECK(!m_page); |
| 485 | 485 |
| 486 // Each highlight uses m_owningWebViewImpl->m_linkHighlightsTimeline | 486 // Each highlight uses m_owningWebViewImpl->m_linkHighlightsTimeline |
| 487 // in destructor. m_linkHighlightsTimeline might be destroyed earlier | 487 // in destructor. m_linkHighlightsTimeline might be destroyed earlier |
| 488 // than m_linkHighlights. | 488 // than m_linkHighlights. |
| 489 DCHECK(m_linkHighlights.isEmpty()); | 489 DCHECK(m_linkHighlights.isEmpty()); |
| (...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 return; | 1850 return; |
| 1851 | 1851 |
| 1852 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 1852 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
| 1853 | 1853 |
| 1854 { | 1854 { |
| 1855 // This object will save the current visual viewport offset w.r.t. the | 1855 // This object will save the current visual viewport offset w.r.t. the |
| 1856 // document and restore it when the object goes out of scope. It's | 1856 // document and restore it when the object goes out of scope. It's |
| 1857 // needed since the top controls adjustment will change the maximum | 1857 // needed since the top controls adjustment will change the maximum |
| 1858 // scroll offset and we may need to reposition them to keep the user's | 1858 // scroll offset and we may need to reposition them to keep the user's |
| 1859 // apparent position unchanged. | 1859 // apparent position unchanged. |
| 1860 ResizeViewportAnchor anchor(*view, visualViewport); | 1860 ResizeViewportAnchor::ResizeScope resizeScope(*m_resizeViewportAnchor); |
| 1861 | 1861 |
| 1862 float topControlsViewportAdjustment = | 1862 float topControlsViewportAdjustment = |
| 1863 topControls().layoutHeight() - topControls().contentOffset(); | 1863 topControls().layoutHeight() - topControls().contentOffset(); |
| 1864 visualViewport.setTopControlsAdjustment(topControlsViewportAdjustment); | 1864 visualViewport.setTopControlsAdjustment(topControlsViewportAdjustment); |
| 1865 | 1865 |
| 1866 // Since the FrameView is sized to be the visual viewport at minimum | 1866 // Since the FrameView is sized to be the visual viewport at minimum |
| 1867 // scale, its adjustment must also be scaled by the minimum scale. | 1867 // scale, its adjustment must also be scaled by the minimum scale. |
| 1868 view->setTopControlsViewportAdjustment( | 1868 view->setTopControlsViewportAdjustment( |
| 1869 topControlsViewportAdjustment / minimumPageScaleFactor()); | 1869 topControlsViewportAdjustment / minimumPageScaleFactor()); |
| 1870 } | 1870 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1928 | 1928 |
| 1929 bool isRotation = settings()->mainFrameResizesAreOrientationChanges() | 1929 bool isRotation = settings()->mainFrameResizesAreOrientationChanges() |
| 1930 && m_size.width && contentsSize().width() && newSize.width != m_size.wid
th && !m_fullscreenController->isFullscreen(); | 1930 && m_size.width && contentsSize().width() && newSize.width != m_size.wid
th && !m_fullscreenController->isFullscreen(); |
| 1931 m_size = newSize; | 1931 m_size = newSize; |
| 1932 | 1932 |
| 1933 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY); | 1933 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY); |
| 1934 if (isRotation) { | 1934 if (isRotation) { |
| 1935 RotationViewportAnchor anchor(*view, visualViewport, viewportAnchorCoord
s, pageScaleConstraintsSet()); | 1935 RotationViewportAnchor anchor(*view, visualViewport, viewportAnchorCoord
s, pageScaleConstraintsSet()); |
| 1936 resizeViewWhileAnchored(view, topControlsHeight, topControlsShrinkLayout
); | 1936 resizeViewWhileAnchored(view, topControlsHeight, topControlsShrinkLayout
); |
| 1937 } else { | 1937 } else { |
| 1938 ResizeViewportAnchor anchor(*view, visualViewport); | 1938 ResizeViewportAnchor::ResizeScope resizeScope(*m_resizeViewportAnchor); |
| 1939 resizeViewWhileAnchored(view, topControlsHeight, topControlsShrinkLayout
); | 1939 resizeViewWhileAnchored(view, topControlsHeight, topControlsShrinkLayout
); |
| 1940 } | 1940 } |
| 1941 sendResizeEventAndRepaint(); | 1941 sendResizeEventAndRepaint(); |
| 1942 } | 1942 } |
| 1943 | 1943 |
| 1944 void WebViewImpl::resize(const WebSize& newSize) | 1944 void WebViewImpl::resize(const WebSize& newSize) |
| 1945 { | 1945 { |
| 1946 if (m_shouldAutoResize || m_size == newSize) | 1946 if (m_shouldAutoResize || m_size == newSize) |
| 1947 return; | 1947 return; |
| 1948 | 1948 |
| (...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4044 // Make sure link highlight from previous page is cleared. | 4044 // Make sure link highlight from previous page is cleared. |
| 4045 m_linkHighlights.clear(); | 4045 m_linkHighlights.clear(); |
| 4046 endActiveFlingAnimation(); | 4046 endActiveFlingAnimation(); |
| 4047 m_userGestureObserved = false; | 4047 m_userGestureObserved = false; |
| 4048 } | 4048 } |
| 4049 | 4049 |
| 4050 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) | 4050 void WebViewImpl::postLayoutResize(WebLocalFrameImpl* webframe) |
| 4051 { | 4051 { |
| 4052 FrameView* view = webframe->frame()->view(); | 4052 FrameView* view = webframe->frame()->view(); |
| 4053 if (webframe == mainFrame()) | 4053 if (webframe == mainFrame()) |
| 4054 view->resize(mainFrameSize()); | 4054 m_resizeViewportAnchor->resizeFrameView(mainFrameSize()); |
| 4055 else | 4055 else |
| 4056 view->resize(webframe->frameView()->size()); | 4056 view->resize(webframe->frameView()->size()); |
| 4057 } | 4057 } |
| 4058 | 4058 |
| 4059 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe) | 4059 void WebViewImpl::layoutUpdated(WebLocalFrameImpl* webframe) |
| 4060 { | 4060 { |
| 4061 LocalFrame* frame = webframe->frame(); | 4061 LocalFrame* frame = webframe->frame(); |
| 4062 if (!m_client || !frame->isLocalRoot()) | 4062 if (!m_client || !frame->isLocalRoot()) |
| 4063 return; | 4063 return; |
| 4064 | 4064 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4610 return nullptr; | 4610 return nullptr; |
| 4611 return focusedFrame; | 4611 return focusedFrame; |
| 4612 } | 4612 } |
| 4613 | 4613 |
| 4614 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const | 4614 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const |
| 4615 { | 4615 { |
| 4616 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4616 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4617 } | 4617 } |
| 4618 | 4618 |
| 4619 } // namespace blink | 4619 } // namespace blink |
| OLD | NEW |