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/BlockPainter.h" | 6 #include "core/paint/BlockPainter.h" |
7 | 7 |
8 #include "core/editing/Caret.h" | 8 #include "core/editing/Caret.h" |
9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
11 #include "core/frame/Settings.h" | 11 #include "core/frame/Settings.h" |
12 #include "core/page/Page.h" | 12 #include "core/page/Page.h" |
13 #include "core/paint/BoxClipper.h" | 13 #include "core/paint/BoxClipper.h" |
14 #include "core/paint/BoxPainter.h" | 14 #include "core/paint/BoxPainter.h" |
15 #include "core/paint/GraphicsContextAnnotator.h" | 15 #include "core/paint/GraphicsContextAnnotator.h" |
16 #include "core/paint/InlinePainter.h" | 16 #include "core/paint/InlinePainter.h" |
17 #include "core/paint/LineBoxListPainter.h" | 17 #include "core/paint/LineBoxListPainter.h" |
18 #include "core/paint/RenderDrawingRecorder.h" | 18 #include "core/paint/RenderDrawingRecorder.h" |
19 #include "core/paint/ScrollableAreaPainter.h" | 19 #include "core/paint/ScrollableAreaPainter.h" |
| 20 #include "core/paint/SubtreeInfoRecorder.h" |
20 #include "core/rendering/PaintInfo.h" | 21 #include "core/rendering/PaintInfo.h" |
21 #include "core/rendering/RenderBlock.h" | 22 #include "core/rendering/RenderBlock.h" |
22 #include "core/rendering/RenderFlexibleBox.h" | 23 #include "core/rendering/RenderFlexibleBox.h" |
23 #include "core/rendering/RenderInline.h" | 24 #include "core/rendering/RenderInline.h" |
24 #include "core/rendering/RenderLayer.h" | 25 #include "core/rendering/RenderLayer.h" |
25 #include "core/rendering/RenderView.h" | 26 #include "core/rendering/RenderView.h" |
26 #include "platform/geometry/LayoutPoint.h" | 27 #include "platform/geometry/LayoutPoint.h" |
27 #include "platform/geometry/LayoutRect.h" | 28 #include "platform/geometry/LayoutRect.h" |
28 #include "platform/graphics/GraphicsContextStateSaver.h" | 29 #include "platform/graphics/GraphicsContextStateSaver.h" |
29 | 30 |
30 namespace blink { | 31 namespace blink { |
31 | 32 |
32 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff
set) | 33 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff
set) |
33 { | 34 { |
34 PaintInfo localPaintInfo(paintInfo); | 35 PaintInfo localPaintInfo(paintInfo); |
| 36 SubtreeInfoRecorder subtreeInfoRecorder(paintInfo.context, m_renderBlock, lo
calPaintInfo.phase); |
35 | 37 |
36 ANNOTATE_GRAPHICS_CONTEXT(localPaintInfo, &m_renderBlock); | 38 ANNOTATE_GRAPHICS_CONTEXT(localPaintInfo, &m_renderBlock); |
37 | 39 |
38 LayoutPoint adjustedPaintOffset = paintOffset + m_renderBlock.location(); | 40 LayoutPoint adjustedPaintOffset = paintOffset + m_renderBlock.location(); |
39 | 41 |
40 PaintPhase originalPhase = localPaintInfo.phase; | 42 PaintPhase originalPhase = localPaintInfo.phase; |
41 | 43 |
42 // Check if we need to do anything at all. | 44 // Check if we need to do anything at all. |
43 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the RenderView | 45 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the RenderView |
44 // paints the root's background. | 46 // paints the root's background. |
45 if (!m_renderBlock.isDocumentElement()) { | 47 if (!m_renderBlock.isDocumentElement()) { |
46 LayoutRect overflowBox = overflowRectForPaintRejection(); | 48 LayoutRect overflowBox = overflowRectForPaintRejection(); |
47 m_renderBlock.flipForWritingMode(overflowBox); | 49 m_renderBlock.flipForWritingMode(overflowBox); |
48 overflowBox.moveBy(adjustedPaintOffset); | 50 overflowBox.moveBy(adjustedPaintOffset); |
49 if (!overflowBox.intersects(localPaintInfo.rect)) | 51 if (!overflowBox.intersects(localPaintInfo.rect)) |
50 return; | 52 return; |
51 } | 53 } |
52 | 54 |
| 55 subtreeInfoRecorder.begin(); |
| 56 |
53 // There are some cases where not all clipped visual overflow is accounted f
or. | 57 // There are some cases where not all clipped visual overflow is accounted f
or. |
54 // FIXME: reduce the number of such cases. | 58 // FIXME: reduce the number of such cases. |
55 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; | 59 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; |
56 if (m_renderBlock.hasOverflowClip() && !m_renderBlock.hasControlClip() && !(
m_renderBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForegroun
d) && !hasCaret()) | 60 if (m_renderBlock.hasOverflowClip() && !m_renderBlock.hasControlClip() && !(
m_renderBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForegroun
d) && !hasCaret()) |
57 contentsClipBehavior = SkipContentsClipIfPossible; | 61 contentsClipBehavior = SkipContentsClipIfPossible; |
58 | 62 |
59 if (localPaintInfo.phase == PaintPhaseOutline) { | 63 if (localPaintInfo.phase == PaintPhaseOutline) { |
60 localPaintInfo.phase = PaintPhaseChildOutlines; | 64 localPaintInfo.phase = PaintPhaseChildOutlines; |
61 } else if (localPaintInfo.phase == PaintPhaseChildBlockBackground) { | 65 } else if (localPaintInfo.phase == PaintPhaseChildBlockBackground) { |
62 localPaintInfo.phase = PaintPhaseBlockBackground; | 66 localPaintInfo.phase = PaintPhaseBlockBackground; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 RenderBlock* block = flow->containingBlock(); | 493 RenderBlock* block = flow->containingBlock(); |
490 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) | 494 for ( ; block && block != &m_renderBlock; block = block->containingBlock
()) |
491 accumulatedPaintOffset.moveBy(block->location()); | 495 accumulatedPaintOffset.moveBy(block->location()); |
492 ASSERT(block); | 496 ASSERT(block); |
493 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); | 497 InlinePainter(*flow).paintOutline(info, accumulatedPaintOffset); |
494 } | 498 } |
495 } | 499 } |
496 | 500 |
497 | 501 |
498 } // namespace blink | 502 } // namespace blink |
OLD | NEW |