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/layout/FloatingObjects.h" | 8 #include "core/layout/FloatingObjects.h" |
9 #include "core/layout/LayoutBlockFlow.h" | 9 #include "core/layout/LayoutBlockFlow.h" |
10 #include "core/paint/ClipScope.h" | 10 #include "core/paint/ClipScope.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 bounds = m_layoutBlockFlow.visualOverflowRect(); | 61 bounds = m_layoutBlockFlow.visualOverflowRect(); |
62 bounds.moveBy(paintOffset); | 62 bounds.moveBy(paintOffset); |
63 } | 63 } |
64 | 64 |
65 // Only create a DrawingRecorder and ClipScope if skipRecording is false. Th
is logic is needed | 65 // Only create a DrawingRecorder and ClipScope if skipRecording is false. Th
is logic is needed |
66 // because selectionGaps(...) needs to be called even when we do not record. | 66 // because selectionGaps(...) needs to be called even when we do not record. |
67 bool skipRecording = LayoutObjectDrawingRecorder::useCachedDrawingIfPossible
(*paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap); | 67 bool skipRecording = LayoutObjectDrawingRecorder::useCachedDrawingIfPossible
(*paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap); |
68 Optional<DrawingRecorder> drawingRecorder; | 68 Optional<DrawingRecorder> drawingRecorder; |
69 Optional<ClipScope> clipScope; | 69 Optional<ClipScope> clipScope; |
70 if (!skipRecording) { | 70 if (!skipRecording) { |
71 drawingRecorder.emplace(*paintInfo.context, m_layoutBlockFlow, DisplayIt
em::SelectionGap, bounds); | 71 drawingRecorder.emplace(*paintInfo.context, m_layoutBlockFlow, DisplayIt
em::SelectionGap, FloatRect(bounds)); |
72 clipScope.emplace(paintInfo.context); | 72 clipScope.emplace(paintInfo.context); |
73 } | 73 } |
74 | 74 |
75 LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFl
ow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, | 75 LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFl
ow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, |
76 skipRecording ? nullptr : &paintInfo, | 76 skipRecording ? nullptr : &paintInfo, |
77 skipRecording ? nullptr : &(*clipScope)); | 77 skipRecording ? nullptr : &(*clipScope)); |
78 // TODO(wkorman): Rework below to process paint invalidation rects during la
yout rather than paint. | 78 // TODO(wkorman): Rework below to process paint invalidation rects during la
yout rather than paint. |
79 if (!gapRectsBounds.isEmpty()) { | 79 if (!gapRectsBounds.isEmpty()) { |
80 DeprecatedPaintLayer* layer = m_layoutBlockFlow.enclosingLayer(); | 80 DeprecatedPaintLayer* layer = m_layoutBlockFlow.enclosingLayer(); |
81 gapRectsBounds.moveBy(-paintOffset); | 81 gapRectsBounds.moveBy(-paintOffset); |
82 if (!m_layoutBlockFlow.hasLayer()) { | 82 if (!m_layoutBlockFlow.hasLayer()) { |
83 LayoutRect localBounds(gapRectsBounds); | 83 LayoutRect localBounds(gapRectsBounds); |
84 m_layoutBlockFlow.flipForWritingMode(localBounds); | 84 m_layoutBlockFlow.flipForWritingMode(localBounds); |
85 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQuad(F
loatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); | 85 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQuad(F
loatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); |
86 if (layer->layoutObject()->hasOverflowClip()) | 86 if (layer->layoutObject()->hasOverflowClip()) |
87 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset())
; | 87 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset())
; |
88 } | 88 } |
89 layer->addBlockSelectionGapsBounds(gapRectsBounds); | 89 layer->addBlockSelectionGapsBounds(gapRectsBounds); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 } // namespace blink | 93 } // namespace blink |
OLD | NEW |