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

Side by Side Diff: Source/core/paint/ScrollableAreaPainter.cpp

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « Source/core/paint/SVGShapePainter.cpp ('k') | Source/core/paint/TableCellPainter.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/ScrollableAreaPainter.h" 6 #include "core/paint/ScrollableAreaPainter.h"
7 7
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/page/Page.h" 9 #include "core/page/Page.h"
10 #include "core/paint/DeprecatedPaintLayer.h" 10 #include "core/paint/DeprecatedPaintLayer.h"
(...skipping 19 matching lines...) Expand all
30 if (m_scrollableArea.resizer()) { 30 if (m_scrollableArea.resizer()) {
31 if (!absRect.intersects(damageRect)) 31 if (!absRect.intersects(damageRect))
32 return; 32 return;
33 ScrollbarPainter::paintIntoRect(m_scrollableArea.resizer(), context, pai ntOffset, LayoutRect(absRect)); 33 ScrollbarPainter::paintIntoRect(m_scrollableArea.resizer(), context, pai ntOffset, LayoutRect(absRect));
34 return; 34 return;
35 } 35 }
36 36
37 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() && !absRect.intersects(d amageRect)) 37 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() && !absRect.intersects(d amageRect))
38 return; 38 return;
39 39
40 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_scro llableArea.box(), DisplayItem::Resizer))
41 return;
42
40 LayoutObjectDrawingRecorder recorder(*context, m_scrollableArea.box(), Displ ayItem::Resizer, absRect); 43 LayoutObjectDrawingRecorder recorder(*context, m_scrollableArea.box(), Displ ayItem::Resizer, absRect);
41 if (recorder.canUseCachedDrawing())
42 return;
43 44
44 drawPlatformResizerImage(context, absRect); 45 drawPlatformResizerImage(context, absRect);
45 46
46 // Draw a frame around the resizer (1px grey line) if there are any scrollba rs present. 47 // Draw a frame around the resizer (1px grey line) if there are any scrollba rs present.
47 // Clipping will exclude the right and bottom edges of this frame. 48 // Clipping will exclude the right and bottom edges of this frame.
48 if (!m_scrollableArea.hasOverlayScrollbars() && m_scrollableArea.hasScrollba r()) { 49 if (!m_scrollableArea.hasOverlayScrollbars() && m_scrollableArea.hasScrollba r()) {
49 GraphicsContextStateSaver stateSaver(*context); 50 GraphicsContextStateSaver stateSaver(*context);
50 context->clip(absRect); 51 context->clip(absRect);
51 IntRect largerCorner = absRect; 52 IntRect largerCorner = absRect;
52 largerCorner.setSize(IntSize(largerCorner.width() + 1, largerCorner.heig ht() + 1)); 53 largerCorner.setSize(IntSize(largerCorner.width() + 1, largerCorner.heig ht() + 1));
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 185 }
185 186
186 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() && !absRect.intersects(d amageRect)) 187 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() && !absRect.intersects(d amageRect))
187 return; 188 return;
188 189
189 // We don't want to paint white if we have overlay scrollbars, since we need 190 // We don't want to paint white if we have overlay scrollbars, since we need
190 // to see what is behind it. 191 // to see what is behind it.
191 if (m_scrollableArea.hasOverlayScrollbars()) 192 if (m_scrollableArea.hasOverlayScrollbars())
192 return; 193 return;
193 194
194 LayoutObjectDrawingRecorder recorder(*context, m_scrollableArea.box(), Displ ayItem::ScrollbarCorner, absRect); 195 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_scro llableArea.box(), DisplayItem::ScrollbarCorner))
195 if (recorder.canUseCachedDrawing())
196 return; 196 return;
197 197
198 LayoutObjectDrawingRecorder recorder(*context, m_scrollableArea.box(), Displ ayItem::ScrollbarCorner, absRect);
198 context->fillRect(absRect, Color::white); 199 context->fillRect(absRect, Color::white);
199 } 200 }
200 201
201 } // namespace blink 202 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/SVGShapePainter.cpp ('k') | Source/core/paint/TableCellPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698