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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2443753002: Count presence of viewport tag as mobile-friendly
Patch Set: fix naming Created 4 years, 1 month 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
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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 m_imeAcceptEvents(true), 410 m_imeAcceptEvents(true),
411 m_operationsAllowed(WebDragOperationNone), 411 m_operationsAllowed(WebDragOperationNone),
412 m_dragOperation(WebDragOperationNone), 412 m_dragOperation(WebDragOperationNone),
413 m_devToolsEmulator(nullptr), 413 m_devToolsEmulator(nullptr),
414 m_isTransparent(false), 414 m_isTransparent(false),
415 m_tabsToLinks(false), 415 m_tabsToLinks(false),
416 m_layerTreeView(nullptr), 416 m_layerTreeView(nullptr),
417 m_rootLayer(nullptr), 417 m_rootLayer(nullptr),
418 m_rootGraphicsLayer(nullptr), 418 m_rootGraphicsLayer(nullptr),
419 m_visualViewportContainerLayer(nullptr), 419 m_visualViewportContainerLayer(nullptr),
420 m_matchesHeuristicsForGpuRasterization(false), 420 m_isDesktopSiteOnMobile(true),
aelias_OOO_until_Jul13 2016/10/28 21:43:46 Hmm, this has a slight risk of activating intended
wychen 2016/10/28 23:07:36 Done.
421 m_flingModifier(0), 421 m_flingModifier(0),
422 m_flingSourceDevice(WebGestureDeviceUninitialized), 422 m_flingSourceDevice(WebGestureDeviceUninitialized),
423 m_fullscreenController(FullscreenController::create(this)), 423 m_fullscreenController(FullscreenController::create(this)),
424 m_baseBackgroundColor(Color::white), 424 m_baseBackgroundColor(Color::white),
425 m_backgroundColorOverride(Color::transparent), 425 m_backgroundColorOverride(Color::transparent),
426 m_zoomFactorOverride(0), 426 m_zoomFactorOverride(0),
427 m_userGestureObserved(false), 427 m_userGestureObserved(false),
428 m_shouldDispatchFirstVisuallyNonEmptyLayout(false), 428 m_shouldDispatchFirstVisuallyNonEmptyLayout(false),
429 m_shouldDispatchFirstLayoutAfterFinishedParsing(false), 429 m_shouldDispatchFirstLayoutAfterFinishedParsing(false),
430 m_shouldDispatchFirstLayoutAfterFinishedLoading(false), 430 m_shouldDispatchFirstLayoutAfterFinishedLoading(false),
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 862
863 // Don't trigger a disambiguation popup on sites designed for mobile 863 // Don't trigger a disambiguation popup on sites designed for mobile
864 // devices. Instead, assume that the page has been designed with big 864 // devices. Instead, assume that the page has been designed with big
865 // enough buttons and links. Don't trigger a disambiguation popup when 865 // enough buttons and links. Don't trigger a disambiguation popup when
866 // screencasting, since it's implemented outside of compositor pipeline 866 // screencasting, since it's implemented outside of compositor pipeline
867 // and is not being screencasted itself. This leads to bad user 867 // and is not being screencasted itself. This leads to bad user
868 // experience. 868 // experience.
869 WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl(); 869 WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl();
870 VisualViewport& visualViewport = page()->frameHost().visualViewport(); 870 VisualViewport& visualViewport = page()->frameHost().visualViewport();
871 bool screencastEnabled = devTools && devTools->screencastEnabled(); 871 bool screencastEnabled = devTools && devTools->screencastEnabled();
872 if (event.data.tap.width > 0 && 872 if (event.data.tap.width > 0 && m_isDesktopSiteOnMobile &&
873 !visualViewport.shouldDisableDesktopWorkarounds() &&
874 !screencastEnabled) { 873 !screencastEnabled) {
875 IntRect boundingBox(visualViewport.viewportToRootFrame( 874 IntRect boundingBox(visualViewport.viewportToRootFrame(
876 IntRect(event.x - event.data.tap.width / 2, 875 IntRect(event.x - event.data.tap.width / 2,
877 event.y - event.data.tap.height / 2, event.data.tap.width, 876 event.y - event.data.tap.height / 2, event.data.tap.width,
878 event.data.tap.height))); 877 event.data.tap.height)));
879 878
880 // TODO(bokan): We shouldn't pass details of the VisualViewport offset 879 // TODO(bokan): We shouldn't pass details of the VisualViewport offset
881 // to render_view_impl. crbug.com/459591 880 // to render_view_impl. crbug.com/459591
882 WebSize visualViewportOffset = 881 WebSize visualViewportOffset =
883 flooredIntSize(visualViewport.scrollOffset()); 882 flooredIntSize(visualViewport.scrollOffset());
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 if (!frame || !frame->view() || !element) 2933 if (!frame || !frame->view() || !element)
2935 return false; 2934 return false;
2936 2935
2937 if (!isElementEditable(element)) 2936 if (!isElementEditable(element))
2938 return false; 2937 return false;
2939 2938
2940 element->document().updateStyleAndLayoutIgnorePendingStylesheets(); 2939 element->document().updateStyleAndLayoutIgnorePendingStylesheets();
2941 2940
2942 bool zoomInToLegibleScale = 2941 bool zoomInToLegibleScale =
2943 m_webSettings->autoZoomFocusedNodeToLegibleScale() && 2942 m_webSettings->autoZoomFocusedNodeToLegibleScale() &&
2944 !page()->frameHost().visualViewport().shouldDisableDesktopWorkarounds(); 2943 m_isDesktopSiteOnMobile;
2945 2944
2946 if (zoomInToLegibleScale) { 2945 if (zoomInToLegibleScale) {
2947 // When deciding whether to zoom in on a focused text box, we should decide 2946 // When deciding whether to zoom in on a focused text box, we should decide
2948 // not to zoom in if the user won't be able to zoom out. e.g if the textbox 2947 // not to zoom in if the user won't be able to zoom out. e.g if the textbox
2949 // is within a touch-action: none container the user can't zoom back out. 2948 // is within a touch-action: none container the user can't zoom back out.
2950 TouchAction action = TouchActionUtil::computeEffectiveTouchAction(*element); 2949 TouchAction action = TouchActionUtil::computeEffectiveTouchAction(*element);
2951 if (!(action & TouchActionPinchZoom)) 2950 if (!(action & TouchActionPinchZoom))
2952 zoomInToLegibleScale = false; 2951 zoomInToLegibleScale = false;
2953 } 2952 }
2954 2953
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
3350 const ViewportDescription& description) { 3349 const ViewportDescription& description) {
3351 if (!page() || (!m_size.width && !m_size.height) || 3350 if (!page() || (!m_size.width && !m_size.height) ||
3352 !page()->mainFrame()->isLocalFrame()) 3351 !page()->mainFrame()->isLocalFrame())
3353 return; 3352 return;
3354 3353
3355 if (!settings()->viewportEnabled()) { 3354 if (!settings()->viewportEnabled()) {
3356 pageScaleConstraintsSet().clearPageDefinedConstraints(); 3355 pageScaleConstraintsSet().clearPageDefinedConstraints();
3357 updateMainFrameLayoutSize(); 3356 updateMainFrameLayoutSize();
3358 3357
3359 // If we don't support mobile viewports, allow GPU rasterization. 3358 // If we don't support mobile viewports, allow GPU rasterization.
3360 m_matchesHeuristicsForGpuRasterization = true; 3359 m_isDesktopSiteOnMobile = false;
3361 if (m_layerTreeView) 3360 if (m_layerTreeView) {
3362 m_layerTreeView->heuristicsForGpuRasterizationUpdated( 3361 m_layerTreeView->heuristicsForGpuRasterizationUpdated(
3363 m_matchesHeuristicsForGpuRasterization); 3362 !m_isDesktopSiteOnMobile);
3363 }
3364 return; 3364 return;
3365 } 3365 }
3366 3366
3367 Document* document = page()->deprecatedLocalMainFrame()->document(); 3367 Document* document = page()->deprecatedLocalMainFrame()->document();
3368 3368
3369 m_matchesHeuristicsForGpuRasterization = 3369 m_isDesktopSiteOnMobile = !description.isSpecifiedByAuthor();
3370 description.matchesHeuristicsForGpuRasterization(); 3370 if (m_layerTreeView) {
3371 if (m_layerTreeView)
3372 m_layerTreeView->heuristicsForGpuRasterizationUpdated( 3371 m_layerTreeView->heuristicsForGpuRasterizationUpdated(
3373 m_matchesHeuristicsForGpuRasterization); 3372 !m_isDesktopSiteOnMobile);
3373 }
3374 3374
3375 Length defaultMinWidth = document->viewportDefaultMinWidth(); 3375 Length defaultMinWidth = document->viewportDefaultMinWidth();
3376 if (defaultMinWidth.isAuto()) 3376 if (defaultMinWidth.isAuto())
3377 defaultMinWidth = Length(ExtendToZoom); 3377 defaultMinWidth = Length(ExtendToZoom);
3378 3378
3379 ViewportDescription adjustedDescription = description; 3379 ViewportDescription adjustedDescription = description;
3380 if (settingsImpl()->viewportMetaLayoutSizeQuirk() && 3380 if (settingsImpl()->viewportMetaLayoutSizeQuirk() &&
3381 adjustedDescription.type == ViewportDescription::ViewportMeta) { 3381 adjustedDescription.type == ViewportDescription::ViewportMeta) {
3382 const int legacyWidthSnappingMagicNumber = 320; 3382 const int legacyWidthSnappingMagicNumber = 320;
3383 if (adjustedDescription.maxWidth.isFixed() && 3383 if (adjustedDescription.maxWidth.isFixed() &&
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
4551 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4551 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4552 return nullptr; 4552 return nullptr;
4553 return focusedFrame; 4553 return focusedFrame;
4554 } 4554 }
4555 4555
4556 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4556 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4557 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4557 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4558 } 4558 }
4559 4559
4560 } // namespace blink 4560 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/ViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698