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

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

Issue 1154993004: Don't paint empty scrollbar parts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Source/platform/scroll/ScrollbarTheme.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"
11 #include "core/paint/DeprecatedPaintLayerScrollableArea.h" 11 #include "core/paint/DeprecatedPaintLayerScrollableArea.h"
12 #include "core/paint/ScrollbarPainter.h" 12 #include "core/paint/ScrollbarPainter.h"
13 #include "core/paint/TransformRecorder.h" 13 #include "core/paint/TransformRecorder.h"
14 #include "platform/graphics/GraphicsContext.h" 14 #include "platform/graphics/GraphicsContext.h"
15 #include "platform/graphics/GraphicsContextStateSaver.h" 15 #include "platform/graphics/GraphicsContextStateSaver.h"
16 #include "platform/graphics/paint/DrawingRecorder.h" 16 #include "platform/graphics/paint/DrawingRecorder.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 void ScrollableAreaPainter::paintResizer(GraphicsContext* context, const IntPoin t& paintOffset, const IntRect& damageRect) 20 void ScrollableAreaPainter::paintResizer(GraphicsContext* context, const IntPoin t& paintOffset, const IntRect& damageRect)
21 { 21 {
22 if (m_scrollableArea.box().style()->resize() == RESIZE_NONE) 22 if (m_scrollableArea.box().style()->resize() == RESIZE_NONE)
23 return; 23 return;
24 24
25 IntRect absRect = m_scrollableArea.resizerCornerRect(m_scrollableArea.box(). pixelSnappedBorderBoxRect(), ResizerForPointer); 25 IntRect absRect = m_scrollableArea.resizerCornerRect(m_scrollableArea.box(). pixelSnappedBorderBoxRect(), ResizerForPointer);
26 if (absRect.isEmpty())
27 return;
26 absRect.moveBy(paintOffset); 28 absRect.moveBy(paintOffset);
27 if (!absRect.intersects(damageRect))
28 return;
29 29
30 if (m_scrollableArea.resizer()) { 30 if (m_scrollableArea.resizer()) {
31 if (!absRect.intersects(damageRect))
chrishtr 2015/06/05 22:50:09 Why is this ok? I thought we had to paint all or n
Xianzhu 2015/06/05 22:56:54 We paint all or none for non-custom parts. For cus
chrishtr 2015/06/05 22:59:11 OK, then...
32 return;
31 ScrollbarPainter::paintIntoRect(m_scrollableArea.resizer(), context, pai ntOffset, LayoutRect(absRect)); 33 ScrollbarPainter::paintIntoRect(m_scrollableArea.resizer(), context, pai ntOffset, LayoutRect(absRect));
32 return; 34 return;
33 } 35 }
34 36
37 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() && !absRect.intersects(d amageRect))
chrishtr 2015/06/05 22:59:11 Why condition on slimming paint here?
Xianzhu 2015/06/05 23:04:41 This is the non-custom path. In slimming paint mod
38 return;
39
35 DrawingRecorder recorder(*context, m_scrollableArea.box(), DisplayItem::Resi zer, absRect); 40 DrawingRecorder recorder(*context, m_scrollableArea.box(), DisplayItem::Resi zer, absRect);
36 if (recorder.canUseCachedDrawing()) 41 if (recorder.canUseCachedDrawing())
37 return; 42 return;
38 43
39 drawPlatformResizerImage(context, absRect); 44 drawPlatformResizerImage(context, absRect);
40 45
41 // Draw a frame around the resizer (1px grey line) if there are any scrollba rs present. 46 // Draw a frame around the resizer (1px grey line) if there are any scrollba rs present.
42 // Clipping will exclude the right and bottom edges of this frame. 47 // Clipping will exclude the right and bottom edges of this frame.
43 if (!m_scrollableArea.hasOverlayScrollbars() && m_scrollableArea.hasScrollba r()) { 48 if (!m_scrollableArea.hasOverlayScrollbars() && m_scrollableArea.hasScrollba r()) {
44 GraphicsContextStateSaver stateSaver(*context); 49 GraphicsContextStateSaver stateSaver(*context);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (m_scrollableArea.resizerCornerRect(borderBox, ResizerForPointer).interse cts(localRect)) 165 if (m_scrollableArea.resizerCornerRect(borderBox, ResizerForPointer).interse cts(localRect))
161 return true; 166 return true;
162 167
163 return false; 168 return false;
164 } 169 }
165 170
166 171
167 void ScrollableAreaPainter::paintScrollCorner(GraphicsContext* context, const In tPoint& paintOffset, const IntRect& damageRect) 172 void ScrollableAreaPainter::paintScrollCorner(GraphicsContext* context, const In tPoint& paintOffset, const IntRect& damageRect)
168 { 173 {
169 IntRect absRect = m_scrollableArea.scrollCornerRect(); 174 IntRect absRect = m_scrollableArea.scrollCornerRect();
175 if (absRect.isEmpty())
176 return;
170 absRect.moveBy(paintOffset); 177 absRect.moveBy(paintOffset);
171 178
172 if (m_scrollableArea.scrollCorner()) { 179 if (m_scrollableArea.scrollCorner()) {
173 if (!absRect.intersects(damageRect)) 180 if (!absRect.intersects(damageRect))
174 return; 181 return;
175 ScrollbarPainter::paintIntoRect(m_scrollableArea.scrollCorner(), context , paintOffset, LayoutRect(absRect)); 182 ScrollbarPainter::paintIntoRect(m_scrollableArea.scrollCorner(), context , paintOffset, LayoutRect(absRect));
176 return; 183 return;
177 } 184 }
178 185
179 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() && !absRect.intersects(d amageRect)) 186 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() && !absRect.intersects(d amageRect))
180 return; 187 return;
181 188
182 // We don't want to paint white if we have overlay scrollbars, since we need 189 // We don't want to paint white if we have overlay scrollbars, since we need
183 // to see what is behind it. 190 // to see what is behind it.
184 if (m_scrollableArea.hasOverlayScrollbars()) 191 if (m_scrollableArea.hasOverlayScrollbars())
185 return; 192 return;
186 193
187 DrawingRecorder recorder(*context, m_scrollableArea.box(), DisplayItem::Scro llbarCorner, absRect); 194 DrawingRecorder recorder(*context, m_scrollableArea.box(), DisplayItem::Scro llbarCorner, absRect);
188 if (recorder.canUseCachedDrawing()) 195 if (recorder.canUseCachedDrawing())
189 return; 196 return;
190 197
191 context->fillRect(absRect, Color::white); 198 context->fillRect(absRect, Color::white);
192 } 199 }
193 200
194 } // namespace blink 201 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/scroll/ScrollbarTheme.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698