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

Side by Side Diff: Source/web/WebPluginContainerImpl.cpp

Issue 322193002: Don't do a style recalc when updating the composited layer of a plugin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix assert Created 6 years, 6 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 | « no previous file | no next file » | 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "core/html/HTMLFormElement.h" 58 #include "core/html/HTMLFormElement.h"
59 #include "core/html/HTMLPlugInElement.h" 59 #include "core/html/HTMLPlugInElement.h"
60 #include "core/loader/FormState.h" 60 #include "core/loader/FormState.h"
61 #include "core/loader/FrameLoadRequest.h" 61 #include "core/loader/FrameLoadRequest.h"
62 #include "core/page/FocusController.h" 62 #include "core/page/FocusController.h"
63 #include "core/page/Page.h" 63 #include "core/page/Page.h"
64 #include "core/page/scrolling/ScrollingCoordinator.h" 64 #include "core/page/scrolling/ScrollingCoordinator.h"
65 #include "core/plugins/PluginOcclusionSupport.h" 65 #include "core/plugins/PluginOcclusionSupport.h"
66 #include "core/rendering/HitTestResult.h" 66 #include "core/rendering/HitTestResult.h"
67 #include "core/rendering/RenderBox.h" 67 #include "core/rendering/RenderBox.h"
68 #include "core/rendering/RenderLayer.h"
68 #include "platform/HostWindow.h" 69 #include "platform/HostWindow.h"
69 #include "platform/KeyboardCodes.h" 70 #include "platform/KeyboardCodes.h"
70 #include "platform/PlatformGestureEvent.h" 71 #include "platform/PlatformGestureEvent.h"
71 #include "platform/UserGestureIndicator.h" 72 #include "platform/UserGestureIndicator.h"
72 #include "platform/graphics/GraphicsContext.h" 73 #include "platform/graphics/GraphicsContext.h"
73 #include "platform/graphics/GraphicsLayer.h" 74 #include "platform/graphics/GraphicsLayer.h"
74 #include "platform/scroll/ScrollAnimator.h" 75 #include "platform/scroll/ScrollAnimator.h"
75 #include "platform/scroll/ScrollView.h" 76 #include "platform/scroll/ScrollView.h"
76 #include "platform/scroll/ScrollbarTheme.h" 77 #include "platform/scroll/ScrollbarTheme.h"
77 #include "public/platform/Platform.h" 78 #include "public/platform/Platform.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (!frame) 282 if (!frame)
282 return 1.0; 283 return 1.0;
283 return frame->pageZoomFactor(); 284 return frame->pageZoomFactor();
284 } 285 }
285 286
286 void WebPluginContainerImpl::setWebLayer(WebLayer* layer) 287 void WebPluginContainerImpl::setWebLayer(WebLayer* layer)
287 { 288 {
288 if (m_webLayer == layer) 289 if (m_webLayer == layer)
289 return; 290 return;
290 291
291 // If anyone of the layers is null we need to switch between hardware
292 // and software compositing.
293 if (!m_webLayer || !layer) {
294 m_element->setNeedsCompositingUpdate();
295 // Trigger a style recalc so we update the
296 // requiresAcceleratedCompositingForExternalReasons bit in
297 // RenderStyle and thus give the plugin a NormalLayer RenderLayer.
298 m_element->setNeedsStyleRecalc(LocalStyleChange);
299 }
300 if (m_webLayer) 292 if (m_webLayer)
301 GraphicsLayer::unregisterContentsLayer(m_webLayer); 293 GraphicsLayer::unregisterContentsLayer(m_webLayer);
302 if (layer) 294 if (layer)
303 GraphicsLayer::registerContentsLayer(layer); 295 GraphicsLayer::registerContentsLayer(layer);
296
297 // If anyone of the layers is null we need to switch between hardware
esprehn 2014/06/10 21:14:37 "any one" or "either"
298 // and software compositing.
299 bool needsCompositingUpdate = !m_webLayer || !layer;
300
304 m_webLayer = layer; 301 m_webLayer = layer;
302
303 if (!needsCompositingUpdate)
304 return;
305
306 m_element->setNeedsCompositingUpdate();
307 // Being composited or not affects the self painting layer bit
308 // on the RenderLayer.
309 if (RenderPart* renderer = m_element->renderPart()) {
310 ASSERT(renderer->hasLayer());
311 renderer->layer()->updateSelfPaintingLayer();
312 }
305 } 313 }
306 314
307 bool WebPluginContainerImpl::supportsPaginatedPrint() const 315 bool WebPluginContainerImpl::supportsPaginatedPrint() const
308 { 316 {
309 return m_webPlugin->supportsPaginatedPrint(); 317 return m_webPlugin->supportsPaginatedPrint();
310 } 318 }
311 319
312 bool WebPluginContainerImpl::isPrintScalingDisabled() const 320 bool WebPluginContainerImpl::isPrintScalingDisabled() const
313 { 321 {
314 return m_webPlugin->isPrintScalingDisabled(); 322 return m_webPlugin->isPrintScalingDisabled();
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 908
901 return clipRect; 909 return clipRect;
902 } 910 }
903 911
904 bool WebPluginContainerImpl::pluginShouldPersist() const 912 bool WebPluginContainerImpl::pluginShouldPersist() const
905 { 913 {
906 return m_webPlugin->shouldPersist(); 914 return m_webPlugin->shouldPersist();
907 } 915 }
908 916
909 } // namespace blink 917 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698