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

Side by Side Diff: third_party/WebKit/Source/core/paint/BlockFlowPainter.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
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/BlockFlowPainter.h" 5 #include "core/paint/BlockFlowPainter.h"
6 6
7 #include "core/layout/FloatingObjects.h" 7 #include "core/layout/FloatingObjects.h"
8 #include "core/layout/LayoutBlockFlow.h" 8 #include "core/layout/LayoutBlockFlow.h"
9 #include "core/paint/ClipScope.h" 9 #include "core/paint/BlockPainter.h"
10 #include "core/paint/LayoutObjectDrawingRecorder.h" 10 #include "core/paint/LineBoxListPainter.h"
11 #include "core/paint/ObjectPainter.h" 11 #include "core/paint/ObjectPainter.h"
12 #include "core/paint/PaintInfo.h" 12 #include "core/paint/PaintInfo.h"
13 #include "core/paint/PaintLayer.h"
14 13
15 namespace blink { 14 namespace blink {
16 15
16 void BlockFlowPainter::paintContentsAndFloats(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
17 {
18 paintContents(paintInfo, paintOffset);
19
20 const PaintPhase paintPhase = paintInfo.phase;
21 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || pa intPhase == PaintPhaseTextClip)
22 paintFloats(paintInfo, paintOffset);
23 }
24
25 void BlockFlowPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoi nt& paintOffset)
26 {
27 // Avoid painting descendants of the root element when stylesheets haven't l oaded. This eliminates FOUC.
28 // It's ok not to draw, because later on, when all the stylesheets do load, styleResolverMayHaveChanged()
29 // on Document will trigger a full paint invalidation.
30 if (m_layoutBlockFlow.document().didLayoutWithPendingStylesheets() && !m_lay outBlockFlow.isLayoutView())
31 return;
32
33 if (!m_layoutBlockFlow.childrenInline()) {
34 BlockPainter(m_layoutBlockFlow).paintContents(paintInfo, paintOffset);
35 return;
36 }
37 if (shouldPaintDescendantOutlines(paintInfo.phase))
38 ObjectPainter(m_layoutBlockFlow).paintInlineChildrenOutlines(paintInfo, paintOffset);
39 else
40 LineBoxListPainter(m_layoutBlockFlow.lineBoxes()).paint(m_layoutBlockFlo w, paintInfo, paintOffset);
41 }
42
17 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint & paintOffset) 43 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint & paintOffset)
18 { 44 {
19 if (!m_layoutBlockFlow.floatingObjects()) 45 if (!m_layoutBlockFlow.floatingObjects())
20 return; 46 return;
21 47
22 ASSERT(paintInfo.phase == PaintPhaseFloat || paintInfo.phase == PaintPhaseSe lection || paintInfo.phase == PaintPhaseTextClip); 48 ASSERT(paintInfo.phase == PaintPhaseFloat || paintInfo.phase == PaintPhaseSe lection || paintInfo.phase == PaintPhaseTextClip);
23 PaintInfo floatPaintInfo(paintInfo); 49 PaintInfo floatPaintInfo(paintInfo);
24 if (paintInfo.phase == PaintPhaseFloat) 50 if (paintInfo.phase == PaintPhaseFloat)
25 floatPaintInfo.phase = PaintPhaseForeground; 51 floatPaintInfo.phase = PaintPhaseForeground;
26 52
27 for (const auto& floatingObject : m_layoutBlockFlow.floatingObjects()->set() ) { 53 for (const auto& floatingObject : m_layoutBlockFlow.floatingObjects()->set() ) {
28 if (!floatingObject->shouldPaint()) 54 if (!floatingObject->shouldPaint())
29 continue; 55 continue;
30 56
31 const LayoutBox* floatingLayoutObject = floatingObject->layoutObject(); 57 const LayoutBox* floatingLayoutObject = floatingObject->layoutObject();
32 if (floatingLayoutObject->hasSelfPaintingLayer()) 58 if (floatingLayoutObject->hasSelfPaintingLayer())
33 continue; 59 continue;
34 60
35 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make this much cleaner. 61 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make this much cleaner.
36 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChi ld( 62 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChi ld(
37 *floatingObject, LayoutPoint(paintOffset.x() 63 *floatingObject, LayoutPoint(paintOffset.x()
38 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(*floatingObject ) - floatingLayoutObject->location().x(), paintOffset.y() 64 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(*floatingObject ) - floatingLayoutObject->location().x(), paintOffset.y()
39 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(*floatingObject ) - floatingLayoutObject->location().y())); 65 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(*floatingObject ) - floatingLayoutObject->location().y()));
40 ObjectPainter(*floatingLayoutObject).paintAllPhasesAtomically(floatPaint Info, childPoint); 66 ObjectPainter(*floatingLayoutObject).paintAllPhasesAtomically(floatPaint Info, childPoint);
41 } 67 }
42 } 68 }
43 69
44 } // namespace blink 70 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698