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

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

Issue 13959008: Remove NonCompositedContentHost (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: one more 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
« no previous file with comments | « Source/WebKit/chromium/src/WebViewImpl.h ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "AutofillPopupMenuClient.h" 52 #include "AutofillPopupMenuClient.h"
53 #include "BatteryClientImpl.h" 53 #include "BatteryClientImpl.h"
54 #include "CSSValueKeywords.h" 54 #include "CSSValueKeywords.h"
55 #include "CompositionUnderlineVectorBuilder.h" 55 #include "CompositionUnderlineVectorBuilder.h"
56 #include "ContextFeaturesClientImpl.h" 56 #include "ContextFeaturesClientImpl.h"
57 #include "DeviceOrientationClientProxy.h" 57 #include "DeviceOrientationClientProxy.h"
58 #include "GeolocationClientProxy.h" 58 #include "GeolocationClientProxy.h"
59 #include "GraphicsLayerFactoryChromium.h" 59 #include "GraphicsLayerFactoryChromium.h"
60 #include "HTMLNames.h" 60 #include "HTMLNames.h"
61 #include "LinkHighlight.h" 61 #include "LinkHighlight.h"
62 #include "NonCompositedContentHost.h"
63 #include "PageWidgetDelegate.h" 62 #include "PageWidgetDelegate.h"
64 #include "PrerendererClientImpl.h" 63 #include "PrerendererClientImpl.h"
65 #include "SpeechInputClientImpl.h" 64 #include "SpeechInputClientImpl.h"
66 #include "SpeechRecognitionClientProxy.h" 65 #include "SpeechRecognitionClientProxy.h"
67 #include "TextFieldDecoratorImpl.h" 66 #include "TextFieldDecoratorImpl.h"
68 #include "ValidationMessageClientImpl.h" 67 #include "ValidationMessageClientImpl.h"
69 #include "ViewportAnchor.h" 68 #include "ViewportAnchor.h"
70 #include "WebAccessibilityObject.h" 69 #include "WebAccessibilityObject.h"
71 #include "WebActiveWheelFlingParameters.h" 70 #include "WebActiveWheelFlingParameters.h"
72 #include "WebAutofillClient.h" 71 #include "WebAutofillClient.h"
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 if (m_continuousPaintingEnabled) { 1777 if (m_continuousPaintingEnabled) {
1779 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); 1778 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get());
1780 m_client->scheduleAnimation(); 1779 m_client->scheduleAnimation();
1781 } 1780 }
1782 } 1781 }
1783 1782
1784 void WebViewImpl::layout() 1783 void WebViewImpl::layout()
1785 { 1784 {
1786 TRACE_EVENT0("webkit", "WebViewImpl::layout"); 1785 TRACE_EVENT0("webkit", "WebViewImpl::layout");
1787 PageWidgetDelegate::layout(m_page.get()); 1786 PageWidgetDelegate::layout(m_page.get());
1787 if (m_layerTreeView)
1788 m_layerTreeView->setBackgroundColor(backgroundColor());
1788 1789
1789 if (m_linkHighlight) 1790 if (m_linkHighlight)
1790 m_linkHighlight->updateGeometry(); 1791 m_linkHighlight->updateGeometry();
1791 } 1792 }
1792 1793
1793 void WebViewImpl::enterForceCompositingMode(bool enter) 1794 void WebViewImpl::enterForceCompositingMode(bool enter)
1794 { 1795 {
1795 if (page()->settings()->forceCompositingMode() == enter) 1796 if (page()->settings()->forceCompositingMode() == enter)
1796 return; 1797 return;
1797 1798
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2944 { 2945 {
2945 if (!page()) 2946 if (!page())
2946 return; 2947 return;
2947 2948
2948 Frame* frame = page()->mainFrame(); 2949 Frame* frame = page()->mainFrame();
2949 if (!frame || !frame->view()) 2950 if (!frame || !frame->view())
2950 return; 2951 return;
2951 2952
2952 frame->view()->setUseFixedLayout(enable); 2953 frame->view()->setUseFixedLayout(enable);
2953 2954
2954 // Also notify the base layer, which RenderLayerCompositor does not see. 2955 if (m_isAcceleratedCompositingActive)
2955 if (m_nonCompositedContentHost)
2956 updateLayerTreeViewport(); 2956 updateLayerTreeViewport();
2957 } 2957 }
2958 2958
2959 2959
2960 void WebViewImpl::enableAutoResizeMode(const WebSize& minSize, const WebSize& ma xSize) 2960 void WebViewImpl::enableAutoResizeMode(const WebSize& minSize, const WebSize& ma xSize)
2961 { 2961 {
2962 m_shouldAutoResize = true; 2962 m_shouldAutoResize = true;
2963 m_minAutoSize = minSize; 2963 m_minAutoSize = minSize;
2964 m_maxAutoSize = maxSize; 2964 m_maxAutoSize = maxSize;
2965 configureAutoResizeMode(); 2965 configureAutoResizeMode();
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
3540 { 3540 {
3541 // Set any existing frames to be transparent. 3541 // Set any existing frames to be transparent.
3542 Frame* frame = m_page->mainFrame(); 3542 Frame* frame = m_page->mainFrame();
3543 while (frame) { 3543 while (frame) {
3544 frame->view()->setTransparent(isTransparent); 3544 frame->view()->setTransparent(isTransparent);
3545 frame = frame->tree()->traverseNext(); 3545 frame = frame->tree()->traverseNext();
3546 } 3546 }
3547 3547
3548 // Future frames check this to know whether to be transparent. 3548 // Future frames check this to know whether to be transparent.
3549 m_isTransparent = isTransparent; 3549 m_isTransparent = isTransparent;
3550
3551 if (m_nonCompositedContentHost)
3552 m_nonCompositedContentHost->setOpaque(!isTransparent);
3553 } 3550 }
3554 3551
3555 bool WebViewImpl::isTransparent() const 3552 bool WebViewImpl::isTransparent() const
3556 { 3553 {
3557 return m_isTransparent; 3554 return m_isTransparent;
3558 } 3555 }
3559 3556
3560 void WebViewImpl::setIsActive(bool active) 3557 void WebViewImpl::setIsActive(bool active)
3561 { 3558 {
3562 if (page() && page()->focusController()) 3559 if (page() && page()->focusController())
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
3844 } 3841 }
3845 3842
3846 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) 3843 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
3847 { 3844 {
3848 suppressInvalidations(true); 3845 suppressInvalidations(true);
3849 3846
3850 m_rootGraphicsLayer = layer; 3847 m_rootGraphicsLayer = layer;
3851 m_rootLayer = layer ? layer->platformLayer() : 0; 3848 m_rootLayer = layer ? layer->platformLayer() : 0;
3852 3849
3853 setIsAcceleratedCompositingActive(layer); 3850 setIsAcceleratedCompositingActive(layer);
3854 if (m_nonCompositedContentHost) {
3855 GraphicsLayer* scrollLayer = 0;
3856 if (layer) {
3857 Document* document = page()->mainFrame()->document();
3858 RenderView* renderView = document->renderView();
3859 RenderLayerCompositor* compositor = renderView->compositor();
3860 scrollLayer = compositor->scrollLayer();
3861 }
3862 m_nonCompositedContentHost->setScrollLayer(scrollLayer);
3863 }
3864 3851
3865 if (m_layerTreeView) { 3852 if (m_layerTreeView) {
3866 if (m_rootLayer) 3853 if (m_rootLayer)
3867 m_layerTreeView->setRootLayer(*m_rootLayer); 3854 m_layerTreeView->setRootLayer(*m_rootLayer);
3868 else 3855 else
3869 m_layerTreeView->clearRootLayer(); 3856 m_layerTreeView->clearRootLayer();
3870 } 3857 }
3871 3858
3872 suppressInvalidations(false); 3859 suppressInvalidations(false);
3873 } 3860 }
(...skipping 12 matching lines...) Expand all
3886 { 3873 {
3887 if (m_layerTreeViewCommitsDeferred) { 3874 if (m_layerTreeViewCommitsDeferred) {
3888 // If we receive an invalidation from WebKit while in deferred commit mo de, 3875 // If we receive an invalidation from WebKit while in deferred commit mo de,
3889 // that means it's time to start producing frames again so un-defer. 3876 // that means it's time to start producing frames again so un-defer.
3890 if (m_layerTreeView) 3877 if (m_layerTreeView)
3891 m_layerTreeView->setDeferCommits(false); 3878 m_layerTreeView->setDeferCommits(false);
3892 m_layerTreeViewCommitsDeferred = false; 3879 m_layerTreeViewCommitsDeferred = false;
3893 } 3880 }
3894 if (m_isAcceleratedCompositingActive) { 3881 if (m_isAcceleratedCompositingActive) {
3895 ASSERT(m_layerTreeView); 3882 ASSERT(m_layerTreeView);
3896
3897 if (!page())
3898 return;
3899
3900 FrameView* view = page()->mainFrame()->view();
3901 IntRect dirtyRect = view->windowToContents(rect);
3902 updateLayerTreeViewport(); 3883 updateLayerTreeViewport();
3903 m_nonCompositedContentHost->invalidateRect(dirtyRect);
3904 } else if (m_client) 3884 } else if (m_client)
3905 m_client->didInvalidateRect(rect); 3885 m_client->didInvalidateRect(rect);
3906 } 3886 }
3907 3887
3908 NonCompositedContentHost* WebViewImpl::nonCompositedContentHost()
3909 {
3910 return m_nonCompositedContentHost.get();
3911 }
3912
3913 void WebViewImpl::setBackgroundColor(const WebCore::Color& color)
3914 {
3915 WebCore::Color documentBackgroundColor = color.isValid() ? color : WebCore:: Color::white;
3916 WebColor webDocumentBackgroundColor = documentBackgroundColor.rgb();
3917 m_nonCompositedContentHost->setBackgroundColor(documentBackgroundColor);
3918 m_layerTreeView->setBackgroundColor(webDocumentBackgroundColor);
3919 }
3920
3921 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const 3888 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
3922 { 3889 {
3923 return m_graphicsLayerFactory.get(); 3890 return m_graphicsLayerFactory.get();
3924 } 3891 }
3925 3892
3926 void WebViewImpl::registerForAnimations(WebLayer* layer) 3893 void WebViewImpl::registerForAnimations(WebLayer* layer)
3927 { 3894 {
3928 if (m_layerTreeView) 3895 if (m_layerTreeView)
3929 m_layerTreeView->registerForAnimations(layer); 3896 m_layerTreeView->registerForAnimations(layer);
3930 } 3897 }
3931 3898
3932 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() 3899 WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer()
3933 { 3900 {
3934 return m_rootGraphicsLayer; 3901 return m_rootGraphicsLayer;
3935 } 3902 }
3936 3903
3937 void WebViewImpl::scheduleAnimation() 3904 void WebViewImpl::scheduleAnimation()
3938 { 3905 {
3939 if (isAcceleratedCompositingActive()) { 3906 if (isAcceleratedCompositingActive()) {
3940 if (Platform::current()->isThreadedCompositingEnabled()) { 3907 if (Platform::current()->isThreadedCompositingEnabled()) {
3941 ASSERT(m_layerTreeView); 3908 ASSERT(m_layerTreeView);
3942 m_layerTreeView->setNeedsAnimate(); 3909 m_layerTreeView->setNeedsAnimate();
3943 } else 3910 } else
3944 m_client->scheduleAnimation(); 3911 m_client->scheduleAnimation();
3945 } else 3912 } else
3946 m_client->scheduleAnimation(); 3913 m_client->scheduleAnimation();
3947 } 3914 }
3948 3915
3949 void WebViewImpl::paintRootLayer(GraphicsContext& context, const IntRect& conten tRect)
3950 {
3951 double paintStart = currentTime();
3952 if (!page())
3953 return;
3954 FrameView* view = page()->mainFrame()->view();
3955 context.setUseHighResMarkers(page()->deviceScaleFactor() > 1.5f);
3956 view->paintContents(&context, contentRect);
3957 double paintEnd = currentTime();
3958 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintE nd - paintStart);
3959 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaint DurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
3960 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaint MegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
3961
3962 setBackgroundColor(view->documentBackgroundColor());
3963 }
3964
3965 void WebViewImpl::setIsAcceleratedCompositingActive(bool active) 3916 void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
3966 { 3917 {
3967 WebKit::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompo sitingActive", active * 2 + m_isAcceleratedCompositingActive, 4); 3918 WebKit::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompo sitingActive", active * 2 + m_isAcceleratedCompositingActive, 4);
3968 3919
3969 if (m_isAcceleratedCompositingActive == active) 3920 if (m_isAcceleratedCompositingActive == active)
3970 return; 3921 return;
3971 3922
3972 if (!active) { 3923 if (!active) {
3973 m_isAcceleratedCompositingActive = false; 3924 m_isAcceleratedCompositingActive = false;
3974 // We need to finish all GL rendering before sending didDeactivateCompos itor() to prevent 3925 // We need to finish all GL rendering before sending didDeactivateCompos itor() to prevent
(...skipping 12 matching lines...) Expand all
3987 m_layerTreeViewCommitsDeferred = true; 3938 m_layerTreeViewCommitsDeferred = true;
3988 } 3939 }
3989 } else if (m_layerTreeView) { 3940 } else if (m_layerTreeView) {
3990 m_isAcceleratedCompositingActive = true; 3941 m_isAcceleratedCompositingActive = true;
3991 updateLayerTreeViewport(); 3942 updateLayerTreeViewport();
3992 3943
3993 m_client->didActivateCompositor(m_inputHandlerIdentifier); 3944 m_client->didActivateCompositor(m_inputHandlerIdentifier);
3994 } else { 3945 } else {
3995 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t rue)"); 3946 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t rue)");
3996 3947
3997 m_nonCompositedContentHost = NonCompositedContentHost::create(this, grap hicsLayerFactory());
3998 m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->show DebugBorders());
3999 m_nonCompositedContentHost->setOpaque(!isTransparent());
4000
4001 m_client->initializeLayerTreeView(); 3948 m_client->initializeLayerTreeView();
4002 m_layerTreeView = m_client->layerTreeView(); 3949 m_layerTreeView = m_client->layerTreeView();
4003 if (m_layerTreeView) { 3950 if (m_layerTreeView) {
4004 m_layerTreeView->setRootLayer(*m_rootLayer); 3951 m_layerTreeView->setRootLayer(*m_rootLayer);
4005 3952
4006 bool visible = page()->visibilityState() == PageVisibilityStateVisib le; 3953 bool visible = page()->visibilityState() == PageVisibilityStateVisib le;
4007 m_layerTreeView->setVisible(visible); 3954 m_layerTreeView->setVisible(visible);
4008 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor()); 3955 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor());
4009 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_mi nimumPageScaleFactor, m_maximumPageScaleFactor); 3956 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_mi nimumPageScaleFactor, m_maximumPageScaleFactor);
3957 m_layerTreeView->setBackgroundColor(backgroundColor());
4010 m_layerTreeView->setHasTransparentBackground(isTransparent()); 3958 m_layerTreeView->setHasTransparentBackground(isTransparent());
4011 updateLayerTreeViewport(); 3959 updateLayerTreeViewport();
4012 m_client->didActivateCompositor(m_inputHandlerIdentifier); 3960 m_client->didActivateCompositor(m_inputHandlerIdentifier);
4013 m_isAcceleratedCompositingActive = true; 3961 m_isAcceleratedCompositingActive = true;
4014 m_compositorCreationFailed = false; 3962 m_compositorCreationFailed = false;
4015 if (m_pageOverlays) 3963 if (m_pageOverlays)
4016 m_pageOverlays->update(); 3964 m_pageOverlays->update();
4017 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); 3965 m_layerTreeView->setShowFPSCounter(m_showFPSCounter);
4018 m_layerTreeView->setShowPaintRects(m_showPaintRects); 3966 m_layerTreeView->setShowPaintRects(m_showPaintRects);
4019 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); 3967 m_layerTreeView->setShowDebugBorders(m_showDebugBorders);
4020 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEn abled); 3968 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEn abled);
4021 } else { 3969 } else {
4022 m_nonCompositedContentHost.clear();
4023 m_isAcceleratedCompositingActive = false; 3970 m_isAcceleratedCompositingActive = false;
4024 m_client->didDeactivateCompositor(); 3971 m_client->didDeactivateCompositor();
4025 m_compositorCreationFailed = true; 3972 m_compositorCreationFailed = true;
4026 } 3973 }
4027 } 3974 }
4028 if (page()) 3975 if (page())
4029 page()->mainFrame()->view()->setClipsRepaints(!m_isAcceleratedCompositin gActive); 3976 page()->mainFrame()->view()->setClipsRepaints(!m_isAcceleratedCompositin gActive);
4030 } 3977 }
4031 3978
4032 WebInputHandler* WebViewImpl::createInputHandler() 3979 WebInputHandler* WebViewImpl::createInputHandler()
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
4083 4030
4084 // Force a style recalc to remove all the composited layers. 4031 // Force a style recalc to remove all the composited layers.
4085 m_page->mainFrame()->document()->scheduleForcedStyleRecalc(); 4032 m_page->mainFrame()->document()->scheduleForcedStyleRecalc();
4086 4033
4087 if (m_pageOverlays) 4034 if (m_pageOverlays)
4088 m_pageOverlays->update(); 4035 m_pageOverlays->update();
4089 } 4036 }
4090 4037
4091 void WebViewImpl::updateLayerTreeViewport() 4038 void WebViewImpl::updateLayerTreeViewport()
4092 { 4039 {
4093 if (!page() || !m_nonCompositedContentHost || !m_layerTreeView) 4040 if (!page() || !m_layerTreeView)
4094 return; 4041 return;
4095 4042
4096 FrameView* view = page()->mainFrame()->view();
4097 m_nonCompositedContentHost->setViewport(m_size, view->contentsSize(), view-> scrollPosition(), view->scrollOrigin());
4098 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPag eScaleFactor, m_maximumPageScaleFactor); 4043 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPag eScaleFactor, m_maximumPageScaleFactor);
4099 } 4044 }
4100 4045
4101 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) 4046 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex)
4102 { 4047 {
4103 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio nsCount()) 4048 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio nsCount())
4104 m_autofillPopupClient->valueChanged(listIndex); 4049 m_autofillPopupClient->valueChanged(listIndex);
4105 } 4050 }
4106 4051
4107 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) 4052 bool WebViewImpl::detectContentOnTouch(const WebPoint& position)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
4194 } 4139 }
4195 4140
4196 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4141 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4197 { 4142 {
4198 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4143 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4199 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4144 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4200 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4145 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4201 } 4146 }
4202 4147
4203 } // namespace WebKit 4148 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebViewImpl.h ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698