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

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

Issue 2271883002: Fix paint invalidation and painting for composited-scrolling input elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 3 months 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 "core/paint/BlockPainter.h" 5 #include "core/paint/BlockPainter.h"
6 6
7 #include "core/editing/DragCaretController.h" 7 #include "core/editing/DragCaretController.h"
8 #include "core/editing/FrameSelection.h" 8 #include "core/editing/FrameSelection.h"
9 #include "core/layout/LayoutFlexibleBox.h" 9 #include "core/layout/LayoutFlexibleBox.h"
10 #include "core/layout/LayoutInline.h" 10 #include "core/layout/LayoutInline.h"
11 #include "core/layout/api/LineLayoutAPIShim.h" 11 #include "core/layout/api/LineLayoutAPIShim.h"
12 #include "core/layout/api/LineLayoutBox.h" 12 #include "core/layout/api/LineLayoutBox.h"
13 #include "core/page/Page.h" 13 #include "core/page/Page.h"
14 #include "core/paint/BlockFlowPainter.h" 14 #include "core/paint/BlockFlowPainter.h"
15 #include "core/paint/BoxClipper.h" 15 #include "core/paint/BoxClipper.h"
16 #include "core/paint/BoxPainter.h" 16 #include "core/paint/BoxPainter.h"
17 #include "core/paint/LayoutObjectDrawingRecorder.h" 17 #include "core/paint/LayoutObjectDrawingRecorder.h"
18 #include "core/paint/ObjectPaintProperties.h" 18 #include "core/paint/ObjectPaintProperties.h"
19 #include "core/paint/ObjectPainter.h" 19 #include "core/paint/ObjectPainter.h"
20 #include "core/paint/PaintInfo.h" 20 #include "core/paint/PaintInfo.h"
21 #include "core/paint/PaintLayer.h" 21 #include "core/paint/PaintLayer.h"
22 #include "core/paint/ScrollRecorder.h" 22 #include "core/paint/ScrollRecorder.h"
23 #include "core/paint/ScrollableAreaPainter.h" 23 #include "core/paint/ScrollableAreaPainter.h"
24 #include "platform/graphics/GraphicsLayer.h"
24 #include "platform/graphics/paint/ClipRecorder.h" 25 #include "platform/graphics/paint/ClipRecorder.h"
25 #include "wtf/Optional.h" 26 #include "wtf/Optional.h"
26 27
27 namespace blink { 28 namespace blink {
28 29
29 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set) 30 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set)
30 { 31 {
31 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); 32 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location();
32 if (!intersectsPaintRect(paintInfo, adjustedPaintOffset)) 33 if (!intersectsPaintRect(paintInfo, adjustedPaintOffset))
33 return; 34 return;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } else { 187 } else {
187 paintContents(contentsPaintInfo, paintOffset); 188 paintContents(contentsPaintInfo, paintOffset);
188 } 189 }
189 } 190 }
190 191
191 if (shouldPaintSelfOutline(paintPhase)) 192 if (shouldPaintSelfOutline(paintPhase))
192 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, paintOffset); 193 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, paintOffset);
193 194
194 // If the caret's node's layout object's containing block is this block, and the paint action is PaintPhaseForeground, 195 // If the caret's node's layout object's containing block is this block, and the paint action is PaintPhaseForeground,
195 // then paint the caret. 196 // then paint the caret.
196 if (paintPhase == PaintPhaseForeground && m_layoutBlock.hasCaret() && !Layou tObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutBl ock, DisplayItem::Caret)) { 197 const DisplayItemClient& displayItemClient = m_layoutBlock.usesCompositedScr olling() ? static_cast<const DisplayItemClient&>(*m_layoutBlock.layer()->graphic sLayerBackingForScrolling())
pdr. 2016/08/25 22:07:11 Nit: are these static cats needed?
chrishtr 2016/08/26 16:02:25 In fact, I had forgotten to remove this code now t
198 : m_layoutBlock;
199 if (paintPhase == PaintPhaseForeground && m_layoutBlock.hasCaret() && !Drawi ngRecorder::useCachedDrawingIfPossible(paintInfo.context, displayItemClient, Dis playItem::Caret)) {
197 LayoutRect bounds = m_layoutBlock.visualOverflowRect(); 200 LayoutRect bounds = m_layoutBlock.visualOverflowRect();
198 bounds.moveBy(paintOffset); 201 bounds.moveBy(paintOffset);
199 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBlock, D isplayItem::Caret, bounds); 202
203 DrawingRecorder drawingRecorder(paintInfo.context, displayItemClient, Di splayItem::Caret, FloatRect(bounds));
200 paintCarets(paintInfo, paintOffset); 204 paintCarets(paintInfo, paintOffset);
201 } 205 }
202 } 206 }
203 207
204 void BlockPainter::paintCarets(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) 208 void BlockPainter::paintCarets(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset)
205 { 209 {
206 LocalFrame* frame = m_layoutBlock.frame(); 210 LocalFrame* frame = m_layoutBlock.frame();
207 211
208 if (m_layoutBlock.hasCursorCaret()) 212 if (m_layoutBlock.hasCursorCaret())
209 frame->selection().paintCaret(paintInfo.context, paintOffset); 213 frame->selection().paintCaret(paintInfo.context, paintOffset);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 248 }
245 249
246 void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 250 void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
247 { 251 {
248 DCHECK(!m_layoutBlock.childrenInline()); 252 DCHECK(!m_layoutBlock.childrenInline());
249 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); 253 PaintInfo paintInfoForDescendants = paintInfo.forDescendants();
250 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset); 254 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset);
251 } 255 }
252 256
253 } // namespace blink 257 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698