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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 } | 46 } |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo int& paintOffset) | 50 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo int& paintOffset) |
51 { | 51 { |
52 ASSERT(paintInfo.phase == PaintPhaseForeground); | 52 ASSERT(paintInfo.phase == PaintPhaseForeground); |
53 if (!m_layoutBlockFlow.shouldPaintSelectionGaps()) | 53 if (!m_layoutBlockFlow.shouldPaintSelectionGaps()) |
54 return; | 54 return; |
55 | 55 |
56 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.conte xt, m_layoutBlockFlow, DisplayItem::SelectionGap)) | |
57 return; | |
58 | |
56 LayoutUnit lastTop = 0; | 59 LayoutUnit lastTop = 0; |
57 LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_layout BlockFlow, lastTop); | 60 LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_layout BlockFlow, lastTop); |
58 LayoutUnit lastRight = m_layoutBlockFlow.logicalRightSelectionOffset(&m_layo utBlockFlow, lastTop); | 61 LayoutUnit lastRight = m_layoutBlockFlow.logicalRightSelectionOffset(&m_layo utBlockFlow, lastTop); |
59 | 62 |
60 LayoutRect bounds; | 63 LayoutRect bounds; |
61 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 64 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
62 bounds = m_layoutBlockFlow.visualOverflowRect(); | 65 bounds = m_layoutBlockFlow.visualOverflowRect(); |
63 bounds.moveBy(paintOffset); | 66 bounds.moveBy(paintOffset); |
64 } | 67 } |
65 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap, bounds); | 68 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap, bounds); |
66 ClipScope clipScope(paintInfo.context); | 69 ClipScope clipScope(paintInfo.context); |
67 | 70 |
68 LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFl ow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, | 71 LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFl ow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, &paintInfo, &clipSc ope); |
69 recorder.canUseCachedDrawing() ? nullptr : &paintInfo, | |
70 recorder.canUseCachedDrawing() ? nullptr : &clipScope); | |
71 // TODO(wkorman): Rework below to process paint invalidation rects during la yout rather than paint. | 72 // TODO(wkorman): Rework below to process paint invalidation rects during la yout rather than paint. |
Xianzhu
2015/07/03 01:24:41
If this TODO is still valid, then we can't early r
pdr.
2015/07/03 02:38:04
Good catch. Fixing this required a small amount of
| |
72 if (!gapRectsBounds.isEmpty()) { | 73 if (!gapRectsBounds.isEmpty()) { |
73 DeprecatedPaintLayer* layer = m_layoutBlockFlow.enclosingLayer(); | 74 DeprecatedPaintLayer* layer = m_layoutBlockFlow.enclosingLayer(); |
74 gapRectsBounds.moveBy(-paintOffset); | 75 gapRectsBounds.moveBy(-paintOffset); |
75 if (!m_layoutBlockFlow.hasLayer()) { | 76 if (!m_layoutBlockFlow.hasLayer()) { |
76 LayoutRect localBounds(gapRectsBounds); | 77 LayoutRect localBounds(gapRectsBounds); |
77 m_layoutBlockFlow.flipForWritingMode(localBounds); | 78 m_layoutBlockFlow.flipForWritingMode(localBounds); |
78 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQuad(F loatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); | 79 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQuad(F loatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); |
79 if (layer->layoutObject()->hasOverflowClip()) | 80 if (layer->layoutObject()->hasOverflowClip()) |
80 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset()) ; | 81 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset()) ; |
81 } | 82 } |
82 layer->addBlockSelectionGapsBounds(gapRectsBounds); | 83 layer->addBlockSelectionGapsBounds(gapRectsBounds); |
83 } | 84 } |
84 } | 85 } |
85 | 86 |
86 } // namespace blink | 87 } // namespace blink |
OLD | NEW |