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

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

Issue 1631063002: Add isPageVisible to Page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Clean up Created 4 years, 11 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 4278 matching lines...) Expand 10 before | Expand all | Expand 10 after
4289 updateRootLayerTransform(); 4289 updateRootLayerTransform();
4290 m_layerTreeView->setRootLayer(*m_rootLayer); 4290 m_layerTreeView->setRootLayer(*m_rootLayer);
4291 // We register viewport layers here since there may not be a layer 4291 // We register viewport layers here since there may not be a layer
4292 // tree view prior to this point. 4292 // tree view prior to this point.
4293 visualViewport.registerLayersWithTreeView(m_layerTreeView); 4293 visualViewport.registerLayersWithTreeView(m_layerTreeView);
4294 updatePageOverlays(); 4294 updatePageOverlays();
4295 // TODO(enne): Work around page visibility changes not being 4295 // TODO(enne): Work around page visibility changes not being
4296 // propagated to the WebView in some circumstances. This needs to 4296 // propagated to the WebView in some circumstances. This needs to
4297 // be refreshed here when setting a new root layer to avoid being 4297 // be refreshed here when setting a new root layer to avoid being
4298 // stuck in a presumed incorrectly invisible state. 4298 // stuck in a presumed incorrectly invisible state.
4299 bool visible = page()->visibilityState() == PageVisibilityStateVisible; 4299 m_layerTreeView->setVisible(page()->isPageVisible());
4300 m_layerTreeView->setVisible(visible);
4301 } else { 4300 } else {
4302 m_rootGraphicsLayer = nullptr; 4301 m_rootGraphicsLayer = nullptr;
4303 m_rootLayer = nullptr; 4302 m_rootLayer = nullptr;
4304 // This means that we're transitioning to a new page. Suppress 4303 // This means that we're transitioning to a new page. Suppress
4305 // commits until Blink generates invalidations so we don't 4304 // commits until Blink generates invalidations so we don't
4306 // attempt to paint too early in the next page load. 4305 // attempt to paint too early in the next page load.
4307 m_layerTreeView->setDeferCommits(true); 4306 m_layerTreeView->setDeferCommits(true);
4308 m_layerTreeView->clearRootLayer(); 4307 m_layerTreeView->clearRootLayer();
4309 visualViewport.clearLayersForTreeView(m_layerTreeView); 4308 visualViewport.clearLayersForTreeView(m_layerTreeView);
4310 } 4309 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
4617 // TODO(jbroman): This should probably have hookups for overlays, visual 4616 // TODO(jbroman): This should probably have hookups for overlays, visual
4618 // viewport, etc. 4617 // viewport, etc.
4619 4618
4620 m_paintArtifactCompositor.initializeIfNeeded(); 4619 m_paintArtifactCompositor.initializeIfNeeded();
4621 WebLayer* rootLayer = m_paintArtifactCompositor.webLayer(); 4620 WebLayer* rootLayer = m_paintArtifactCompositor.webLayer();
4622 ASSERT(rootLayer); 4621 ASSERT(rootLayer);
4623 m_layerTreeView->setRootLayer(*rootLayer); 4622 m_layerTreeView->setRootLayer(*rootLayer);
4624 4623
4625 // TODO(jbroman): This is cargo-culted from setRootGraphicsLayer. Is it 4624 // TODO(jbroman): This is cargo-culted from setRootGraphicsLayer. Is it
4626 // necessary? 4625 // necessary?
4627 bool visible = page()->visibilityState() == PageVisibilityStateVisible; 4626 bool visible = page()->isPageVisible();
haraken 2016/01/25 22:54:31 |visible| won't be needed.
ortuno 2016/01/25 23:36:34 Done.
4628 m_layerTreeView->setVisible(visible); 4627 m_layerTreeView->setVisible(visible);
4629 } 4628 }
4630 4629
4631 void WebViewImpl::detachPaintArtifactCompositor() 4630 void WebViewImpl::detachPaintArtifactCompositor()
4632 { 4631 {
4633 if (!m_layerTreeView) 4632 if (!m_layerTreeView)
4634 return; 4633 return;
4635 4634
4636 m_layerTreeView->setDeferCommits(true); 4635 m_layerTreeView->setDeferCommits(true);
4637 m_layerTreeView->clearRootLayer(); 4636 m_layerTreeView->clearRootLayer();
4638 } 4637 }
4639 4638
4640 float WebViewImpl::deviceScaleFactor() const 4639 float WebViewImpl::deviceScaleFactor() const
4641 { 4640 {
4642 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4641 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4643 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4642 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4644 if (!page()) 4643 if (!page())
4645 return 1; 4644 return 1;
4646 4645
4647 return page()->deviceScaleFactor(); 4646 return page()->deviceScaleFactor();
4648 } 4647 }
4649 4648
4650 } // namespace blink 4649 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698