Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Side by Side Diff: Source/WebKit/chromium/src/WebViewImpl.cpp

Issue 14813025: Refactor viewport initialization logic out of WebViewImpl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix webkit_unit_tests Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 namespace WebKit { 207 namespace WebKit {
208 208
209 // Change the text zoom level by kTextSizeMultiplierRatio each time the user 209 // Change the text zoom level by kTextSizeMultiplierRatio each time the user
210 // zooms text in or out (ie., change by 20%). The min and max values limit 210 // zooms text in or out (ie., change by 20%). The min and max values limit
211 // text zoom to half and 3x the original text size. These three values match 211 // text zoom to half and 3x the original text size. These three values match
212 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm 212 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm
213 const double WebView::textSizeMultiplierRatio = 1.2; 213 const double WebView::textSizeMultiplierRatio = 1.2;
214 const double WebView::minTextSizeMultiplier = 0.5; 214 const double WebView::minTextSizeMultiplier = 0.5;
215 const double WebView::maxTextSizeMultiplier = 3.0; 215 const double WebView::maxTextSizeMultiplier = 3.0;
216 const float WebView::minPageScaleFactor = 0.25f;
217 const float WebView::maxPageScaleFactor = 4.0f;
218 216
219 // Used to defer all page activity in cases where the embedder wishes to run 217 // Used to defer all page activity in cases where the embedder wishes to run
220 // a nested event loop. Using a stack enables nesting of message loop invocation s. 218 // a nested event loop. Using a stack enables nesting of message loop invocation s.
221 static Vector<PageGroupLoadDeferrer*>& pageGroupLoadDeferrerStack() 219 static Vector<PageGroupLoadDeferrer*>& pageGroupLoadDeferrerStack()
222 { 220 {
223 DEFINE_STATIC_LOCAL(Vector<PageGroupLoadDeferrer*>, deferrerStack, ()); 221 DEFINE_STATIC_LOCAL(Vector<PageGroupLoadDeferrer*>, deferrerStack, ());
224 return deferrerStack; 222 return deferrerStack;
225 } 223 }
226 224
227 // Ensure that the WebDragOperation enum values stay in sync with the original 225 // Ensure that the WebDragOperation enum values stay in sync with the original
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 , m_inspectorClientImpl(this) 379 , m_inspectorClientImpl(this)
382 , m_backForwardClientImpl(this) 380 , m_backForwardClientImpl(this)
383 , m_shouldAutoResize(false) 381 , m_shouldAutoResize(false)
384 , m_observedNewNavigation(false) 382 , m_observedNewNavigation(false)
385 #ifndef NDEBUG 383 #ifndef NDEBUG
386 , m_newNavigationLoader(0) 384 , m_newNavigationLoader(0)
387 #endif 385 #endif
388 , m_zoomLevel(0) 386 , m_zoomLevel(0)
389 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) 387 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier))
390 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) 388 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier))
391 , m_pageDefinedMinimumPageScaleFactor(-1)
392 , m_pageDefinedMaximumPageScaleFactor(-1)
393 , m_minimumPageScaleFactor(minPageScaleFactor)
394 , m_maximumPageScaleFactor(maxPageScaleFactor)
395 , m_initialPageScaleFactorOverride(-1)
396 , m_initialPageScaleFactor(-1)
397 , m_ignoreViewportTagMaximumScale(false)
398 , m_pageScaleFactorIsSet(false)
399 , m_savedPageScaleFactor(0) 389 , m_savedPageScaleFactor(0)
400 , m_doubleTapZoomPageScaleFactor(0) 390 , m_doubleTapZoomPageScaleFactor(0)
401 , m_doubleTapZoomPending(false) 391 , m_doubleTapZoomPending(false)
402 , m_enableFakeDoubleTapAnimationForTesting(false) 392 , m_enableFakeDoubleTapAnimationForTesting(false)
403 , m_fakeDoubleTapPageScaleFactor(0) 393 , m_fakeDoubleTapPageScaleFactor(0)
404 , m_fakeDoubleTapUseAnchor(false) 394 , m_fakeDoubleTapUseAnchor(false)
405 , m_contextMenuAllowed(false) 395 , m_contextMenuAllowed(false)
406 , m_doingDragAndDrop(false) 396 , m_doingDragAndDrop(false)
407 , m_ignoreInputEvents(false) 397 , m_ignoreInputEvents(false)
408 , m_suppressNextKeypressEvent(false) 398 , m_suppressNextKeypressEvent(false)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 #if ENABLE(BATTERY_STATUS) 472 #if ENABLE(BATTERY_STATUS)
483 provideBatteryTo(m_page.get(), m_batteryClient.get()); 473 provideBatteryTo(m_page.get(), m_batteryClient.get());
484 m_batteryClient->setController(BatteryController::from(m_page.get())); 474 m_batteryClient->setController(BatteryController::from(m_page.get()));
485 #endif 475 #endif
486 476
487 m_page->setGroupType(Page::SharedPageGroup); 477 m_page->setGroupType(Page::SharedPageGroup);
488 478
489 unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout; 479 unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout;
490 m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones)) ; 480 m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones)) ;
491 481
492 if (m_client) 482 if (m_client) {
483 setDeviceScaleFactor(m_client->screenInfo().deviceScaleFactor);
493 setVisibilityState(m_client->visibilityState(), true); 484 setVisibilityState(m_client->visibilityState(), true);
485 }
494 486
495 m_inspectorSettingsMap = adoptPtr(new SettingsMap); 487 m_inspectorSettingsMap = adoptPtr(new SettingsMap);
496 } 488 }
497 489
498 WebViewImpl::~WebViewImpl() 490 WebViewImpl::~WebViewImpl()
499 { 491 {
500 ASSERT(!m_page); 492 ASSERT(!m_page);
501 } 493 }
502 494
503 RenderTheme* WebViewImpl::theme() const 495 RenderTheme* WebViewImpl::theme() const
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 m_contextMenuAllowed = false; 783 m_contextMenuAllowed = false;
792 784
793 break; 785 break;
794 } 786 }
795 case WebInputEvent::GestureTapDown: { 787 case WebInputEvent::GestureTapDown: {
796 m_client->cancelScheduledContentIntents(); 788 m_client->cancelScheduledContentIntents();
797 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGesture Event(platformEvent); 789 eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGesture Event(platformEvent);
798 break; 790 break;
799 } 791 }
800 case WebInputEvent::GestureDoubleTap: 792 case WebInputEvent::GestureDoubleTap:
801 if (m_webSettings->doubleTapToZoomEnabled() && m_minimumPageScaleFactor != m_maximumPageScaleFactor) { 793 if (m_webSettings->doubleTapToZoomEnabled() && minimumPageScaleFactor() != maximumPageScaleFactor()) {
802 m_client->cancelScheduledContentIntents(); 794 m_client->cancelScheduledContentIntents();
803 animateZoomAroundPoint(platformEvent.position(), DoubleTap); 795 animateZoomAroundPoint(platformEvent.position(), DoubleTap);
804 } 796 }
805 // GestureDoubleTap is currently only used by Android for zooming. For W ebCore, 797 // GestureDoubleTap is currently only used by Android for zooming. For W ebCore,
806 // GestureTap with tap count = 2 is used instead. So we drop GestureDoub leTap here. 798 // GestureTap with tap count = 2 is used instead. So we drop GestureDoub leTap here.
807 eventSwallowed = true; 799 eventSwallowed = true;
808 break; 800 break;
809 case WebInputEvent::GestureScrollBegin: 801 case WebInputEvent::GestureScrollBegin:
810 case WebInputEvent::GesturePinchBegin: 802 case WebInputEvent::GesturePinchBegin:
811 m_client->cancelScheduledContentIntents(); 803 m_client->cancelScheduledContentIntents();
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 // be visible). FIXME: Revisit this if it isn't always true. 1152 // be visible). FIXME: Revisit this if it isn't always true.
1161 return; 1153 return;
1162 } 1154 }
1163 1155
1164 bool scaleUnchanged = true; 1156 bool scaleUnchanged = true;
1165 if (!rect.isEmpty()) { 1157 if (!rect.isEmpty()) {
1166 // Pages should be as legible as on desktop when at dpi scale, so no 1158 // Pages should be as legible as on desktop when at dpi scale, so no
1167 // need to zoom in further when automatically determining zoom level 1159 // need to zoom in further when automatically determining zoom level
1168 // (after double tap, find in page, etc), though the user should still 1160 // (after double tap, find in page, etc), though the user should still
1169 // be allowed to manually pinch zoom in further if they desire. 1161 // be allowed to manually pinch zoom in further if they desire.
1170 const float defaultScaleWhenAlreadyLegible = m_minimumPageScaleFactor * doubleTapZoomAlreadyLegibleRatio; 1162 const float defaultScaleWhenAlreadyLegible = minimumPageScaleFactor() * doubleTapZoomAlreadyLegibleRatio;
1171 float legibleScale = 1; 1163 float legibleScale = 1;
1172 if (page() && page()->settings()) 1164 if (page() && page()->settings())
1173 legibleScale *= page()->settings()->textAutosizingFontScaleFactor(); 1165 legibleScale *= page()->settings()->textAutosizingFontScaleFactor();
1174 if (legibleScale < defaultScaleWhenAlreadyLegible) 1166 if (legibleScale < defaultScaleWhenAlreadyLegible)
1175 legibleScale = (scale == m_minimumPageScaleFactor) ? defaultScaleWhe nAlreadyLegible : m_minimumPageScaleFactor; 1167 legibleScale = (scale == minimumPageScaleFactor()) ? defaultScaleWhe nAlreadyLegible : minimumPageScaleFactor();
1176 1168
1177 float defaultMargin = doubleTapZoomContentDefaultMargin; 1169 float defaultMargin = doubleTapZoomContentDefaultMargin;
1178 float minimumMargin = doubleTapZoomContentMinimumMargin; 1170 float minimumMargin = doubleTapZoomContentMinimumMargin;
1179 // We want the margins to have the same physical size, which means we 1171 // We want the margins to have the same physical size, which means we
1180 // need to express them in post-scale size. To do that we'd need to know 1172 // need to express them in post-scale size. To do that we'd need to know
1181 // the scale we're scaling to, but that depends on the margins. Instead 1173 // the scale we're scaling to, but that depends on the margins. Instead
1182 // we express them as a fraction of the target rectangle: this will be 1174 // we express them as a fraction of the target rectangle: this will be
1183 // correct if we end up fully zooming to it, and won't matter if we 1175 // correct if we end up fully zooming to it, and won't matter if we
1184 // don't. 1176 // don't.
1185 rect = widenRectWithinPageBounds(rect, 1177 rect = widenRectWithinPageBounds(rect,
1186 static_cast<int>(defaultMargin * rect.width / m_size.width), 1178 static_cast<int>(defaultMargin * rect.width / m_size.width),
1187 static_cast<int>(minimumMargin * rect.width / m_size.width)); 1179 static_cast<int>(minimumMargin * rect.width / m_size.width));
1188 // Fit block to screen, respecting limits. 1180 // Fit block to screen, respecting limits.
1189 scale = static_cast<float>(m_size.width) / rect.width; 1181 scale = static_cast<float>(m_size.width) / rect.width;
1190 scale = min(scale, legibleScale); 1182 scale = min(scale, legibleScale);
1191 scale = clampPageScaleFactorToLimits(scale); 1183 scale = clampPageScaleFactorToLimits(scale);
1192 1184
1193 scaleUnchanged = fabs(pageScaleFactor() - scale) < minScaleDifference; 1185 scaleUnchanged = fabs(pageScaleFactor() - scale) < minScaleDifference;
1194 } 1186 }
1195 1187
1196 bool stillAtPreviousDoubleTapScale = (pageScaleFactor() == m_doubleTapZoomPa geScaleFactor 1188 bool stillAtPreviousDoubleTapScale = (pageScaleFactor() == m_doubleTapZoomPa geScaleFactor
1197 && m_doubleTapZoomPageScaleFactor != m_minimumPageScaleFactor) 1189 && m_doubleTapZoomPageScaleFactor != minimumPageScaleFactor())
1198 || m_doubleTapZoomPending; 1190 || m_doubleTapZoomPending;
1199 if (zoomType == DoubleTap && (rect.isEmpty() || scaleUnchanged || stillAtPre viousDoubleTapScale)) { 1191 if (zoomType == DoubleTap && (rect.isEmpty() || scaleUnchanged || stillAtPre viousDoubleTapScale)) {
1200 // Zoom out to minimum scale. 1192 // Zoom out to minimum scale.
1201 scale = m_minimumPageScaleFactor; 1193 scale = minimumPageScaleFactor();
1202 scroll = WebPoint(hitRect.x, hitRect.y); 1194 scroll = WebPoint(hitRect.x, hitRect.y);
1203 isAnchor = true; 1195 isAnchor = true;
1204 } else { 1196 } else {
1205 // FIXME: If this is being called for auto zoom during find in page, 1197 // FIXME: If this is being called for auto zoom during find in page,
1206 // then if the user manually zooms in it'd be nice to preserve the 1198 // then if the user manually zooms in it'd be nice to preserve the
1207 // relative increase in zoom they caused (if they zoom out then it's ok 1199 // relative increase in zoom they caused (if they zoom out then it's ok
1208 // to zoom them back in again). This isn't compatible with our current 1200 // to zoom them back in again). This isn't compatible with our current
1209 // double-tap zoom strategy (fitting the containing block to the screen) 1201 // double-tap zoom strategy (fitting the containing block to the screen)
1210 // though. 1202 // though.
1211 1203
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 { 1586 {
1595 if (mainFrameImpl() && mainFrameImpl()->frameView()) 1587 if (mainFrameImpl() && mainFrameImpl()->frameView())
1596 mainFrameImpl()->frameView()->willStartLiveResize(); 1588 mainFrameImpl()->frameView()->willStartLiveResize();
1597 1589
1598 Frame* frame = mainFrameImpl()->frame(); 1590 Frame* frame = mainFrameImpl()->frame();
1599 WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromF rame(frame); 1591 WebPluginContainerImpl* pluginContainer = WebFrameImpl::pluginContainerFromF rame(frame);
1600 if (pluginContainer) 1592 if (pluginContainer)
1601 pluginContainer->willStartLiveResize(); 1593 pluginContainer->willStartLiveResize();
1602 } 1594 }
1603 1595
1604 IntSize WebViewImpl::scaledSize(float pageScaleFactor) const
1605 {
1606 FloatSize scaledSize = IntSize(m_size);
1607 scaledSize.scale(1 / pageScaleFactor);
1608 return expandedIntSize(scaledSize);
1609 }
1610
1611 WebSize WebViewImpl::size() 1596 WebSize WebViewImpl::size()
1612 { 1597 {
1613 return m_size; 1598 return m_size;
1614 } 1599 }
1615 1600
1616 void WebViewImpl::resize(const WebSize& newSize) 1601 void WebViewImpl::resize(const WebSize& newSize)
1617 { 1602 {
1618 if (m_shouldAutoResize || m_size == newSize) 1603 if (m_shouldAutoResize || m_size == newSize)
1619 return; 1604 return;
1620 1605
1621 FrameView* view = mainFrameImpl()->frameView(); 1606 FrameView* view = mainFrameImpl()->frameView();
1622 if (!view) 1607 if (!view)
1623 return; 1608 return;
1624 1609
1625 WebSize oldSize = m_size; 1610 WebSize oldSize = m_size;
1626 float oldPageScaleFactor = pageScaleFactor(); 1611 float oldPageScaleFactor = pageScaleFactor();
1627 int oldContentsWidth = contentsSize().width(); 1612 int oldContentsWidth = contentsSize().width();
1628 1613
1629 m_size = newSize; 1614 m_size = newSize;
1630 1615
1631 bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() && oldSi ze.width && oldContentsWidth; 1616 bool shouldAnchorAndRescaleViewport = settings()->viewportEnabled() && oldSi ze.width && oldContentsWidth;
1632 ViewportAnchor viewportAnchor(mainFrameImpl()->frame()->eventHandler()); 1617 ViewportAnchor viewportAnchor(mainFrameImpl()->frame()->eventHandler());
1633 if (shouldAnchorAndRescaleViewport) { 1618 if (shouldAnchorAndRescaleViewport) {
1634 viewportAnchor.setAnchor(view->visibleContentRect(), 1619 viewportAnchor.setAnchor(view->visibleContentRect(),
1635 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord)); 1620 FloatSize(viewportAnchorXCoord, viewportAnchorY Coord));
1636 } 1621 }
1637 1622
1638 ViewportArguments viewportArguments = mainFrameImpl()->frame()->document()-> viewportArguments(); 1623 // Set the fixed layout size from the viewport constraints before resizing.
1639 m_page->chrome()->client()->dispatchViewportPropertiesDidChange(viewportArgu ments); 1624 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments());
1640 1625
1641 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); 1626 WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
1642 if (agentPrivate) 1627 if (agentPrivate)
1643 agentPrivate->webViewResized(newSize); 1628 agentPrivate->webViewResized(newSize);
1644 if (!agentPrivate || !agentPrivate->metricsOverridden()) { 1629 if (!agentPrivate || !agentPrivate->metricsOverridden()) {
1645 WebFrameImpl* webFrame = mainFrameImpl(); 1630 WebFrameImpl* webFrame = mainFrameImpl();
1646 if (webFrame->frameView()) 1631 if (webFrame->frameView())
1647 webFrame->frameView()->resize(m_size); 1632 webFrame->frameView()->resize(m_size);
1648 } 1633 }
1649 1634
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2828 { 2813 {
2829 return pow(textSizeMultiplierRatio, zoomLevel); 2814 return pow(textSizeMultiplierRatio, zoomLevel);
2830 } 2815 }
2831 2816
2832 double WebView::zoomFactorToZoomLevel(double factor) 2817 double WebView::zoomFactorToZoomLevel(double factor)
2833 { 2818 {
2834 // Since factor = 1.2^level, level = log(factor) / log(1.2) 2819 // Since factor = 1.2^level, level = log(factor) / log(1.2)
2835 return log(factor) / log(textSizeMultiplierRatio); 2820 return log(factor) / log(textSizeMultiplierRatio);
2836 } 2821 }
2837 2822
2838 void WebViewImpl::setInitialPageScaleOverride(float initialPageScaleFactorOverri de)
2839 {
2840 if (m_initialPageScaleFactorOverride == initialPageScaleFactorOverride)
2841 return;
2842 m_initialPageScaleFactorOverride = initialPageScaleFactorOverride;
2843 m_pageScaleFactorIsSet = false;
2844 computePageScaleFactorLimits();
2845 }
2846
2847 float WebViewImpl::pageScaleFactor() const 2823 float WebViewImpl::pageScaleFactor() const
2848 { 2824 {
2849 if (!page()) 2825 if (!page())
2850 return 1; 2826 return 1;
2851 2827
2852 return page()->pageScaleFactor(); 2828 return page()->pageScaleFactor();
2853 } 2829 }
2854 2830
2855 bool WebViewImpl::isPageScaleFactorSet() const 2831 float WebViewImpl::clampPageScaleFactorToLimits(float scaleFactor) const
2856 { 2832 {
2857 return m_pageScaleFactorIsSet; 2833 return m_pageScaleConstraintsSet.finalConstraints().clampToConstraints(scale Factor);
2858 } 2834 }
2859 2835
2860 float WebViewImpl::clampPageScaleFactorToLimits(float scaleFactor) 2836 IntPoint WebViewImpl::clampOffsetAtScale(const IntPoint& offset, float scale)
2861 { 2837 {
2862 return min(max(scaleFactor, m_minimumPageScaleFactor), m_maximumPageScaleFac tor); 2838 FrameView* view = mainFrameImpl()->frameView();
2863 } 2839 if (!view)
2840 return offset;
2864 2841
2865 IntPoint WebViewImpl::clampOffsetAtScale(const IntPoint& offset, float scale) co nst 2842 IntPoint maxScrollExtent(contentsSize().width() - view->scrollOrigin().x(), contentsSize().height() - view->scrollOrigin().y());
2866 { 2843 FloatSize scaledSize = view->unscaledVisibleContentSize();
2844 scaledSize.scale(1 / scale);
2845
2867 IntPoint clampedOffset = offset; 2846 IntPoint clampedOffset = offset;
2868 clampedOffset = clampedOffset.shrunkTo(IntPoint(contentsSize() - scaledSize( scale))); 2847 clampedOffset = clampedOffset.shrunkTo(maxScrollExtent - expandedIntSize(sca ledSize));
2869 clampedOffset.clampNegativeToZero(); 2848 clampedOffset = clampedOffset.expandedTo(-view->scrollOrigin());
2870 2849
2871 return clampedOffset; 2850 return clampedOffset;
2872 } 2851 }
2873 2852
2874 void WebViewImpl::setPageScaleFactorPreservingScrollOffset(float scaleFactor)
2875 {
2876 scaleFactor = clampPageScaleFactorToLimits(scaleFactor);
2877
2878 IntPoint scrollOffset(mainFrame()->scrollOffset().width, mainFrame()->scroll Offset().height);
2879 scrollOffset = clampOffsetAtScale(scrollOffset, scaleFactor);
2880
2881 setPageScaleFactor(scaleFactor, scrollOffset);
2882 }
2883
2884 void WebViewImpl::setPageScaleFactor(float scaleFactor, const WebPoint& origin) 2853 void WebViewImpl::setPageScaleFactor(float scaleFactor, const WebPoint& origin)
2885 { 2854 {
2886 if (!page()) 2855 if (!page())
2887 return; 2856 return;
2888 2857
2889 if (!scaleFactor)
2890 scaleFactor = 1;
2891
2892 IntPoint newScrollOffset = origin; 2858 IntPoint newScrollOffset = origin;
2893 scaleFactor = clampPageScaleFactorToLimits(scaleFactor); 2859 scaleFactor = clampPageScaleFactorToLimits(scaleFactor);
2894 newScrollOffset = clampOffsetAtScale(newScrollOffset, scaleFactor); 2860 newScrollOffset = clampOffsetAtScale(newScrollOffset, scaleFactor);
2895 2861
2896 Frame* frame = page()->mainFrame(); 2862 page()->setPageScaleFactor(scaleFactor, newScrollOffset);
2897 FrameView* view = frame->view(); 2863 }
2898 IntPoint oldScrollOffset = view->scrollPosition();
2899 2864
2900 // Adjust the page scale in two steps. First, without change to scroll 2865 void WebViewImpl::setPageScaleFactorPreservingScrollOffset(float scaleFactor)
2901 // position, and then with a user scroll to the desired position. 2866 {
2902 // We do this because Page::setPageScaleFactor calls 2867 if (clampPageScaleFactorToLimits(scaleFactor) == pageScaleFactor())
2903 // FrameView::setScrollPosition which is a programmatic scroll 2868 return;
2904 // and we need this method to perform only user scrolls.
2905 page()->setPageScaleFactor(scaleFactor, oldScrollOffset);
2906 if (newScrollOffset != oldScrollOffset)
2907 updateMainFrameScrollPosition(newScrollOffset, false);
2908 2869
2909 m_pageScaleFactorIsSet = true; 2870 IntPoint scrollOffset(mainFrame()->scrollOffset().width, mainFrame()->scroll Offset().height);
2871 setPageScaleFactor(scaleFactor, scrollOffset);
2910 } 2872 }
2911 2873
2912 float WebViewImpl::deviceScaleFactor() const 2874 float WebViewImpl::deviceScaleFactor() const
2913 { 2875 {
2914 if (!page()) 2876 if (!page())
2915 return 1; 2877 return 1;
2916 2878
2917 return page()->deviceScaleFactor(); 2879 return page()->deviceScaleFactor();
2918 } 2880 }
2919 2881
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2964 m_maxAutoSize = maxSize; 2926 m_maxAutoSize = maxSize;
2965 configureAutoResizeMode(); 2927 configureAutoResizeMode();
2966 } 2928 }
2967 2929
2968 void WebViewImpl::disableAutoResizeMode() 2930 void WebViewImpl::disableAutoResizeMode()
2969 { 2931 {
2970 m_shouldAutoResize = false; 2932 m_shouldAutoResize = false;
2971 configureAutoResizeMode(); 2933 configureAutoResizeMode();
2972 } 2934 }
2973 2935
2936 void WebViewImpl::setUserAgentPageScaleConstraints(PageScaleConstraints newConst raints)
2937 {
2938 if (newConstraints == m_pageScaleConstraintsSet.userAgentConstraints())
2939 return;
2940
2941 m_pageScaleConstraintsSet.setUserAgentConstraints(newConstraints);
2942
2943 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
2944 return;
2945
2946 mainFrameImpl()->frameView()->setNeedsLayout();
2947 }
2948
2949 void WebViewImpl::setInitialPageScaleOverride(float initialPageScaleFactorOverri de)
2950 {
2951 PageScaleConstraints constraints = m_pageScaleConstraintsSet.userAgentConstr aints();
2952 constraints.initialScale = initialPageScaleFactorOverride;
2953
2954 if (constraints == m_pageScaleConstraintsSet.userAgentConstraints())
2955 return;
2956
2957 m_pageScaleConstraintsSet.setNeedsReset(true);
2958 setUserAgentPageScaleConstraints(constraints);
2959 }
2960
2974 void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScal e) 2961 void WebViewImpl::setPageScaleFactorLimits(float minPageScale, float maxPageScal e)
2975 { 2962 {
2976 if (minPageScale == m_pageDefinedMinimumPageScaleFactor && maxPageScale == m _pageDefinedMaximumPageScaleFactor) 2963 PageScaleConstraints constraints = m_pageScaleConstraintsSet.userAgentConstr aints();
2964 constraints.minimumScale = minPageScale;
2965 constraints.maximumScale = maxPageScale;
2966 setUserAgentPageScaleConstraints(constraints);
2967 }
2968
2969 void WebViewImpl::setIgnoreViewportTagScaleLimits(bool ignore)
2970 {
2971 PageScaleConstraints constraints = m_pageScaleConstraintsSet.userAgentConstr aints();
2972 if (ignore) {
2973 constraints.minimumScale = m_pageScaleConstraintsSet.defaultConstraints( ).minimumScale;
2974 constraints.maximumScale = m_pageScaleConstraintsSet.defaultConstraints( ).maximumScale;
2975 } else {
2976 constraints.minimumScale = -1;
2977 constraints.maximumScale = -1;
2978 }
2979 setUserAgentPageScaleConstraints(constraints);
2980 }
2981
2982 void WebViewImpl::refreshPageScaleFactorAfterLayout()
2983 {
2984 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()- >view())
2985 return;
2986 FrameView* view = page()->mainFrame()->view();
2987
2988 updatePageDefinedPageScaleConstraints(mainFrameImpl()->frame()->document()-> viewportArguments());
2989 m_pageScaleConstraintsSet.computeFinalConstraints();
2990
2991 if (settings()->viewportEnabled()) {
2992 int verticalScrollbarWidth = 0;
2993 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar())
2994 verticalScrollbarWidth = view->verticalScrollbar()->width();
2995 m_pageScaleConstraintsSet.adjustFinalConstraintsToContentsSize(m_size, c ontentsSize(), verticalScrollbarWidth);
2996 }
2997
2998 float newPageScaleFactor = pageScaleFactor();
2999 if (m_pageScaleConstraintsSet.needsReset() && m_pageScaleConstraintsSet.fina lConstraints().initialScale != -1) {
3000 newPageScaleFactor = m_pageScaleConstraintsSet.finalConstraints().initia lScale;
3001 m_pageScaleConstraintsSet.setNeedsReset(false);
3002 }
3003 setPageScaleFactorPreservingScrollOffset(newPageScaleFactor);
3004
3005 updateLayerTreeViewport();
3006
3007 // Relayout immediately to avoid violating the rule that needsLayout()
3008 // isn't set at the end of a layout.
3009 if (view->needsLayout())
3010 view->layout();
3011 }
3012
3013 void WebViewImpl::updatePageDefinedPageScaleConstraints(const ViewportArguments& arguments)
3014 {
3015 if (!settings()->viewportEnabled() || !isFixedLayoutModeEnabled() || !page() || !m_size.width || !m_size.height)
2977 return; 3016 return;
2978 3017
2979 m_pageDefinedMinimumPageScaleFactor = minPageScale; 3018 m_pageScaleConstraintsSet.updatePageDefinedConstraints(arguments, m_size, pa ge()->settings()->layoutFallbackWidth());
2980 m_pageDefinedMaximumPageScaleFactor = maxPageScale;
2981 3019
2982 if (settings()->viewportEnabled()) { 3020 if (settingsImpl()->supportDeprecatedTargetDensityDPI())
2983 // If we're in viewport tag mode, we need to layout to obtain the latest 3021 m_pageScaleConstraintsSet.adjustPageDefinedConstraintsForAndroidWebView( arguments, m_size, page()->settings()->layoutFallbackWidth(), deviceScaleFactor( ), page()->settings()->useWideViewport(), page()->settings()->loadWithOverviewMo de());
2984 // contents size and compute the final limits.
2985 FrameView* view = mainFrameImpl()->frameView();
2986 if (view)
2987 view->setNeedsLayout();
2988 } else {
2989 // Otherwise just compute the limits immediately.
2990 computePageScaleFactorLimits();
2991 }
2992 }
2993 3022
2994 void WebViewImpl::setIgnoreViewportTagMaximumScale(bool flag) 3023 setFixedLayoutSize(flooredIntSize(m_pageScaleConstraintsSet.pageDefinedConst raints().layoutSize));
2995 {
2996 m_ignoreViewportTagMaximumScale = flag;
2997
2998 if (!page() || !page()->mainFrame())
2999 return;
3000
3001 m_page->chrome()->client()->dispatchViewportPropertiesDidChange(page()->main Frame()->document()->viewportArguments());
3002 } 3024 }
3003 3025
3004 IntSize WebViewImpl::contentsSize() const 3026 IntSize WebViewImpl::contentsSize() const
3005 { 3027 {
3006 RenderView* root = page()->mainFrame()->contentRenderer(); 3028 RenderView* root = page()->mainFrame()->contentRenderer();
3007 if (!root) 3029 if (!root)
3008 return IntSize(); 3030 return IntSize();
3009 return root->documentRect().size(); 3031 return root->documentRect().size();
3010 } 3032 }
3011 3033
3012 void WebViewImpl::computePageScaleFactorLimits()
3013 {
3014 if (!mainFrame() || !page() || !page()->mainFrame() || !page()->mainFrame()- >view())
3015 return;
3016
3017 FrameView* view = page()->mainFrame()->view();
3018
3019 if (m_pageDefinedMinimumPageScaleFactor == -1 || m_pageDefinedMaximumPageSca leFactor == -1) {
3020 m_minimumPageScaleFactor = minPageScaleFactor;
3021 m_maximumPageScaleFactor = maxPageScaleFactor;
3022 } else {
3023 m_minimumPageScaleFactor = min(max(m_pageDefinedMinimumPageScaleFactor, minPageScaleFactor), maxPageScaleFactor);
3024 m_maximumPageScaleFactor = max(min(m_pageDefinedMaximumPageScaleFactor, maxPageScaleFactor), minPageScaleFactor);
3025 }
3026
3027 if (settings()->viewportEnabled()) {
3028 if (!contentsSize().width() || !m_size.width)
3029 return;
3030
3031 // When viewport tag is enabled, the scale needed to see the full
3032 // content width is the default minimum.
3033 int viewWidthNotIncludingScrollbars = m_size.width;
3034 if (view->verticalScrollbar() && !view->verticalScrollbar()->isOverlaySc rollbar())
3035 viewWidthNotIncludingScrollbars -= view->verticalScrollbar()->width( );
3036 m_minimumPageScaleFactor = max(m_minimumPageScaleFactor, static_cast<flo at>(viewWidthNotIncludingScrollbars) / contentsSize().width());
3037 m_maximumPageScaleFactor = max(m_minimumPageScaleFactor, m_maximumPageSc aleFactor);
3038 if (m_initialPageScaleFactorOverride != -1) {
3039 m_minimumPageScaleFactor = min(m_minimumPageScaleFactor, m_initialPa geScaleFactorOverride);
3040 m_maximumPageScaleFactor = max(m_maximumPageScaleFactor, m_initialPa geScaleFactorOverride);
3041 }
3042 }
3043 ASSERT(m_minimumPageScaleFactor <= m_maximumPageScaleFactor);
3044
3045 // Initialize and/or clamp the page scale factor if needed.
3046 float initialPageScaleFactor = m_initialPageScaleFactor;
3047 if (!settings()->viewportEnabled())
3048 initialPageScaleFactor = 1;
3049 if (m_initialPageScaleFactorOverride != -1)
3050 initialPageScaleFactor = m_initialPageScaleFactorOverride;
3051 float newPageScaleFactor = pageScaleFactor();
3052 if (!m_pageScaleFactorIsSet && initialPageScaleFactor != -1) {
3053 newPageScaleFactor = initialPageScaleFactor;
3054 m_pageScaleFactorIsSet = true;
3055 }
3056 newPageScaleFactor = clampPageScaleFactorToLimits(newPageScaleFactor);
3057 if (m_layerTreeView)
3058 m_layerTreeView->setPageScaleFactorAndLimits(newPageScaleFactor, m_minim umPageScaleFactor, m_maximumPageScaleFactor);
3059 if (newPageScaleFactor != pageScaleFactor())
3060 setPageScaleFactorPreservingScrollOffset(newPageScaleFactor);
3061 }
3062
3063 float WebViewImpl::minimumPageScaleFactor() const 3034 float WebViewImpl::minimumPageScaleFactor() const
3064 { 3035 {
3065 return m_minimumPageScaleFactor; 3036 return m_pageScaleConstraintsSet.finalConstraints().minimumScale;
3066 } 3037 }
3067 3038
3068 float WebViewImpl::maximumPageScaleFactor() const 3039 float WebViewImpl::maximumPageScaleFactor() const
3069 { 3040 {
3070 return m_maximumPageScaleFactor; 3041 return m_pageScaleConstraintsSet.finalConstraints().maximumScale;
3071 } 3042 }
3072 3043
3073 void WebViewImpl::saveScrollAndScaleState() 3044 void WebViewImpl::saveScrollAndScaleState()
3074 { 3045 {
3075 m_savedPageScaleFactor = pageScaleFactor(); 3046 m_savedPageScaleFactor = pageScaleFactor();
3076 m_savedScrollOffset = mainFrame()->scrollOffset(); 3047 m_savedScrollOffset = mainFrame()->scrollOffset();
3077 } 3048 }
3078 3049
3079 void WebViewImpl::restoreScrollAndScaleState() 3050 void WebViewImpl::restoreScrollAndScaleState()
3080 { 3051 {
(...skipping 11 matching lines...) Expand all
3092 } 3063 }
3093 3064
3094 void WebViewImpl::resetScrollAndScaleState() 3065 void WebViewImpl::resetScrollAndScaleState()
3095 { 3066 {
3096 page()->setPageScaleFactor(1, IntPoint()); 3067 page()->setPageScaleFactor(1, IntPoint());
3097 3068
3098 // Clear out the values for the current history item. This will prevent the history item from clobbering the 3069 // Clear out the values for the current history item. This will prevent the history item from clobbering the
3099 // value determined during page scale initialization, which may be less than 1. 3070 // value determined during page scale initialization, which may be less than 1.
3100 page()->mainFrame()->loader()->history()->saveDocumentAndScrollState(); 3071 page()->mainFrame()->loader()->history()->saveDocumentAndScrollState();
3101 page()->mainFrame()->loader()->history()->clearScrollPositionAndViewState(); 3072 page()->mainFrame()->loader()->history()->clearScrollPositionAndViewState();
3102 m_pageScaleFactorIsSet = false; 3073 m_pageScaleConstraintsSet.setNeedsReset(true);
3103 3074
3104 // Clobber saved scales and scroll offsets. 3075 // Clobber saved scales and scroll offsets.
3105 if (FrameView* view = page()->mainFrame()->document()->view()) 3076 if (FrameView* view = page()->mainFrame()->document()->view())
3106 view->cacheCurrentScrollPosition(); 3077 view->cacheCurrentScrollPosition();
3107 resetSavedScrollAndScaleState(); 3078 resetSavedScrollAndScaleState();
3108 } 3079 }
3109 3080
3110 WebSize WebViewImpl::fixedLayoutSize() const 3081 WebSize WebViewImpl::fixedLayoutSize() const
3111 { 3082 {
3112 if (!page()) 3083 if (!page())
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
3622 if (isNewNavigation) 3593 if (isNewNavigation)
3623 *isNewNavigation = m_observedNewNavigation; 3594 *isNewNavigation = m_observedNewNavigation;
3624 3595
3625 #ifndef NDEBUG 3596 #ifndef NDEBUG
3626 ASSERT(!m_observedNewNavigation 3597 ASSERT(!m_observedNewNavigation
3627 || m_page->mainFrame()->loader()->documentLoader() == m_newNavigationLoa der); 3598 || m_page->mainFrame()->loader()->documentLoader() == m_newNavigationLoa der);
3628 m_newNavigationLoader = 0; 3599 m_newNavigationLoader = 0;
3629 #endif 3600 #endif
3630 m_observedNewNavigation = false; 3601 m_observedNewNavigation = false;
3631 if (*isNewNavigation && !isNavigationWithinPage) 3602 if (*isNewNavigation && !isNavigationWithinPage)
3632 m_pageScaleFactorIsSet = false; 3603 m_pageScaleConstraintsSet.setNeedsReset(true);
3633 3604
3634 // Make sure link highlight from previous page is cleared. 3605 // Make sure link highlight from previous page is cleared.
3635 m_linkHighlight.clear(); 3606 m_linkHighlight.clear();
3636 m_gestureAnimation.clear(); 3607 m_gestureAnimation.clear();
3637 if (m_layerTreeView) 3608 if (m_layerTreeView)
3638 m_layerTreeView->didStopFlinging(); 3609 m_layerTreeView->didStopFlinging();
3639 resetSavedScrollAndScaleState(); 3610 resetSavedScrollAndScaleState();
3640 } 3611 }
3641 3612
3642 void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) 3613 void WebViewImpl::layoutUpdated(WebFrameImpl* webframe)
3643 { 3614 {
3644 if (!m_client || webframe != mainFrameImpl()) 3615 if (!m_client || webframe != mainFrameImpl())
3645 return; 3616 return;
3646 3617
3647 if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame ()->view()) { 3618 if (m_shouldAutoResize && mainFrameImpl()->frame() && mainFrameImpl()->frame ()->view()) {
3648 WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size() ; 3619 WebSize frameSize = mainFrameImpl()->frame()->view()->frameRect().size() ;
3649 if (frameSize != m_size) { 3620 if (frameSize != m_size) {
3650 m_size = frameSize; 3621 m_size = frameSize;
3651 m_client->didAutoResize(m_size); 3622 m_client->didAutoResize(m_size);
3652 sendResizeEventAndRepaint(); 3623 sendResizeEventAndRepaint();
3653 } 3624 }
3654 } 3625 }
3655 3626
3656 if (settings()->viewportEnabled()) { 3627 if (m_pageScaleConstraintsSet.constraintsDirty())
3657 if (!isPageScaleFactorSet()) { 3628 refreshPageScaleFactorAfterLayout();
3658 // If the viewport tag failed to be processed earlier, we need
3659 // to recompute it now.
3660 ViewportArguments viewportArguments = mainFrameImpl()->frame()->docu ment()->viewportArguments();
3661 m_page->chrome()->client()->dispatchViewportPropertiesDidChange(view portArguments);
3662 }
3663
3664 // Contents size is an input to the page scale limits, so a good time to
3665 // recalculate is after layout has occurred.
3666 computePageScaleFactorLimits();
3667
3668 // Relayout immediately to avoid violating the rule that needsLayout()
3669 // isn't set at the end of a layout.
3670 FrameView* view = mainFrameImpl()->frameView();
3671 if (view && view->needsLayout())
3672 view->layout();
3673 }
3674 3629
3675 m_client->didUpdateLayout(); 3630 m_client->didUpdateLayout();
3676
3677 } 3631 }
3678 3632
3679 void WebViewImpl::didChangeContentsSize() 3633 void WebViewImpl::didChangeContentsSize()
3680 { 3634 {
3635 m_pageScaleConstraintsSet.didChangeContentsSize(contentsSize(), pageScaleFac tor());
3681 } 3636 }
3682 3637
3683 void WebViewImpl::deviceOrPageScaleFactorChanged() 3638 void WebViewImpl::deviceOrPageScaleFactorChanged()
3684 { 3639 {
3685 if (pageScaleFactor() && pageScaleFactor() != 1) 3640 if (pageScaleFactor() && pageScaleFactor() != 1)
3686 enterForceCompositingMode(true); 3641 enterForceCompositingMode(true);
3642 m_pageScaleConstraintsSet.setNeedsReset(false);
3687 updateLayerTreeViewport(); 3643 updateLayerTreeViewport();
3688 } 3644 }
3689 3645
3690 bool WebViewImpl::useExternalPopupMenus() 3646 bool WebViewImpl::useExternalPopupMenus()
3691 { 3647 {
3692 return shouldUseExternalPopupMenus; 3648 return shouldUseExternalPopupMenus;
3693 } 3649 }
3694 3650
3695 void WebViewImpl::setEmulatedTextZoomFactor(float textZoomFactor) 3651 void WebViewImpl::setEmulatedTextZoomFactor(float textZoomFactor)
3696 { 3652 {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
3999 m_nonCompositedContentHost->setOpaque(!isTransparent()); 3955 m_nonCompositedContentHost->setOpaque(!isTransparent());
4000 3956
4001 m_client->initializeLayerTreeView(); 3957 m_client->initializeLayerTreeView();
4002 m_layerTreeView = m_client->layerTreeView(); 3958 m_layerTreeView = m_client->layerTreeView();
4003 if (m_layerTreeView) { 3959 if (m_layerTreeView) {
4004 m_layerTreeView->setRootLayer(*m_rootLayer); 3960 m_layerTreeView->setRootLayer(*m_rootLayer);
4005 3961
4006 bool visible = page()->visibilityState() == PageVisibilityStateVisib le; 3962 bool visible = page()->visibilityState() == PageVisibilityStateVisib le;
4007 m_layerTreeView->setVisible(visible); 3963 m_layerTreeView->setVisible(visible);
4008 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor()); 3964 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor());
4009 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_mi nimumPageScaleFactor, m_maximumPageScaleFactor); 3965 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), mini mumPageScaleFactor(), maximumPageScaleFactor());
4010 m_layerTreeView->setHasTransparentBackground(isTransparent()); 3966 m_layerTreeView->setHasTransparentBackground(isTransparent());
4011 updateLayerTreeViewport(); 3967 updateLayerTreeViewport();
4012 m_client->didActivateCompositor(m_inputHandlerIdentifier); 3968 m_client->didActivateCompositor(m_inputHandlerIdentifier);
4013 m_isAcceleratedCompositingActive = true; 3969 m_isAcceleratedCompositingActive = true;
4014 m_compositorCreationFailed = false; 3970 m_compositorCreationFailed = false;
4015 if (m_pageOverlays) 3971 if (m_pageOverlays)
4016 m_pageOverlays->update(); 3972 m_pageOverlays->update();
4017 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); 3973 m_layerTreeView->setShowFPSCounter(m_showFPSCounter);
4018 m_layerTreeView->setShowPaintRects(m_showPaintRects); 3974 m_layerTreeView->setShowPaintRects(m_showPaintRects);
4019 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); 3975 m_layerTreeView->setShowDebugBorders(m_showDebugBorders);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
4088 m_pageOverlays->update(); 4044 m_pageOverlays->update();
4089 } 4045 }
4090 4046
4091 void WebViewImpl::updateLayerTreeViewport() 4047 void WebViewImpl::updateLayerTreeViewport()
4092 { 4048 {
4093 if (!page() || !m_nonCompositedContentHost || !m_layerTreeView) 4049 if (!page() || !m_nonCompositedContentHost || !m_layerTreeView)
4094 return; 4050 return;
4095 4051
4096 FrameView* view = page()->mainFrame()->view(); 4052 FrameView* view = page()->mainFrame()->view();
4097 m_nonCompositedContentHost->setViewport(m_size, view->contentsSize(), view-> scrollPosition(), view->scrollOrigin()); 4053 m_nonCompositedContentHost->setViewport(m_size, view->contentsSize(), view-> scrollPosition(), view->scrollOrigin());
4098 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPag eScaleFactor, m_maximumPageScaleFactor); 4054 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor());
4099 } 4055 }
4100 4056
4101 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) 4057 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex)
4102 { 4058 {
4103 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio nsCount()) 4059 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio nsCount())
4104 m_autofillPopupClient->valueChanged(listIndex); 4060 m_autofillPopupClient->valueChanged(listIndex);
4105 } 4061 }
4106 4062
4107 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) 4063 bool WebViewImpl::detectContentOnTouch(const WebPoint& position)
4108 { 4064 {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
4194 } 4150 }
4195 4151
4196 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4152 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4197 { 4153 {
4198 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4154 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4199 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4155 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4200 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4156 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4201 } 4157 }
4202 4158
4203 } // namespace WebKit 4159 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698