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

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: Adding back LCD text workaround Created 7 years, 8 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
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "Image.h" 75 #include "Image.h"
76 #include "ImageBuffer.h" 76 #include "ImageBuffer.h"
77 #include "InspectorController.h" 77 #include "InspectorController.h"
78 #include "InspectorInstrumentation.h" 78 #include "InspectorInstrumentation.h"
79 #include "KeyboardCodes.h" 79 #include "KeyboardCodes.h"
80 #include "KeyboardEvent.h" 80 #include "KeyboardEvent.h"
81 #include "LayerPainterChromium.h" 81 #include "LayerPainterChromium.h"
82 #include "LinkHighlight.h" 82 #include "LinkHighlight.h"
83 #include "MIMETypeRegistry.h" 83 #include "MIMETypeRegistry.h"
84 #include "NodeRenderStyle.h" 84 #include "NodeRenderStyle.h"
85 #include "NonCompositedContentHost.h"
86 #include "NotImplemented.h" 85 #include "NotImplemented.h"
87 #include "Page.h" 86 #include "Page.h"
88 #include "PageGroup.h" 87 #include "PageGroup.h"
89 #include "PageGroupLoadDeferrer.h" 88 #include "PageGroupLoadDeferrer.h"
90 #include "PagePopupClient.h" 89 #include "PagePopupClient.h"
91 #include "PageWidgetDelegate.h" 90 #include "PageWidgetDelegate.h"
92 #include "PlatformContextSkia.h" 91 #include "PlatformContextSkia.h"
93 #include "PlatformGestureEvent.h" 92 #include "PlatformGestureEvent.h"
94 #include "PlatformKeyboardEvent.h" 93 #include "PlatformKeyboardEvent.h"
95 #include "PlatformMouseEvent.h" 94 #include "PlatformMouseEvent.h"
(...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2963 { 2962 {
2964 if (!page()) 2963 if (!page())
2965 return; 2964 return;
2966 2965
2967 Frame* frame = page()->mainFrame(); 2966 Frame* frame = page()->mainFrame();
2968 if (!frame || !frame->view()) 2967 if (!frame || !frame->view())
2969 return; 2968 return;
2970 2969
2971 frame->view()->setUseFixedLayout(enable); 2970 frame->view()->setUseFixedLayout(enable);
2972 2971
2973 // Also notify the base layer, which RenderLayerCompositor does not see. 2972 if (m_isAcceleratedCompositingActive)
2974 if (m_nonCompositedContentHost)
2975 updateLayerTreeViewport(); 2973 updateLayerTreeViewport();
2976 } 2974 }
2977 2975
2978 2976
2979 void WebViewImpl::enableAutoResizeMode(const WebSize& minSize, const WebSize& ma xSize) 2977 void WebViewImpl::enableAutoResizeMode(const WebSize& minSize, const WebSize& ma xSize)
2980 { 2978 {
2981 m_shouldAutoResize = true; 2979 m_shouldAutoResize = true;
2982 m_minAutoSize = minSize; 2980 m_minAutoSize = minSize;
2983 m_maxAutoSize = maxSize; 2981 m_maxAutoSize = maxSize;
2984 configureAutoResizeMode(); 2982 configureAutoResizeMode();
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
3551 { 3549 {
3552 // Set any existing frames to be transparent. 3550 // Set any existing frames to be transparent.
3553 Frame* frame = m_page->mainFrame(); 3551 Frame* frame = m_page->mainFrame();
3554 while (frame) { 3552 while (frame) {
3555 frame->view()->setTransparent(isTransparent); 3553 frame->view()->setTransparent(isTransparent);
3556 frame = frame->tree()->traverseNext(); 3554 frame = frame->tree()->traverseNext();
3557 } 3555 }
3558 3556
3559 // Future frames check this to know whether to be transparent. 3557 // Future frames check this to know whether to be transparent.
3560 m_isTransparent = isTransparent; 3558 m_isTransparent = isTransparent;
3561
3562 if (m_nonCompositedContentHost)
3563 m_nonCompositedContentHost->setOpaque(!isTransparent);
3564 } 3559 }
3565 3560
3566 bool WebViewImpl::isTransparent() const 3561 bool WebViewImpl::isTransparent() const
3567 { 3562 {
3568 return m_isTransparent; 3563 return m_isTransparent;
3569 } 3564 }
3570 3565
3571 void WebViewImpl::setIsActive(bool active) 3566 void WebViewImpl::setIsActive(bool active)
3572 { 3567 {
3573 if (page() && page()->focusController()) 3568 if (page() && page()->focusController())
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
3855 } 3850 }
3856 3851
3857 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) 3852 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
3858 { 3853 {
3859 suppressInvalidations(true); 3854 suppressInvalidations(true);
3860 3855
3861 m_rootGraphicsLayer = layer; 3856 m_rootGraphicsLayer = layer;
3862 m_rootLayer = layer ? layer->platformLayer() : 0; 3857 m_rootLayer = layer ? layer->platformLayer() : 0;
3863 3858
3864 setIsAcceleratedCompositingActive(layer); 3859 setIsAcceleratedCompositingActive(layer);
3865 if (m_nonCompositedContentHost) {
3866 GraphicsLayer* scrollLayer = 0;
3867 if (layer) {
3868 Document* document = page()->mainFrame()->document();
3869 RenderView* renderView = document->renderView();
3870 RenderLayerCompositor* compositor = renderView->compositor();
3871 scrollLayer = compositor->scrollLayer();
3872 }
3873 m_nonCompositedContentHost->setScrollLayer(scrollLayer);
3874 }
3875 3860
3876 if (m_layerTreeView) { 3861 if (m_layerTreeView) {
3877 if (m_rootLayer) 3862 if (m_rootLayer)
3878 m_layerTreeView->setRootLayer(*m_rootLayer); 3863 m_layerTreeView->setRootLayer(*m_rootLayer);
3879 else 3864 else
3880 m_layerTreeView->clearRootLayer(); 3865 m_layerTreeView->clearRootLayer();
3881 } 3866 }
3882 3867
3883 suppressInvalidations(false); 3868 suppressInvalidations(false);
3884 } 3869 }
(...skipping 16 matching lines...) Expand all
3901 if (m_layerTreeView) 3886 if (m_layerTreeView)
3902 m_layerTreeView->setDeferCommits(false); 3887 m_layerTreeView->setDeferCommits(false);
3903 m_layerTreeViewCommitsDeferred = false; 3888 m_layerTreeViewCommitsDeferred = false;
3904 } 3889 }
3905 if (m_isAcceleratedCompositingActive) { 3890 if (m_isAcceleratedCompositingActive) {
3906 ASSERT(m_layerTreeView); 3891 ASSERT(m_layerTreeView);
3907 3892
3908 if (!page()) 3893 if (!page())
3909 return; 3894 return;
3910 3895
3911 FrameView* view = page()->mainFrame()->view();
3912 IntRect dirtyRect = view->windowToContents(rect);
3913 updateLayerTreeViewport(); 3896 updateLayerTreeViewport();
3914 m_nonCompositedContentHost->invalidateRect(dirtyRect);
3915 } else if (m_client) 3897 } else if (m_client)
3916 m_client->didInvalidateRect(rect); 3898 m_client->didInvalidateRect(rect);
3917 } 3899 }
3918 3900
3919 NonCompositedContentHost* WebViewImpl::nonCompositedContentHost()
3920 {
3921 return m_nonCompositedContentHost.get();
3922 }
3923
3924 void WebViewImpl::setBackgroundColor(const WebCore::Color& color) 3901 void WebViewImpl::setBackgroundColor(const WebCore::Color& color)
3925 { 3902 {
3926 if (!m_nonCompositedContentHost) 3903 if (!m_layerTreeView)
3927 return; 3904 return;
3928 3905
3929 WebCore::Color documentBackgroundColor = color.isValid() ? color : WebCore:: Color::white; 3906 WebCore::Color documentBackgroundColor = color.isValid() ? color : WebCore:: Color::white;
3930 WebColor webDocumentBackgroundColor = documentBackgroundColor.rgb(); 3907 WebColor webDocumentBackgroundColor = documentBackgroundColor.rgb();
3931 m_nonCompositedContentHost->setBackgroundColor(documentBackgroundColor);
3932 m_layerTreeView->setBackgroundColor(webDocumentBackgroundColor); 3908 m_layerTreeView->setBackgroundColor(webDocumentBackgroundColor);
3933 } 3909 }
3934 3910
3935 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const 3911 WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
3936 { 3912 {
3937 return m_graphicsLayerFactory.get(); 3913 return m_graphicsLayerFactory.get();
3938 } 3914 }
3939 3915
3940 void WebViewImpl::registerForAnimations(WebLayer* layer) 3916 void WebViewImpl::registerForAnimations(WebLayer* layer)
3941 { 3917 {
(...skipping 11 matching lines...) Expand all
3953 if (isAcceleratedCompositingActive()) { 3929 if (isAcceleratedCompositingActive()) {
3954 if (Platform::current()->isThreadedCompositingEnabled()) { 3930 if (Platform::current()->isThreadedCompositingEnabled()) {
3955 ASSERT(m_layerTreeView); 3931 ASSERT(m_layerTreeView);
3956 m_layerTreeView->setNeedsAnimate(); 3932 m_layerTreeView->setNeedsAnimate();
3957 } else 3933 } else
3958 m_client->scheduleAnimation(); 3934 m_client->scheduleAnimation();
3959 } else 3935 } else
3960 m_client->scheduleAnimation(); 3936 m_client->scheduleAnimation();
3961 } 3937 }
3962 3938
3963 void WebViewImpl::paintRootLayer(GraphicsContext& context, const IntRect& conten tRect)
3964 {
3965 double paintStart = currentTime();
3966 if (!page())
3967 return;
3968 FrameView* view = page()->mainFrame()->view();
3969 if (context.platformContext())
3970 context.platformContext()->setDeviceScaleFactor(page()->deviceScaleFacto r());
3971 view->paintContents(&context, contentRect);
3972 double paintEnd = currentTime();
3973 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintE nd - paintStart);
3974 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaint DurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
3975 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaint MegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
3976 // The background color should have been set already in order to show up wit h the correct color in the compositor
3977 // frame being painted currently. This verifies the view's background color was not changed without calling
3978 // setBackgroundColor() before this paint phase happened.
3979 ASSERT(m_nonCompositedContentHost->backgroundColor() == view->documentBackgr oundColor());
3980 }
3981
3982 void WebViewImpl::setIsAcceleratedCompositingActive(bool active) 3939 void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
3983 { 3940 {
3984 WebKit::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompo sitingActive", active * 2 + m_isAcceleratedCompositingActive, 4); 3941 WebKit::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompo sitingActive", active * 2 + m_isAcceleratedCompositingActive, 4);
3985 3942
3986 if (m_isAcceleratedCompositingActive == active) 3943 if (m_isAcceleratedCompositingActive == active)
3987 return; 3944 return;
3988 3945
3989 if (!active) { 3946 if (!active) {
3990 m_isAcceleratedCompositingActive = false; 3947 m_isAcceleratedCompositingActive = false;
3991 // We need to finish all GL rendering before sending didDeactivateCompos itor() to prevent 3948 // We need to finish all GL rendering before sending didDeactivateCompos itor() to prevent
(...skipping 12 matching lines...) Expand all
4004 m_layerTreeViewCommitsDeferred = true; 3961 m_layerTreeViewCommitsDeferred = true;
4005 } 3962 }
4006 } else if (m_layerTreeView) { 3963 } else if (m_layerTreeView) {
4007 m_isAcceleratedCompositingActive = true; 3964 m_isAcceleratedCompositingActive = true;
4008 updateLayerTreeViewport(); 3965 updateLayerTreeViewport();
4009 3966
4010 m_client->didActivateCompositor(m_inputHandlerIdentifier); 3967 m_client->didActivateCompositor(m_inputHandlerIdentifier);
4011 } else { 3968 } else {
4012 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t rue)"); 3969 TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(t rue)");
4013 3970
4014 m_nonCompositedContentHost = NonCompositedContentHost::create(this, grap hicsLayerFactory());
4015 m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->show DebugBorders());
4016 m_nonCompositedContentHost->setOpaque(!isTransparent());
4017
4018 m_client->initializeLayerTreeView(); 3971 m_client->initializeLayerTreeView();
4019 m_layerTreeView = m_client->layerTreeView(); 3972 m_layerTreeView = m_client->layerTreeView();
4020 if (m_layerTreeView) { 3973 if (m_layerTreeView) {
4021 m_layerTreeView->setRootLayer(*m_rootLayer); 3974 m_layerTreeView->setRootLayer(*m_rootLayer);
4022 3975
4023 bool visible = page()->visibilityState() == PageVisibilityStateVisib le; 3976 bool visible = page()->visibilityState() == PageVisibilityStateVisib le;
4024 m_layerTreeView->setVisible(visible); 3977 m_layerTreeView->setVisible(visible);
4025 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor()); 3978 m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor());
4026 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_mi nimumPageScaleFactor, m_maximumPageScaleFactor); 3979 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_mi nimumPageScaleFactor, m_maximumPageScaleFactor);
4027 m_layerTreeView->setHasTransparentBackground(isTransparent()); 3980 m_layerTreeView->setHasTransparentBackground(isTransparent());
4028 updateLayerTreeViewport(); 3981 updateLayerTreeViewport();
4029 m_client->didActivateCompositor(m_inputHandlerIdentifier); 3982 m_client->didActivateCompositor(m_inputHandlerIdentifier);
4030 m_isAcceleratedCompositingActive = true; 3983 m_isAcceleratedCompositingActive = true;
4031 m_compositorCreationFailed = false; 3984 m_compositorCreationFailed = false;
4032 if (m_pageOverlays) 3985 if (m_pageOverlays)
4033 m_pageOverlays->update(); 3986 m_pageOverlays->update();
4034 m_layerTreeView->setShowFPSCounter(m_showFPSCounter); 3987 m_layerTreeView->setShowFPSCounter(m_showFPSCounter);
4035 m_layerTreeView->setShowPaintRects(m_showPaintRects); 3988 m_layerTreeView->setShowPaintRects(m_showPaintRects);
4036 m_layerTreeView->setShowDebugBorders(m_showDebugBorders); 3989 m_layerTreeView->setShowDebugBorders(m_showDebugBorders);
4037 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEn abled); 3990 m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEn abled);
4038 } else { 3991 } else {
4039 m_nonCompositedContentHost.clear();
4040 m_isAcceleratedCompositingActive = false; 3992 m_isAcceleratedCompositingActive = false;
4041 m_client->didDeactivateCompositor(); 3993 m_client->didDeactivateCompositor();
4042 m_compositorCreationFailed = true; 3994 m_compositorCreationFailed = true;
4043 } 3995 }
4044 } 3996 }
4045 if (page()) 3997 if (page())
4046 page()->mainFrame()->view()->setClipsRepaints(!m_isAcceleratedCompositin gActive); 3998 page()->mainFrame()->view()->setClipsRepaints(!m_isAcceleratedCompositin gActive);
4047 } 3999 }
4048 4000
4049 WebInputHandler* WebViewImpl::createInputHandler() 4001 WebInputHandler* WebViewImpl::createInputHandler()
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4098 m_compositorCreationFailed = true; 4050 m_compositorCreationFailed = true;
4099 m_client->didInvalidateRect(IntRect(0, 0, m_size.width, m_size.height)); 4051 m_client->didInvalidateRect(IntRect(0, 0, m_size.width, m_size.height));
4100 4052
4101 // Force a style recalc to remove all the composited layers. 4053 // Force a style recalc to remove all the composited layers.
4102 m_page->mainFrame()->document()->scheduleForcedStyleRecalc(); 4054 m_page->mainFrame()->document()->scheduleForcedStyleRecalc();
4103 4055
4104 if (m_pageOverlays) 4056 if (m_pageOverlays)
4105 m_pageOverlays->update(); 4057 m_pageOverlays->update();
4106 } 4058 }
4107 4059
4108 void WebViewImpl::updateLayerTreeViewport() 4060 void WebViewImpl::updateLayerTreeViewport()
aelias_OOO_until_Jul13 2013/04/24 22:49:45 Looks like this method isn't needed anymore. Plea
4109 { 4061 {
4110 if (!page() || !m_nonCompositedContentHost || !m_layerTreeView) 4062 if (!page() || !m_layerTreeView)
4111 return; 4063 return;
4112 4064
4113 FrameView* view = page()->mainFrame()->view();
4114 m_nonCompositedContentHost->setViewport(m_size, view->contentsSize(), view-> scrollPosition(), view->scrollOrigin());
4115 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPag eScaleFactor, m_maximumPageScaleFactor); 4065 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPag eScaleFactor, m_maximumPageScaleFactor);
4116 } 4066 }
4117 4067
4118 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) 4068 void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex)
4119 { 4069 {
4120 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio nsCount()) 4070 if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestio nsCount())
4121 m_autofillPopupClient->valueChanged(listIndex); 4071 m_autofillPopupClient->valueChanged(listIndex);
4122 } 4072 }
4123 4073
4124 bool WebViewImpl::detectContentOnTouch(const WebPoint& position) 4074 bool WebViewImpl::detectContentOnTouch(const WebPoint& position)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
4211 } 4161 }
4212 4162
4213 bool WebViewImpl::shouldDisableDesktopWorkarounds() 4163 bool WebViewImpl::shouldDisableDesktopWorkarounds()
4214 { 4164 {
4215 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments(); 4165 ViewportArguments arguments = mainFrameImpl()->frame()->document()->viewport Arguments();
4216 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom 4166 return arguments.width == ViewportArguments::ValueDeviceWidth || !arguments. userZoom
4217 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto); 4167 || (arguments.minZoom == arguments.maxZoom && arguments.minZoom != Viewp ortArguments::ValueAuto);
4218 } 4168 }
4219 4169
4220 } // namespace WebKit 4170 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698