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/BlockFlowPainter.h" | 6 #include "core/paint/BlockFlowPainter.h" |
7 | 7 |
| 8 #include "core/paint/GraphicsContextRecorder.h" |
8 #include "core/rendering/FloatingObjects.h" | 9 #include "core/rendering/FloatingObjects.h" |
9 #include "core/rendering/PaintInfo.h" | 10 #include "core/rendering/PaintInfo.h" |
10 #include "core/rendering/RenderBlockFlow.h" | 11 #include "core/rendering/RenderBlockFlow.h" |
11 #include "core/rendering/RenderLayer.h" | 12 #include "core/rendering/RenderLayer.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset, bool preservePhase) | 16 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint
& paintOffset, bool preservePhase) |
16 { | 17 { |
17 if (!m_renderBlockFlow.floatingObjects()) | 18 if (!m_renderBlockFlow.floatingObjects()) |
(...skipping 26 matching lines...) Expand all Loading... |
44 } | 45 } |
45 } | 46 } |
46 } | 47 } |
47 | 48 |
48 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo
int& paintOffset) | 49 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo
int& paintOffset) |
49 { | 50 { |
50 if (m_renderBlockFlow.shouldPaintSelectionGaps() && paintInfo.phase == Paint
PhaseForeground) { | 51 if (m_renderBlockFlow.shouldPaintSelectionGaps() && paintInfo.phase == Paint
PhaseForeground) { |
51 LayoutUnit lastTop = 0; | 52 LayoutUnit lastTop = 0; |
52 LayoutUnit lastLeft = m_renderBlockFlow.logicalLeftSelectionOffset(&m_re
nderBlockFlow, lastTop); | 53 LayoutUnit lastLeft = m_renderBlockFlow.logicalLeftSelectionOffset(&m_re
nderBlockFlow, lastTop); |
53 LayoutUnit lastRight = m_renderBlockFlow.logicalRightSelectionOffset(&m_
renderBlockFlow, lastTop); | 54 LayoutUnit lastRight = m_renderBlockFlow.logicalRightSelectionOffset(&m_
renderBlockFlow, lastTop); |
54 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 55 GraphicsContextRecorder graphicsContextRecorder(*paintInfo.context); |
55 | 56 |
56 LayoutRect gapRectsBounds = m_renderBlockFlow.selectionGaps(&m_renderBlo
ckFlow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, &paintInfo); | 57 LayoutRect gapRectsBounds = m_renderBlockFlow.selectionGaps(&m_renderBlo
ckFlow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, &paintInfo); |
57 if (!gapRectsBounds.isEmpty()) { | 58 if (!gapRectsBounds.isEmpty()) { |
58 RenderLayer* layer = m_renderBlockFlow.enclosingLayer(); | 59 RenderLayer* layer = m_renderBlockFlow.enclosingLayer(); |
59 gapRectsBounds.moveBy(-paintOffset); | 60 gapRectsBounds.moveBy(-paintOffset); |
60 if (!m_renderBlockFlow.hasLayer()) { | 61 if (!m_renderBlockFlow.hasLayer()) { |
61 LayoutRect localBounds(gapRectsBounds); | 62 LayoutRect localBounds(gapRectsBounds); |
62 m_renderBlockFlow.flipForWritingMode(localBounds); | 63 m_renderBlockFlow.flipForWritingMode(localBounds); |
63 gapRectsBounds = m_renderBlockFlow.localToContainerQuad(FloatRec
t(localBounds), layer->renderer()).enclosingBoundingBox(); | 64 gapRectsBounds = m_renderBlockFlow.localToContainerQuad(FloatRec
t(localBounds), layer->renderer()).enclosingBoundingBox(); |
64 if (layer->renderer()->hasOverflowClip()) | 65 if (layer->renderer()->hasOverflowClip()) |
65 gapRectsBounds.move(layer->renderBox()->scrolledContentOffse
t()); | 66 gapRectsBounds.move(layer->renderBox()->scrolledContentOffse
t()); |
66 } | 67 } |
67 layer->addBlockSelectionGapsBounds(gapRectsBounds); | 68 layer->addBlockSelectionGapsBounds(gapRectsBounds); |
68 } | 69 } |
69 } | 70 } |
70 } | 71 } |
71 | 72 |
72 } // namespace blink | 73 } // namespace blink |
OLD | NEW |