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

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

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