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

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

Issue 1914023002: [DevTools] Apply emulation root layer transform to innerViewportContainerLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comment Created 4 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
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 , m_suppressNextKeypressEvent(false) 421 , m_suppressNextKeypressEvent(false)
422 , m_imeAcceptEvents(true) 422 , m_imeAcceptEvents(true)
423 , m_operationsAllowed(WebDragOperationNone) 423 , m_operationsAllowed(WebDragOperationNone)
424 , m_dragOperation(WebDragOperationNone) 424 , m_dragOperation(WebDragOperationNone)
425 , m_devToolsEmulator(nullptr) 425 , m_devToolsEmulator(nullptr)
426 , m_isTransparent(false) 426 , m_isTransparent(false)
427 , m_tabsToLinks(false) 427 , m_tabsToLinks(false)
428 , m_layerTreeView(nullptr) 428 , m_layerTreeView(nullptr)
429 , m_rootLayer(nullptr) 429 , m_rootLayer(nullptr)
430 , m_rootGraphicsLayer(nullptr) 430 , m_rootGraphicsLayer(nullptr)
431 , m_visualViewportContainerLayer(nullptr)
431 , m_matchesHeuristicsForGpuRasterization(false) 432 , m_matchesHeuristicsForGpuRasterization(false)
432 , m_flingModifier(0) 433 , m_flingModifier(0)
433 , m_flingSourceDevice(WebGestureDeviceUninitialized) 434 , m_flingSourceDevice(WebGestureDeviceUninitialized)
434 , m_fullscreenController(FullscreenController::create(this)) 435 , m_fullscreenController(FullscreenController::create(this))
435 , m_showFPSCounter(false)
436 , m_baseBackgroundColor(Color::white) 436 , m_baseBackgroundColor(Color::white)
437 , m_backgroundColorOverride(Color::transparent) 437 , m_backgroundColorOverride(Color::transparent)
438 , m_zoomFactorOverride(0) 438 , m_zoomFactorOverride(0)
439 , m_userGestureObserved(false) 439 , m_userGestureObserved(false)
440 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) 440 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false)
441 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) 441 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false)
442 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false) 442 , m_shouldDispatchFirstLayoutAfterFinishedLoading(false)
443 , m_displayMode(WebDisplayModeBrowser) 443 , m_displayMode(WebDisplayModeBrowser)
444 , m_elasticOverscroll(FloatSize()) 444 , m_elasticOverscroll(FloatSize())
445 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr eateWebViewScheduler(this).release())) 445 , m_scheduler(adoptPtr(Platform::current()->currentThread()->scheduler()->cr eateWebViewScheduler(this).release()))
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 1009
1010 void WebViewImpl::enableFakePageScaleAnimationForTesting(bool enable) 1010 void WebViewImpl::enableFakePageScaleAnimationForTesting(bool enable)
1011 { 1011 {
1012 m_enableFakePageScaleAnimationForTesting = enable; 1012 m_enableFakePageScaleAnimationForTesting = enable;
1013 } 1013 }
1014 1014
1015 void WebViewImpl::setShowFPSCounter(bool show) 1015 void WebViewImpl::setShowFPSCounter(bool show)
1016 { 1016 {
1017 if (m_layerTreeView) { 1017 if (m_layerTreeView) {
1018 TRACE_EVENT0("blink", "WebViewImpl::setShowFPSCounter"); 1018 TRACE_EVENT0("blink", "WebViewImpl::setShowFPSCounter");
1019 m_layerTreeView->setShowFPSCounter(show && !m_devToolsEmulator->deviceEm ulationEnabled()); 1019 m_layerTreeView->setShowFPSCounter(show);
1020 } 1020 }
1021 m_showFPSCounter = show;
1022 } 1021 }
1023 1022
1024 void WebViewImpl::setShowPaintRects(bool show) 1023 void WebViewImpl::setShowPaintRects(bool show)
1025 { 1024 {
1026 if (m_layerTreeView) { 1025 if (m_layerTreeView) {
1027 TRACE_EVENT0("blink", "WebViewImpl::setShowPaintRects"); 1026 TRACE_EVENT0("blink", "WebViewImpl::setShowPaintRects");
1028 m_layerTreeView->setShowPaintRects(show); 1027 m_layerTreeView->setShowPaintRects(show);
1029 } 1028 }
1030 setFirstPaintInvalidationTrackingEnabledForShowPaintRects(show); 1029 setFirstPaintInvalidationTrackingEnabledForShowPaintRects(show);
1031 } 1030 }
1032 1031
1033 void WebViewImpl::setShowDebugBorders(bool show) 1032 void WebViewImpl::setShowDebugBorders(bool show)
1034 { 1033 {
1035 if (m_layerTreeView) 1034 if (m_layerTreeView)
1036 m_layerTreeView->setShowDebugBorders(show); 1035 m_layerTreeView->setShowDebugBorders(show);
1037 } 1036 }
1038 1037
1039 void WebViewImpl::updateShowFPSCounter()
1040 {
1041 if (m_layerTreeView)
1042 m_layerTreeView->setShowFPSCounter(m_showFPSCounter && !m_devToolsEmulat or->deviceEmulationEnabled());
1043 }
1044
1045 void WebViewImpl::setShowScrollBottleneckRects(bool show) 1038 void WebViewImpl::setShowScrollBottleneckRects(bool show)
1046 { 1039 {
1047 if (m_layerTreeView) 1040 if (m_layerTreeView)
1048 m_layerTreeView->setShowScrollBottleneckRects(show); 1041 m_layerTreeView->setShowScrollBottleneckRects(show);
1049 } 1042 }
1050 1043
1051 void WebViewImpl::acceptLanguagesChanged() 1044 void WebViewImpl::acceptLanguagesChanged()
1052 { 1045 {
1053 if (m_client) 1046 if (m_client)
1054 FontCache::acceptLanguagesChanged(m_client->acceptLanguages()); 1047 FontCache::acceptLanguagesChanged(m_client->acceptLanguages());
(...skipping 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after
4162 return; 4155 return;
4163 4156
4164 // In SPv2, we attach layers via PaintArtifactCompositor, rather than 4157 // In SPv2, we attach layers via PaintArtifactCompositor, rather than
4165 // supplying a root GraphicsLayer from PaintLayerCompositor. 4158 // supplying a root GraphicsLayer from PaintLayerCompositor.
4166 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 4159 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
4167 4160
4168 VisualViewport& visualViewport = page()->frameHost().visualViewport(); 4161 VisualViewport& visualViewport = page()->frameHost().visualViewport();
4169 visualViewport.attachToLayerTree(layer); 4162 visualViewport.attachToLayerTree(layer);
4170 if (layer) { 4163 if (layer) {
4171 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); 4164 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer();
4165 m_visualViewportContainerLayer = visualViewport.containerLayer();
4172 m_rootLayer = m_rootGraphicsLayer->platformLayer(); 4166 m_rootLayer = m_rootGraphicsLayer->platformLayer();
4173 updateRootLayerTransform(); 4167 updateRootLayerTransform();
4174 m_layerTreeView->setRootLayer(*m_rootLayer); 4168 m_layerTreeView->setRootLayer(*m_rootLayer);
4175 // We register viewport layers here since there may not be a layer 4169 // We register viewport layers here since there may not be a layer
4176 // tree view prior to this point. 4170 // tree view prior to this point.
4177 visualViewport.registerLayersWithTreeView(m_layerTreeView); 4171 visualViewport.registerLayersWithTreeView(m_layerTreeView);
4178 updatePageOverlays(); 4172 updatePageOverlays();
4179 // TODO(enne): Work around page visibility changes not being 4173 // TODO(enne): Work around page visibility changes not being
4180 // propagated to the WebView in some circumstances. This needs to 4174 // propagated to the WebView in some circumstances. This needs to
4181 // be refreshed here when setting a new root layer to avoid being 4175 // be refreshed here when setting a new root layer to avoid being
4182 // stuck in a presumed incorrectly invisible state. 4176 // stuck in a presumed incorrectly invisible state.
4183 m_layerTreeView->setVisible(page()->isPageVisible()); 4177 m_layerTreeView->setVisible(page()->isPageVisible());
4184 } else { 4178 } else {
4185 m_rootGraphicsLayer = nullptr; 4179 m_rootGraphicsLayer = nullptr;
4180 m_visualViewportContainerLayer = nullptr;
4186 m_rootLayer = nullptr; 4181 m_rootLayer = nullptr;
4187 // This means that we're transitioning to a new page. Suppress 4182 // This means that we're transitioning to a new page. Suppress
4188 // commits until Blink generates invalidations so we don't 4183 // commits until Blink generates invalidations so we don't
4189 // attempt to paint too early in the next page load. 4184 // attempt to paint too early in the next page load.
4190 m_layerTreeView->setDeferCommits(true); 4185 m_layerTreeView->setDeferCommits(true);
4191 m_layerTreeView->clearRootLayer(); 4186 m_layerTreeView->clearRootLayer();
4192 visualViewport.clearLayersForTreeView(m_layerTreeView); 4187 visualViewport.clearLayersForTreeView(m_layerTreeView);
4193 } 4188 }
4194 } 4189 }
4195 4190
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
4327 { 4322 {
4328 DCHECK(page()); 4323 DCHECK(page());
4329 DCHECK(m_layerTreeView); 4324 DCHECK(m_layerTreeView);
4330 4325
4331 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit orDeviceScaleFactorOverride : page()->deviceScaleFactor(); 4326 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit orDeviceScaleFactorOverride : page()->deviceScaleFactor();
4332 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 4327 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
4333 } 4328 }
4334 4329
4335 void WebViewImpl::updateRootLayerTransform() 4330 void WebViewImpl::updateRootLayerTransform()
4336 { 4331 {
4337 if (m_rootGraphicsLayer) { 4332 if (m_visualViewportContainerLayer) {
4338 TransformationMatrix transform; 4333 TransformationMatrix transform;
4339 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); 4334 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height);
4340 transform = transform.scale(m_rootLayerScale); 4335 transform = transform.scale(m_rootLayerScale);
4341 m_rootGraphicsLayer->setTransform(transform); 4336 m_visualViewportContainerLayer->setTransform(transform);
4342 } 4337 }
4343 } 4338 }
4344 4339
4345 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar getedEvent) 4340 bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& tar getedEvent)
4346 { 4341 {
4347 if (!m_page->mainFrame()->isLocalFrame()) 4342 if (!m_page->mainFrame()->isLocalFrame())
4348 return false; 4343 return false;
4349 4344
4350 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo ot() will modify it. 4345 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRo ot() will modify it.
4351 HitTestResult touchHit = targetedEvent.hitTestResult(); 4346 HitTestResult touchHit = targetedEvent.hitTestResult();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
4494 { 4489 {
4495 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4490 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4496 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4491 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4497 if (!page()) 4492 if (!page())
4498 return 1; 4493 return 1;
4499 4494
4500 return page()->deviceScaleFactor(); 4495 return page()->deviceScaleFactor();
4501 } 4496 }
4502 4497
4503 } // namespace blink 4498 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698