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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/Settings.in ('k') | Source/core/rendering/svg/RenderSVGContainer.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "core/rendering/RenderTableCell.h" 57 #include "core/rendering/RenderTableCell.h"
58 #include "core/rendering/RenderTextControl.h" 58 #include "core/rendering/RenderTextControl.h"
59 #include "core/rendering/RenderTextFragment.h" 59 #include "core/rendering/RenderTextFragment.h"
60 #include "core/rendering/RenderTheme.h" 60 #include "core/rendering/RenderTheme.h"
61 #include "core/rendering/RenderView.h" 61 #include "core/rendering/RenderView.h"
62 #include "core/rendering/shapes/ShapeOutsideInfo.h" 62 #include "core/rendering/shapes/ShapeOutsideInfo.h"
63 #include "core/rendering/style/ContentData.h" 63 #include "core/rendering/style/ContentData.h"
64 #include "core/rendering/style/RenderStyle.h" 64 #include "core/rendering/style/RenderStyle.h"
65 #include "platform/geometry/FloatQuad.h" 65 #include "platform/geometry/FloatQuad.h"
66 #include "platform/geometry/TransformState.h" 66 #include "platform/geometry/TransformState.h"
67 #include "platform/graphics/GraphicsContextCullSaver.h"
67 #include "platform/graphics/GraphicsContextStateSaver.h" 68 #include "platform/graphics/GraphicsContextStateSaver.h"
68 #include "wtf/StdLibExtras.h" 69 #include "wtf/StdLibExtras.h"
69 #include "wtf/TemporaryChange.h" 70 #include "wtf/TemporaryChange.h"
70 71
71 using namespace std; 72 using namespace std;
72 using namespace WTF; 73 using namespace WTF;
73 using namespace Unicode; 74 using namespace Unicode;
74 75
75 namespace WebCore { 76 namespace WebCore {
76 77
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 } 1826 }
1826 1827
1827 void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 1828 void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
1828 { 1829 {
1829 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); 1830 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
1830 1831
1831 LayoutPoint adjustedPaintOffset = paintOffset + location(); 1832 LayoutPoint adjustedPaintOffset = paintOffset + location();
1832 1833
1833 PaintPhase phase = paintInfo.phase; 1834 PaintPhase phase = paintInfo.phase;
1834 1835
1836 LayoutRect overflowBox;
1835 // Check if we need to do anything at all. 1837 // Check if we need to do anything at all.
1836 // FIXME: Could eliminate the isRoot() check if we fix background painting s o that the RenderView 1838 // FIXME: Could eliminate the isRoot() check if we fix background painting s o that the RenderView
1837 // paints the root's background. 1839 // paints the root's background.
1838 if (!isRoot()) { 1840 if (!isRoot()) {
1839 LayoutRect overflowBox = overflowRectForPaintRejection(); 1841 overflowBox = overflowRectForPaintRejection();
1840 flipForWritingMode(overflowBox); 1842 flipForWritingMode(overflowBox);
1841 overflowBox.moveBy(adjustedPaintOffset); 1843 overflowBox.moveBy(adjustedPaintOffset);
1842 if (!overflowBox.intersects(paintInfo.rect)) 1844 if (!overflowBox.intersects(paintInfo.rect))
1843 return; 1845 return;
1844 } 1846 }
1845 1847
1846 // There are some cases where not all clipped visual overflow is accounted f or. 1848 // There are some cases where not all clipped visual overflow is accounted f or.
1847 // FIXME: reduce the number of such cases. 1849 // FIXME: reduce the number of such cases.
1848 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; 1850 ContentsClipBehavior contentsClipBehavior = ForceContentsClip;
1849 if (hasOverflowClip() && !hasControlClip() && !(shouldPaintSelectionGaps() & & phase == PaintPhaseForeground) && !hasCaret()) 1851 if (hasOverflowClip() && !hasControlClip() && !(shouldPaintSelectionGaps() & & phase == PaintPhaseForeground) && !hasCaret())
1850 contentsClipBehavior = SkipContentsClipIfPossible; 1852 contentsClipBehavior = SkipContentsClipIfPossible;
1851 1853
1852 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC lipBehavior); 1854 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC lipBehavior);
1853 paintObject(paintInfo, adjustedPaintOffset); 1855 {
1856 GraphicsContextCullSaver cullSaver(*paintInfo.context);
1857 // Cull if we have more than one child and we didn't already clip.
1858 bool shouldCull = document().settings()->containerCullingEnabled() && !p ushedClip && !isRoot()
1859 && firstChild() && lastChild() && firstChild() != lastChild();
1860 if (shouldCull)
1861 cullSaver.cull(overflowBox);
1862
1863 paintObject(paintInfo, adjustedPaintOffset);
1864 }
1854 if (pushedClip) 1865 if (pushedClip)
1855 popContentsClip(paintInfo, phase, adjustedPaintOffset); 1866 popContentsClip(paintInfo, phase, adjustedPaintOffset);
1856 1867
1857 // Our scrollbar widgets paint exactly when we tell them to, so that they wo rk properly with 1868 // Our scrollbar widgets paint exactly when we tell them to, so that they wo rk properly with
1858 // z-index. We paint after we painted the background/border, so that the sc rollbars will 1869 // z-index. We paint after we painted the background/border, so that the sc rollbars will
1859 // sit above the background/border. 1870 // sit above the background/border.
1860 if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == Paint PhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.sh ouldPaintWithinRoot(this) && !paintInfo.paintRootBackgroundOnly()) 1871 if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == Paint PhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.sh ouldPaintWithinRoot(this) && !paintInfo.paintRootBackgroundOnly())
1861 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro ls */); 1872 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro ls */);
1862 } 1873 }
1863 1874
(...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after
5025 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5036 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5026 { 5037 {
5027 showRenderObject(); 5038 showRenderObject();
5028 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5039 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5029 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5040 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5030 } 5041 }
5031 5042
5032 #endif 5043 #endif
5033 5044
5034 } // namespace WebCore 5045 } // namespace WebCore
OLDNEW
« 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