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

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

Issue 1562183002: ObjectPainter::paintAsStackingContext() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/ClipScope.h"
10 #include "core/paint/LayoutObjectDrawingRecorder.h" 10 #include "core/paint/LayoutObjectDrawingRecorder.h"
11 #include "core/paint/ObjectPainter.h"
11 #include "core/paint/PaintInfo.h" 12 #include "core/paint/PaintInfo.h"
12 #include "core/paint/PaintLayer.h" 13 #include "core/paint/PaintLayer.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint & paintOffset, bool preservePhase) 17 void BlockFlowPainter::paintFloats(const PaintInfo& paintInfo, const LayoutPoint & paintOffset)
17 { 18 {
18 if (!m_layoutBlockFlow.floatingObjects()) 19 if (!m_layoutBlockFlow.floatingObjects())
19 return; 20 return;
20 21
21 const FloatingObjectSet& floatingObjectSet = m_layoutBlockFlow.floatingObjec ts()->set(); 22 ASSERT(paintInfo.phase == PaintPhaseFloat);
22 FloatingObjectSetIterator end = floatingObjectSet.end(); 23 PaintInfo floatPaintInfo(paintInfo);
23 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++ it) { 24 floatPaintInfo.phase = PaintPhaseForeground;
24 const FloatingObject& floatingObject = *it->get(); 25
25 // Only paint the object if our m_shouldPaint flag is set. 26 for (const auto& floatingObject : m_layoutBlockFlow.floatingObjects()->set() ) {
26 if (floatingObject.shouldPaint() && !floatingObject.layoutObject()->hasS elfPaintingLayer()) { 27 if (!floatingObject->shouldPaint())
27 PaintInfo currentPaintInfo(paintInfo); 28 continue;
28 currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhas eBlockBackground; 29
29 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin wo uld make this much cleaner. 30 const LayoutBox* floatingLayoutObject = floatingObject->layoutObject();
30 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeFo rChild( 31 if (floatingLayoutObject->hasSelfPaintingLayer())
31 floatingObject, LayoutPoint(paintOffset.x() 32 continue;
32 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(floatingObj ect) - floatingObject.layoutObject()->location().x(), paintOffset.y() 33
33 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(floatingObj ect) - floatingObject.layoutObject()->location().y())); 34 // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make this much cleaner.
34 floatingObject.layoutObject()->paint(currentPaintInfo, childPoint); 35 LayoutPoint childPoint = m_layoutBlockFlow.flipFloatForWritingModeForChi ld(
35 if (!preservePhase) { 36 *floatingObject, LayoutPoint(paintOffset.x()
36 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; 37 + m_layoutBlockFlow.xPositionForFloatIncludingMargin(*floatingObject ) - floatingLayoutObject->location().x(), paintOffset.y()
37 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin t); 38 + m_layoutBlockFlow.yPositionForFloatIncludingMargin(*floatingObject ) - floatingLayoutObject->location().y()));
38 currentPaintInfo.phase = PaintPhaseFloat; 39 ObjectPainter(*floatingLayoutObject).paintAsPseudoStackingContext(floatP aintInfo, childPoint);
39 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin t);
40 currentPaintInfo.phase = PaintPhaseForeground;
41 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin t);
42 currentPaintInfo.phase = PaintPhaseOutline;
43 floatingObject.layoutObject()->paint(currentPaintInfo, childPoin t);
44 }
45 }
46 } 40 }
47 } 41 }
48 42
49 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo int& paintOffset) 43 void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo int& paintOffset)
50 { 44 {
51 ASSERT(paintInfo.phase == PaintPhaseForeground); 45 ASSERT(paintInfo.phase == PaintPhaseForeground);
52 if (!m_layoutBlockFlow.shouldPaintSelectionGaps()) 46 if (!m_layoutBlockFlow.shouldPaintSelectionGaps())
53 return; 47 return;
54 48
55 LayoutUnit lastTop = 0; 49 LayoutUnit lastTop = 0;
(...skipping 25 matching lines...) Expand all
81 m_layoutBlockFlow.flipForWritingMode(localBounds); 75 m_layoutBlockFlow.flipForWritingMode(localBounds);
82 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToAncestorQuad(Fl oatRect(localBounds), layer->layoutObject()).enclosingBoundingBox()); 76 gapRectsBounds = LayoutRect(m_layoutBlockFlow.localToAncestorQuad(Fl oatRect(localBounds), layer->layoutObject()).enclosingBoundingBox());
83 if (layer->layoutObject()->hasOverflowClip()) 77 if (layer->layoutObject()->hasOverflowClip())
84 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset()) ; 78 gapRectsBounds.move(layer->layoutBox()->scrolledContentOffset()) ;
85 } 79 }
86 layer->addBlockSelectionGapsBounds(gapRectsBounds); 80 layer->addBlockSelectionGapsBounds(gapRectsBounds);
87 } 81 }
88 } 82 }
89 83
90 } // namespace blink 84 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/BlockFlowPainter.h ('k') | third_party/WebKit/Source/core/paint/BlockPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698