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

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

Issue 308183002: Made root translation layer the root when using pinch virtual viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed unit test Created 6 years, 6 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
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 3615 matching lines...) Expand 10 before | Expand all | Expand 10 after
3626 { 3626 {
3627 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp ty()) 3627 if (m_pageOverlays && m_pageOverlays->remove(overlay) && m_pageOverlays->emp ty())
3628 m_pageOverlays = nullptr; 3628 m_pageOverlays = nullptr;
3629 } 3629 }
3630 3630
3631 void WebViewImpl::setOverlayLayer(WebCore::GraphicsLayer* layer) 3631 void WebViewImpl::setOverlayLayer(WebCore::GraphicsLayer* layer)
3632 { 3632 {
3633 if (!m_rootGraphicsLayer) 3633 if (!m_rootGraphicsLayer)
3634 return; 3634 return;
3635 3635
3636 if (pinchVirtualViewportEnabled()) {
3637 m_page->mainFrame()->view()->renderView()->compositor()->setOverlayLayer (layer);
3638 return;
3639 }
3640
3641 // FIXME(bokan): This path goes away after virtual viewport pinch is enabled everywhere.
3636 if (!m_rootTransformLayer) 3642 if (!m_rootTransformLayer)
3637 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos itor()->ensureRootTransformLayer(); 3643 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos itor()->ensureRootTransformLayer();
3638 3644
3639 if (m_rootTransformLayer) { 3645 if (m_rootTransformLayer) {
3640 if (layer->parent() != m_rootTransformLayer) 3646 if (layer->parent() != m_rootTransformLayer)
3641 m_rootTransformLayer->addChild(layer); 3647 m_rootTransformLayer->addChild(layer);
3642 } 3648 }
3643 } 3649 }
3644 3650
3645 Element* WebViewImpl::focusedElement() const 3651 Element* WebViewImpl::focusedElement() const
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3680 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) 3686 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
3681 { 3687 {
3682 suppressInvalidations(true); 3688 suppressInvalidations(true);
3683 3689
3684 if (pinchVirtualViewportEnabled()) { 3690 if (pinchVirtualViewportEnabled()) {
3685 PinchViewport& pinchViewport = page()->frameHost().pinchViewport(); 3691 PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
3686 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory()); 3692 pinchViewport.attachToLayerTree(layer, graphicsLayerFactory());
3687 if (layer) { 3693 if (layer) {
3688 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer(); 3694 m_rootGraphicsLayer = pinchViewport.rootGraphicsLayer();
3689 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer(); 3695 m_rootLayer = pinchViewport.rootGraphicsLayer()->platformLayer();
3690 m_rootTransformLayer = 0; 3696 m_rootTransformLayer = pinchViewport.rootGraphicsLayer();
3691 } else { 3697 } else {
3692 m_rootGraphicsLayer = 0; 3698 m_rootGraphicsLayer = 0;
3693 m_rootLayer = 0; 3699 m_rootLayer = 0;
3694 m_rootTransformLayer = 0; 3700 m_rootTransformLayer = 0;
3695 } 3701 }
3696 } else { 3702 } else {
3697 m_rootGraphicsLayer = layer; 3703 m_rootGraphicsLayer = layer;
3698 m_rootLayer = layer ? layer->platformLayer() : 0; 3704 m_rootLayer = layer ? layer->platformLayer() : 0;
3699 m_rootTransformLayer = 0; 3705 m_rootTransformLayer = 0;
3700 } 3706 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3934 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 3940 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
3935 } 3941 }
3936 3942
3937 void WebViewImpl::updateRootLayerTransform() 3943 void WebViewImpl::updateRootLayerTransform()
3938 { 3944 {
3939 // If we don't have a root graphics layer, we won't bother trying to find 3945 // If we don't have a root graphics layer, we won't bother trying to find
3940 // or update the transform layer. 3946 // or update the transform layer.
3941 if (!m_rootGraphicsLayer) 3947 if (!m_rootGraphicsLayer)
3942 return; 3948 return;
3943 3949
3950 // FIXME(bokan): m_rootTransformLayer is always set here in pinch virtual vi ewport. This can go away once
3951 // that's default everywhere.
3944 if (!m_rootTransformLayer) 3952 if (!m_rootTransformLayer)
3945 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos itor()->ensureRootTransformLayer(); 3953 m_rootTransformLayer = m_page->mainFrame()->view()->renderView()->compos itor()->ensureRootTransformLayer();
3946 3954
3947 if (m_rootTransformLayer) { 3955 if (m_rootTransformLayer) {
3948 WebCore::TransformationMatrix transform; 3956 WebCore::TransformationMatrix transform;
3949 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); 3957 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height);
3950 transform = transform.scale(m_rootLayerScale); 3958 transform = transform.scale(m_rootLayerScale);
3951 m_rootTransformLayer->setTransform(transform); 3959 m_rootTransformLayer->setTransform(transform);
3952 } 3960 }
3953 } 3961 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
4046 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4054 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4047 4055
4048 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4056 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4049 return false; 4057 return false;
4050 4058
4051 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4059 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4052 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4060 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4053 } 4061 }
4054 4062
4055 } // namespace blink 4063 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/RenderLayerCompositor.cpp ('k') | Source/web/tests/PinchViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698