Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: third_party/WebKit/Source/core/paint/BlockFlowPainter.cpp

Issue 1512803004: Use refs for GraphicsContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 LayoutUnit lastTop = 0; 56 LayoutUnit lastTop = 0;
57 LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_layout BlockFlow, lastTop); 57 LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_layout BlockFlow, lastTop);
58 LayoutUnit lastRight = m_layoutBlockFlow.logicalRightSelectionOffset(&m_layo utBlockFlow, lastTop); 58 LayoutUnit lastRight = m_layoutBlockFlow.logicalRightSelectionOffset(&m_layo utBlockFlow, lastTop);
59 59
60 LayoutRect bounds = m_layoutBlockFlow.visualOverflowRect(); 60 LayoutRect bounds = m_layoutBlockFlow.visualOverflowRect();
61 bounds.moveBy(paintOffset); 61 bounds.moveBy(paintOffset);
62 62
63 // Only create a DrawingRecorder and ClipScope if skipRecording is false. Th is logic is needed 63 // Only create a DrawingRecorder and ClipScope if skipRecording is false. Th is logic is needed
64 // because selectionGaps(...) needs to be called even when we do not record. 64 // because selectionGaps(...) needs to be called even when we do not record.
65 bool skipRecording = LayoutObjectDrawingRecorder::useCachedDrawingIfPossible (*paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap, paintOffset); 65 bool skipRecording = LayoutObjectDrawingRecorder::useCachedDrawingIfPossible (paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap, paintOffset);
66 Optional<LayoutObjectDrawingRecorder> drawingRecorder; 66 Optional<LayoutObjectDrawingRecorder> drawingRecorder;
67 Optional<ClipScope> clipScope; 67 Optional<ClipScope> clipScope;
68 if (!skipRecording) { 68 if (!skipRecording) {
69 drawingRecorder.emplace(*paintInfo.context, m_layoutBlockFlow, DisplayIt em::SelectionGap, FloatRect(bounds), paintOffset); 69 drawingRecorder.emplace(paintInfo.context, m_layoutBlockFlow, DisplayIte m::SelectionGap, FloatRect(bounds), paintOffset);
70 clipScope.emplace(paintInfo.context); 70 clipScope.emplace(paintInfo.context);
71 } 71 }
72 72
73 LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFl ow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, 73 LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFl ow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight,
74 skipRecording ? nullptr : &paintInfo, 74 skipRecording ? nullptr : &paintInfo,
75 skipRecording ? nullptr : &(*clipScope)); 75 skipRecording ? nullptr : &(*clipScope));
76 // TODO(wkorman): Rework below to process paint invalidation rects during la yout rather than paint. 76 // TODO(wkorman): Rework below to process paint invalidation rects during la yout rather than paint.
77 if (!gapRectsBounds.isEmpty()) { 77 if (!gapRectsBounds.isEmpty()) {
78 PaintLayer* layer = m_layoutBlockFlow.enclosingLayer(); 78 PaintLayer* layer = m_layoutBlockFlow.enclosingLayer();
79 gapRectsBounds.moveBy(-paintOffset); 79 gapRectsBounds.moveBy(-paintOffset);
80 if (!m_layoutBlockFlow.hasLayer()) { 80 if (!m_layoutBlockFlow.hasLayer()) {
81 LayoutRect localBounds(gapRectsBounds); 81 LayoutRect localBounds(gapRectsBounds);
82 m_layoutBlockFlow.flipForWritingMode(localBounds); 82 m_layoutBlockFlow.flipForWritingMode(localBounds);
83 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQuad(F loatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); 83 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQuad(F loatRect(localBounds), layer->layoutObject()).enclosingBoundingBox());
84 if (layer->layoutObject()->hasOverflowClip()) 84 if (layer->layoutObject()->hasOverflowClip())
85 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset()) ; 85 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset()) ;
86 } 86 }
87 layer->addBlockSelectionGapsBounds(gapRectsBounds); 87 layer->addBlockSelectionGapsBounds(gapRectsBounds);
88 } 88 }
89 } 89 }
90 90
91 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698