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

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

Issue 1993713002: Move line painting to BlockFlowPainter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/BlockPainter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/frame/Settings.h"
10 #include "core/layout/LayoutBlockFlow.h"
11 #include "core/layout/LayoutFlexibleBox.h" 9 #include "core/layout/LayoutFlexibleBox.h"
12 #include "core/layout/LayoutInline.h" 10 #include "core/layout/LayoutInline.h"
13 #include "core/layout/api/LineLayoutAPIShim.h" 11 #include "core/layout/api/LineLayoutAPIShim.h"
14 #include "core/layout/api/LineLayoutBox.h" 12 #include "core/layout/api/LineLayoutBox.h"
15 #include "core/page/Page.h" 13 #include "core/page/Page.h"
16 #include "core/paint/BoxClipper.h" 14 #include "core/paint/BoxClipper.h"
17 #include "core/paint/BoxPainter.h" 15 #include "core/paint/BoxPainter.h"
18 #include "core/paint/InlinePainter.h"
19 #include "core/paint/LayoutObjectDrawingRecorder.h" 16 #include "core/paint/LayoutObjectDrawingRecorder.h"
20 #include "core/paint/LineBoxListPainter.h"
21 #include "core/paint/ObjectPaintProperties.h" 17 #include "core/paint/ObjectPaintProperties.h"
22 #include "core/paint/PaintInfo.h" 18 #include "core/paint/PaintInfo.h"
23 #include "core/paint/PaintLayer.h" 19 #include "core/paint/PaintLayer.h"
24 #include "core/paint/ScopeRecorder.h"
25 #include "core/paint/ScrollRecorder.h" 20 #include "core/paint/ScrollRecorder.h"
26 #include "core/paint/ScrollableAreaPainter.h" 21 #include "core/paint/ScrollableAreaPainter.h"
27 #include "platform/graphics/paint/ClipRecorder.h" 22 #include "platform/graphics/paint/ClipRecorder.h"
28 #include "wtf/Optional.h" 23 #include "wtf/Optional.h"
29 24
30 namespace blink { 25 namespace blink {
31 26
32 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set) 27 void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff set)
33 { 28 {
34 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location(); 29 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh ase, scrollOffset); 169 scrollRecorder.emplace(paintInfo.context, m_layoutBlock, paintPh ase, scrollOffset);
175 scrolledPaintInfo.emplace(paintInfo); 170 scrolledPaintInfo.emplace(paintInfo);
176 AffineTransform transform; 171 AffineTransform transform;
177 transform.translate(-scrollOffset.width(), -scrollOffset.height( )); 172 transform.translate(-scrollOffset.width(), -scrollOffset.height( ));
178 scrolledPaintInfo->updateCullRect(transform); 173 scrolledPaintInfo->updateCullRect(transform);
179 } 174 }
180 } 175 }
181 176
182 const PaintInfo& contentsPaintInfo = scrolledPaintInfo ? *scrolledPaintI nfo : paintInfo; 177 const PaintInfo& contentsPaintInfo = scrolledPaintInfo ? *scrolledPaintI nfo : paintInfo;
183 178
184 paintContents(contentsPaintInfo, paintOffset); 179 m_layoutBlock.paintContentsAndFloats(contentsPaintInfo, paintOffset);
mstensho (USE GERRIT) 2016/05/18 15:12:34 Not sure how you prefer this. We could just as wel
chrishtr 2016/05/18 16:50:42 It would be good to avoid having a method related
mstensho (USE GERRIT) 2016/05/18 18:51:08 Hmm... is it okay to initialize a BlockFlowPainter
185
186 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection | | paintPhase == PaintPhaseTextClip)
187 m_layoutBlock.paintFloats(contentsPaintInfo, paintOffset);
188 } 180 }
189 181
190 if (shouldPaintSelfOutline(paintPhase)) 182 if (shouldPaintSelfOutline(paintPhase))
191 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, paintOffset); 183 ObjectPainter(m_layoutBlock).paintOutline(paintInfo, paintOffset);
192 184
193 // If the caret's node's layout object's containing block is this block, and the paint action is PaintPhaseForeground, 185 // If the caret's node's layout object's containing block is this block, and the paint action is PaintPhaseForeground,
194 // then paint the caret. 186 // then paint the caret.
195 if (paintPhase == PaintPhaseForeground && m_layoutBlock.hasCaret() && !Layou tObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutBl ock, DisplayItem::Caret)) { 187 if (paintPhase == PaintPhaseForeground && m_layoutBlock.hasCaret() && !Layou tObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, m_layoutBl ock, DisplayItem::Caret)) {
196 LayoutRect bounds = m_layoutBlock.visualOverflowRect(); 188 LayoutRect bounds = m_layoutBlock.visualOverflowRect();
197 bounds.moveBy(paintOffset); 189 bounds.moveBy(paintOffset);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 overflowRect.unite(m_layoutBlock.layoutOverflowRect()); 222 overflowRect.unite(m_layoutBlock.layoutOverflowRect());
231 overflowRect.move(-m_layoutBlock.scrolledContentOffset()); 223 overflowRect.move(-m_layoutBlock.scrolledContentOffset());
232 } 224 }
233 m_layoutBlock.flipForWritingMode(overflowRect); 225 m_layoutBlock.flipForWritingMode(overflowRect);
234 overflowRect.moveBy(adjustedPaintOffset); 226 overflowRect.moveBy(adjustedPaintOffset);
235 return paintInfo.cullRect().intersectsCullRect(overflowRect); 227 return paintInfo.cullRect().intersectsCullRect(overflowRect);
236 } 228 }
237 229
238 void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 230 void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
239 { 231 {
240 // Avoid painting descendants of the root element when stylesheets haven't l oaded. This eliminates FOUC. 232 DCHECK(!m_layoutBlock.childrenInline());
241 // It's ok not to draw, because later on, when all the stylesheets do load, styleResolverMayHaveChanged() 233 PaintInfo paintInfoForDescendants = paintInfo.forDescendants();
242 // on Document will trigger a full paint invalidation. 234 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset);
243 if (m_layoutBlock.document().didLayoutWithPendingStylesheets() && !m_layoutB lock.isLayoutView())
244 return;
245
246 if (m_layoutBlock.childrenInline()) {
247 if (shouldPaintDescendantOutlines(paintInfo.phase))
248 ObjectPainter(m_layoutBlock).paintInlineChildrenOutlines(paintInfo, paintOffset);
249 else
250 LineBoxListPainter(m_layoutBlock.lineBoxes()).paint(m_layoutBlock, p aintInfo, paintOffset);
251 } else {
252 PaintInfo paintInfoForDescendants = paintInfo.forDescendants();
253 m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset);
254 }
255 } 235 }
256 236
257 } // namespace blink 237 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/BlockPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698