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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1598 FrameView* view = mainFrameImpl()->frameView(); | 1598 FrameView* view = mainFrameImpl()->frameView(); |
1599 if (!view) | 1599 if (!view) |
1600 return; | 1600 return; |
1601 | 1601 |
1602 WebSize oldSize = m_size; | 1602 WebSize oldSize = m_size; |
1603 float oldPageScaleFactor = pageScaleFactor(); | 1603 float oldPageScaleFactor = pageScaleFactor(); |
1604 int oldContentsWidth = contentsSize().width(); | 1604 int oldContentsWidth = contentsSize().width(); |
1605 | 1605 |
1606 m_size = newSize; | 1606 m_size = newSize; |
1607 | 1607 |
1608 bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() && oldSi ze.width && oldContentsWidth; | 1608 // On devices like phones where a resize comes from screen rotation, we want to |
1609 // adjust the viewport size so that we don't cause a relayout | |
aelias_OOO_until_Jul13
2013/06/18 01:24:18
This comment doesn't accurately describe what this
| |
1610 bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() | |
1611 && settings()->resizeAffectsLayoutWidth() && oldSize.width && oldContent sWidth; | |
1612 | |
1609 ViewportAnchor viewportAnchor(mainFrameImpl()->frame()->eventHandler()); | 1613 ViewportAnchor viewportAnchor(mainFrameImpl()->frame()->eventHandler()); |
1610 if (shouldAnchorAndRescaleViewport) { | 1614 if (shouldAnchorAndRescaleViewport) { |
1611 viewportAnchor.setAnchor(view->visibleContentRect(), | 1615 viewportAnchor.setAnchor(view->visibleContentRect(), |
1612 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord)); | 1616 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord)); |
1613 } | 1617 } |
1614 | 1618 |
1615 // Set the fixed layout size from the viewport constraints before resizing. | 1619 // Set the fixed layout size from the viewport constraints before resizing. |
1616 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments()); | 1620 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments()); |
1617 | 1621 |
1618 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); | 1622 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3012 | 3016 |
3013 if (settingsImpl()->supportDeprecatedTargetDensityDPI()) | 3017 if (settingsImpl()->supportDeprecatedTargetDensityDPI()) |
3014 m_pageScaleConstraintsSet.adjustPageDefinedConstraintsForAndroidWebView( arguments, m_size, page()->settings()->layoutFallbackWidth(), deviceScaleFactor( ), page()->settings()->useWideViewport(), page()->settings()->loadWithOverviewMo de()); | 3018 m_pageScaleConstraintsSet.adjustPageDefinedConstraintsForAndroidWebView( arguments, m_size, page()->settings()->layoutFallbackWidth(), deviceScaleFactor( ), page()->settings()->useWideViewport(), page()->settings()->loadWithOverviewMo de()); |
3015 | 3019 |
3016 WebSize layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedCon straints().layoutSize); | 3020 WebSize layoutSize = flooredIntSize(m_pageScaleConstraintsSet.pageDefinedCon straints().layoutSize); |
3017 | 3021 |
3018 if (page()->settings() && page()->settings()->textAutosizingEnabled() && pag e()->mainFrame() | 3022 if (page()->settings() && page()->settings()->textAutosizingEnabled() && pag e()->mainFrame() |
3019 && layoutSize.width != fixedLayoutSize().width) | 3023 && layoutSize.width != fixedLayoutSize().width) |
3020 page()->mainFrame()->document()->textAutosizer()->recalculateMultipl iers(); | 3024 page()->mainFrame()->document()->textAutosizer()->recalculateMultipl iers(); |
3021 | 3025 |
3022 setFixedLayoutSize(layoutSize); | 3026 // If layoutFallbackWidthIsWindowWidth is set and there's no viewport width set, set the layout size to the window size |
3027 if (settings()->layoutFallbackWidthIsWindowWidth() && arguments.width == Vie wportArguments::ValueAuto) | |
3028 setFixedLayoutSize(m_size); | |
3029 else | |
3030 setFixedLayoutSize(layoutSize); | |
3031 | |
3023 } | 3032 } |
3024 | 3033 |
3025 IntSize WebViewImpl::contentsSize() const | 3034 IntSize WebViewImpl::contentsSize() const |
3026 { | 3035 { |
3027 RenderView* root = page()->mainFrame()->contentRenderer(); | 3036 RenderView* root = page()->mainFrame()->contentRenderer(); |
3028 if (!root) | 3037 if (!root) |
3029 return IntSize(); | 3038 return IntSize(); |
3030 return root->documentRect().size(); | 3039 return root->documentRect().size(); |
3031 } | 3040 } |
3032 | 3041 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3600 { | 3609 { |
3601 if (isNewNavigation) | 3610 if (isNewNavigation) |
3602 *isNewNavigation = m_observedNewNavigation; | 3611 *isNewNavigation = m_observedNewNavigation; |
3603 | 3612 |
3604 #ifndef NDEBUG | 3613 #ifndef NDEBUG |
3605 ASSERT(!m_observedNewNavigation | 3614 ASSERT(!m_observedNewNavigation |
3606 || m_page->mainFrame()->loader()->documentLoader() == m_newNavigationLoa der); | 3615 || m_page->mainFrame()->loader()->documentLoader() == m_newNavigationLoa der); |
3607 m_newNavigationLoader = 0; | 3616 m_newNavigationLoader = 0; |
3608 #endif | 3617 #endif |
3609 m_observedNewNavigation = false; | 3618 m_observedNewNavigation = false; |
3610 if (*isNewNavigation && !isNavigationWithinPage) | 3619 |
3620 // FIXME: Always need reset when layoutFallbackWidthIsWindowWidth is set | |
3621 // this is a hack to fix some page scaling issues when reloading a page. Why is this needed? | |
aelias_OOO_until_Jul13
2013/06/18 01:24:18
Instead of doing this, try calling setInitialPageS
aelias_OOO_until_Jul13
2013/06/18 01:30:19
On second thought, that probably won't work. I do
| |
3622 if ((*isNewNavigation && !isNavigationWithinPage) || settings()->layoutFallb ackWidthIsWindowWidth()) | |
3611 m_pageScaleConstraintsSet.setNeedsReset(true); | 3623 m_pageScaleConstraintsSet.setNeedsReset(true); |
3612 | 3624 |
3613 // Make sure link highlight from previous page is cleared. | 3625 // Make sure link highlight from previous page is cleared. |
3614 m_linkHighlight.clear(); | 3626 m_linkHighlight.clear(); |
3615 m_gestureAnimation.clear(); | 3627 m_gestureAnimation.clear(); |
3616 if (m_layerTreeView) | 3628 if (m_layerTreeView) |
3617 m_layerTreeView->didStopFlinging(); | 3629 m_layerTreeView->didStopFlinging(); |
3618 resetSavedScrollAndScaleState(); | 3630 resetSavedScrollAndScaleState(); |
3619 } | 3631 } |
3620 | 3632 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4100 } | 4112 } |
4101 | 4113 |
4102 bool WebViewImpl::shouldDisableDesktopWorkarounds() | 4114 bool WebViewImpl::shouldDisableDesktopWorkarounds() |
4103 { | 4115 { |
4104 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); | 4116 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); |
4105 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom | 4117 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom |
4106 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); | 4118 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); |
4107 } | 4119 } |
4108 | 4120 |
4109 } // namespace WebKit | 4121 } // namespace WebKit |
OLD | NEW |