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

Side by Side Diff: third_party/WebKit/Source/core/paint/FramePainter.cpp

Issue 1422493003: Change Widget subclasses to use a CullRect instead of an IntRect for painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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/FramePainter.h" 6 #include "core/paint/FramePainter.h"
7 7
8 #include "core/editing/markers/DocumentMarkerController.h" 8 #include "core/editing/markers/DocumentMarkerController.h"
9 #include "core/fetch/MemoryCache.h" 9 #include "core/fetch/MemoryCache.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
11 #include "core/inspector/InspectorInstrumentation.h" 11 #include "core/inspector/InspectorInstrumentation.h"
12 #include "core/inspector/InspectorTraceEvents.h" 12 #include "core/inspector/InspectorTraceEvents.h"
13 #include "core/layout/LayoutView.h" 13 #include "core/layout/LayoutView.h"
14 #include "core/page/Page.h" 14 #include "core/page/Page.h"
15 #include "core/paint/LayoutObjectDrawingRecorder.h" 15 #include "core/paint/LayoutObjectDrawingRecorder.h"
16 #include "core/paint/PaintInfo.h" 16 #include "core/paint/PaintInfo.h"
17 #include "core/paint/PaintLayer.h" 17 #include "core/paint/PaintLayer.h"
18 #include "core/paint/PaintLayerPainter.h" 18 #include "core/paint/PaintLayerPainter.h"
19 #include "core/paint/ScrollbarPainter.h" 19 #include "core/paint/ScrollbarPainter.h"
20 #include "core/paint/TransformRecorder.h" 20 #include "core/paint/TransformRecorder.h"
21 #include "platform/fonts/FontCache.h" 21 #include "platform/fonts/FontCache.h"
22 #include "platform/graphics/GraphicsContext.h" 22 #include "platform/graphics/GraphicsContext.h"
23 #include "platform/graphics/paint/ClipRecorder.h" 23 #include "platform/graphics/paint/ClipRecorder.h"
24 #include "platform/scroll/ScrollbarTheme.h" 24 #include "platform/scroll/ScrollbarTheme.h"
25 25
26 namespace blink { 26 namespace blink {
27 27
28 bool FramePainter::s_inPaintContents = false; 28 bool FramePainter::s_inPaintContents = false;
29 29
30 void FramePainter::paint(GraphicsContext* context, const GlobalPaintFlags global PaintFlags, const IntRect& rect) 30 void FramePainter::paint(GraphicsContext* context, const GlobalPaintFlags global PaintFlags, const CullRect& rect)
31 { 31 {
32 frameView().notifyPageThatContentAreaWillPaint(); 32 frameView().notifyPageThatContentAreaWillPaint();
33 33
34 IntRect documentDirtyRect = rect; 34 IntRect documentDirtyRect = rect.m_rect;
35 IntRect visibleAreaWithoutScrollbars(frameView().location(), frameView().vis ibleContentRect().size()); 35 IntRect visibleAreaWithoutScrollbars(frameView().location(), frameView().vis ibleContentRect().size());
36 documentDirtyRect.intersect(visibleAreaWithoutScrollbars); 36 documentDirtyRect.intersect(visibleAreaWithoutScrollbars);
37 37
38 if (!documentDirtyRect.isEmpty()) { 38 if (!documentDirtyRect.isEmpty()) {
39 TransformRecorder transformRecorder(*context, *frameView().layoutView(), 39 TransformRecorder transformRecorder(*context, *frameView().layoutView(),
40 AffineTransform::translation(frameView().x() - frameView().scrollX() , frameView().y() - frameView().scrollY())); 40 AffineTransform::translation(frameView().x() - frameView().scrollX() , frameView().y() - frameView().scrollY()));
41 41
42 ClipRecorder recorder(*context, *frameView().layoutView(), DisplayItem:: ClipFrameToVisibleContentRect, LayoutRect(frameView().visibleContentRect())); 42 ClipRecorder recorder(*context, *frameView().layoutView(), DisplayItem:: ClipFrameToVisibleContentRect, LayoutRect(frameView().visibleContentRect()));
43 43
44 documentDirtyRect.moveBy(-frameView().location() + frameView().scrollPos ition()); 44 documentDirtyRect.moveBy(-frameView().location() + frameView().scrollPos ition());
45 paintContents(context, globalPaintFlags, documentDirtyRect); 45 paintContents(context, globalPaintFlags, documentDirtyRect);
46 } 46 }
47 47
48 // Now paint the scrollbars. 48 // Now paint the scrollbars.
49 if (!frameView().scrollbarsSuppressed() && (frameView().horizontalScrollbar( ) || frameView().verticalScrollbar())) { 49 if (!frameView().scrollbarsSuppressed() && (frameView().horizontalScrollbar( ) || frameView().verticalScrollbar())) {
50 IntRect scrollViewDirtyRect = rect; 50 IntRect scrollViewDirtyRect = rect.m_rect;
51 IntRect visibleAreaWithScrollbars(frameView().location(), frameView().vi sibleContentRect(IncludeScrollbars).size()); 51 IntRect visibleAreaWithScrollbars(frameView().location(), frameView().vi sibleContentRect(IncludeScrollbars).size());
52 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars); 52 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars);
53 scrollViewDirtyRect.moveBy(-frameView().location()); 53 scrollViewDirtyRect.moveBy(-frameView().location());
54 54
55 TransformRecorder transformRecorder(*context, *frameView().layoutView(), 55 TransformRecorder transformRecorder(*context, *frameView().layoutView(),
56 AffineTransform::translation(frameView().x(), frameView().y())); 56 AffineTransform::translation(frameView().x(), frameView().y()));
57 57
58 ClipRecorder recorder(*context, *frameView().layoutView(), DisplayItem:: ClipFrameScrollbars, LayoutRect(IntPoint(), visibleAreaWithScrollbars.size())); 58 ClipRecorder recorder(*context, *frameView().layoutView(), DisplayItem:: ClipFrameScrollbars, LayoutRect(IntPoint(), visibleAreaWithScrollbars.size()));
59 59
60 paintScrollbars(context, scrollViewDirtyRect); 60 paintScrollbars(context, scrollViewDirtyRect);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 void FramePainter::paintScrollbar(GraphicsContext* context, Scrollbar* bar, cons t IntRect& rect) 178 void FramePainter::paintScrollbar(GraphicsContext* context, Scrollbar* bar, cons t IntRect& rect)
179 { 179 {
180 bool needsBackground = bar->isCustomScrollbar() && frameView().frame().isMai nFrame(); 180 bool needsBackground = bar->isCustomScrollbar() && frameView().frame().isMai nFrame();
181 if (needsBackground) { 181 if (needsBackground) {
182 IntRect toFill = bar->frameRect(); 182 IntRect toFill = bar->frameRect();
183 toFill.intersect(rect); 183 toFill.intersect(rect);
184 context->fillRect(toFill, frameView().baseBackgroundColor()); 184 context->fillRect(toFill, frameView().baseBackgroundColor());
185 } 185 }
186 186
187 bar->paint(context, rect); 187 bar->paint(context, CullRect(rect));
188 } 188 }
189 189
190 const FrameView& FramePainter::frameView() 190 const FrameView& FramePainter::frameView()
191 { 191 {
192 ASSERT(m_frameView); 192 ASSERT(m_frameView);
193 return *m_frameView; 193 return *m_frameView;
194 } 194 }
195 195
196 } // namespace blink 196 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/FramePainter.h ('k') | third_party/WebKit/Source/core/paint/PaintInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698