Changeset 137483 in webkit
- Timestamp:
- Dec 12, 2012, 10:44:29 AM (13 years ago)
- Location:
- trunk/Source/WebKit/gtk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/gtk/ChangeLog
r137447 r137483 1 2012-12-12 Joone Hur <joone.hur@intel.com> 2 3 [GTK][AC] The non-composited content is not painted 4 https://bugs.webkit.org/show_bug.cgi?id=104819 5 6 Reviewed by Gustavo Noronha Silva. 7 8 When Accelerated Compositing is enabled, only GraphicsLayers are painted. 9 This patch allows to paint the non-composited content on the viewport with 10 GraphicsLayers. Most of the codes are the same as AcceleratedCompositingContextGL.cpp 11 12 * WebCoreSupport/AcceleratedCompositingContext.h: Add m_nonCompositedContentLayer. 13 * WebCoreSupport/AcceleratedCompositingContextClutter.cpp: 14 (WebKit::AcceleratedCompositingContext::AcceleratedCompositingContext): 15 (WebKit::AcceleratedCompositingContext::initialize): 16 (WebKit): 17 (WebKit::AcceleratedCompositingContext::~AcceleratedCompositingContext): 18 (WebKit::AcceleratedCompositingContext::renderLayersToWindow): 19 (WebKit::AcceleratedCompositingContext::setRootCompositingLayer): 20 (WebKit::AcceleratedCompositingContext::setNonCompositedContentsNeedDisplay): 21 (WebKit::AcceleratedCompositingContext::resizeRootLayer): 22 (WebKit::AcceleratedCompositingContext::scrollNonCompositedContents): Make the non-composited 23 content scroll. 24 (WebKit::AcceleratedCompositingContext::layerFlushTimerFiredCallback): 25 (WebKit::AcceleratedCompositingContext::flushPendingLayerChanges): 26 (WebKit::AcceleratedCompositingContext::flushAndRenderLayers): 27 (WebKit::AcceleratedCompositingContext::notifyAnimationStarted): 28 (WebKit::AcceleratedCompositingContext::paintContents): Paint the non-composited content. 29 1 30 2012-12-12 Joone Hur <joone.hur@intel.com> 2 31 -
trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h
r137447 r137483 76 76 77 77 #if USE(CLUTTER) 78 WebCore::GraphicsLayer* m_rootGraphicsLayer;79 78 GtkWidget* m_rootLayerEmbedder; 79 OwnPtr<WebCore::GraphicsLayer> m_rootLayer; 80 OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer; 81 80 82 static gboolean layerFlushTimerFiredCallback(AcceleratedCompositingContext*); 81 83 #elif USE(TEXTURE_MAPPER_GL) -
trunk/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp
r137447 r137483 26 26 #include "FrameView.h" 27 27 #include "GraphicsLayer.h" 28 #include "GraphicsLayerActor.h" 28 29 #include "NotImplemented.h" 30 #include "Settings.h" 29 31 #include "webkitwebviewprivate.h" 30 32 #include <clutter-gtk/clutter-gtk.h> … … 38 40 : m_webView(webView) 39 41 , m_layerFlushTimerCallbackId(0) 40 , m_rootGraphicsLayer(0)41 42 , m_rootLayerEmbedder(0) 42 43 { 44 } 45 46 void AcceleratedCompositingContext::initialize() 47 { 48 if (m_rootLayer) 49 return; 50 51 GtkAllocation allocation; 52 gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation); 53 IntSize pageSize(allocation.width, allocation.height); 54 55 m_rootLayer = GraphicsLayer::create(0, this); 56 m_rootLayer->setDrawsContent(false); 57 m_rootLayer->setSize(pageSize); 58 59 // The non-composited contents are a child of the root layer. 60 m_nonCompositedContentLayer = GraphicsLayer::create(0, this); 61 m_nonCompositedContentLayer->setDrawsContent(true); 62 m_nonCompositedContentLayer->setContentsOpaque(!m_webView->priv->transparent); 63 m_nonCompositedContentLayer->setSize(pageSize); 64 if (core(m_webView)->settings()->acceleratedDrawingEnabled()) 65 m_nonCompositedContentLayer->setAcceleratesDrawing(true); 66 67 #ifndef NDEBUG 68 m_rootLayer->setName("Root layer"); 69 m_nonCompositedContentLayer->setName("Non-composited content"); 70 #endif 71 72 m_rootLayer->addChild(m_nonCompositedContentLayer.get()); 73 m_nonCompositedContentLayer->setNeedsDisplay(); 74 75 scheduleLayerFlush(); 43 76 } 44 77 … … 51 84 bool AcceleratedCompositingContext::enabled() 52 85 { 53 return m_root GraphicsLayer;86 return m_rootLayer; 54 87 } 55 88 … … 65 98 gtk_container_remove(GTK_CONTAINER(m_webView), m_rootLayerEmbedder); 66 99 m_rootLayerEmbedder = 0; 67 m_rootGraphicsLayer = 0; 100 m_rootLayer = nullptr; 101 m_nonCompositedContentLayer = nullptr; 68 102 return; 69 103 } … … 80 114 } 81 115 116 // Add the accelerated layer tree hierarchy. 117 initialize(); 118 119 m_nonCompositedContentLayer->removeAllChildren(); 120 m_nonCompositedContentLayer->addChild(graphicsLayer); 121 82 122 // Add a root GraphicsLayer to the stage. 83 123 if (graphicsLayer) { 84 m_rootGraphicsLayer = graphicsLayer;85 124 ClutterColor stageColor = { 0xFF, 0xFF, 0xFF, 0xFF }; 86 125 ClutterActor* stage = gtk_clutter_embed_get_stage(GTK_CLUTTER_EMBED(m_rootLayerEmbedder)); 87 126 clutter_stage_set_color(CLUTTER_STAGE(stage), &stageColor); 88 clutter_container_add_actor(CLUTTER_CONTAINER(stage), m_root GraphicsLayer->platformLayer());127 clutter_container_add_actor(CLUTTER_CONTAINER(stage), m_rootLayer->platformLayer()); 89 128 clutter_actor_show_all(stage); 90 129 } … … 95 134 void AcceleratedCompositingContext::setNonCompositedContentsNeedDisplay(const IntRect& rect) 96 135 { 97 if (!m_root GraphicsLayer)136 if (!m_rootLayer) 98 137 return; 99 138 100 139 if (rect.isEmpty()) { 101 m_rootGraphicsLayer->setNeedsDisplay(); 102 return; 103 } 104 105 m_rootGraphicsLayer->setNeedsDisplayInRect(rect); 106 } 107 108 void AcceleratedCompositingContext::resizeRootLayer(const IntSize& size) 140 m_rootLayer->setNeedsDisplay(); 141 return; 142 } 143 144 m_nonCompositedContentLayer->setNeedsDisplayInRect(rect); 145 scheduleLayerFlush(); 146 } 147 148 void AcceleratedCompositingContext::resizeRootLayer(const IntSize& newSize) 109 149 { 110 150 if (!m_rootLayerEmbedder) 151 return; 152 153 if (m_rootLayer->size() == newSize) 111 154 return; 112 155 … … 114 157 allocation.x = 0; 115 158 allocation.y = 0; 116 allocation.width = size.width();117 allocation.height = size.height();159 allocation.width = newSize.width(); 160 allocation.height = newSize.height(); 118 161 gtk_widget_size_allocate(GTK_WIDGET(m_rootLayerEmbedder), &allocation); 119 162 163 m_rootLayer->setSize(newSize); 164 165 // If the newSize exposes new areas of the non-composited content a setNeedsDisplay is needed 166 // for those newly exposed areas. 167 FloatSize oldSize = m_nonCompositedContentLayer->size(); 168 m_nonCompositedContentLayer->setSize(newSize); 169 170 if (newSize.width() > oldSize.width()) { 171 float height = std::min(static_cast<float>(newSize.height()), oldSize.height()); 172 m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(oldSize.width(), 0, newSize.width() - oldSize.width(), height)); 173 } 174 175 if (newSize.height() > oldSize.height()) 176 m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(0, oldSize.height(), newSize.width(), newSize.height() - oldSize.height())); 177 178 m_nonCompositedContentLayer->setNeedsDisplayInRect(IntRect(IntPoint(), newSize)); 120 179 scheduleLayerFlush(); 121 180 } … … 123 182 void AcceleratedCompositingContext::scrollNonCompositedContents(const IntRect& scrollRect, const IntSize& scrollOffset) 124 183 { 125 notImplemented(); 184 m_nonCompositedContentLayer->setNeedsDisplayInRect(scrollRect); 185 scheduleLayerFlush(); 126 186 } 127 187 … … 144 204 bool AcceleratedCompositingContext::flushPendingLayerChanges() 145 205 { 146 if (m_rootGraphicsLayer) 147 m_rootGraphicsLayer->flushCompositingStateForThisLayerOnly(); 206 if (m_rootLayer) { 207 m_rootLayer->flushCompositingStateForThisLayerOnly(); 208 m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly(); 209 } 148 210 149 211 return core(m_webView)->mainFrame()->view()->flushCompositingStateIncludingSubframes(); … … 153 215 { 154 216 m_layerFlushTimerCallbackId = 0; 155 flushPendingLayerChanges(); 156 if (!m_rootGraphicsLayer) 157 return; 158 159 renderLayersToWindow(0, IntRect()); 217 218 if (!enabled()) 219 return; 220 221 Frame* frame = core(m_webView)->mainFrame(); 222 if (!frame || !frame->contentRenderer() || !frame->view()) 223 return; 224 225 if (!flushPendingLayerChanges()) 226 return; 160 227 } 161 228 … … 169 236 } 170 237 171 void AcceleratedCompositingContext::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) 172 { 173 ASSERT_NOT_REACHED(); 238 void AcceleratedCompositingContext::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& rectToPaint) 239 { 240 context.save(); 241 context.clip(rectToPaint); 242 core(m_webView)->mainFrame()->view()->paint(&context, rectToPaint); 243 context.restore(); 174 244 } 175 245
Note:
See TracChangeset
for help on using the changeset viewer.