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

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

Issue 720313002: Push selection gaps logic down to RenderBlockFlow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move even MOAR! Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/BlockFlowPainter.h ('k') | Source/core/paint/BlockPainter.cpp » ('j') | 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/rendering/FloatingObjects.h" 8 #include "core/rendering/FloatingObjects.h"
9 #include "core/rendering/PaintInfo.h" 9 #include "core/rendering/PaintInfo.h"
10 #include "core/rendering/RenderBlockFlow.h" 10 #include "core/rendering/RenderBlockFlow.h"
11 #include "core/rendering/RenderLayer.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 void BlockFlowPainter::paintFloats(PaintInfo& paintInfo, const LayoutPoint& pain tOffset, bool preservePhase) 15 void BlockFlowPainter::paintFloats(PaintInfo& paintInfo, const LayoutPoint& pain tOffset, bool preservePhase)
15 { 16 {
16 if (!m_renderBlockFlow.floatingObjects()) 17 if (!m_renderBlockFlow.floatingObjects())
17 return; 18 return;
18 19
19 const FloatingObjectSet& floatingObjectSet = m_renderBlockFlow.floatingObjec ts()->set(); 20 const FloatingObjectSet& floatingObjectSet = m_renderBlockFlow.floatingObjec ts()->set();
20 FloatingObjectSetIterator end = floatingObjectSet.end(); 21 FloatingObjectSetIterator end = floatingObjectSet.end();
(...skipping 16 matching lines...) Expand all
37 floatingObject->renderer()->paint(currentPaintInfo, childPoint); 38 floatingObject->renderer()->paint(currentPaintInfo, childPoint);
38 currentPaintInfo.phase = PaintPhaseForeground; 39 currentPaintInfo.phase = PaintPhaseForeground;
39 floatingObject->renderer()->paint(currentPaintInfo, childPoint); 40 floatingObject->renderer()->paint(currentPaintInfo, childPoint);
40 currentPaintInfo.phase = PaintPhaseOutline; 41 currentPaintInfo.phase = PaintPhaseOutline;
41 floatingObject->renderer()->paint(currentPaintInfo, childPoint); 42 floatingObject->renderer()->paint(currentPaintInfo, childPoint);
42 } 43 }
43 } 44 }
44 } 45 }
45 } 46 }
46 47
48 void BlockFlowPainter::paintSelection(PaintInfo& paintInfo, const LayoutPoint& p aintOffset)
49 {
50 if (m_renderBlockFlow.shouldPaintSelectionGaps() && paintInfo.phase == Paint PhaseForeground) {
51 LayoutUnit lastTop = 0;
52 LayoutUnit lastLeft = m_renderBlockFlow.logicalLeftSelectionOffset(&m_re nderBlockFlow, lastTop);
53 LayoutUnit lastRight = m_renderBlockFlow.logicalRightSelectionOffset(&m_ renderBlockFlow, lastTop);
54 GraphicsContextStateSaver stateSaver(*paintInfo.context);
55
56 LayoutRect gapRectsBounds = m_renderBlockFlow.selectionGaps(&m_renderBlo ckFlow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, &paintInfo);
57 if (!gapRectsBounds.isEmpty()) {
58 RenderLayer* layer = m_renderBlockFlow.enclosingLayer();
59 gapRectsBounds.moveBy(-paintOffset);
60 if (!m_renderBlockFlow.hasLayer()) {
61 LayoutRect localBounds(gapRectsBounds);
62 m_renderBlockFlow.flipForWritingMode(localBounds);
63 gapRectsBounds = m_renderBlockFlow.localToContainerQuad(FloatRec t(localBounds), layer->renderer()).enclosingBoundingBox();
64 if (layer->renderer()->hasOverflowClip())
65 gapRectsBounds.move(layer->renderBox()->scrolledContentOffse t());
66 }
67 layer->addBlockSelectionGapsBounds(gapRectsBounds);
68 }
69 }
70 }
71
47 } // namespace blink 72 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/BlockFlowPainter.h ('k') | Source/core/paint/BlockPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698