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

Unified Diff: Source/core/rendering/RenderBlock.cpp

Issue 204093002: GraphicsContext culling support. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Flag disabled by default. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/frame/Settings.in ('k') | Source/core/rendering/svg/RenderSVGContainer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index a23bfbb8af6da719c0329019d101c1b0f6ab86d1..6949041866bef6c756180b86afd9141ae42a7761 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -64,6 +64,7 @@
#include "core/rendering/style/RenderStyle.h"
#include "platform/geometry/FloatQuad.h"
#include "platform/geometry/TransformState.h"
+#include "platform/graphics/GraphicsContextCullSaver.h"
#include "platform/graphics/GraphicsContextStateSaver.h"
#include "wtf/StdLibExtras.h"
#include "wtf/TemporaryChange.h"
@@ -1832,11 +1833,12 @@ void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
PaintPhase phase = paintInfo.phase;
+ LayoutRect overflowBox;
// Check if we need to do anything at all.
// FIXME: Could eliminate the isRoot() check if we fix background painting so that the RenderView
// paints the root's background.
if (!isRoot()) {
- LayoutRect overflowBox = overflowRectForPaintRejection();
+ overflowBox = overflowRectForPaintRejection();
flipForWritingMode(overflowBox);
overflowBox.moveBy(adjustedPaintOffset);
if (!overflowBox.intersects(paintInfo.rect))
@@ -1850,7 +1852,16 @@ void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
contentsClipBehavior = SkipContentsClipIfPossible;
bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsClipBehavior);
- paintObject(paintInfo, adjustedPaintOffset);
+ {
+ GraphicsContextCullSaver cullSaver(*paintInfo.context);
+ // Cull if we have more than one child and we didn't already clip.
+ bool shouldCull = document().settings()->containerCullingEnabled() && !pushedClip && !isRoot()
+ && firstChild() && lastChild() && firstChild() != lastChild();
+ if (shouldCull)
+ cullSaver.cull(overflowBox);
+
+ paintObject(paintInfo, adjustedPaintOffset);
+ }
if (pushedClip)
popContentsClip(paintInfo, phase, adjustedPaintOffset);
« no previous file with comments | « Source/core/frame/Settings.in ('k') | Source/core/rendering/svg/RenderSVGContainer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698