Chromium Code Reviews| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 LayoutUnit lastRight = m_layoutBlockFlow.logicalRightSelectionOffset(&m_layo utBlockFlow, lastTop); | 57 LayoutUnit lastRight = m_layoutBlockFlow.logicalRightSelectionOffset(&m_layo utBlockFlow, lastTop); |
| 58 | 58 |
| 59 LayoutRect bounds; | 59 LayoutRect bounds; |
| 60 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 60 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 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, paintOffset); |
|
Xianzhu
2015/08/27 17:20:10
I remember your idea of DrawingParameters when add
pdr.
2015/08/28 03:31:41
I'm afraid I don't remember what DrawingParameters
Xianzhu
2015/08/28 03:59:00
It is actually DrawingRecorderCacheParameters whic
| |
| 68 Optional<DrawingRecorder> drawingRecorder; | 68 Optional<LayoutObjectDrawingRecorder> 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, FloatRect(bounds)); | 71 drawingRecorder.emplace(*paintInfo.context, m_layoutBlockFlow, DisplayIt em::SelectionGap, FloatRect(bounds), paintOffset); |
| 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 |