OLD | NEW |
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/dom/DocumentMarkerController.h" | 8 #include "core/dom/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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 if (!documentDirtyRect.isEmpty()) { | 39 if (!documentDirtyRect.isEmpty()) { |
40 TransformRecorder transformRecorder(*context, *m_frameView.layoutView(), | 40 TransformRecorder transformRecorder(*context, *m_frameView.layoutView(), |
41 AffineTransform::translation(m_frameView.x() - m_frameView.scrollX()
, m_frameView.y() - m_frameView.scrollY())); | 41 AffineTransform::translation(m_frameView.x() - m_frameView.scrollX()
, m_frameView.y() - m_frameView.scrollY())); |
42 | 42 |
43 ClipRecorder recorder(*context, *m_frameView.layoutView(), DisplayItem::
ClipFrameToVisibleContentRect, LayoutRect(m_frameView.visibleContentRect())); | 43 ClipRecorder recorder(*context, *m_frameView.layoutView(), DisplayItem::
ClipFrameToVisibleContentRect, LayoutRect(m_frameView.visibleContentRect())); |
44 | 44 |
45 documentDirtyRect.moveBy(-m_frameView.location() + m_frameView.scrollPos
ition()); | 45 documentDirtyRect.moveBy(-m_frameView.location() + m_frameView.scrollPos
ition()); |
46 paintContents(context, documentDirtyRect); | 46 paintContents(context, documentDirtyRect); |
47 } | 47 } |
48 | 48 |
49 calculateAndPaintOverhangAreas(context, rect); | |
50 | |
51 // Now paint the scrollbars. | 49 // Now paint the scrollbars. |
52 if (!m_frameView.scrollbarsSuppressed() && (m_frameView.horizontalScrollbar(
) || m_frameView.verticalScrollbar())) { | 50 if (!m_frameView.scrollbarsSuppressed() && (m_frameView.horizontalScrollbar(
) || m_frameView.verticalScrollbar())) { |
53 IntRect scrollViewDirtyRect = rect; | 51 IntRect scrollViewDirtyRect = rect; |
54 IntRect visibleAreaWithScrollbars(m_frameView.location(), m_frameView.vi
sibleContentRect(IncludeScrollbars).size()); | 52 IntRect visibleAreaWithScrollbars(m_frameView.location(), m_frameView.vi
sibleContentRect(IncludeScrollbars).size()); |
55 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars); | 53 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars); |
56 scrollViewDirtyRect.moveBy(-m_frameView.location()); | 54 scrollViewDirtyRect.moveBy(-m_frameView.location()); |
57 | 55 |
58 TransformRecorder transformRecorder(*context, *m_frameView.layoutView(), | 56 TransformRecorder transformRecorder(*context, *m_frameView.layoutView(), |
59 AffineTransform::translation(m_frameView.x(), m_frameView.y())); | 57 AffineTransform::translation(m_frameView.x(), m_frameView.y())); |
60 | 58 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool needsBackground = bar->isCustomScrollbar() && m_frameView.frame().isMai
nFrame(); | 197 bool needsBackground = bar->isCustomScrollbar() && m_frameView.frame().isMai
nFrame(); |
200 if (needsBackground) { | 198 if (needsBackground) { |
201 IntRect toFill = bar->frameRect(); | 199 IntRect toFill = bar->frameRect(); |
202 toFill.intersect(rect); | 200 toFill.intersect(rect); |
203 context->fillRect(toFill, m_frameView.baseBackgroundColor()); | 201 context->fillRect(toFill, m_frameView.baseBackgroundColor()); |
204 } | 202 } |
205 | 203 |
206 bar->paint(context, rect); | 204 bar->paint(context, rect); |
207 } | 205 } |
208 | 206 |
209 void FramePainter::paintOverhangAreas(GraphicsContext* context, const IntRect& h
orizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirty
Rect) | |
210 { | |
211 if (m_frameView.frame().document()->printing()) | |
212 return; | |
213 | |
214 if (m_frameView.frame().isMainFrame()) { | |
215 if (m_frameView.frame().page()->chrome().client().paintCustomOverhangAre
a(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect)) | |
216 return; | |
217 } | |
218 | |
219 paintOverhangAreasInternal(context, horizontalOverhangArea, verticalOverhang
Area, dirtyRect); | |
220 } | |
221 | |
222 void FramePainter::paintOverhangAreasInternal(GraphicsContext* context, const In
tRect& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRec
t& dirtyRect) | |
223 { | |
224 ScrollbarTheme::theme()->paintOverhangBackground(context, horizontalOverhang
Rect, verticalOverhangRect, dirtyRect); | |
225 ScrollbarTheme::theme()->paintOverhangShadows(context, m_frameView.scrollOff
set(), horizontalOverhangRect, verticalOverhangRect, dirtyRect); | |
226 } | |
227 | |
228 void FramePainter::calculateAndPaintOverhangAreas(GraphicsContext* context, cons
t IntRect& dirtyRect) | |
229 { | |
230 IntRect horizontalOverhangRect; | |
231 IntRect verticalOverhangRect; | |
232 m_frameView.calculateOverhangAreasForPainting(horizontalOverhangRect, vertic
alOverhangRect); | |
233 | |
234 if (dirtyRect.intersects(horizontalOverhangRect) || dirtyRect.intersects(ver
ticalOverhangRect)) | |
235 paintOverhangAreas(context, horizontalOverhangRect, verticalOverhangRect
, dirtyRect); | |
236 } | |
237 | |
238 } // namespace blink | 207 } // namespace blink |
OLD | NEW |