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/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/inspector/InspectorInstrumentation.h" | 10 #include "core/inspector/InspectorInstrumentation.h" |
11 #include "core/inspector/InspectorTraceEvents.h" | 11 #include "core/inspector/InspectorTraceEvents.h" |
12 #include "core/page/Chrome.h" | 12 #include "core/page/Chrome.h" |
13 #include "core/page/ChromeClient.h" | 13 #include "core/page/ChromeClient.h" |
14 #include "core/page/Page.h" | 14 #include "core/page/Page.h" |
| 15 #include "core/paint/ClipRecorder.h" |
15 #include "core/paint/LayerPainter.h" | 16 #include "core/paint/LayerPainter.h" |
16 #include "core/paint/ScrollbarPainter.h" | 17 #include "core/paint/ScrollbarPainter.h" |
| 18 #include "core/paint/TranslationRecorder.h" |
17 #include "core/rendering/RenderLayer.h" | 19 #include "core/rendering/RenderLayer.h" |
18 #include "core/rendering/RenderView.h" | 20 #include "core/rendering/RenderView.h" |
19 #include "platform/fonts/FontCache.h" | 21 #include "platform/fonts/FontCache.h" |
20 #include "platform/graphics/GraphicsContext.h" | 22 #include "platform/graphics/GraphicsContext.h" |
21 #include "platform/graphics/GraphicsContextStateSaver.h" | 23 #include "platform/graphics/GraphicsContextStateSaver.h" |
22 #include "platform/scroll/ScrollbarTheme.h" | 24 #include "platform/scroll/ScrollbarTheme.h" |
23 | 25 |
24 namespace blink { | 26 namespace blink { |
25 | 27 |
26 bool FramePainter::s_inPaintContents = false; | 28 bool FramePainter::s_inPaintContents = false; |
27 | 29 |
28 void FramePainter::paint(GraphicsContext* context, const IntRect& rect) | 30 void FramePainter::paint(GraphicsContext* context, const IntRect& rect) |
29 { | 31 { |
30 m_frameView.notifyPageThatContentAreaWillPaint(); | 32 m_frameView.notifyPageThatContentAreaWillPaint(); |
31 | 33 |
32 IntRect documentDirtyRect = rect; | 34 IntRect documentDirtyRect = rect; |
33 IntRect visibleAreaWithoutScrollbars(m_frameView.location(), m_frameView.vis
ibleContentRect().size()); | 35 IntRect visibleAreaWithoutScrollbars(m_frameView.location(), m_frameView.vis
ibleContentRect().size()); |
34 documentDirtyRect.intersect(visibleAreaWithoutScrollbars); | 36 documentDirtyRect.intersect(visibleAreaWithoutScrollbars); |
35 | 37 |
36 if (!documentDirtyRect.isEmpty()) { | 38 if (!documentDirtyRect.isEmpty()) { |
37 GraphicsContextStateSaver stateSaver(*context); | 39 // FIXME: Need proper identifier (renderer and phase pair) for the recor
ders. |
38 | 40 TranslationRecorder translationRecorder(m_frameView.renderView(), contex
t, FloatSize(m_frameView.x() - m_frameView.scrollX(), m_frameView.y() - m_frameV
iew.scrollY())); |
39 context->translate(m_frameView.x() - m_frameView.scrollX(), m_frameView.
y() - m_frameView.scrollY()); | 41 ClipRecorder clipRecorder(m_frameView.renderView()->layer(), context, Di
splayItem::ClipLayerForeground, LayoutRect(m_frameView.visibleContentRect())); |
40 context->clip(m_frameView.visibleContentRect()); | |
41 | 42 |
42 documentDirtyRect.moveBy(-m_frameView.location() + m_frameView.scrollPos
ition()); | 43 documentDirtyRect.moveBy(-m_frameView.location() + m_frameView.scrollPos
ition()); |
43 paintContents(context, documentDirtyRect); | 44 paintContents(context, documentDirtyRect); |
44 } | 45 } |
45 | 46 |
46 calculateAndPaintOverhangAreas(context, rect); | 47 calculateAndPaintOverhangAreas(context, rect); |
47 | 48 |
48 // Now paint the scrollbars. | 49 // Now paint the scrollbars. |
49 if (!m_frameView.scrollbarsSuppressed() && (m_frameView.horizontalScrollbar(
) || m_frameView.verticalScrollbar())) { | 50 if (!m_frameView.scrollbarsSuppressed() && (m_frameView.horizontalScrollbar(
) || m_frameView.verticalScrollbar())) { |
50 GraphicsContextStateSaver stateSaver(*context); | 51 GraphicsContextStateSaver stateSaver(*context); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 { | 217 { |
217 IntRect horizontalOverhangRect; | 218 IntRect horizontalOverhangRect; |
218 IntRect verticalOverhangRect; | 219 IntRect verticalOverhangRect; |
219 m_frameView.calculateOverhangAreasForPainting(horizontalOverhangRect, vertic
alOverhangRect); | 220 m_frameView.calculateOverhangAreasForPainting(horizontalOverhangRect, vertic
alOverhangRect); |
220 | 221 |
221 if (dirtyRect.intersects(horizontalOverhangRect) || dirtyRect.intersects(ver
ticalOverhangRect)) | 222 if (dirtyRect.intersects(horizontalOverhangRect) || dirtyRect.intersects(ver
ticalOverhangRect)) |
222 paintOverhangAreas(context, horizontalOverhangRect, verticalOverhangRect
, dirtyRect); | 223 paintOverhangAreas(context, horizontalOverhangRect, verticalOverhangRect
, dirtyRect); |
223 } | 224 } |
224 | 225 |
225 } // namespace blink | 226 } // namespace blink |
OLD | NEW |