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

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

Issue 763173003: Convert RenderBlockFlow code to use FloatingObject references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 6 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 | « Source/core/layout/shapes/ShapeOutsideInfo.cpp ('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 "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"
11 #include "core/paint/DeprecatedPaintLayer.h" 11 #include "core/paint/DeprecatedPaintLayer.h"
12 #include "core/paint/LayoutObjectDrawingRecorder.h" 12 #include "core/paint/LayoutObjectDrawingRecorder.h"
13 #include "core/paint/PaintInfo.h" 13 #include "core/paint/PaintInfo.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint & paintOffset, bool preservePhase) 17 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint & paintOffset, bool preservePhase)
18 { 18 {
19 if (!m_layoutBlockFlow.floatingObjects()) 19 if (!m_layoutBlockFlow.floatingObjects())
20 return; 20 return;
21 21
22 const FloatingObjectSet& floatingObjectSet = m_layoutBlockFlow.floatingObjec ts()->set(); 22 const FloatingObjectSet& floatingObjectSet = m_layoutBlockFlow.floatingObjec ts()->set();
23 FloatingObjectSetIterator end = floatingObjectSet.end(); 23 FloatingObjectSetIterator end = floatingObjectSet.end();
24 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) { 24 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) {
25 FloatingObject* floatingObject = it->get(); 25 const FloatingObject& floatingObject = *it->get();
26 // Only paint the object if our m_shouldPaint flag is set. 26 // Only paint the object if our m_shouldPaint flag is set.
27 if (floatingObject->shouldPaint() && !floatingObject->layoutObject()->ha sSelfPaintingLayer()) { 27 if (floatingObject.shouldPaint() && !floatingObject.layoutObject()->hasS elfPaintingLayer()) {
28 PaintInfo currentPaintInfo(paintInfo); 28 PaintInfo currentPaintInfo(paintInfo);
29 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas eBlockBackground; 29 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas eBlockBackground;
30 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo uld make this much cleaner. 30 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo uld make this much cleaner.
31 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeFo rChild( 31 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeFo rChild(
32 floatingObject, LayoutPoint(paintOffset.x() 32 floatingObject, LayoutPoint(paintOffset.x()
33 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(floatingObj ect) - floatingObject->layoutObject()->location().x(), paintOffset.y() 33 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(floatingObj ect) - floatingObject.layoutObject()->location().x(), paintOffset.y()
34 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(floatingObj ect) - floatingObject->layoutObject()->location().y())); 34 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(floatingObj ect) - floatingObject.layoutObject()->location().y()));
35 floatingObject->layoutObject()->paint(currentPaintInfo, childPoint); 35 floatingObject.layoutObject()->paint(currentPaintInfo, childPoint);
36 if (!preservePhase) { 36 if (!preservePhase) {
37 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; 37 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
38 floatingObject->layoutObject()->paint(currentPaintInfo, childPoi nt); 38 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin t);
39 currentPaintInfo.phase = PaintPhaseFloat; 39 currentPaintInfo.phase = PaintPhaseFloat;
40 floatingObject->layoutObject()->paint(currentPaintInfo, childPoi nt); 40 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin t);
41 currentPaintInfo.phase = PaintPhaseForeground; 41 currentPaintInfo.phase = PaintPhaseForeground;
42 floatingObject->layoutObject()->paint(currentPaintInfo, childPoi nt); 42 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin t);
43 currentPaintInfo.phase = PaintPhaseOutline; 43 currentPaintInfo.phase = PaintPhaseOutline;
44 floatingObject->layoutObject()->paint(currentPaintInfo, childPoi nt); 44 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin t);
45 } 45 }
46 } 46 }
47 } 47 }
48 } 48 }
49 49
50 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo int& paintOffset) 50 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo int& paintOffset)
51 { 51 {
52 if (m_layoutBlockFlow.shouldPaintSelectionGaps() && paintInfo.phase == Paint PhaseForeground) { 52 if (m_layoutBlockFlow.shouldPaintSelectionGaps() && paintInfo.phase == Paint PhaseForeground) {
53 LayoutUnit lastTop = 0; 53 LayoutUnit lastTop = 0;
54 LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_la youtBlockFlow, lastTop); 54 LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_la youtBlockFlow, lastTop);
(...skipping 20 matching lines...) Expand all
75 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQu ad(FloatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); 75 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToContainerQu ad(FloatRect(localBounds), layer->layoutObject()).enclosingBoundingBox());
76 if (layer->layoutObject()->hasOverflowClip()) 76 if (layer->layoutObject()->hasOverflowClip())
77 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffse t()); 77 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffse t());
78 } 78 }
79 layer->addBlockSelectionGapsBounds(gapRectsBounds); 79 layer->addBlockSelectionGapsBounds(gapRectsBounds);
80 } 80 }
81 } 81 }
82 } 82 }
83 83
84 } // namespace blink 84 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/shapes/ShapeOutsideInfo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698