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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 namespace WebKit { | 208 namespace WebKit { |
209 | 209 |
210 // Change the text zoom level by kTextSizeMultiplierRatio each time the user | 210 // Change the text zoom level by kTextSizeMultiplierRatio each time the user |
211 // zooms text in or out (ie., change by 20%). The min and max values limit | 211 // zooms text in or out (ie., change by 20%). The min and max values limit |
212 // text zoom to half and 3x the original text size. These three values match | 212 // text zoom to half and 3x the original text size. These three values match |
213 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm | 213 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm |
214 const double WebView::textSizeMultiplierRatio = 1.2; | 214 const double WebView::textSizeMultiplierRatio = 1.2; |
215 const double WebView::minTextSizeMultiplier = 0.5; | 215 const double WebView::minTextSizeMultiplier = 0.5; |
216 const double WebView::maxTextSizeMultiplier = 3.0; | 216 const double WebView::maxTextSizeMultiplier = 3.0; |
217 const float WebView::minPageScaleFactor = 0.25f; | |
218 const float WebView::maxPageScaleFactor = 4.0f; | |
219 | 217 |
220 // Used to defer all page activity in cases where the embedder wishes to run | 218 // Used to defer all page activity in cases where the embedder wishes to run |
221 // a nested event loop. Using a stack enables nesting of message loop invocation
s. | 219 // a nested event loop. Using a stack enables nesting of message loop invocation
s. |
222 static Vector<PageGroupLoadDeferrer*>& pageGroupLoadDeferrerStack() | 220 static Vector<PageGroupLoadDeferrer*>& pageGroupLoadDeferrerStack() |
223 { | 221 { |
224 DEFINE_STATIC_LOCAL(Vector<PageGroupLoadDeferrer*>, deferrerStack, ()); | 222 DEFINE_STATIC_LOCAL(Vector<PageGroupLoadDeferrer*>, deferrerStack, ()); |
225 return deferrerStack; | 223 return deferrerStack; |
226 } | 224 } |
227 | 225 |
228 // Ensure that the WebDragOperation enum values stay in sync with the original | 226 // Ensure that the WebDragOperation enum values stay in sync with the original |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 , m_inspectorClientImpl(this) | 380 , m_inspectorClientImpl(this) |
383 , m_backForwardClientImpl(this) | 381 , m_backForwardClientImpl(this) |
384 , m_shouldAutoResize(false) | 382 , m_shouldAutoResize(false) |
385 , m_observedNewNavigation(false) | 383 , m_observedNewNavigation(false) |
386 #ifndef NDEBUG | 384 #ifndef NDEBUG |
387 , m_newNavigationLoader(0) | 385 , m_newNavigationLoader(0) |
388 #endif | 386 #endif |
389 , m_zoomLevel(0) | 387 , m_zoomLevel(0) |
390 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) | 388 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) |
391 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) | 389 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) |
392 , m_pageDefinedMinimumPageScaleFactor(-1) | |
393 , m_pageDefinedMaximumPageScaleFactor(-1) | |
394 , m_minimumPageScaleFactor(minPageScaleFactor) | |
395 , m_maximumPageScaleFactor(maxPageScaleFactor) | |
396 , m_initialPageScaleFactorOverride(-1) | |
397 , m_initialPageScaleFactor(-1) | |
398 , m_ignoreViewportTagMaximumScale(false) | |
399 , m_pageScaleFactorIsSet(false) | |
400 , m_savedPageScaleFactor(0) | 390 , m_savedPageScaleFactor(0) |
401 , m_doubleTapZoomPageScaleFactor(0) | 391 , m_doubleTapZoomPageScaleFactor(0) |
402 , m_doubleTapZoomPending(false) | 392 , m_doubleTapZoomPending(false) |
403 , m_enableFakeDoubleTapAnimationForTesting(false) | 393 , m_enableFakeDoubleTapAnimationForTesting(false) |
404 , m_fakeDoubleTapPageScaleFactor(0) | 394 , m_fakeDoubleTapPageScaleFactor(0) |
405 , m_fakeDoubleTapUseAnchor(false) | 395 , m_fakeDoubleTapUseAnchor(false) |
406 , m_contextMenuAllowed(false) | 396 , m_contextMenuAllowed(false) |
407 , m_doingDragAndDrop(false) | 397 , m_doingDragAndDrop(false) |
408 , m_ignoreInputEvents(false) | 398 , m_ignoreInputEvents(false) |
409 , m_suppressNextKeypressEvent(false) | 399 , m_suppressNextKeypressEvent(false) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 #if ENABLE(BATTERY_STATUS) | 473 #if ENABLE(BATTERY_STATUS) |
484 provideBatteryTo(m_page.get(), m_batteryClient.get()); | 474 provideBatteryTo(m_page.get(), m_batteryClient.get()); |
485 m_batteryClient->setController(BatteryController::from(m_page.get())); | 475 m_batteryClient->setController(BatteryController::from(m_page.get())); |
486 #endif | 476 #endif |
487 | 477 |
488 m_page->setGroupType(Page::SharedPageGroup); | 478 m_page->setGroupType(Page::SharedPageGroup); |
489 | 479 |
490 unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout; | 480 unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout; |
491 m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones))
; | 481 m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones))
; |
492 | 482 |
493 if (m_client) | 483 if (m_client) { |
| 484 setDeviceScaleFactor(m_client->screenInfo().deviceScaleFactor); |
494 setVisibilityState(m_client->visibilityState(), true); | 485 setVisibilityState(m_client->visibilityState(), true); |
| 486 } |
495 | 487 |
496 m_inspectorSettingsMap = adoptPtr(new SettingsMap); | 488 m_inspectorSettingsMap = adoptPtr(new SettingsMap); |
497 } | 489 } |
498 | 490 |
499 WebViewImpl::~WebViewImpl() | 491 WebViewImpl::~WebViewImpl() |
500 { | 492 { |
501 ASSERT(!m_page); | 493 ASSERT(!m_page); |
502 } | 494 } |
503 | 495 |
504 RenderTheme* WebViewImpl::theme() const | 496 RenderTheme* WebViewImpl::theme() const |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 m_contextMenuAllowed = false; | 792 m_contextMenuAllowed = false; |
801 | 793 |
802 break; | 794 break; |
803 } | 795 } |
804 case WebInputEvent::GestureTapDown: { | 796 case WebInputEvent::GestureTapDown: { |
805 m_client->cancelScheduledContentIntents(); | 797 m_client->cancelScheduledContentIntents(); |
806 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGesture
Event(platformEvent); | 798 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGesture
Event(platformEvent); |
807 break; | 799 break; |
808 } | 800 } |
809 case WebInputEvent::GestureDoubleTap: | 801 case WebInputEvent::GestureDoubleTap: |
810 if (m_webSettings->doubleTapToZoomEnabled() && m_minimumPageScaleFactor
!= m_maximumPageScaleFactor) { | 802 if (m_webSettings->doubleTapToZoomEnabled() && minimumPageScaleFactor()
!= maximumPageScaleFactor()) { |
811 m_client->cancelScheduledContentIntents(); | 803 m_client->cancelScheduledContentIntents(); |
812 animateZoomAroundPoint(platformEvent.position(), DoubleTap); | 804 animateZoomAroundPoint(platformEvent.position(), DoubleTap); |
813 } | 805 } |
814 // GestureDoubleTap is currently only used by Android for zooming. For W
ebCore, | 806 // GestureDoubleTap is currently only used by Android for zooming. For W
ebCore, |
815 // GestureTap with tap count = 2 is used instead. So we drop GestureDoub
leTap here. | 807 // GestureTap with tap count = 2 is used instead. So we drop GestureDoub
leTap here. |
816 eventSwallowed = true; | 808 eventSwallowed = true; |
817 break; | 809 break; |
818 case WebInputEvent::GestureScrollBegin: | 810 case WebInputEvent::GestureScrollBegin: |
819 case WebInputEvent::GesturePinchBegin: | 811 case WebInputEvent::GesturePinchBegin: |
820 m_client->cancelScheduledContentIntents(); | 812 m_client->cancelScheduledContentIntents(); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 // be visible). FIXME: Revisit this if it isn't always true. | 1165 // be visible). FIXME: Revisit this if it isn't always true. |
1174 return; | 1166 return; |
1175 } | 1167 } |
1176 | 1168 |
1177 bool scaleUnchanged = true; | 1169 bool scaleUnchanged = true; |
1178 if (!rect.isEmpty()) { | 1170 if (!rect.isEmpty()) { |
1179 // Pages should be as legible as on desktop when at dpi scale, so no | 1171 // Pages should be as legible as on desktop when at dpi scale, so no |
1180 // need to zoom in further when automatically determining zoom level | 1172 // need to zoom in further when automatically determining zoom level |
1181 // (after double tap, find in page, etc), though the user should still | 1173 // (after double tap, find in page, etc), though the user should still |
1182 // be allowed to manually pinch zoom in further if they desire. | 1174 // be allowed to manually pinch zoom in further if they desire. |
1183 const float defaultScaleWhenAlreadyLegible = m_minimumPageScaleFactor *
doubleTapZoomAlreadyLegibleRatio; | 1175 const float defaultScaleWhenAlreadyLegible = minimumPageScaleFactor() *
doubleTapZoomAlreadyLegibleRatio; |
1184 float legibleScale = 1; | 1176 float legibleScale = 1; |
1185 if (page() && page()->settings()) | 1177 if (page() && page()->settings()) |
1186 legibleScale *= page()->settings()->textAutosizingFontScaleFactor(); | 1178 legibleScale *= page()->settings()->textAutosizingFontScaleFactor(); |
1187 if (legibleScale < defaultScaleWhenAlreadyLegible) | 1179 if (legibleScale < defaultScaleWhenAlreadyLegible) |
1188 legibleScale = (scale == m_minimumPageScaleFactor) ? defaultScaleWhe
nAlreadyLegible : m_minimumPageScaleFactor; | 1180 legibleScale = (scale == minimumPageScaleFactor()) ? defaultScaleWhe
nAlreadyLegible : minimumPageScaleFactor(); |
1189 | 1181 |
1190 float defaultMargin = doubleTapZoomContentDefaultMargin; | 1182 float defaultMargin = doubleTapZoomContentDefaultMargin; |
1191 float minimumMargin = doubleTapZoomContentMinimumMargin; | 1183 float minimumMargin = doubleTapZoomContentMinimumMargin; |
1192 // We want the margins to have the same physical size, which means we | 1184 // We want the margins to have the same physical size, which means we |
1193 // need to express them in post-scale size. To do that we'd need to know | 1185 // need to express them in post-scale size. To do that we'd need to know |
1194 // the scale we're scaling to, but that depends on the margins. Instead | 1186 // the scale we're scaling to, but that depends on the margins. Instead |
1195 // we express them as a fraction of the target rectangle: this will be | 1187 // we express them as a fraction of the target rectangle: this will be |
1196 // correct if we end up fully zooming to it, and won't matter if we | 1188 // correct if we end up fully zooming to it, and won't matter if we |
1197 // don't. | 1189 // don't. |
1198 rect = widenRectWithinPageBounds(rect, | 1190 rect = widenRectWithinPageBounds(rect, |
1199 static_cast<int>(defaultMargin * rect.width / m_size.width), | 1191 static_cast<int>(defaultMargin * rect.width / m_size.width), |
1200 static_cast<int>(minimumMargin * rect.width / m_size.width)); | 1192 static_cast<int>(minimumMargin * rect.width / m_size.width)); |
1201 // Fit block to screen, respecting limits. | 1193 // Fit block to screen, respecting limits. |
1202 scale = static_cast<float>(m_size.width) / rect.width; | 1194 scale = static_cast<float>(m_size.width) / rect.width; |
1203 scale = min(scale, legibleScale); | 1195 scale = min(scale, legibleScale); |
1204 scale = clampPageScaleFactorToLimits(scale); | 1196 scale = clampPageScaleFactorToLimits(scale); |
1205 | 1197 |
1206 scaleUnchanged = fabs(pageScaleFactor() - scale) < minScaleDifference; | 1198 scaleUnchanged = fabs(pageScaleFactor() - scale) < minScaleDifference; |
1207 } | 1199 } |
1208 | 1200 |
1209 bool stillAtPreviousDoubleTapScale = (pageScaleFactor() == m_doubleTapZoomPa
geScaleFactor | 1201 bool stillAtPreviousDoubleTapScale = (pageScaleFactor() == m_doubleTapZoomPa
geScaleFactor |
1210 && m_doubleTapZoomPageScaleFactor != m_minimumPageScaleFactor) | 1202 && m_doubleTapZoomPageScaleFactor != minimumPageScaleFactor()) |
1211 || m_doubleTapZoomPending; | 1203 || m_doubleTapZoomPending; |
1212 if (zoomType == DoubleTap && (rect.isEmpty() || scaleUnchanged || stillAtPre
viousDoubleTapScale)) { | 1204 if (zoomType == DoubleTap && (rect.isEmpty() || scaleUnchanged || stillAtPre
viousDoubleTapScale)) { |
1213 // Zoom out to minimum scale. | 1205 // Zoom out to minimum scale. |
1214 scale = m_minimumPageScaleFactor; | 1206 scale = minimumPageScaleFactor(); |
1215 scroll = WebPoint(hitRect.x, hitRect.y); | 1207 scroll = WebPoint(hitRect.x, hitRect.y); |
1216 isAnchor = true; | 1208 isAnchor = true; |
1217 } else { | 1209 } else { |
1218 // FIXME: If this is being called for auto zoom during find in page, | 1210 // FIXME: If this is being called for auto zoom during find in page, |
1219 // then if the user manually zooms in it'd be nice to preserve the | 1211 // then if the user manually zooms in it'd be nice to preserve the |
1220 // relative increase in zoom they caused (if they zoom out then it's ok | 1212 // relative increase in zoom they caused (if they zoom out then it's ok |
1221 // to zoom them back in again). This isn't compatible with our current | 1213 // to zoom them back in again). This isn't compatible with our current |
1222 // double-tap zoom strategy (fitting the containing block to the screen) | 1214 // double-tap zoom strategy (fitting the containing block to the screen) |
1223 // though. | 1215 // though. |
1224 | 1216 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 { | 1601 { |
1610 if (mainFrameImpl() && mainFrameImpl()->frameView()) | 1602 if (mainFrameImpl() && mainFrameImpl()->frameView()) |
1611 mainFrameImpl()->frameView()->willStartLiveResize(); | 1603 mainFrameImpl()->frameView()->willStartLiveResize(); |
1612 | 1604 |
1613 Frame* frame = mainFrameImpl()->frame(); | 1605 Frame* frame = mainFrameImpl()->frame(); |
1614 WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromF
rame(frame); | 1606 WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromF
rame(frame); |
1615 if (pluginContainer) | 1607 if (pluginContainer) |
1616 pluginContainer->willStartLiveResize(); | 1608 pluginContainer->willStartLiveResize(); |
1617 } | 1609 } |
1618 | 1610 |
1619 IntSize WebViewImpl::scaledSize(float pageScaleFactor) const | |
1620 { | |
1621 FloatSize scaledSize = IntSize(m_size); | |
1622 scaledSize.scale(1 / pageScaleFactor); | |
1623 return expandedIntSize(scaledSize); | |
1624 } | |
1625 | |
1626 WebSize WebViewImpl::size() | 1611 WebSize WebViewImpl::size() |
1627 { | 1612 { |
1628 return m_size; | 1613 return m_size; |
1629 } | 1614 } |
1630 | 1615 |
1631 void WebViewImpl::resize(const WebSize& newSize) | 1616 void WebViewImpl::resize(const WebSize& newSize) |
1632 { | 1617 { |
1633 if (m_shouldAutoResize || m_size == newSize) | 1618 if (m_shouldAutoResize || m_size == newSize) |
1634 return; | 1619 return; |
1635 | 1620 |
1636 FrameView* view = mainFrameImpl()->frameView(); | 1621 FrameView* view = mainFrameImpl()->frameView(); |
1637 if (!view) | 1622 if (!view) |
1638 return; | 1623 return; |
1639 | 1624 |
1640 WebSize oldSize = m_size; | 1625 WebSize oldSize = m_size; |
1641 float oldPageScaleFactor = pageScaleFactor(); | 1626 float oldPageScaleFactor = pageScaleFactor(); |
1642 int oldContentsWidth = contentsSize().width(); | 1627 int oldContentsWidth = contentsSize().width(); |
1643 | 1628 |
1644 m_size = newSize; | 1629 m_size = newSize; |
1645 | 1630 |
1646 bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() && oldSi
ze.width && oldContentsWidth; | 1631 bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() && oldSi
ze.width && oldContentsWidth; |
1647 ViewportAnchor viewportAnchor(mainFrameImpl()->frame()->eventHandler()); | 1632 ViewportAnchor viewportAnchor(mainFrameImpl()->frame()->eventHandler()); |
1648 if (shouldAnchorAndRescaleViewport) { | 1633 if (shouldAnchorAndRescaleViewport) { |
1649 viewportAnchor.setAnchor(view->visibleContentRect(), | 1634 viewportAnchor.setAnchor(view->visibleContentRect(), |
1650 FloatSize(viewportAnchorXCoord, viewportAnchorY
Coord)); | 1635 FloatSize(viewportAnchorXCoord, viewportAnchorY
Coord)); |
1651 } | 1636 } |
1652 | 1637 |
1653 ViewportArguments viewportArguments = mainFrameImpl()->frame()->document()->
viewportArguments(); | 1638 // Set the fixed layout size from the viewport attributes before resizing. |
1654 m_page->chrome()->client()->dispatchViewportPropertiesDidChange(viewportArgu
ments); | 1639 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v
iewportArguments()); |
1655 | 1640 |
1656 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); | 1641 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); |
1657 if (agentPrivate) | 1642 if (agentPrivate) |
1658 agentPrivate->webViewResized(newSize); | 1643 agentPrivate->webViewResized(newSize); |
1659 if (!agentPrivate || !agentPrivate->metricsOverridden()) { | 1644 if (!agentPrivate || !agentPrivate->metricsOverridden()) { |
1660 WebFrameImpl* webFrame = mainFrameImpl(); | 1645 WebFrameImpl* webFrame = mainFrameImpl(); |
1661 if (webFrame->frameView()) | 1646 if (webFrame->frameView()) |
1662 webFrame->frameView()->resize(m_size); | 1647 webFrame->frameView()->resize(m_size); |
1663 } | 1648 } |
1664 | 1649 |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2843 { | 2828 { |
2844 return pow(textSizeMultiplierRatio, zoomLevel); | 2829 return pow(textSizeMultiplierRatio, zoomLevel); |
2845 } | 2830 } |
2846 | 2831 |
2847 double WebView::zoomFactorToZoomLevel(double factor) | 2832 double WebView::zoomFactorToZoomLevel(double factor) |
2848 { | 2833 { |
2849 // Since factor = 1.2^level, level = log(factor) / log(1.2) | 2834 // Since factor = 1.2^level, level = log(factor) / log(1.2) |
2850 return log(factor) / log(textSizeMultiplierRatio); | 2835 return log(factor) / log(textSizeMultiplierRatio); |
2851 } | 2836 } |
2852 | 2837 |
2853 void WebViewImpl::setInitialPageScaleOverride(float initialPageScaleFactorOverri
de) | |
2854 { | |
2855 if (m_initialPageScaleFactorOverride == initialPageScaleFactorOverride) | |
2856 return; | |
2857 m_initialPageScaleFactorOverride = initialPageScaleFactorOverride; | |
2858 m_pageScaleFactorIsSet = false; | |
2859 computePageScaleFactorLimits(); | |
2860 } | |
2861 | |
2862 float WebViewImpl::pageScaleFactor() const | 2838 float WebViewImpl::pageScaleFactor() const |
2863 { | 2839 { |
2864 if (!page()) | 2840 if (!page()) |
2865 return 1; | 2841 return 1; |
2866 | 2842 |
2867 return page()->pageScaleFactor(); | 2843 return page()->pageScaleFactor(); |
2868 } | 2844 } |
2869 | 2845 |
2870 bool WebViewImpl::isPageScaleFactorSet() const | 2846 float WebViewImpl::clampPageScaleFactorToLimits(float scaleFactor) const |
2871 { | 2847 { |
2872 return m_pageScaleFactorIsSet; | 2848 return m_viewportAttributesManager.finalConstraints().clampToConstraints(sca
leFactor); |
2873 } | 2849 } |
2874 | 2850 |
2875 float WebViewImpl::clampPageScaleFactorToLimits(float scaleFactor) | 2851 IntPoint WebViewImpl::clampOffsetAtScale(const IntPoint& offset, float scale) |
2876 { | 2852 { |
2877 return min(max(scaleFactor, m_minimumPageScaleFactor), m_maximumPageScaleFac
tor); | 2853 FrameView* view = mainFrameImpl()->frameView(); |
2878 } | 2854 if (!view) |
| 2855 return offset; |
2879 | 2856 |
2880 IntPoint WebViewImpl::clampOffsetAtScale(const IntPoint& offset, float scale) co
nst | 2857 IntPoint maxScrollExtent(contentsSize().width() - view->scrollOrigin().x(),
contentsSize().height() - view->scrollOrigin().y()); |
2881 { | 2858 FloatSize scaledSize = IntSize(view->visibleContentRect().size()); |
| 2859 scaledSize.scale(1 / scale); |
| 2860 |
2882 IntPoint clampedOffset = offset; | 2861 IntPoint clampedOffset = offset; |
2883 clampedOffset = clampedOffset.shrunkTo(IntPoint(contentsSize() - scaledSize(
scale))); | 2862 clampedOffset = clampedOffset.shrunkTo(maxScrollExtent - expandedIntSize(sca
ledSize)); |
2884 clampedOffset.clampNegativeToZero(); | 2863 clampedOffset = clampedOffset.expandedTo(-view->scrollOrigin()); |
2885 | 2864 |
2886 return clampedOffset; | 2865 return clampedOffset; |
2887 } | 2866 } |
2888 | 2867 |
2889 void WebViewImpl::setPageScaleFactorPreservingScrollOffset(float scaleFactor) | |
2890 { | |
2891 scaleFactor = clampPageScaleFactorToLimits(scaleFactor); | |
2892 | |
2893 IntPoint scrollOffset(mainFrame()->scrollOffset().width, mainFrame()->scroll
Offset().height); | |
2894 scrollOffset = clampOffsetAtScale(scrollOffset, scaleFactor); | |
2895 | |
2896 setPageScaleFactor(scaleFactor, scrollOffset); | |
2897 } | |
2898 | |
2899 void WebViewImpl::setPageScaleFactor(float scaleFactor, const WebPoint& origin) | 2868 void WebViewImpl::setPageScaleFactor(float scaleFactor, const WebPoint& origin) |
2900 { | 2869 { |
2901 if (!page()) | 2870 if (!page()) |
2902 return; | 2871 return; |
2903 | 2872 |
2904 if (!scaleFactor) | |
2905 scaleFactor = 1; | |
2906 | |
2907 IntPoint newScrollOffset = origin; | 2873 IntPoint newScrollOffset = origin; |
2908 scaleFactor = clampPageScaleFactorToLimits(scaleFactor); | 2874 scaleFactor = clampPageScaleFactorToLimits(scaleFactor); |
2909 newScrollOffset = clampOffsetAtScale(newScrollOffset, scaleFactor); | 2875 newScrollOffset = clampOffsetAtScale(newScrollOffset, scaleFactor); |
2910 | 2876 |
2911 Frame* frame = page()->mainFrame(); | 2877 page()->setPageScaleFactor(scaleFactor, newScrollOffset); |
2912 FrameView* view = frame->view(); | 2878 } |
2913 IntPoint oldScrollOffset = view->scrollPosition(); | |
2914 | 2879 |
2915 // Adjust the page scale in two steps. First, without change to scroll | 2880 void WebViewImpl::setPageScaleFactorPreservingScrollOffset(float scaleFactor) |
2916 // position, and then with a user scroll to the desired position. | 2881 { |
2917 // We do this because Page::setPageScaleFactor calls | 2882 IntPoint scrollOffset(mainFrame()->scrollOffset().width, mainFrame()->scroll
Offset().height); |
2918 // FrameView::setScrollPosition which is a programmatic scroll | 2883 setPageScaleFactor(scaleFactor, scrollOffset); |
2919 // and we need this method to perform only user scrolls. | |
2920 page()->setPageScaleFactor(scaleFactor, oldScrollOffset); | |
2921 if (newScrollOffset != oldScrollOffset) | |
2922 updateMainFrameScrollPosition(newScrollOffset, false); | |
2923 | |
2924 m_pageScaleFactorIsSet = true; | |
2925 } | 2884 } |
2926 | 2885 |
2927 float WebViewImpl::deviceScaleFactor() const | 2886 float WebViewImpl::deviceScaleFactor() const |
2928 { | 2887 { |
2929 if (!page()) | 2888 if (!page()) |
2930 return 1; | 2889 return 1; |
2931 | 2890 |
2932 return page()->deviceScaleFactor(); | 2891 return page()->deviceScaleFactor(); |
2933 } | 2892 } |
2934 | 2893 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2979 m_maxAutoSize = maxSize; | 2938 m_maxAutoSize = maxSize; |
2980 configureAutoResizeMode(); | 2939 configureAutoResizeMode(); |
2981 } | 2940 } |
2982 | 2941 |
2983 void WebViewImpl::disableAutoResizeMode() | 2942 void WebViewImpl::disableAutoResizeMode() |
2984 { | 2943 { |
2985 m_shouldAutoResize = false; | 2944 m_shouldAutoResize = false; |
2986 configureAutoResizeMode(); | 2945 configureAutoResizeMode(); |
2987 } | 2946 } |
2988 | 2947 |
| 2948 void WebViewImpl::setUserAgentViewportConstraints(ViewportAttributes newConstrai
nts) |
| 2949 { |
| 2950 if (newConstraints == m_viewportAttributesManager.userAgentConstraints()) |
| 2951 return; |
| 2952 |
| 2953 m_viewportAttributesManager.setUserAgentConstraints(newConstraints); |
| 2954 |
| 2955 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
| 2956 return; |
| 2957 |
| 2958 mainFrameImpl()->frameView()->setNeedsLayout(); |
| 2959 } |
| 2960 |
| 2961 void WebViewImpl::setInitialPageScaleOverride(float initialPageScaleFactorOverri
de) |
| 2962 { |
| 2963 ViewportAttributes constraints = m_viewportAttributesManager.userAgentConstr
aints(); |
| 2964 constraints.initialScale = initialPageScaleFactorOverride; |
| 2965 |
| 2966 if (constraints == m_viewportAttributesManager.userAgentConstraints()) |
| 2967 return; |
| 2968 |
| 2969 m_viewportAttributesManager.setNeedsReset(true); |
| 2970 setUserAgentViewportConstraints(constraints); |
| 2971 } |
| 2972 |
2989 void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScal
e) | 2973 void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScal
e) |
2990 { | 2974 { |
2991 if (minPageScale == m_pageDefinedMinimumPageScaleFactor && maxPageScale == m
_pageDefinedMaximumPageScaleFactor) | 2975 ViewportAttributes constraints = m_viewportAttributesManager.userAgentConstr
aints(); |
| 2976 constraints.minimumScale = minPageScale; |
| 2977 constraints.maximumScale = maxPageScale; |
| 2978 setUserAgentViewportConstraints(constraints); |
| 2979 } |
| 2980 |
| 2981 void WebViewImpl::setIgnoreViewportTagScaleLimits(bool ignore) |
| 2982 { |
| 2983 ViewportAttributes constraints = m_viewportAttributesManager.userAgentConstr
aints(); |
| 2984 if (ignore) { |
| 2985 constraints.minimumScale = m_viewportAttributesManager.defaultConstraint
s().minimumScale; |
| 2986 constraints.maximumScale = m_viewportAttributesManager.defaultConstraint
s().maximumScale; |
| 2987 } else { |
| 2988 constraints.minimumScale = -1; |
| 2989 constraints.maximumScale = -1; |
| 2990 } |
| 2991 setUserAgentViewportConstraints(constraints); |
| 2992 } |
| 2993 |
| 2994 void WebViewImpl::refreshPageScaleFactorAfterLayout() |
| 2995 { |
| 2996 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()-
>view()) |
| 2997 return; |
| 2998 FrameView* view = page()->mainFrame()->view(); |
| 2999 |
| 3000 updatePageDefinedViewportConstraints(mainFrameImpl()->frame()->document()->v
iewportArguments()); |
| 3001 m_viewportAttributesManager.computeFinalConstraints(); |
| 3002 |
| 3003 if (settings()->viewportEnabled()) { |
| 3004 int verticalScrollbarWidth = 0; |
| 3005 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc
rollbar()) |
| 3006 verticalScrollbarWidth = view->verticalScrollbar()->width(); |
| 3007 m_viewportAttributesManager.adjustFinalConstraintsToContentsSize(m_size,
contentsSize(), verticalScrollbarWidth); |
| 3008 } |
| 3009 |
| 3010 float newPageScaleFactor = pageScaleFactor(); |
| 3011 if (m_viewportAttributesManager.needsReset() && m_viewportAttributesManager.
finalConstraints().initialScale != -1) { |
| 3012 newPageScaleFactor = m_viewportAttributesManager.finalConstraints().init
ialScale; |
| 3013 m_viewportAttributesManager.setNeedsReset(false); |
| 3014 } |
| 3015 setPageScaleFactorPreservingScrollOffset(newPageScaleFactor); |
| 3016 |
| 3017 updateLayerTreeViewport(); |
| 3018 |
| 3019 // Relayout immediately to avoid violating the rule that needsLayout() |
| 3020 // isn't set at the end of a layout. |
| 3021 if (view->needsLayout()) |
| 3022 view->layout(); |
| 3023 } |
| 3024 |
| 3025 void WebViewImpl::updatePageDefinedViewportConstraints(const ViewportArguments&
arguments) |
| 3026 { |
| 3027 if (!settings()->viewportEnabled() || !isFixedLayoutModeEnabled() || !page()
|| !m_size.width || !m_size.height) |
2992 return; | 3028 return; |
2993 | 3029 |
2994 m_pageDefinedMinimumPageScaleFactor = minPageScale; | 3030 m_viewportAttributesManager.updatePageDefinedConstraints(arguments, m_size,
page()->settings()->layoutFallbackWidth()); |
2995 m_pageDefinedMaximumPageScaleFactor = maxPageScale; | |
2996 | 3031 |
2997 if (settings()->viewportEnabled()) { | 3032 if (settingsImpl()->supportDeprecatedTargetDensityDPI()) |
2998 // If we're in viewport tag mode, we need to layout to obtain the latest | 3033 m_viewportAttributesManager.adjustPageDefinedConstraintsForAndroidWebVie
w(arguments, m_size, page()->settings()->layoutFallbackWidth(), deviceScaleFacto
r(), settingsImpl()->useWideViewport(), settingsImpl()->initializeAtMinimumPageS
cale()); |
2999 // contents size and compute the final limits. | |
3000 FrameView* view = mainFrameImpl()->frameView(); | |
3001 if (view) | |
3002 view->setNeedsLayout(); | |
3003 } else { | |
3004 // Otherwise just compute the limits immediately. | |
3005 computePageScaleFactorLimits(); | |
3006 } | |
3007 } | |
3008 | 3034 |
3009 void WebViewImpl::setIgnoreViewportTagMaximumScale(bool flag) | 3035 setFixedLayoutSize(flooredIntSize(m_viewportAttributesManager.pageDefinedCon
straints().layoutSize)); |
3010 { | |
3011 m_ignoreViewportTagMaximumScale = flag; | |
3012 | |
3013 if (!page() || !page()->mainFrame()) | |
3014 return; | |
3015 | |
3016 m_page->chrome()->client()->dispatchViewportPropertiesDidChange(page()->main
Frame()->document()->viewportArguments()); | |
3017 } | 3036 } |
3018 | 3037 |
3019 IntSize WebViewImpl::contentsSize() const | 3038 IntSize WebViewImpl::contentsSize() const |
3020 { | 3039 { |
3021 RenderView* root = page()->mainFrame()->contentRenderer(); | 3040 RenderView* root = page()->mainFrame()->contentRenderer(); |
3022 if (!root) | 3041 if (!root) |
3023 return IntSize(); | 3042 return IntSize(); |
3024 return root->documentRect().size(); | 3043 return root->documentRect().size(); |
3025 } | 3044 } |
3026 | 3045 |
3027 void WebViewImpl::computePageScaleFactorLimits() | |
3028 { | |
3029 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()-
>view()) | |
3030 return; | |
3031 | |
3032 FrameView* view = page()->mainFrame()->view(); | |
3033 | |
3034 if (m_pageDefinedMinimumPageScaleFactor == -1 || m_pageDefinedMaximumPageSca
leFactor == -1) { | |
3035 m_minimumPageScaleFactor = minPageScaleFactor; | |
3036 m_maximumPageScaleFactor = maxPageScaleFactor; | |
3037 } else { | |
3038 m_minimumPageScaleFactor = min(max(m_pageDefinedMinimumPageScaleFactor,
minPageScaleFactor), maxPageScaleFactor); | |
3039 m_maximumPageScaleFactor = max(min(m_pageDefinedMaximumPageScaleFactor,
maxPageScaleFactor), minPageScaleFactor); | |
3040 } | |
3041 | |
3042 if (settings()->viewportEnabled()) { | |
3043 if (!contentsSize().width() || !m_size.width) | |
3044 return; | |
3045 | |
3046 // When viewport tag is enabled, the scale needed to see the full | |
3047 // content width is the default minimum. | |
3048 int viewWidthNotIncludingScrollbars = m_size.width; | |
3049 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc
rollbar()) | |
3050 viewWidthNotIncludingScrollbars -= view->verticalScrollbar()->width(
); | |
3051 m_minimumPageScaleFactor = max(m_minimumPageScaleFactor, static_cast<flo
at>(viewWidthNotIncludingScrollbars) / contentsSize().width()); | |
3052 m_maximumPageScaleFactor = max(m_minimumPageScaleFactor, m_maximumPageSc
aleFactor); | |
3053 if (m_initialPageScaleFactorOverride != -1) { | |
3054 m_minimumPageScaleFactor = min(m_minimumPageScaleFactor, m_initialPa
geScaleFactorOverride); | |
3055 m_maximumPageScaleFactor = max(m_maximumPageScaleFactor, m_initialPa
geScaleFactorOverride); | |
3056 } | |
3057 } | |
3058 ASSERT(m_minimumPageScaleFactor <= m_maximumPageScaleFactor); | |
3059 | |
3060 // Initialize and/or clamp the page scale factor if needed. | |
3061 float initialPageScaleFactor = m_initialPageScaleFactor; | |
3062 if (!settings()->viewportEnabled()) | |
3063 initialPageScaleFactor = 1; | |
3064 if (m_initialPageScaleFactorOverride != -1) | |
3065 initialPageScaleFactor = m_initialPageScaleFactorOverride; | |
3066 float newPageScaleFactor = pageScaleFactor(); | |
3067 if (!m_pageScaleFactorIsSet && initialPageScaleFactor != -1) { | |
3068 newPageScaleFactor = initialPageScaleFactor; | |
3069 m_pageScaleFactorIsSet = true; | |
3070 } | |
3071 newPageScaleFactor = clampPageScaleFactorToLimits(newPageScaleFactor); | |
3072 if (m_layerTreeView) | |
3073 m_layerTreeView->setPageScaleFactorAndLimits(newPageScaleFactor, m_minim
umPageScaleFactor, m_maximumPageScaleFactor); | |
3074 if (newPageScaleFactor != pageScaleFactor()) | |
3075 setPageScaleFactorPreservingScrollOffset(newPageScaleFactor); | |
3076 } | |
3077 | |
3078 float WebViewImpl::minimumPageScaleFactor() const | 3046 float WebViewImpl::minimumPageScaleFactor() const |
3079 { | 3047 { |
3080 return m_minimumPageScaleFactor; | 3048 return m_viewportAttributesManager.finalConstraints().minimumScale; |
3081 } | 3049 } |
3082 | 3050 |
3083 float WebViewImpl::maximumPageScaleFactor() const | 3051 float WebViewImpl::maximumPageScaleFactor() const |
3084 { | 3052 { |
3085 return m_maximumPageScaleFactor; | 3053 return m_viewportAttributesManager.finalConstraints().maximumScale; |
3086 } | 3054 } |
3087 | 3055 |
3088 void WebViewImpl::saveScrollAndScaleState() | 3056 void WebViewImpl::saveScrollAndScaleState() |
3089 { | 3057 { |
3090 m_savedPageScaleFactor = pageScaleFactor(); | 3058 m_savedPageScaleFactor = pageScaleFactor(); |
3091 m_savedScrollOffset = mainFrame()->scrollOffset(); | 3059 m_savedScrollOffset = mainFrame()->scrollOffset(); |
3092 } | 3060 } |
3093 | 3061 |
3094 void WebViewImpl::restoreScrollAndScaleState() | 3062 void WebViewImpl::restoreScrollAndScaleState() |
3095 { | 3063 { |
(...skipping 11 matching lines...) Expand all Loading... |
3107 } | 3075 } |
3108 | 3076 |
3109 void WebViewImpl::resetScrollAndScaleState() | 3077 void WebViewImpl::resetScrollAndScaleState() |
3110 { | 3078 { |
3111 page()->setPageScaleFactor(1, IntPoint()); | 3079 page()->setPageScaleFactor(1, IntPoint()); |
3112 | 3080 |
3113 // Clear out the values for the current history item. This will prevent the
history item from clobbering the | 3081 // Clear out the values for the current history item. This will prevent the
history item from clobbering the |
3114 // value determined during page scale initialization, which may be less than
1. | 3082 // value determined during page scale initialization, which may be less than
1. |
3115 page()->mainFrame()->loader()->history()->saveDocumentAndScrollState(); | 3083 page()->mainFrame()->loader()->history()->saveDocumentAndScrollState(); |
3116 page()->mainFrame()->loader()->history()->clearScrollPositionAndViewState(); | 3084 page()->mainFrame()->loader()->history()->clearScrollPositionAndViewState(); |
3117 m_pageScaleFactorIsSet = false; | 3085 m_viewportAttributesManager.setNeedsReset(true); |
3118 | 3086 |
3119 // Clobber saved scales and scroll offsets. | 3087 // Clobber saved scales and scroll offsets. |
3120 if (FrameView* view = page()->mainFrame()->document()->view()) | 3088 if (FrameView* view = page()->mainFrame()->document()->view()) |
3121 view->cacheCurrentScrollPosition(); | 3089 view->cacheCurrentScrollPosition(); |
3122 resetSavedScrollAndScaleState(); | 3090 resetSavedScrollAndScaleState(); |
3123 } | 3091 } |
3124 | 3092 |
3125 WebSize WebViewImpl::fixedLayoutSize() const | 3093 WebSize WebViewImpl::fixedLayoutSize() const |
3126 { | 3094 { |
3127 if (!page()) | 3095 if (!page()) |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3639 if (isNewNavigation) | 3607 if (isNewNavigation) |
3640 *isNewNavigation = m_observedNewNavigation; | 3608 *isNewNavigation = m_observedNewNavigation; |
3641 | 3609 |
3642 #ifndef NDEBUG | 3610 #ifndef NDEBUG |
3643 ASSERT(!m_observedNewNavigation | 3611 ASSERT(!m_observedNewNavigation |
3644 || m_page->mainFrame()->loader()->documentLoader() == m_newNavigationLoa
der); | 3612 || m_page->mainFrame()->loader()->documentLoader() == m_newNavigationLoa
der); |
3645 m_newNavigationLoader = 0; | 3613 m_newNavigationLoader = 0; |
3646 #endif | 3614 #endif |
3647 m_observedNewNavigation = false; | 3615 m_observedNewNavigation = false; |
3648 if (*isNewNavigation && !isNavigationWithinPage) | 3616 if (*isNewNavigation && !isNavigationWithinPage) |
3649 m_pageScaleFactorIsSet = false; | 3617 m_viewportAttributesManager.setNeedsReset(true); |
3650 | 3618 |
3651 // Make sure link highlight from previous page is cleared. | 3619 // Make sure link highlight from previous page is cleared. |
3652 m_linkHighlight.clear(); | 3620 m_linkHighlight.clear(); |
3653 m_gestureAnimation.clear(); | 3621 m_gestureAnimation.clear(); |
3654 if (m_layerTreeView) | 3622 if (m_layerTreeView) |
3655 m_layerTreeView->didStopFlinging(); | 3623 m_layerTreeView->didStopFlinging(); |
3656 resetSavedScrollAndScaleState(); | 3624 resetSavedScrollAndScaleState(); |
3657 } | 3625 } |
3658 | 3626 |
3659 void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) | 3627 void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) |
3660 { | 3628 { |
3661 if (!m_client || webframe != mainFrameImpl()) | 3629 if (!m_client || webframe != mainFrameImpl()) |
3662 return; | 3630 return; |
3663 | 3631 |
3664 if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame
()->view()) { | 3632 if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame
()->view()) { |
3665 WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size()
; | 3633 WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size()
; |
3666 if (frameSize != m_size) { | 3634 if (frameSize != m_size) { |
3667 m_size = frameSize; | 3635 m_size = frameSize; |
3668 m_client->didAutoResize(m_size); | 3636 m_client->didAutoResize(m_size); |
3669 sendResizeEventAndRepaint(); | 3637 sendResizeEventAndRepaint(); |
3670 } | 3638 } |
3671 } | 3639 } |
3672 | 3640 |
3673 if (settings()->viewportEnabled()) { | 3641 if (m_viewportAttributesManager.constraintsDirty()) |
3674 if (!isPageScaleFactorSet()) { | 3642 refreshPageScaleFactorAfterLayout(); |
3675 // If the viewport tag failed to be processed earlier, we need | |
3676 // to recompute it now. | |
3677 ViewportArguments viewportArguments = mainFrameImpl()->frame()->docu
ment()->viewportArguments(); | |
3678 m_page->chrome()->client()->dispatchViewportPropertiesDidChange(view
portArguments); | |
3679 } | |
3680 | |
3681 // Contents size is an input to the page scale limits, so a good time to | |
3682 // recalculate is after layout has occurred. | |
3683 computePageScaleFactorLimits(); | |
3684 | |
3685 // Relayout immediately to avoid violating the rule that needsLayout() | |
3686 // isn't set at the end of a layout. | |
3687 FrameView* view = mainFrameImpl()->frameView(); | |
3688 if (view && view->needsLayout()) | |
3689 view->layout(); | |
3690 } | |
3691 | 3643 |
3692 m_client->didUpdateLayout(); | 3644 m_client->didUpdateLayout(); |
3693 | |
3694 } | 3645 } |
3695 | 3646 |
3696 void WebViewImpl::didChangeContentsSize() | 3647 void WebViewImpl::didChangeContentsSize() |
3697 { | 3648 { |
| 3649 m_viewportAttributesManager.didChangeContentsSize(contentsSize(), pageScaleF
actor()); |
3698 } | 3650 } |
3699 | 3651 |
3700 void WebViewImpl::deviceOrPageScaleFactorChanged() | 3652 void WebViewImpl::deviceOrPageScaleFactorChanged() |
3701 { | 3653 { |
3702 if (pageScaleFactor() && pageScaleFactor() != 1) | 3654 if (pageScaleFactor() && pageScaleFactor() != 1) |
3703 enterForceCompositingMode(true); | 3655 enterForceCompositingMode(true); |
| 3656 m_viewportAttributesManager.setNeedsReset(false); |
3704 updateLayerTreeViewport(); | 3657 updateLayerTreeViewport(); |
3705 } | 3658 } |
3706 | 3659 |
3707 bool WebViewImpl::useExternalPopupMenus() | 3660 bool WebViewImpl::useExternalPopupMenus() |
3708 { | 3661 { |
3709 return shouldUseExternalPopupMenus; | 3662 return shouldUseExternalPopupMenus; |
3710 } | 3663 } |
3711 | 3664 |
3712 void WebViewImpl::setEmulatedTextZoomFactor(float textZoomFactor) | 3665 void WebViewImpl::setEmulatedTextZoomFactor(float textZoomFactor) |
3713 { | 3666 { |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4016 m_nonCompositedContentHost->setOpaque(!isTransparent()); | 3969 m_nonCompositedContentHost->setOpaque(!isTransparent()); |
4017 | 3970 |
4018 m_client->initializeLayerTreeView(); | 3971 m_client->initializeLayerTreeView(); |
4019 m_layerTreeView = m_client->layerTreeView(); | 3972 m_layerTreeView = m_client->layerTreeView(); |
4020 if (m_layerTreeView) { | 3973 if (m_layerTreeView) { |
4021 m_layerTreeView->setRootLayer(*m_rootLayer); | 3974 m_layerTreeView->setRootLayer(*m_rootLayer); |
4022 | 3975 |
4023 bool visible = page()->visibilityState() == PageVisibilityStateVisib
le; | 3976 bool visible = page()->visibilityState() == PageVisibilityStateVisib
le; |
4024 m_layerTreeView->setVisible(visible); | 3977 m_layerTreeView->setVisible(visible); |
4025 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor()); | 3978 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor()); |
4026 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_mi
nimumPageScaleFactor, m_maximumPageScaleFactor); | |
4027 m_layerTreeView->setHasTransparentBackground(isTransparent()); | 3979 m_layerTreeView->setHasTransparentBackground(isTransparent()); |
4028 updateLayerTreeViewport(); | 3980 updateLayerTreeViewport(); |
4029 m_client->didActivateCompositor(m_inputHandlerIdentifier); | 3981 m_client->didActivateCompositor(m_inputHandlerIdentifier); |
4030 m_isAcceleratedCompositingActive = true; | 3982 m_isAcceleratedCompositingActive = true; |
4031 m_compositorCreationFailed = false; | 3983 m_compositorCreationFailed = false; |
4032 if (m_pageOverlays) | 3984 if (m_pageOverlays) |
4033 m_pageOverlays->update(); | 3985 m_pageOverlays->update(); |
4034 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); | 3986 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); |
4035 m_layerTreeView->setShowPaintRects(m_showPaintRects); | 3987 m_layerTreeView->setShowPaintRects(m_showPaintRects); |
4036 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); | 3988 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4105 m_pageOverlays->update(); | 4057 m_pageOverlays->update(); |
4106 } | 4058 } |
4107 | 4059 |
4108 void WebViewImpl::updateLayerTreeViewport() | 4060 void WebViewImpl::updateLayerTreeViewport() |
4109 { | 4061 { |
4110 if (!page() || !m_nonCompositedContentHost || !m_layerTreeView) | 4062 if (!page() || !m_nonCompositedContentHost || !m_layerTreeView) |
4111 return; | 4063 return; |
4112 | 4064 |
4113 FrameView* view = page()->mainFrame()->view(); | 4065 FrameView* view = page()->mainFrame()->view(); |
4114 m_nonCompositedContentHost->setViewport(m_size, view->contentsSize(), view->
scrollPosition(), view->scrollOrigin()); | 4066 m_nonCompositedContentHost->setViewport(m_size, view->contentsSize(), view->
scrollPosition(), view->scrollOrigin()); |
4115 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPag
eScaleFactor, m_maximumPageScaleFactor); | 4067 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS
caleFactor(), maximumPageScaleFactor()); |
4116 } | 4068 } |
4117 | 4069 |
4118 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) | 4070 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) |
4119 { | 4071 { |
4120 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio
nsCount()) | 4072 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio
nsCount()) |
4121 m_autofillPopupClient->valueChanged(listIndex); | 4073 m_autofillPopupClient->valueChanged(listIndex); |
4122 } | 4074 } |
4123 | 4075 |
4124 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) | 4076 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) |
4125 { | 4077 { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4211 } | 4163 } |
4212 | 4164 |
4213 bool WebViewImpl::shouldDisableDesktopWorkarounds() | 4165 bool WebViewImpl::shouldDisableDesktopWorkarounds() |
4214 { | 4166 { |
4215 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport
Arguments(); | 4167 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport
Arguments(); |
4216 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments.
userZoom | 4168 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments.
userZoom |
4217 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp
ortArguments::ValueAuto); | 4169 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp
ortArguments::ValueAuto); |
4218 } | 4170 } |
4219 | 4171 |
4220 } // namespace WebKit | 4172 } // namespace WebKit |
OLD | NEW |